aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2015-03-09 18:04:15 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2015-03-10 10:01:32 -0400
commita03a8dbe20eff6d57aae3147577bf84b52aba4e6 (patch)
tree3460950cb98879361087e392078c0dfd4dba9912
parent8ac467e837a24eb024177b4b01013d8e6764913a (diff)
netfilter: fix sparse warnings in reject handling
make C=1 CF=-D__CHECK_ENDIAN__ shows following: net/bridge/netfilter/nft_reject_bridge.c:65:50: warning: incorrect type in argument 3 (different base types) net/bridge/netfilter/nft_reject_bridge.c:65:50: expected restricted __be16 [usertype] protocol [..] net/bridge/netfilter/nft_reject_bridge.c:102:37: warning: cast from restricted __be16 net/bridge/netfilter/nft_reject_bridge.c:102:37: warning: incorrect type in argument 1 (different base types) [..] net/bridge/netfilter/nft_reject_bridge.c:121:50: warning: incorrect type in argument 3 (different base types) [..] net/bridge/netfilter/nft_reject_bridge.c:168:52: warning: incorrect type in argument 3 (different base types) [..] net/bridge/netfilter/nft_reject_bridge.c:233:52: warning: incorrect type in argument 3 (different base types) [..] Caused by two (harmless) errors: 1. htons() instead of ntohs() 2. __be16 for protocol in nf_reject_ipXhdr_put API, use u8 instead. Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--include/net/netfilter/ipv4/nf_reject.h2
-rw-r--r--include/net/netfilter/ipv6/nf_reject.h2
-rw-r--r--net/bridge/netfilter/nft_reject_bridge.c2
-rw-r--r--net/ipv4/netfilter/nf_reject_ipv4.c2
-rw-r--r--net/ipv6/netfilter/nf_reject_ipv6.c2
5 files changed, 5 insertions, 5 deletions
diff --git a/include/net/netfilter/ipv4/nf_reject.h b/include/net/netfilter/ipv4/nf_reject.h
index 864127573c32..77862c3645f0 100644
--- a/include/net/netfilter/ipv4/nf_reject.h
+++ b/include/net/netfilter/ipv4/nf_reject.h
@@ -12,7 +12,7 @@ const struct tcphdr *nf_reject_ip_tcphdr_get(struct sk_buff *oldskb,
12 struct tcphdr *_oth, int hook); 12 struct tcphdr *_oth, int hook);
13struct iphdr *nf_reject_iphdr_put(struct sk_buff *nskb, 13struct iphdr *nf_reject_iphdr_put(struct sk_buff *nskb,
14 const struct sk_buff *oldskb, 14 const struct sk_buff *oldskb,
15 __be16 protocol, int ttl); 15 __u8 protocol, int ttl);
16void nf_reject_ip_tcphdr_put(struct sk_buff *nskb, const struct sk_buff *oldskb, 16void nf_reject_ip_tcphdr_put(struct sk_buff *nskb, const struct sk_buff *oldskb,
17 const struct tcphdr *oth); 17 const struct tcphdr *oth);
18 18
diff --git a/include/net/netfilter/ipv6/nf_reject.h b/include/net/netfilter/ipv6/nf_reject.h
index 0ae445d3f217..0ea4fa37db16 100644
--- a/include/net/netfilter/ipv6/nf_reject.h
+++ b/include/net/netfilter/ipv6/nf_reject.h
@@ -13,7 +13,7 @@ const struct tcphdr *nf_reject_ip6_tcphdr_get(struct sk_buff *oldskb,
13 unsigned int *otcplen, int hook); 13 unsigned int *otcplen, int hook);
14struct ipv6hdr *nf_reject_ip6hdr_put(struct sk_buff *nskb, 14struct ipv6hdr *nf_reject_ip6hdr_put(struct sk_buff *nskb,
15 const struct sk_buff *oldskb, 15 const struct sk_buff *oldskb,
16 __be16 protocol, int hoplimit); 16 __u8 protocol, int hoplimit);
17void nf_reject_ip6_tcphdr_put(struct sk_buff *nskb, 17void nf_reject_ip6_tcphdr_put(struct sk_buff *nskb,
18 const struct sk_buff *oldskb, 18 const struct sk_buff *oldskb,
19 const struct tcphdr *oth, unsigned int otcplen); 19 const struct tcphdr *oth, unsigned int otcplen);
diff --git a/net/bridge/netfilter/nft_reject_bridge.c b/net/bridge/netfilter/nft_reject_bridge.c
index 5c6c96585acd..54a2fdf0f457 100644
--- a/net/bridge/netfilter/nft_reject_bridge.c
+++ b/net/bridge/netfilter/nft_reject_bridge.c
@@ -99,7 +99,7 @@ static void nft_reject_br_send_v4_unreach(struct sk_buff *oldskb,
99 if (!pskb_may_pull(oldskb, len)) 99 if (!pskb_may_pull(oldskb, len))
100 return; 100 return;
101 101
102 if (pskb_trim_rcsum(oldskb, htons(ip_hdr(oldskb)->tot_len))) 102 if (pskb_trim_rcsum(oldskb, ntohs(ip_hdr(oldskb)->tot_len)))
103 return; 103 return;
104 104
105 if (ip_hdr(oldskb)->protocol == IPPROTO_TCP || 105 if (ip_hdr(oldskb)->protocol == IPPROTO_TCP ||
diff --git a/net/ipv4/netfilter/nf_reject_ipv4.c b/net/ipv4/netfilter/nf_reject_ipv4.c
index b7405eb7f1ef..c5b794da51a9 100644
--- a/net/ipv4/netfilter/nf_reject_ipv4.c
+++ b/net/ipv4/netfilter/nf_reject_ipv4.c
@@ -43,7 +43,7 @@ EXPORT_SYMBOL_GPL(nf_reject_ip_tcphdr_get);
43 43
44struct iphdr *nf_reject_iphdr_put(struct sk_buff *nskb, 44struct iphdr *nf_reject_iphdr_put(struct sk_buff *nskb,
45 const struct sk_buff *oldskb, 45 const struct sk_buff *oldskb,
46 __be16 protocol, int ttl) 46 __u8 protocol, int ttl)
47{ 47{
48 struct iphdr *niph, *oiph = ip_hdr(oldskb); 48 struct iphdr *niph, *oiph = ip_hdr(oldskb);
49 49
diff --git a/net/ipv6/netfilter/nf_reject_ipv6.c b/net/ipv6/netfilter/nf_reject_ipv6.c
index 68e0bb4db1bf..3afdce03d94e 100644
--- a/net/ipv6/netfilter/nf_reject_ipv6.c
+++ b/net/ipv6/netfilter/nf_reject_ipv6.c
@@ -65,7 +65,7 @@ EXPORT_SYMBOL_GPL(nf_reject_ip6_tcphdr_get);
65 65
66struct ipv6hdr *nf_reject_ip6hdr_put(struct sk_buff *nskb, 66struct ipv6hdr *nf_reject_ip6hdr_put(struct sk_buff *nskb,
67 const struct sk_buff *oldskb, 67 const struct sk_buff *oldskb,
68 __be16 protocol, int hoplimit) 68 __u8 protocol, int hoplimit)
69{ 69{
70 struct ipv6hdr *ip6h; 70 struct ipv6hdr *ip6h;
71 const struct ipv6hdr *oip6h = ipv6_hdr(oldskb); 71 const struct ipv6hdr *oip6h = ipv6_hdr(oldskb);