netfilter: Reduce switch/case indent
authorJoe Perches <joe@perches.com>
Fri, 1 Jul 2011 09:43:06 +0000 (09:43 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 Jul 2011 23:11:15 +0000 (16:11 -0700)
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: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/netfilter/ipt_CLUSTERIP.c
net/ipv4/netfilter/nf_nat_snmp_basic.c
net/netfilter/xt_HL.c
net/netfilter/xt_hl.c

index 5c9e97c790172984b7d87bd2d2f40b61028184cc..db8d22db425f6917b23d8d31661905ab58d3ef2d 100644 (file)
@@ -317,19 +317,19 @@ clusterip_tg(struct sk_buff *skb, const struct xt_action_param *par)
        hash = clusterip_hashfn(skb, cipinfo->config);
 
        switch (ctinfo) {
-               case IP_CT_NEW:
-                       ct->mark = hash;
-                       break;
-               case IP_CT_RELATED:
-               case IP_CT_RELATED_REPLY:
-                       /* FIXME: we don't handle expectations at the
-                        * moment.  they can arrive on a different node than
-                        * the master connection (e.g. FTP passive mode) */
-               case IP_CT_ESTABLISHED:
-               case IP_CT_ESTABLISHED_REPLY:
-                       break;
-               default:
-                       break;
+       case IP_CT_NEW:
+               ct->mark = hash;
+               break;
+       case IP_CT_RELATED:
+       case IP_CT_RELATED_REPLY:
+               /* FIXME: we don't handle expectations at the moment.
+                * They can arrive on a different node than
+                * the master connection (e.g. FTP passive mode) */
+       case IP_CT_ESTABLISHED:
+       case IP_CT_ESTABLISHED_REPLY:
+               break;
+       default:                        /* Prevent gcc warnings */
+               break;
        }
 
 #ifdef DEBUG
index 8812a02078ab4e04aa9da689a18d04f2e66c709a..076b7c8c4aa4b608b5a65bdd4ea9b14994b3899f 100644 (file)
@@ -719,117 +719,115 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
 
        l = 0;
        switch (type) {
-               case SNMP_INTEGER:
-                       len = sizeof(long);
-                       if (!asn1_long_decode(ctx, end, &l)) {
-                               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.l[0] = l;
-                       break;
-               case SNMP_OCTETSTR:
-               case SNMP_OPAQUE:
-                       if (!asn1_octets_decode(ctx, end, &p, &len)) {
-                               kfree(id);
-                               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.c, p, len);
+       case SNMP_INTEGER:
+               len = sizeof(long);
+               if (!asn1_long_decode(ctx, end, &l)) {
+                       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.l[0] = l;
+               break;
+       case SNMP_OCTETSTR:
+       case SNMP_OPAQUE:
+               if (!asn1_octets_decode(ctx, end, &p, &len)) {
+                       kfree(id);
+                       return 0;
+               }
+               *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC);
+               if (*obj == NULL) {
                        kfree(p);
-                       break;
-               case SNMP_NULL:
-               case SNMP_NOSUCHOBJECT:
-               case SNMP_NOSUCHINSTANCE:
-               case SNMP_ENDOFMIBVIEW:
-                       len = 0;
-                       *obj = kmalloc(sizeof(struct snmp_object), GFP_ATOMIC);
-                       if (*obj == NULL) {
-                               kfree(id);
-                               if (net_ratelimit())
-                                       pr_notice("OOM in bsalg (%d)\n", __LINE__);
-                               return 0;
-                       }
-                       if (!asn1_null_decode(ctx, end)) {
-                               kfree(id);
-                               kfree(*obj);
-                               *obj = NULL;
-                               return 0;
-                       }
-                       break;
-               case SNMP_OBJECTID:
-                       if (!asn1_oid_decode(ctx, end, (unsigned long **)&lp, &len)) {
-                               kfree(id);
-                               return 0;
-                       }
-                       len *= sizeof(unsigned long);
-                       *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC);
-                       if (*obj == NULL) {
-                               kfree(lp);
-                               kfree(id);
-                               if (net_ratelimit())
-                                       pr_notice("OOM in bsalg (%d)\n", __LINE__);
-                               return 0;
-                       }
-                       memcpy((*obj)->syntax.ul, lp, len);
+                       kfree(id);
+                       if (net_ratelimit())
+                               pr_notice("OOM in bsalg (%d)\n", __LINE__);
+                       return 0;
+               }
+               memcpy((*obj)->syntax.c, p, len);
+               kfree(p);
+               break;
+       case SNMP_NULL:
+       case SNMP_NOSUCHOBJECT:
+       case SNMP_NOSUCHINSTANCE:
+       case SNMP_ENDOFMIBVIEW:
+               len = 0;
+               *obj = kmalloc(sizeof(struct snmp_object), GFP_ATOMIC);
+               if (*obj == NULL) {
+                       kfree(id);
+                       if (net_ratelimit())
+                               pr_notice("OOM in bsalg (%d)\n", __LINE__);
+                       return 0;
+               }
+               if (!asn1_null_decode(ctx, end)) {
+                       kfree(id);
+                       kfree(*obj);
+                       *obj = NULL;
+                       return 0;
+               }
+               break;
+       case SNMP_OBJECTID:
+               if (!asn1_oid_decode(ctx, end, (unsigned long **)&lp, &len)) {
+                       kfree(id);
+                       return 0;
+               }
+               len *= sizeof(unsigned long);
+               *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC);
+               if (*obj == NULL) {
                        kfree(lp);
-                       break;
-               case SNMP_IPADDR:
-                       if (!asn1_octets_decode(ctx, end, &p, &len)) {
-                               kfree(id);
-                               return 0;
-                       }
-                       if (len != 4) {
-                               kfree(p);
-                               kfree(id);
-                               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(id);
+                       if (net_ratelimit())
+                               pr_notice("OOM in bsalg (%d)\n", __LINE__);
+                       return 0;
+               }
+               memcpy((*obj)->syntax.ul, lp, len);
+               kfree(lp);
+               break;
+       case SNMP_IPADDR:
+               if (!asn1_octets_decode(ctx, end, &p, &len)) {
+                       kfree(id);
+                       return 0;
+               }
+               if (len != 4) {
                        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 = 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;
index 95b084800fcc7ca5672b817167528a0334c2246f..1535e87ed9bd4fa47a7f431afab82320cf5e8530 100644 (file)
@@ -38,22 +38,22 @@ ttl_tg(struct sk_buff *skb, const struct xt_action_param *par)
        iph = ip_hdr(skb);
 
        switch (info->mode) {
-               case IPT_TTL_SET:
-                       new_ttl = info->ttl;
-                       break;
-               case IPT_TTL_INC:
-                       new_ttl = iph->ttl + info->ttl;
-                       if (new_ttl > 255)
-                               new_ttl = 255;
-                       break;
-               case IPT_TTL_DEC:
-                       new_ttl = iph->ttl - info->ttl;
-                       if (new_ttl < 0)
-                               new_ttl = 0;
-                       break;
-               default:
-                       new_ttl = iph->ttl;
-                       break;
+       case IPT_TTL_SET:
+               new_ttl = info->ttl;
+               break;
+       case IPT_TTL_INC:
+               new_ttl = iph->ttl + info->ttl;
+               if (new_ttl > 255)
+                       new_ttl = 255;
+               break;
+       case IPT_TTL_DEC:
+               new_ttl = iph->ttl - info->ttl;
+               if (new_ttl < 0)
+                       new_ttl = 0;
+               break;
+       default:
+               new_ttl = iph->ttl;
+               break;
        }
 
        if (new_ttl != iph->ttl) {
@@ -78,22 +78,22 @@ hl_tg6(struct sk_buff *skb, const struct xt_action_param *par)
        ip6h = ipv6_hdr(skb);
 
        switch (info->mode) {
-               case IP6T_HL_SET:
-                       new_hl = info->hop_limit;
-                       break;
-               case IP6T_HL_INC:
-                       new_hl = ip6h->hop_limit + info->hop_limit;
-                       if (new_hl > 255)
-                               new_hl = 255;
-                       break;
-               case IP6T_HL_DEC:
-                       new_hl = ip6h->hop_limit - info->hop_limit;
-                       if (new_hl < 0)
-                               new_hl = 0;
-                       break;
-               default:
-                       new_hl = ip6h->hop_limit;
-                       break;
+       case IP6T_HL_SET:
+               new_hl = info->hop_limit;
+               break;
+       case IP6T_HL_INC:
+               new_hl = ip6h->hop_limit + info->hop_limit;
+               if (new_hl > 255)
+                       new_hl = 255;
+               break;
+       case IP6T_HL_DEC:
+               new_hl = ip6h->hop_limit - info->hop_limit;
+               if (new_hl < 0)
+                       new_hl = 0;
+               break;
+       default:
+               new_hl = ip6h->hop_limit;
+               break;
        }
 
        ip6h->hop_limit = new_hl;
index 7d12221ead8966136fc84b5a8ddce158a212258b..003951149c9e18bfeab590dee6d855abe5841601 100644 (file)
@@ -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;
 
        switch (info->mode) {
-               case IPT_TTL_EQ:
-                       return ttl == info->ttl;
-               case IPT_TTL_NE:
-                       return ttl != info->ttl;
-               case IPT_TTL_LT:
-                       return ttl < info->ttl;
-               case IPT_TTL_GT:
-                       return ttl > info->ttl;
+       case IPT_TTL_EQ:
+               return ttl == info->ttl;
+       case IPT_TTL_NE:
+               return ttl != info->ttl;
+       case IPT_TTL_LT:
+               return ttl < info->ttl;
+       case IPT_TTL_GT:
+               return ttl > info->ttl;
        }
 
        return false;
@@ -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);
 
        switch (info->mode) {
-               case IP6T_HL_EQ:
-                       return ip6h->hop_limit == info->hop_limit;
-               case IP6T_HL_NE:
-                       return ip6h->hop_limit != info->hop_limit;
-               case IP6T_HL_LT:
-                       return ip6h->hop_limit < info->hop_limit;
-               case IP6T_HL_GT:
-                       return ip6h->hop_limit > info->hop_limit;
+       case IP6T_HL_EQ:
+               return ip6h->hop_limit == info->hop_limit;
+       case IP6T_HL_NE:
+               return ip6h->hop_limit != info->hop_limit;
+       case IP6T_HL_LT:
+               return ip6h->hop_limit < info->hop_limit;
+       case IP6T_HL_GT:
+               return ip6h->hop_limit > info->hop_limit;
        }
 
        return false;