aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid Miller <davem@davemloft.net>2015-04-07 23:05:42 -0400
committerDavid S. Miller <davem@davemloft.net>2015-04-08 15:20:50 -0400
commitc1f866767777d1c6abae0ec57effffcb72017c00 (patch)
treeb4d26d6d3f93a8a5129d0e2718f3a4a28f71c25c /net
parente85e85c85a6ae250ef2549065fc0c7377ba4689b (diff)
netfilter: Fix switch statement warnings with recent gcc.
More recent GCC warns about two kinds of switch statement uses: 1) Switching on an enumeration, but not having an explicit case statement for all members of the enumeration. To show the compiler this is intentional, we simply add a default case with nothing more than a break statement. 2) Switching on a boolean value. I think this warning is dumb but nevertheless you get it wholesale with -Wswitch. This patch cures all such warnings in netfilter. Signed-off-by: David S. Miller <davem@davemloft.net> Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
-rw-r--r--net/bridge/netfilter/nft_reject_bridge.c2
-rw-r--r--net/ipv4/netfilter/nft_reject_ipv4.c2
-rw-r--r--net/ipv6/netfilter/nft_reject_ipv6.c2
-rw-r--r--net/netfilter/nft_compat.c6
-rw-r--r--net/netfilter/nft_ct.c8
5 files changed, 17 insertions, 3 deletions
diff --git a/net/bridge/netfilter/nft_reject_bridge.c b/net/bridge/netfilter/nft_reject_bridge.c
index 54a2fdf0f457..ae8141f409d9 100644
--- a/net/bridge/netfilter/nft_reject_bridge.c
+++ b/net/bridge/netfilter/nft_reject_bridge.c
@@ -371,6 +371,8 @@ static int nft_reject_bridge_dump(struct sk_buff *skb,
371 if (nla_put_u8(skb, NFTA_REJECT_ICMP_CODE, priv->icmp_code)) 371 if (nla_put_u8(skb, NFTA_REJECT_ICMP_CODE, priv->icmp_code))
372 goto nla_put_failure; 372 goto nla_put_failure;
373 break; 373 break;
374 default:
375 break;
374 } 376 }
375 377
376 return 0; 378 return 0;
diff --git a/net/ipv4/netfilter/nft_reject_ipv4.c b/net/ipv4/netfilter/nft_reject_ipv4.c
index 16a5d4d73d75..a7621faa9678 100644
--- a/net/ipv4/netfilter/nft_reject_ipv4.c
+++ b/net/ipv4/netfilter/nft_reject_ipv4.c
@@ -33,6 +33,8 @@ static void nft_reject_ipv4_eval(const struct nft_expr *expr,
33 case NFT_REJECT_TCP_RST: 33 case NFT_REJECT_TCP_RST:
34 nf_send_reset(pkt->skb, pkt->ops->hooknum); 34 nf_send_reset(pkt->skb, pkt->ops->hooknum);
35 break; 35 break;
36 default:
37 break;
36 } 38 }
37 39
38 data[NFT_REG_VERDICT].verdict = NF_DROP; 40 data[NFT_REG_VERDICT].verdict = NF_DROP;
diff --git a/net/ipv6/netfilter/nft_reject_ipv6.c b/net/ipv6/netfilter/nft_reject_ipv6.c
index f73285924144..71c7be5ee43a 100644
--- a/net/ipv6/netfilter/nft_reject_ipv6.c
+++ b/net/ipv6/netfilter/nft_reject_ipv6.c
@@ -34,6 +34,8 @@ static void nft_reject_ipv6_eval(const struct nft_expr *expr,
34 case NFT_REJECT_TCP_RST: 34 case NFT_REJECT_TCP_RST:
35 nf_send_reset6(net, pkt->skb, pkt->ops->hooknum); 35 nf_send_reset6(net, pkt->skb, pkt->ops->hooknum);
36 break; 36 break;
37 default:
38 break;
37 } 39 }
38 40
39 data[NFT_REG_VERDICT].verdict = NF_DROP; 41 data[NFT_REG_VERDICT].verdict = NF_DROP;
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c
index 589b8487cd08..0d137c1ac889 100644
--- a/net/netfilter/nft_compat.c
+++ b/net/netfilter/nft_compat.c
@@ -321,11 +321,11 @@ static void nft_match_eval(const struct nft_expr *expr,
321 return; 321 return;
322 } 322 }
323 323
324 switch(ret) { 324 switch (ret ? 1 : 0) {
325 case true: 325 case 1:
326 data[NFT_REG_VERDICT].verdict = NFT_CONTINUE; 326 data[NFT_REG_VERDICT].verdict = NFT_CONTINUE;
327 break; 327 break;
328 case false: 328 case 0:
329 data[NFT_REG_VERDICT].verdict = NFT_BREAK; 329 data[NFT_REG_VERDICT].verdict = NFT_BREAK;
330 break; 330 break;
331 } 331 }
diff --git a/net/netfilter/nft_ct.c b/net/netfilter/nft_ct.c
index cc5603016242..18d520e0ca0a 100644
--- a/net/netfilter/nft_ct.c
+++ b/net/netfilter/nft_ct.c
@@ -56,6 +56,8 @@ static void nft_ct_get_eval(const struct nft_expr *expr,
56 state = NF_CT_STATE_BIT(ctinfo); 56 state = NF_CT_STATE_BIT(ctinfo);
57 dest->data[0] = state; 57 dest->data[0] = state;
58 return; 58 return;
59 default:
60 break;
59 } 61 }
60 62
61 if (ct == NULL) 63 if (ct == NULL)
@@ -117,6 +119,8 @@ static void nft_ct_get_eval(const struct nft_expr *expr,
117 return; 119 return;
118 } 120 }
119#endif 121#endif
122 default:
123 break;
120 } 124 }
121 125
122 tuple = &ct->tuplehash[priv->dir].tuple; 126 tuple = &ct->tuplehash[priv->dir].tuple;
@@ -141,6 +145,8 @@ static void nft_ct_get_eval(const struct nft_expr *expr,
141 case NFT_CT_PROTO_DST: 145 case NFT_CT_PROTO_DST:
142 dest->data[0] = (__force __u16)tuple->dst.u.all; 146 dest->data[0] = (__force __u16)tuple->dst.u.all;
143 return; 147 return;
148 default:
149 break;
144 } 150 }
145 return; 151 return;
146err: 152err:
@@ -172,6 +178,8 @@ static void nft_ct_set_eval(const struct nft_expr *expr,
172 } 178 }
173 break; 179 break;
174#endif 180#endif
181 default:
182 break;
175 } 183 }
176} 184}
177 185