Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Joe Perches and committed by
David S. Miller
181b1e9c 1d67a516

+168 -170
+13 -13
net/ipv4/netfilter/ipt_CLUSTERIP.c
··· 317 317 hash = clusterip_hashfn(skb, cipinfo->config); 318 318 319 319 switch (ctinfo) { 320 - case IP_CT_NEW: 321 - ct->mark = hash; 322 - break; 323 - case IP_CT_RELATED: 324 - case IP_CT_RELATED_REPLY: 325 - /* FIXME: we don't handle expectations at the 326 - * moment. they can arrive on a different node than 327 - * the master connection (e.g. FTP passive mode) */ 328 - case IP_CT_ESTABLISHED: 329 - case IP_CT_ESTABLISHED_REPLY: 330 - break; 331 - default: 332 - break; 320 + case IP_CT_NEW: 321 + ct->mark = hash; 322 + break; 323 + case IP_CT_RELATED: 324 + case IP_CT_RELATED_REPLY: 325 + /* FIXME: we don't handle expectations at the moment. 326 + * They can arrive on a different node than 327 + * the master connection (e.g. FTP passive mode) */ 328 + case IP_CT_ESTABLISHED: 329 + case IP_CT_ESTABLISHED_REPLY: 330 + break; 331 + default: /* Prevent gcc warnings */ 332 + break; 333 333 } 334 334 335 335 #ifdef DEBUG
+107 -109
net/ipv4/netfilter/nf_nat_snmp_basic.c
··· 719 719 720 720 l = 0; 721 721 switch (type) { 722 - case SNMP_INTEGER: 723 - len = sizeof(long); 724 - if (!asn1_long_decode(ctx, end, &l)) { 725 - kfree(id); 726 - return 0; 727 - } 728 - *obj = kmalloc(sizeof(struct snmp_object) + len, 729 - GFP_ATOMIC); 730 - if (*obj == NULL) { 731 - kfree(id); 732 - if (net_ratelimit()) 733 - pr_notice("OOM in bsalg (%d)\n", __LINE__); 734 - return 0; 735 - } 736 - (*obj)->syntax.l[0] = l; 737 - break; 738 - case SNMP_OCTETSTR: 739 - case SNMP_OPAQUE: 740 - if (!asn1_octets_decode(ctx, end, &p, &len)) { 741 - kfree(id); 742 - return 0; 743 - } 744 - *obj = kmalloc(sizeof(struct snmp_object) + len, 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); 755 - break; 756 - case SNMP_NULL: 757 - case SNMP_NOSUCHOBJECT: 758 - case SNMP_NOSUCHINSTANCE: 759 - case SNMP_ENDOFMIBVIEW: 760 - len = 0; 761 - *obj = kmalloc(sizeof(struct snmp_object), GFP_ATOMIC); 762 - if (*obj == NULL) { 763 - kfree(id); 764 - if (net_ratelimit()) 765 - pr_notice("OOM in bsalg (%d)\n", __LINE__); 766 - return 0; 767 - } 768 - if (!asn1_null_decode(ctx, end)) { 769 - kfree(id); 770 - kfree(*obj); 771 - *obj = NULL; 772 - return 0; 773 - } 774 - break; 775 - case SNMP_OBJECTID: 776 - if (!asn1_oid_decode(ctx, end, (unsigned long **)&lp, &len)) { 777 - kfree(id); 778 - return 0; 779 - } 780 - len *= sizeof(unsigned long); 781 - *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); 782 - if (*obj == NULL) { 783 - kfree(lp); 784 - kfree(id); 785 - if (net_ratelimit()) 786 - pr_notice("OOM in bsalg (%d)\n", __LINE__); 787 - return 0; 788 - } 789 - memcpy((*obj)->syntax.ul, lp, len); 790 - kfree(lp); 791 - break; 792 - case SNMP_IPADDR: 793 - if (!asn1_octets_decode(ctx, end, &p, &len)) { 794 - kfree(id); 795 - return 0; 796 - } 797 - if (len != 4) { 798 - kfree(p); 799 - kfree(id); 800 - return 0; 801 - } 802 - *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); 803 - if (*obj == NULL) { 804 - kfree(p); 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); 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: 722 + case SNMP_INTEGER: 723 + len = sizeof(long); 724 + if (!asn1_long_decode(ctx, end, &l)) { 831 725 kfree(id); 832 726 return 0; 727 + } 728 + *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); 729 + if (*obj == NULL) { 730 + kfree(id); 731 + if (net_ratelimit()) 732 + pr_notice("OOM in bsalg (%d)\n", __LINE__); 733 + return 0; 734 + } 735 + (*obj)->syntax.l[0] = l; 736 + break; 737 + case SNMP_OCTETSTR: 738 + case SNMP_OPAQUE: 739 + if (!asn1_octets_decode(ctx, end, &p, &len)) { 740 + kfree(id); 741 + return 0; 742 + } 743 + *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); 744 + if (*obj == NULL) { 745 + kfree(p); 746 + kfree(id); 747 + if (net_ratelimit()) 748 + pr_notice("OOM in bsalg (%d)\n", __LINE__); 749 + return 0; 750 + } 751 + memcpy((*obj)->syntax.c, p, len); 752 + kfree(p); 753 + break; 754 + case SNMP_NULL: 755 + case SNMP_NOSUCHOBJECT: 756 + case SNMP_NOSUCHINSTANCE: 757 + case SNMP_ENDOFMIBVIEW: 758 + len = 0; 759 + *obj = kmalloc(sizeof(struct snmp_object), GFP_ATOMIC); 760 + if (*obj == NULL) { 761 + kfree(id); 762 + if (net_ratelimit()) 763 + pr_notice("OOM in bsalg (%d)\n", __LINE__); 764 + return 0; 765 + } 766 + if (!asn1_null_decode(ctx, end)) { 767 + kfree(id); 768 + kfree(*obj); 769 + *obj = NULL; 770 + return 0; 771 + } 772 + break; 773 + case SNMP_OBJECTID: 774 + if (!asn1_oid_decode(ctx, end, (unsigned long **)&lp, &len)) { 775 + kfree(id); 776 + return 0; 777 + } 778 + len *= sizeof(unsigned long); 779 + *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); 780 + if (*obj == NULL) { 781 + kfree(lp); 782 + kfree(id); 783 + if (net_ratelimit()) 784 + pr_notice("OOM in bsalg (%d)\n", __LINE__); 785 + return 0; 786 + } 787 + memcpy((*obj)->syntax.ul, lp, len); 788 + kfree(lp); 789 + break; 790 + case SNMP_IPADDR: 791 + if (!asn1_octets_decode(ctx, end, &p, &len)) { 792 + kfree(id); 793 + return 0; 794 + } 795 + if (len != 4) { 796 + kfree(p); 797 + kfree(id); 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 833 (*obj)->syntax_len = len;
+32 -32
net/netfilter/xt_HL.c
··· 38 38 iph = ip_hdr(skb); 39 39 40 40 switch (info->mode) { 41 - case IPT_TTL_SET: 42 - new_ttl = info->ttl; 43 - break; 44 - case IPT_TTL_INC: 45 - new_ttl = iph->ttl + info->ttl; 46 - if (new_ttl > 255) 47 - new_ttl = 255; 48 - break; 49 - case IPT_TTL_DEC: 50 - new_ttl = iph->ttl - info->ttl; 51 - if (new_ttl < 0) 52 - new_ttl = 0; 53 - break; 54 - default: 55 - new_ttl = iph->ttl; 56 - break; 41 + case IPT_TTL_SET: 42 + new_ttl = info->ttl; 43 + break; 44 + case IPT_TTL_INC: 45 + new_ttl = iph->ttl + info->ttl; 46 + if (new_ttl > 255) 47 + new_ttl = 255; 48 + break; 49 + case IPT_TTL_DEC: 50 + new_ttl = iph->ttl - info->ttl; 51 + if (new_ttl < 0) 52 + new_ttl = 0; 53 + break; 54 + default: 55 + new_ttl = iph->ttl; 56 + break; 57 57 } 58 58 59 59 if (new_ttl != iph->ttl) { ··· 78 78 ip6h = ipv6_hdr(skb); 79 79 80 80 switch (info->mode) { 81 - case IP6T_HL_SET: 82 - new_hl = info->hop_limit; 83 - break; 84 - case IP6T_HL_INC: 85 - new_hl = ip6h->hop_limit + info->hop_limit; 86 - if (new_hl > 255) 87 - new_hl = 255; 88 - break; 89 - case IP6T_HL_DEC: 90 - new_hl = ip6h->hop_limit - info->hop_limit; 91 - if (new_hl < 0) 92 - new_hl = 0; 93 - break; 94 - default: 95 - new_hl = ip6h->hop_limit; 96 - break; 81 + case IP6T_HL_SET: 82 + new_hl = info->hop_limit; 83 + break; 84 + case IP6T_HL_INC: 85 + new_hl = ip6h->hop_limit + info->hop_limit; 86 + if (new_hl > 255) 87 + new_hl = 255; 88 + break; 89 + case IP6T_HL_DEC: 90 + new_hl = ip6h->hop_limit - info->hop_limit; 91 + if (new_hl < 0) 92 + new_hl = 0; 93 + break; 94 + default: 95 + new_hl = ip6h->hop_limit; 96 + break; 97 97 } 98 98 99 99 ip6h->hop_limit = new_hl;
+16 -16
net/netfilter/xt_hl.c
··· 31 31 const u8 ttl = ip_hdr(skb)->ttl; 32 32 33 33 switch (info->mode) { 34 - case IPT_TTL_EQ: 35 - return ttl == info->ttl; 36 - case IPT_TTL_NE: 37 - return ttl != info->ttl; 38 - case IPT_TTL_LT: 39 - return ttl < info->ttl; 40 - case IPT_TTL_GT: 41 - return ttl > info->ttl; 34 + case IPT_TTL_EQ: 35 + return ttl == info->ttl; 36 + case IPT_TTL_NE: 37 + return ttl != info->ttl; 38 + case IPT_TTL_LT: 39 + return ttl < info->ttl; 40 + case IPT_TTL_GT: 41 + return ttl > info->ttl; 42 42 } 43 43 44 44 return false; ··· 50 50 const struct ipv6hdr *ip6h = ipv6_hdr(skb); 51 51 52 52 switch (info->mode) { 53 - case IP6T_HL_EQ: 54 - return ip6h->hop_limit == info->hop_limit; 55 - case IP6T_HL_NE: 56 - return ip6h->hop_limit != info->hop_limit; 57 - case IP6T_HL_LT: 58 - return ip6h->hop_limit < info->hop_limit; 59 - case IP6T_HL_GT: 60 - return ip6h->hop_limit > info->hop_limit; 53 + case IP6T_HL_EQ: 54 + return ip6h->hop_limit == info->hop_limit; 55 + case IP6T_HL_NE: 56 + return ip6h->hop_limit != info->hop_limit; 57 + case IP6T_HL_LT: 58 + return ip6h->hop_limit < info->hop_limit; 59 + case IP6T_HL_GT: 60 + return ip6h->hop_limit > info->hop_limit; 61 61 } 62 62 63 63 return false;