diff options
author | Joe Perches <joe@perches.com> | 2011-07-01 05:43:06 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-01 19:11:15 -0400 |
commit | 181b1e9ce1b9e705d4cd27b542ce05bc43abdab0 (patch) | |
tree | 548d47da8a2fe693873e15b684c4abc63c9c6f81 | |
parent | 1d67a51682443ffd1209d76dcc2f24a685259530 (diff) |
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: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/netfilter/ipt_CLUSTERIP.c | 26 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_nat_snmp_basic.c | 210 | ||||
-rw-r--r-- | net/netfilter/xt_HL.c | 64 | ||||
-rw-r--r-- | net/netfilter/xt_hl.c | 32 |
4 files changed, 165 insertions, 167 deletions
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index 5c9e97c79017..db8d22db425f 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c | |||
@@ -317,19 +317,19 @@ clusterip_tg(struct sk_buff *skb, const struct xt_action_param *par) | |||
317 | hash = clusterip_hashfn(skb, cipinfo->config); | 317 | hash = clusterip_hashfn(skb, cipinfo->config); |
318 | 318 | ||
319 | switch (ctinfo) { | 319 | switch (ctinfo) { |
320 | case IP_CT_NEW: | 320 | case IP_CT_NEW: |
321 | ct->mark = hash; | 321 | ct->mark = hash; |
322 | break; | 322 | break; |
323 | case IP_CT_RELATED: | 323 | case IP_CT_RELATED: |
324 | case IP_CT_RELATED_REPLY: | 324 | case IP_CT_RELATED_REPLY: |
325 | /* FIXME: we don't handle expectations at the | 325 | /* FIXME: we don't handle expectations at the moment. |
326 | * moment. they can arrive on a different node than | 326 | * They can arrive on a different node than |
327 | * the master connection (e.g. FTP passive mode) */ | 327 | * the master connection (e.g. FTP passive mode) */ |
328 | case IP_CT_ESTABLISHED: | 328 | case IP_CT_ESTABLISHED: |
329 | case IP_CT_ESTABLISHED_REPLY: | 329 | case IP_CT_ESTABLISHED_REPLY: |
330 | break; | 330 | break; |
331 | default: | 331 | default: /* Prevent gcc warnings */ |
332 | break; | 332 | break; |
333 | } | 333 | } |
334 | 334 | ||
335 | #ifdef DEBUG | 335 | #ifdef DEBUG |
diff --git a/net/ipv4/netfilter/nf_nat_snmp_basic.c b/net/ipv4/netfilter/nf_nat_snmp_basic.c index 8812a02078ab..076b7c8c4aa4 100644 --- a/net/ipv4/netfilter/nf_nat_snmp_basic.c +++ b/net/ipv4/netfilter/nf_nat_snmp_basic.c | |||
@@ -719,117 +719,115 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx, | |||
719 | 719 | ||
720 | l = 0; | 720 | l = 0; |
721 | switch (type) { | 721 | switch (type) { |
722 | case SNMP_INTEGER: | 722 | case SNMP_INTEGER: |
723 | len = sizeof(long); | 723 | len = sizeof(long); |
724 | if (!asn1_long_decode(ctx, end, &l)) { | 724 | if (!asn1_long_decode(ctx, end, &l)) { |
725 | kfree(id); | 725 | kfree(id); |
726 | return 0; | 726 | return 0; |
727 | } | 727 | } |
728 | *obj = kmalloc(sizeof(struct snmp_object) + len, | 728 | *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); |
729 | GFP_ATOMIC); | 729 | if (*obj == NULL) { |
730 | if (*obj == NULL) { | 730 | kfree(id); |
731 | kfree(id); | 731 | if (net_ratelimit()) |
732 | if (net_ratelimit()) | 732 | pr_notice("OOM in bsalg (%d)\n", __LINE__); |
733 | pr_notice("OOM in bsalg (%d)\n", __LINE__); | 733 | return 0; |
734 | return 0; | 734 | } |
735 | } | 735 | (*obj)->syntax.l[0] = l; |
736 | (*obj)->syntax.l[0] = l; | 736 | break; |
737 | break; | 737 | case SNMP_OCTETSTR: |
738 | case SNMP_OCTETSTR: | 738 | case SNMP_OPAQUE: |
739 | case SNMP_OPAQUE: | 739 | if (!asn1_octets_decode(ctx, end, &p, &len)) { |
740 | if (!asn1_octets_decode(ctx, end, &p, &len)) { | 740 | kfree(id); |
741 | kfree(id); | 741 | return 0; |
742 | return 0; | 742 | } |
743 | } | 743 | *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); |
744 | *obj = kmalloc(sizeof(struct snmp_object) + len, | 744 | if (*obj == NULL) { |
745 | GFP_ATOMIC); | ||
746 | if (*obj == NULL) { | ||
747 | kfree(p); | ||
748 | kfree(id); | ||
749 | if (net_ratelimit()) | ||
750 | pr_notice("OOM in bsalg (%d)\n", __LINE__); | ||
751 | return 0; | ||
752 | } | ||
753 | memcpy((*obj)->syntax.c, p, len); | ||
754 | kfree(p); | 745 | kfree(p); |
755 | break; | 746 | kfree(id); |
756 | case SNMP_NULL: | 747 | if (net_ratelimit()) |
757 | case SNMP_NOSUCHOBJECT: | 748 | pr_notice("OOM in bsalg (%d)\n", __LINE__); |
758 | case SNMP_NOSUCHINSTANCE: | 749 | return 0; |
759 | case SNMP_ENDOFMIBVIEW: | 750 | } |
760 | len = 0; | 751 | memcpy((*obj)->syntax.c, p, len); |
761 | *obj = kmalloc(sizeof(struct snmp_object), GFP_ATOMIC); | 752 | kfree(p); |
762 | if (*obj == NULL) { | 753 | break; |
763 | kfree(id); | 754 | case SNMP_NULL: |
764 | if (net_ratelimit()) | 755 | case SNMP_NOSUCHOBJECT: |
765 | pr_notice("OOM in bsalg (%d)\n", __LINE__); | 756 | case SNMP_NOSUCHINSTANCE: |
766 | return 0; | 757 | case SNMP_ENDOFMIBVIEW: |
767 | } | 758 | len = 0; |
768 | if (!asn1_null_decode(ctx, end)) { | 759 | *obj = kmalloc(sizeof(struct snmp_object), GFP_ATOMIC); |
769 | kfree(id); | 760 | if (*obj == NULL) { |
770 | kfree(*obj); | 761 | kfree(id); |
771 | *obj = NULL; | 762 | if (net_ratelimit()) |
772 | return 0; | 763 | pr_notice("OOM in bsalg (%d)\n", __LINE__); |
773 | } | 764 | return 0; |
774 | break; | 765 | } |
775 | case SNMP_OBJECTID: | 766 | if (!asn1_null_decode(ctx, end)) { |
776 | if (!asn1_oid_decode(ctx, end, (unsigned long **)&lp, &len)) { | 767 | kfree(id); |
777 | kfree(id); | 768 | kfree(*obj); |
778 | return 0; | 769 | *obj = NULL; |
779 | } | 770 | return 0; |
780 | len *= sizeof(unsigned long); | 771 | } |
781 | *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); | 772 | break; |
782 | if (*obj == NULL) { | 773 | case SNMP_OBJECTID: |
783 | kfree(lp); | 774 | if (!asn1_oid_decode(ctx, end, (unsigned long **)&lp, &len)) { |
784 | kfree(id); | 775 | kfree(id); |
785 | if (net_ratelimit()) | 776 | return 0; |
786 | pr_notice("OOM in bsalg (%d)\n", __LINE__); | 777 | } |
787 | return 0; | 778 | len *= sizeof(unsigned long); |
788 | } | 779 | *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); |
789 | memcpy((*obj)->syntax.ul, lp, len); | 780 | if (*obj == NULL) { |
790 | kfree(lp); | 781 | kfree(lp); |
791 | break; | 782 | kfree(id); |
792 | case SNMP_IPADDR: | 783 | if (net_ratelimit()) |
793 | if (!asn1_octets_decode(ctx, end, &p, &len)) { | 784 | pr_notice("OOM in bsalg (%d)\n", __LINE__); |
794 | kfree(id); | 785 | return 0; |
795 | return 0; | 786 | } |
796 | } | 787 | memcpy((*obj)->syntax.ul, lp, len); |
797 | if (len != 4) { | 788 | kfree(lp); |
798 | kfree(p); | 789 | break; |
799 | kfree(id); | 790 | case SNMP_IPADDR: |
800 | return 0; | 791 | if (!asn1_octets_decode(ctx, end, &p, &len)) { |
801 | } | 792 | kfree(id); |
802 | *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); | 793 | return 0; |
803 | if (*obj == NULL) { | 794 | } |
804 | kfree(p); | 795 | if (len != 4) { |
805 | kfree(id); | ||
806 | if (net_ratelimit()) | ||
807 | pr_notice("OOM in bsalg (%d)\n", __LINE__); | ||
808 | return 0; | ||
809 | } | ||
810 | memcpy((*obj)->syntax.uc, p, len); | ||
811 | kfree(p); | 796 | kfree(p); |
812 | break; | ||
813 | case SNMP_COUNTER: | ||
814 | case SNMP_GAUGE: | ||
815 | case SNMP_TIMETICKS: | ||
816 | len = sizeof(unsigned long); | ||
817 | if (!asn1_ulong_decode(ctx, end, &ul)) { | ||
818 | kfree(id); | ||
819 | return 0; | ||
820 | } | ||
821 | *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); | ||
822 | if (*obj == NULL) { | ||
823 | kfree(id); | ||
824 | if (net_ratelimit()) | ||
825 | pr_notice("OOM in bsalg (%d)\n", __LINE__); | ||
826 | return 0; | ||
827 | } | ||
828 | (*obj)->syntax.ul[0] = ul; | ||
829 | break; | ||
830 | default: | ||
831 | kfree(id); | 797 | kfree(id); |
832 | return 0; | 798 | return 0; |
799 | } | ||
800 | *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); | ||
801 | if (*obj == NULL) { | ||
802 | kfree(p); | ||
803 | kfree(id); | ||
804 | if (net_ratelimit()) | ||
805 | pr_notice("OOM in bsalg (%d)\n", __LINE__); | ||
806 | return 0; | ||
807 | } | ||
808 | memcpy((*obj)->syntax.uc, p, len); | ||
809 | kfree(p); | ||
810 | break; | ||
811 | case SNMP_COUNTER: | ||
812 | case SNMP_GAUGE: | ||
813 | case SNMP_TIMETICKS: | ||
814 | len = sizeof(unsigned long); | ||
815 | if (!asn1_ulong_decode(ctx, end, &ul)) { | ||
816 | kfree(id); | ||
817 | return 0; | ||
818 | } | ||
819 | *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); | ||
820 | if (*obj == NULL) { | ||
821 | kfree(id); | ||
822 | if (net_ratelimit()) | ||
823 | pr_notice("OOM in bsalg (%d)\n", __LINE__); | ||
824 | return 0; | ||
825 | } | ||
826 | (*obj)->syntax.ul[0] = ul; | ||
827 | break; | ||
828 | default: | ||
829 | kfree(id); | ||
830 | return 0; | ||
833 | } | 831 | } |
834 | 832 | ||
835 | (*obj)->syntax_len = len; | 833 | (*obj)->syntax_len = len; |
diff --git a/net/netfilter/xt_HL.c b/net/netfilter/xt_HL.c index 95b084800fcc..1535e87ed9bd 100644 --- a/net/netfilter/xt_HL.c +++ b/net/netfilter/xt_HL.c | |||
@@ -38,22 +38,22 @@ ttl_tg(struct sk_buff *skb, const struct xt_action_param *par) | |||
38 | iph = ip_hdr(skb); | 38 | iph = ip_hdr(skb); |
39 | 39 | ||
40 | switch (info->mode) { | 40 | switch (info->mode) { |
41 | case IPT_TTL_SET: | 41 | case IPT_TTL_SET: |
42 | new_ttl = info->ttl; | 42 | new_ttl = info->ttl; |
43 | break; | 43 | break; |
44 | case IPT_TTL_INC: | 44 | case IPT_TTL_INC: |
45 | new_ttl = iph->ttl + info->ttl; | 45 | new_ttl = iph->ttl + info->ttl; |
46 | if (new_ttl > 255) | 46 | if (new_ttl > 255) |
47 | new_ttl = 255; | 47 | new_ttl = 255; |
48 | break; | 48 | break; |
49 | case IPT_TTL_DEC: | 49 | case IPT_TTL_DEC: |
50 | new_ttl = iph->ttl - info->ttl; | 50 | new_ttl = iph->ttl - info->ttl; |
51 | if (new_ttl < 0) | 51 | if (new_ttl < 0) |
52 | new_ttl = 0; | 52 | new_ttl = 0; |
53 | break; | 53 | break; |
54 | default: | 54 | default: |
55 | new_ttl = iph->ttl; | 55 | new_ttl = iph->ttl; |
56 | break; | 56 | break; |
57 | } | 57 | } |
58 | 58 | ||
59 | if (new_ttl != iph->ttl) { | 59 | if (new_ttl != iph->ttl) { |
@@ -78,22 +78,22 @@ hl_tg6(struct sk_buff *skb, const struct xt_action_param *par) | |||
78 | ip6h = ipv6_hdr(skb); | 78 | ip6h = ipv6_hdr(skb); |
79 | 79 | ||
80 | switch (info->mode) { | 80 | switch (info->mode) { |
81 | case IP6T_HL_SET: | 81 | case IP6T_HL_SET: |
82 | new_hl = info->hop_limit; | 82 | new_hl = info->hop_limit; |
83 | break; | 83 | break; |
84 | case IP6T_HL_INC: | 84 | case IP6T_HL_INC: |
85 | new_hl = ip6h->hop_limit + info->hop_limit; | 85 | new_hl = ip6h->hop_limit + info->hop_limit; |
86 | if (new_hl > 255) | 86 | if (new_hl > 255) |
87 | new_hl = 255; | 87 | new_hl = 255; |
88 | break; | 88 | break; |
89 | case IP6T_HL_DEC: | 89 | case IP6T_HL_DEC: |
90 | new_hl = ip6h->hop_limit - info->hop_limit; | 90 | new_hl = ip6h->hop_limit - info->hop_limit; |
91 | if (new_hl < 0) | 91 | if (new_hl < 0) |
92 | new_hl = 0; | 92 | new_hl = 0; |
93 | break; | 93 | break; |
94 | default: | 94 | default: |
95 | new_hl = ip6h->hop_limit; | 95 | new_hl = ip6h->hop_limit; |
96 | break; | 96 | break; |
97 | } | 97 | } |
98 | 98 | ||
99 | ip6h->hop_limit = new_hl; | 99 | ip6h->hop_limit = new_hl; |
diff --git a/net/netfilter/xt_hl.c b/net/netfilter/xt_hl.c index 7d12221ead89..003951149c9e 100644 --- a/net/netfilter/xt_hl.c +++ b/net/netfilter/xt_hl.c | |||
@@ -31,14 +31,14 @@ static bool ttl_mt(const struct sk_buff *skb, struct xt_action_param *par) | |||
31 | const u8 ttl = ip_hdr(skb)->ttl; | 31 | const u8 ttl = ip_hdr(skb)->ttl; |
32 | 32 | ||
33 | switch (info->mode) { | 33 | switch (info->mode) { |
34 | case IPT_TTL_EQ: | 34 | case IPT_TTL_EQ: |
35 | return ttl == info->ttl; | 35 | return ttl == info->ttl; |
36 | case IPT_TTL_NE: | 36 | case IPT_TTL_NE: |
37 | return ttl != info->ttl; | 37 | return ttl != info->ttl; |
38 | case IPT_TTL_LT: | 38 | case IPT_TTL_LT: |
39 | return ttl < info->ttl; | 39 | return ttl < info->ttl; |
40 | case IPT_TTL_GT: | 40 | case IPT_TTL_GT: |
41 | return ttl > info->ttl; | 41 | return ttl > info->ttl; |
42 | } | 42 | } |
43 | 43 | ||
44 | return false; | 44 | return false; |
@@ -50,14 +50,14 @@ static bool hl_mt6(const struct sk_buff *skb, struct xt_action_param *par) | |||
50 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); | 50 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); |
51 | 51 | ||
52 | switch (info->mode) { | 52 | switch (info->mode) { |
53 | case IP6T_HL_EQ: | 53 | case IP6T_HL_EQ: |
54 | return ip6h->hop_limit == info->hop_limit; | 54 | return ip6h->hop_limit == info->hop_limit; |
55 | case IP6T_HL_NE: | 55 | case IP6T_HL_NE: |
56 | return ip6h->hop_limit != info->hop_limit; | 56 | return ip6h->hop_limit != info->hop_limit; |
57 | case IP6T_HL_LT: | 57 | case IP6T_HL_LT: |
58 | return ip6h->hop_limit < info->hop_limit; | 58 | return ip6h->hop_limit < info->hop_limit; |
59 | case IP6T_HL_GT: | 59 | case IP6T_HL_GT: |
60 | return ip6h->hop_limit > info->hop_limit; | 60 | return ip6h->hop_limit > info->hop_limit; |
61 | } | 61 | } |
62 | 62 | ||
63 | return false; | 63 | return false; |