diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2005-08-24 14:35:51 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-08-29 19:08:09 -0400 |
commit | 98a82febb6340466824c3a453738d4fbd05db81a (patch) | |
tree | ce1e22a4d8ccb662ed116a90c78dbf8bcbb3e0f4 | |
parent | 0c7770c740156c8802c23d24fc094d06967d997d (diff) |
[AX25/NETROM]: Cleanup direct calls into IP stack
Get rid of the calls to ip_rcv and arp_rcv which were layering
violations anyway. With those being replaced by netif_rx, less parts
of AX.25 and relatives depend on INET support actually being enabled.
This also will make PF_PACKET sockets work for IP and ARP packets
received over AX.25 and for IP packets over NET/ROM.
Signed-off-by: Ralf Baechle DL5RB <ralf@linux-mips.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ax25/ax25_in.c | 13 | ||||
-rw-r--r-- | net/netrom/af_netrom.c | 5 | ||||
-rw-r--r-- | net/netrom/nr_dev.c | 5 |
3 files changed, 7 insertions, 16 deletions
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c index 0357705d575d..810c9c76c2e0 100644 --- a/net/ax25/ax25_in.c +++ b/net/ax25/ax25_in.c | |||
@@ -9,7 +9,6 @@ | |||
9 | * Copyright (C) Joerg Reuter DL1BKE (jreuter@yaina.de) | 9 | * Copyright (C) Joerg Reuter DL1BKE (jreuter@yaina.de) |
10 | * Copyright (C) Hans-Joachim Hetscher DD8NE (dd8ne@bnv-bamberg.de) | 10 | * Copyright (C) Hans-Joachim Hetscher DD8NE (dd8ne@bnv-bamberg.de) |
11 | */ | 11 | */ |
12 | #include <linux/config.h> | ||
13 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
14 | #include <linux/types.h> | 13 | #include <linux/types.h> |
15 | #include <linux/socket.h> | 14 | #include <linux/socket.h> |
@@ -26,9 +25,7 @@ | |||
26 | #include <linux/skbuff.h> | 25 | #include <linux/skbuff.h> |
27 | #include <linux/netfilter.h> | 26 | #include <linux/netfilter.h> |
28 | #include <net/sock.h> | 27 | #include <net/sock.h> |
29 | #include <net/ip.h> /* For ip_rcv */ | ||
30 | #include <net/tcp_states.h> | 28 | #include <net/tcp_states.h> |
31 | #include <net/arp.h> /* For arp_rcv */ | ||
32 | #include <asm/uaccess.h> | 29 | #include <asm/uaccess.h> |
33 | #include <asm/system.h> | 30 | #include <asm/system.h> |
34 | #include <linux/fcntl.h> | 31 | #include <linux/fcntl.h> |
@@ -114,7 +111,6 @@ int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb) | |||
114 | 111 | ||
115 | pid = *skb->data; | 112 | pid = *skb->data; |
116 | 113 | ||
117 | #ifdef CONFIG_INET | ||
118 | if (pid == AX25_P_IP) { | 114 | if (pid == AX25_P_IP) { |
119 | /* working around a TCP bug to keep additional listeners | 115 | /* working around a TCP bug to keep additional listeners |
120 | * happy. TCP re-uses the buffer and destroys the original | 116 | * happy. TCP re-uses the buffer and destroys the original |
@@ -132,10 +128,9 @@ int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb) | |||
132 | skb->dev = ax25->ax25_dev->dev; | 128 | skb->dev = ax25->ax25_dev->dev; |
133 | skb->pkt_type = PACKET_HOST; | 129 | skb->pkt_type = PACKET_HOST; |
134 | skb->protocol = htons(ETH_P_IP); | 130 | skb->protocol = htons(ETH_P_IP); |
135 | ip_rcv(skb, skb->dev, NULL, skb->dev); /* Wrong ptype */ | 131 | netif_rx(skb); |
136 | return 1; | 132 | return 1; |
137 | } | 133 | } |
138 | #endif | ||
139 | if (pid == AX25_P_SEGMENT) { | 134 | if (pid == AX25_P_SEGMENT) { |
140 | skb_pull(skb, 1); /* Remove PID */ | 135 | skb_pull(skb, 1); /* Remove PID */ |
141 | return ax25_rx_fragment(ax25, skb); | 136 | return ax25_rx_fragment(ax25, skb); |
@@ -250,7 +245,6 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev, | |||
250 | 245 | ||
251 | /* Now we are pointing at the pid byte */ | 246 | /* Now we are pointing at the pid byte */ |
252 | switch (skb->data[1]) { | 247 | switch (skb->data[1]) { |
253 | #ifdef CONFIG_INET | ||
254 | case AX25_P_IP: | 248 | case AX25_P_IP: |
255 | skb_pull(skb,2); /* drop PID/CTRL */ | 249 | skb_pull(skb,2); /* drop PID/CTRL */ |
256 | skb->h.raw = skb->data; | 250 | skb->h.raw = skb->data; |
@@ -258,7 +252,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev, | |||
258 | skb->dev = dev; | 252 | skb->dev = dev; |
259 | skb->pkt_type = PACKET_HOST; | 253 | skb->pkt_type = PACKET_HOST; |
260 | skb->protocol = htons(ETH_P_IP); | 254 | skb->protocol = htons(ETH_P_IP); |
261 | ip_rcv(skb, dev, ptype, dev); /* Note ptype here is the wrong one, fix me later */ | 255 | netif_rx(skb); |
262 | break; | 256 | break; |
263 | 257 | ||
264 | case AX25_P_ARP: | 258 | case AX25_P_ARP: |
@@ -268,9 +262,8 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev, | |||
268 | skb->dev = dev; | 262 | skb->dev = dev; |
269 | skb->pkt_type = PACKET_HOST; | 263 | skb->pkt_type = PACKET_HOST; |
270 | skb->protocol = htons(ETH_P_ARP); | 264 | skb->protocol = htons(ETH_P_ARP); |
271 | arp_rcv(skb, dev, ptype, dev); /* Note ptype here is wrong... */ | 265 | netif_rx(skb); |
272 | break; | 266 | break; |
273 | #endif | ||
274 | case AX25_P_TEXT: | 267 | case AX25_P_TEXT: |
275 | /* Now find a suitable dgram socket */ | 268 | /* Now find a suitable dgram socket */ |
276 | sk = ax25_get_socket(&dest, &src, SOCK_DGRAM); | 269 | sk = ax25_get_socket(&dest, &src, SOCK_DGRAM); |
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 9aa8b14a81ab..4b53de982114 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
@@ -858,17 +858,16 @@ int nr_rx_frame(struct sk_buff *skb, struct net_device *dev) | |||
858 | frametype = skb->data[19] & 0x0F; | 858 | frametype = skb->data[19] & 0x0F; |
859 | flags = skb->data[19] & 0xF0; | 859 | flags = skb->data[19] & 0xF0; |
860 | 860 | ||
861 | #ifdef CONFIG_INET | ||
862 | /* | 861 | /* |
863 | * Check for an incoming IP over NET/ROM frame. | 862 | * Check for an incoming IP over NET/ROM frame. |
864 | */ | 863 | */ |
865 | if (frametype == NR_PROTOEXT && circuit_index == NR_PROTO_IP && circuit_id == NR_PROTO_IP) { | 864 | if (frametype == NR_PROTOEXT && |
865 | circuit_index == NR_PROTO_IP && circuit_id == NR_PROTO_IP) { | ||
866 | skb_pull(skb, NR_NETWORK_LEN + NR_TRANSPORT_LEN); | 866 | skb_pull(skb, NR_NETWORK_LEN + NR_TRANSPORT_LEN); |
867 | skb->h.raw = skb->data; | 867 | skb->h.raw = skb->data; |
868 | 868 | ||
869 | return nr_rx_ip(skb, dev); | 869 | return nr_rx_ip(skb, dev); |
870 | } | 870 | } |
871 | #endif | ||
872 | 871 | ||
873 | /* | 872 | /* |
874 | * Find an existing socket connection, based on circuit ID, if it's | 873 | * Find an existing socket connection, based on circuit ID, if it's |
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c index 83eb41d9b937..263da4c26494 100644 --- a/net/netrom/nr_dev.c +++ b/net/netrom/nr_dev.c | |||
@@ -38,8 +38,6 @@ | |||
38 | #include <net/ax25.h> | 38 | #include <net/ax25.h> |
39 | #include <net/netrom.h> | 39 | #include <net/netrom.h> |
40 | 40 | ||
41 | #ifdef CONFIG_INET | ||
42 | |||
43 | /* | 41 | /* |
44 | * Only allow IP over NET/ROM frames through if the netrom device is up. | 42 | * Only allow IP over NET/ROM frames through if the netrom device is up. |
45 | */ | 43 | */ |
@@ -64,11 +62,12 @@ int nr_rx_ip(struct sk_buff *skb, struct net_device *dev) | |||
64 | skb->nh.raw = skb->data; | 62 | skb->nh.raw = skb->data; |
65 | skb->pkt_type = PACKET_HOST; | 63 | skb->pkt_type = PACKET_HOST; |
66 | 64 | ||
67 | ip_rcv(skb, skb->dev, NULL, skb->dev); | 65 | netif_rx(skb); |
68 | 66 | ||
69 | return 1; | 67 | return 1; |
70 | } | 68 | } |
71 | 69 | ||
70 | #ifdef CONFIG_INET | ||
72 | 71 | ||
73 | static int nr_rebuild_header(struct sk_buff *skb) | 72 | static int nr_rebuild_header(struct sk_buff *skb) |
74 | { | 73 | { |