Commit 181b1e9c authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

netfilter: Reduce switch/case indent

Make the case labels the same indent as the switch.

git diff -w shows miscellaneous 80 column wrapping,
comment reflowing and a comment for a useless gcc
warning for an otherwise unused default: case.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1d67a516
...@@ -317,19 +317,19 @@ clusterip_tg(struct sk_buff *skb, const struct xt_action_param *par) ...@@ -317,19 +317,19 @@ clusterip_tg(struct sk_buff *skb, const struct xt_action_param *par)
hash = clusterip_hashfn(skb, cipinfo->config); hash = clusterip_hashfn(skb, cipinfo->config);
switch (ctinfo) { switch (ctinfo) {
case IP_CT_NEW: case IP_CT_NEW:
ct->mark = hash; ct->mark = hash;
break; break;
case IP_CT_RELATED: case IP_CT_RELATED:
case IP_CT_RELATED_REPLY: case IP_CT_RELATED_REPLY:
/* FIXME: we don't handle expectations at the /* FIXME: we don't handle expectations at the moment.
* moment. they can arrive on a different node than * They can arrive on a different node than
* the master connection (e.g. FTP passive mode) */ * the master connection (e.g. FTP passive mode) */
case IP_CT_ESTABLISHED: case IP_CT_ESTABLISHED:
case IP_CT_ESTABLISHED_REPLY: case IP_CT_ESTABLISHED_REPLY:
break; break;
default: default: /* Prevent gcc warnings */
break; break;
} }
#ifdef DEBUG #ifdef DEBUG
......
...@@ -719,117 +719,115 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx, ...@@ -719,117 +719,115 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
l = 0; l = 0;
switch (type) { switch (type) {
case SNMP_INTEGER: case SNMP_INTEGER:
len = sizeof(long); len = sizeof(long);
if (!asn1_long_decode(ctx, end, &l)) { if (!asn1_long_decode(ctx, end, &l)) {
kfree(id); kfree(id);
return 0; return 0;
} }
*obj = kmalloc(sizeof(struct snmp_object) + len, *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC);
GFP_ATOMIC); if (*obj == NULL) {
if (*obj == NULL) { kfree(id);
kfree(id); if (net_ratelimit())
if (net_ratelimit()) pr_notice("OOM in bsalg (%d)\n", __LINE__);
pr_notice("OOM in bsalg (%d)\n", __LINE__); return 0;
return 0; }
} (*obj)->syntax.l[0] = l;
(*obj)->syntax.l[0] = l; break;
break; case SNMP_OCTETSTR:
case SNMP_OCTETSTR: case SNMP_OPAQUE:
case SNMP_OPAQUE: if (!asn1_octets_decode(ctx, end, &p, &len)) {
if (!asn1_octets_decode(ctx, end, &p, &len)) { kfree(id);
kfree(id); return 0;
return 0; }
} *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC);
*obj = kmalloc(sizeof(struct snmp_object) + len, if (*obj == NULL) {
GFP_ATOMIC);
if (*obj == NULL) {
kfree(p);
kfree(id);
if (net_ratelimit())
pr_notice("OOM in bsalg (%d)\n", __LINE__);
return 0;
}
memcpy((*obj)->syntax.c, p, len);
kfree(p); kfree(p);
break; kfree(id);
case SNMP_NULL: if (net_ratelimit())
case SNMP_NOSUCHOBJECT: pr_notice("OOM in bsalg (%d)\n", __LINE__);
case SNMP_NOSUCHINSTANCE: return 0;
case SNMP_ENDOFMIBVIEW: }
len = 0; memcpy((*obj)->syntax.c, p, len);
*obj = kmalloc(sizeof(struct snmp_object), GFP_ATOMIC); kfree(p);
if (*obj == NULL) { break;
kfree(id); case SNMP_NULL:
if (net_ratelimit()) case SNMP_NOSUCHOBJECT:
pr_notice("OOM in bsalg (%d)\n", __LINE__); case SNMP_NOSUCHINSTANCE:
return 0; case SNMP_ENDOFMIBVIEW:
} len = 0;
if (!asn1_null_decode(ctx, end)) { *obj = kmalloc(sizeof(struct snmp_object), GFP_ATOMIC);
kfree(id); if (*obj == NULL) {
kfree(*obj); kfree(id);
*obj = NULL; if (net_ratelimit())
return 0; pr_notice("OOM in bsalg (%d)\n", __LINE__);
} return 0;
break; }
case SNMP_OBJECTID: if (!asn1_null_decode(ctx, end)) {
if (!asn1_oid_decode(ctx, end, (unsigned long **)&lp, &len)) { kfree(id);
kfree(id); kfree(*obj);
return 0; *obj = NULL;
} return 0;
len *= sizeof(unsigned long); }
*obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); break;
if (*obj == NULL) { case SNMP_OBJECTID:
kfree(lp); if (!asn1_oid_decode(ctx, end, (unsigned long **)&lp, &len)) {
kfree(id); kfree(id);
if (net_ratelimit()) return 0;
pr_notice("OOM in bsalg (%d)\n", __LINE__); }
return 0; len *= sizeof(unsigned long);
} *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC);
memcpy((*obj)->syntax.ul, lp, len); if (*obj == NULL) {
kfree(lp); kfree(lp);
break; kfree(id);
case SNMP_IPADDR: if (net_ratelimit())
if (!asn1_octets_decode(ctx, end, &p, &len)) { pr_notice("OOM in bsalg (%d)\n", __LINE__);
kfree(id); return 0;
return 0; }
} memcpy((*obj)->syntax.ul, lp, len);
if (len != 4) { kfree(lp);
kfree(p); break;
kfree(id); case SNMP_IPADDR:
return 0; if (!asn1_octets_decode(ctx, end, &p, &len)) {
} kfree(id);
*obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); return 0;
if (*obj == NULL) { }
kfree(p); if (len != 4) {
kfree(id);
if (net_ratelimit())
pr_notice("OOM in bsalg (%d)\n", __LINE__);
return 0;
}
memcpy((*obj)->syntax.uc, p, len);
kfree(p); kfree(p);
break;
case SNMP_COUNTER:
case SNMP_GAUGE:
case SNMP_TIMETICKS:
len = sizeof(unsigned long);
if (!asn1_ulong_decode(ctx, end, &ul)) {
kfree(id);
return 0;
}
*obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC);
if (*obj == NULL) {
kfree(id);
if (net_ratelimit())
pr_notice("OOM in bsalg (%d)\n", __LINE__);
return 0;
}
(*obj)->syntax.ul[0] = ul;
break;
default:
kfree(id); kfree(id);
return 0; return 0;
}
*obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC);
if (*obj == NULL) {
kfree(p);
kfree(id);
if (net_ratelimit())
pr_notice("OOM in bsalg (%d)\n", __LINE__);
return 0;
}
memcpy((*obj)->syntax.uc, p, len);
kfree(p);
break;
case SNMP_COUNTER:
case SNMP_GAUGE:
case SNMP_TIMETICKS:
len = sizeof(unsigned long);
if (!asn1_ulong_decode(ctx, end, &ul)) {
kfree(id);
return 0;
}
*obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC);
if (*obj == NULL) {
kfree(id);
if (net_ratelimit())
pr_notice("OOM in bsalg (%d)\n", __LINE__);
return 0;
}
(*obj)->syntax.ul[0] = ul;
break;
default:
kfree(id);
return 0;
} }
(*obj)->syntax_len = len; (*obj)->syntax_len = len;
......
...@@ -38,22 +38,22 @@ ttl_tg(struct sk_buff *skb, const struct xt_action_param *par) ...@@ -38,22 +38,22 @@ ttl_tg(struct sk_buff *skb, const struct xt_action_param *par)
iph = ip_hdr(skb); iph = ip_hdr(skb);
switch (info->mode) { switch (info->mode) {
case IPT_TTL_SET: case IPT_TTL_SET:
new_ttl = info->ttl; new_ttl = info->ttl;
break; break;
case IPT_TTL_INC: case IPT_TTL_INC:
new_ttl = iph->ttl + info->ttl; new_ttl = iph->ttl + info->ttl;
if (new_ttl > 255) if (new_ttl > 255)
new_ttl = 255; new_ttl = 255;
break; break;
case IPT_TTL_DEC: case IPT_TTL_DEC:
new_ttl = iph->ttl - info->ttl; new_ttl = iph->ttl - info->ttl;
if (new_ttl < 0) if (new_ttl < 0)
new_ttl = 0; new_ttl = 0;
break; break;
default: default:
new_ttl = iph->ttl; new_ttl = iph->ttl;
break; break;
} }
if (new_ttl != iph->ttl) { if (new_ttl != iph->ttl) {
...@@ -78,22 +78,22 @@ hl_tg6(struct sk_buff *skb, const struct xt_action_param *par) ...@@ -78,22 +78,22 @@ hl_tg6(struct sk_buff *skb, const struct xt_action_param *par)
ip6h = ipv6_hdr(skb); ip6h = ipv6_hdr(skb);
switch (info->mode) { switch (info->mode) {
case IP6T_HL_SET: case IP6T_HL_SET:
new_hl = info->hop_limit; new_hl = info->hop_limit;
break; break;
case IP6T_HL_INC: case IP6T_HL_INC:
new_hl = ip6h->hop_limit + info->hop_limit; new_hl = ip6h->hop_limit + info->hop_limit;
if (new_hl > 255) if (new_hl > 255)
new_hl = 255; new_hl = 255;
break; break;
case IP6T_HL_DEC: case IP6T_HL_DEC:
new_hl = ip6h->hop_limit - info->hop_limit; new_hl = ip6h->hop_limit - info->hop_limit;
if (new_hl < 0) if (new_hl < 0)
new_hl = 0; new_hl = 0;
break; break;
default: default:
new_hl = ip6h->hop_limit; new_hl = ip6h->hop_limit;
break; break;
} }
ip6h->hop_limit = new_hl; ip6h->hop_limit = new_hl;
......
...@@ -31,14 +31,14 @@ static bool ttl_mt(const struct sk_buff *skb, struct xt_action_param *par) ...@@ -31,14 +31,14 @@ static bool ttl_mt(const struct sk_buff *skb, struct xt_action_param *par)
const u8 ttl = ip_hdr(skb)->ttl; const u8 ttl = ip_hdr(skb)->ttl;
switch (info->mode) { switch (info->mode) {
case IPT_TTL_EQ: case IPT_TTL_EQ:
return ttl == info->ttl; return ttl == info->ttl;
case IPT_TTL_NE: case IPT_TTL_NE:
return ttl != info->ttl; return ttl != info->ttl;
case IPT_TTL_LT: case IPT_TTL_LT:
return ttl < info->ttl; return ttl < info->ttl;
case IPT_TTL_GT: case IPT_TTL_GT:
return ttl > info->ttl; return ttl > info->ttl;
} }
return false; return false;
...@@ -50,14 +50,14 @@ static bool hl_mt6(const struct sk_buff *skb, struct xt_action_param *par) ...@@ -50,14 +50,14 @@ static bool hl_mt6(const struct sk_buff *skb, struct xt_action_param *par)
const struct ipv6hdr *ip6h = ipv6_hdr(skb); const struct ipv6hdr *ip6h = ipv6_hdr(skb);
switch (info->mode) { switch (info->mode) {
case IP6T_HL_EQ: case IP6T_HL_EQ:
return ip6h->hop_limit == info->hop_limit; return ip6h->hop_limit == info->hop_limit;
case IP6T_HL_NE: case IP6T_HL_NE:
return ip6h->hop_limit != info->hop_limit; return ip6h->hop_limit != info->hop_limit;
case IP6T_HL_LT: case IP6T_HL_LT:
return ip6h->hop_limit < info->hop_limit; return ip6h->hop_limit < info->hop_limit;
case IP6T_HL_GT: case IP6T_HL_GT:
return ip6h->hop_limit > info->hop_limit; return ip6h->hop_limit > info->hop_limit;
} }
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment