diff options
Diffstat (limited to 'net/llc')
-rw-r--r-- | net/llc/af_llc.c | 7 | ||||
-rw-r--r-- | net/llc/llc_if.c | 3 | ||||
-rw-r--r-- | net/llc/llc_input.c | 10 | ||||
-rw-r--r-- | net/llc/llc_proc.c | 1 | ||||
-rw-r--r-- | net/llc/llc_sap.c | 59 | ||||
-rw-r--r-- | net/llc/llc_station.c | 1 | ||||
-rw-r--r-- | net/llc/sysctl_net_llc.c | 1 |
7 files changed, 61 insertions, 21 deletions
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index 5a04db745c..d6cfe84d52 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c | |||
@@ -20,7 +20,6 @@ | |||
20 | * | 20 | * |
21 | * See the GNU General Public License for more details. | 21 | * See the GNU General Public License for more details. |
22 | */ | 22 | */ |
23 | #include <linux/config.h> | ||
24 | #include <linux/compiler.h> | 23 | #include <linux/compiler.h> |
25 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
26 | #include <linux/module.h> | 25 | #include <linux/module.h> |
@@ -674,7 +673,7 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
674 | 673 | ||
675 | lock_sock(sk); | 674 | lock_sock(sk); |
676 | copied = -ENOTCONN; | 675 | copied = -ENOTCONN; |
677 | if (sk->sk_state == TCP_LISTEN) | 676 | if (unlikely(sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_LISTEN)) |
678 | goto out; | 677 | goto out; |
679 | 678 | ||
680 | timeo = sock_rcvtimeo(sk, nonblock); | 679 | timeo = sock_rcvtimeo(sk, nonblock); |
@@ -733,7 +732,7 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
733 | if (sk->sk_shutdown & RCV_SHUTDOWN) | 732 | if (sk->sk_shutdown & RCV_SHUTDOWN) |
734 | break; | 733 | break; |
735 | 734 | ||
736 | if (sk->sk_state == TCP_CLOSE) { | 735 | if (sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_CLOSE) { |
737 | if (!sock_flag(sk, SOCK_DONE)) { | 736 | if (!sock_flag(sk, SOCK_DONE)) { |
738 | /* | 737 | /* |
739 | * This occurs when user tries to read | 738 | * This occurs when user tries to read |
@@ -789,7 +788,7 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
789 | continue; | 788 | continue; |
790 | 789 | ||
791 | if (!(flags & MSG_PEEK)) { | 790 | if (!(flags & MSG_PEEK)) { |
792 | sk_eat_skb(sk, skb); | 791 | sk_eat_skb(sk, skb, 0); |
793 | *seq = 0; | 792 | *seq = 0; |
794 | } | 793 | } |
795 | } while (len > 0); | 794 | } while (len > 0); |
diff --git a/net/llc/llc_if.c b/net/llc/llc_if.c index ba90f7f080..a89917130a 100644 --- a/net/llc/llc_if.c +++ b/net/llc/llc_if.c | |||
@@ -11,7 +11,6 @@ | |||
11 | * | 11 | * |
12 | * See the GNU General Public License for more details. | 12 | * See the GNU General Public License for more details. |
13 | */ | 13 | */ |
14 | #include <linux/config.h> | ||
15 | #include <linux/module.h> | 14 | #include <linux/module.h> |
16 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
17 | #include <linux/netdevice.h> | 16 | #include <linux/netdevice.h> |
@@ -26,8 +25,6 @@ | |||
26 | #include <net/llc_c_st.h> | 25 | #include <net/llc_c_st.h> |
27 | #include <net/tcp_states.h> | 26 | #include <net/tcp_states.h> |
28 | 27 | ||
29 | u8 llc_mac_null_var[IFHWADDRLEN]; | ||
30 | |||
31 | /** | 28 | /** |
32 | * llc_build_and_send_pkt - Connection data sending for upper layers. | 29 | * llc_build_and_send_pkt - Connection data sending for upper layers. |
33 | * @sk: connection | 30 | * @sk: connection |
diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c index d62e0f9b9d..94d2368ade 100644 --- a/net/llc/llc_input.c +++ b/net/llc/llc_input.c | |||
@@ -142,6 +142,8 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev, | |||
142 | struct llc_sap *sap; | 142 | struct llc_sap *sap; |
143 | struct llc_pdu_sn *pdu; | 143 | struct llc_pdu_sn *pdu; |
144 | int dest; | 144 | int dest; |
145 | int (*rcv)(struct sk_buff *, struct net_device *, | ||
146 | struct packet_type *, struct net_device *); | ||
145 | 147 | ||
146 | /* | 148 | /* |
147 | * When the interface is in promisc. mode, drop all the crap that it | 149 | * When the interface is in promisc. mode, drop all the crap that it |
@@ -169,9 +171,11 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev, | |||
169 | * First the upper layer protocols that don't need the full | 171 | * First the upper layer protocols that don't need the full |
170 | * LLC functionality | 172 | * LLC functionality |
171 | */ | 173 | */ |
172 | if (sap->rcv_func) { | 174 | rcv = rcu_dereference(sap->rcv_func); |
173 | sap->rcv_func(skb, dev, pt, orig_dev); | 175 | if (rcv) { |
174 | goto out_put; | 176 | struct sk_buff *cskb = skb_clone(skb, GFP_ATOMIC); |
177 | if (cskb) | ||
178 | rcv(cskb, dev, pt, orig_dev); | ||
175 | } | 179 | } |
176 | dest = llc_pdu_type(skb); | 180 | dest = llc_pdu_type(skb); |
177 | if (unlikely(!dest || !llc_type_handlers[dest - 1])) | 181 | if (unlikely(!dest || !llc_type_handlers[dest - 1])) |
diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c index bd531cb235..19308fece3 100644 --- a/net/llc/llc_proc.c +++ b/net/llc/llc_proc.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * See the GNU General Public License for more details. | 12 | * See the GNU General Public License for more details. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/config.h> | ||
16 | #include <linux/init.h> | 15 | #include <linux/init.h> |
17 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
18 | #include <linux/proc_fs.h> | 17 | #include <linux/proc_fs.h> |
diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c index 4029ceee9b..20c4eb5c1a 100644 --- a/net/llc/llc_sap.c +++ b/net/llc/llc_sap.c | |||
@@ -282,7 +282,7 @@ static void llc_sap_rcv(struct llc_sap *sap, struct sk_buff *skb) | |||
282 | * mac, and local sap. Returns pointer for socket found, %NULL otherwise. | 282 | * mac, and local sap. Returns pointer for socket found, %NULL otherwise. |
283 | */ | 283 | */ |
284 | static struct sock *llc_lookup_dgram(struct llc_sap *sap, | 284 | static struct sock *llc_lookup_dgram(struct llc_sap *sap, |
285 | struct llc_addr *laddr) | 285 | const struct llc_addr *laddr) |
286 | { | 286 | { |
287 | struct sock *rc; | 287 | struct sock *rc; |
288 | struct hlist_node *node; | 288 | struct hlist_node *node; |
@@ -304,19 +304,62 @@ found: | |||
304 | return rc; | 304 | return rc; |
305 | } | 305 | } |
306 | 306 | ||
307 | /** | ||
308 | * llc_sap_mcast - Deliver multicast PDU's to all matching datagram sockets. | ||
309 | * @sap: SAP | ||
310 | * @laddr: address of local LLC (MAC + SAP) | ||
311 | * | ||
312 | * Search socket list of the SAP and finds connections with same sap. | ||
313 | * Deliver clone to each. | ||
314 | */ | ||
315 | static void llc_sap_mcast(struct llc_sap *sap, | ||
316 | const struct llc_addr *laddr, | ||
317 | struct sk_buff *skb) | ||
318 | { | ||
319 | struct sock *sk; | ||
320 | struct hlist_node *node; | ||
321 | |||
322 | read_lock_bh(&sap->sk_list.lock); | ||
323 | sk_for_each(sk, node, &sap->sk_list.list) { | ||
324 | struct llc_sock *llc = llc_sk(sk); | ||
325 | struct sk_buff *skb1; | ||
326 | |||
327 | if (sk->sk_type != SOCK_DGRAM) | ||
328 | continue; | ||
329 | |||
330 | if (llc->laddr.lsap != laddr->lsap) | ||
331 | continue; | ||
332 | |||
333 | skb1 = skb_clone(skb, GFP_ATOMIC); | ||
334 | if (!skb1) | ||
335 | break; | ||
336 | |||
337 | sock_hold(sk); | ||
338 | skb_set_owner_r(skb1, sk); | ||
339 | llc_sap_rcv(sap, skb1); | ||
340 | sock_put(sk); | ||
341 | } | ||
342 | read_unlock_bh(&sap->sk_list.lock); | ||
343 | } | ||
344 | |||
345 | |||
307 | void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb) | 346 | void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb) |
308 | { | 347 | { |
309 | struct llc_addr laddr; | 348 | struct llc_addr laddr; |
310 | struct sock *sk; | ||
311 | 349 | ||
312 | llc_pdu_decode_da(skb, laddr.mac); | 350 | llc_pdu_decode_da(skb, laddr.mac); |
313 | llc_pdu_decode_dsap(skb, &laddr.lsap); | 351 | llc_pdu_decode_dsap(skb, &laddr.lsap); |
314 | 352 | ||
315 | sk = llc_lookup_dgram(sap, &laddr); | 353 | if (llc_mac_multicast(laddr.mac)) { |
316 | if (sk) { | 354 | llc_sap_mcast(sap, &laddr, skb); |
317 | skb_set_owner_r(skb, sk); | ||
318 | llc_sap_rcv(sap, skb); | ||
319 | sock_put(sk); | ||
320 | } else | ||
321 | kfree_skb(skb); | 355 | kfree_skb(skb); |
356 | } else { | ||
357 | struct sock *sk = llc_lookup_dgram(sap, &laddr); | ||
358 | if (sk) { | ||
359 | skb_set_owner_r(skb, sk); | ||
360 | llc_sap_rcv(sap, skb); | ||
361 | sock_put(sk); | ||
362 | } else | ||
363 | kfree_skb(skb); | ||
364 | } | ||
322 | } | 365 | } |
diff --git a/net/llc/llc_station.c b/net/llc/llc_station.c index f37dbf8ef1..8275bd33bd 100644 --- a/net/llc/llc_station.c +++ b/net/llc/llc_station.c | |||
@@ -11,7 +11,6 @@ | |||
11 | * | 11 | * |
12 | * See the GNU General Public License for more details. | 12 | * See the GNU General Public License for more details. |
13 | */ | 13 | */ |
14 | #include <linux/config.h> | ||
15 | #include <linux/init.h> | 14 | #include <linux/init.h> |
16 | #include <linux/module.h> | 15 | #include <linux/module.h> |
17 | #include <net/llc.h> | 16 | #include <net/llc.h> |
diff --git a/net/llc/sysctl_net_llc.c b/net/llc/sysctl_net_llc.c index d1eaddb136..45d7dd92a0 100644 --- a/net/llc/sysctl_net_llc.c +++ b/net/llc/sysctl_net_llc.c | |||
@@ -4,7 +4,6 @@ | |||
4 | * Arnaldo Carvalho de Melo <acme@conectiva.com.br> | 4 | * Arnaldo Carvalho de Melo <acme@conectiva.com.br> |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/config.h> | ||
8 | #include <linux/mm.h> | 7 | #include <linux/mm.h> |
9 | #include <linux/init.h> | 8 | #include <linux/init.h> |
10 | #include <linux/sysctl.h> | 9 | #include <linux/sysctl.h> |