diff options
author | David S. Miller <davem@davemloft.net> | 2012-06-19 21:56:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-19 21:56:21 -0400 |
commit | f9242b6b28d61295f2bf7e8adfb1060b382e5381 (patch) | |
tree | b395670bd6ae832e9f6f87f47a1840baf3a06d0d /net/ipv6/raw.c | |
parent | 677a3d60fb3153f786a0d28fcf0287670e7bd3c2 (diff) |
inet: Sanitize inet{,6} protocol demux.
Don't pretend that inet_protos[] and inet6_protos[] are hashes, thay
are just a straight arrays. Remove all unnecessary hash masking.
Document MAX_INET_PROTOS.
Use RAW_HTABLE_SIZE when appropriate.
Reported-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/raw.c')
-rw-r--r-- | net/ipv6/raw.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 43b0042f15f4..b5c1dcb27737 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -165,7 +165,7 @@ static bool ipv6_raw_deliver(struct sk_buff *skb, int nexthdr) | |||
165 | saddr = &ipv6_hdr(skb)->saddr; | 165 | saddr = &ipv6_hdr(skb)->saddr; |
166 | daddr = saddr + 1; | 166 | daddr = saddr + 1; |
167 | 167 | ||
168 | hash = nexthdr & (MAX_INET_PROTOS - 1); | 168 | hash = nexthdr & (RAW_HTABLE_SIZE - 1); |
169 | 169 | ||
170 | read_lock(&raw_v6_hashinfo.lock); | 170 | read_lock(&raw_v6_hashinfo.lock); |
171 | sk = sk_head(&raw_v6_hashinfo.ht[hash]); | 171 | sk = sk_head(&raw_v6_hashinfo.ht[hash]); |
@@ -229,7 +229,7 @@ bool raw6_local_deliver(struct sk_buff *skb, int nexthdr) | |||
229 | { | 229 | { |
230 | struct sock *raw_sk; | 230 | struct sock *raw_sk; |
231 | 231 | ||
232 | raw_sk = sk_head(&raw_v6_hashinfo.ht[nexthdr & (MAX_INET_PROTOS - 1)]); | 232 | raw_sk = sk_head(&raw_v6_hashinfo.ht[nexthdr & (RAW_HTABLE_SIZE - 1)]); |
233 | if (raw_sk && !ipv6_raw_deliver(skb, nexthdr)) | 233 | if (raw_sk && !ipv6_raw_deliver(skb, nexthdr)) |
234 | raw_sk = NULL; | 234 | raw_sk = NULL; |
235 | 235 | ||