aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_input.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2007-11-20 01:35:07 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:54:28 -0500
commit7bc54c90307b4bc3d7fb2ffd6ad8fbda0671a45e (patch)
tree74e2030d9603c41ce5dc3699862804a69300b7dc /net/ipv4/ip_input.c
parente372c41401993b45c721c4d92730e7e0a79f7c1b (diff)
[IPv4] RAW: Compact the API for the kernel
The raw sockets functions are explicitly used from inside the kernel in two places: 1. in ip_local_deliver_finish to intercept skb-s 2. in icmp_error For this purposes many functions and even data structures, that are naturally internal for raw protocol, are exported. Compact the API to two functions and hide all the other (including hash table and rwlock) inside the net/ipv4/raw.c Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_input.c')
-rw-r--r--net/ipv4/ip_input.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 4068e178d747..65631391d479 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -204,22 +204,14 @@ static int ip_local_deliver_finish(struct sk_buff *skb)
204 204
205 rcu_read_lock(); 205 rcu_read_lock();
206 { 206 {
207 /* Note: See raw.c and net/raw.h, RAWV4_HTABLE_SIZE==MAX_INET_PROTOS */
208 int protocol = ip_hdr(skb)->protocol; 207 int protocol = ip_hdr(skb)->protocol;
209 int hash; 208 int hash, raw;
210 struct sock *raw_sk;
211 struct net_protocol *ipprot; 209 struct net_protocol *ipprot;
212 210
213 resubmit: 211 resubmit:
214 hash = protocol & (MAX_INET_PROTOS - 1); 212 raw = raw_local_deliver(skb, protocol);
215 raw_sk = sk_head(&raw_v4_htable[hash]);
216
217 /* If there maybe a raw socket we must check - if not we
218 * don't care less
219 */
220 if (raw_sk && !raw_v4_input(skb, ip_hdr(skb), hash))
221 raw_sk = NULL;
222 213
214 hash = protocol & (MAX_INET_PROTOS - 1);
223 if ((ipprot = rcu_dereference(inet_protos[hash])) != NULL) { 215 if ((ipprot = rcu_dereference(inet_protos[hash])) != NULL) {
224 int ret; 216 int ret;
225 217
@@ -237,7 +229,7 @@ static int ip_local_deliver_finish(struct sk_buff *skb)
237 } 229 }
238 IP_INC_STATS_BH(IPSTATS_MIB_INDELIVERS); 230 IP_INC_STATS_BH(IPSTATS_MIB_INDELIVERS);
239 } else { 231 } else {
240 if (!raw_sk) { 232 if (!raw) {
241 if (xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { 233 if (xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
242 IP_INC_STATS_BH(IPSTATS_MIB_INUNKNOWNPROTOS); 234 IP_INC_STATS_BH(IPSTATS_MIB_INUNKNOWNPROTOS);
243 icmp_send(skb, ICMP_DEST_UNREACH, 235 icmp_send(skb, ICMP_DEST_UNREACH,