diff options
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/datagram.c | 28 | ||||
-rw-r--r-- | net/core/dev.c | 17 | ||||
-rw-r--r-- | net/core/iovec.c | 2 | ||||
-rw-r--r-- | net/core/link_watch.c | 7 | ||||
-rw-r--r-- | net/core/neighbour.c | 2 | ||||
-rw-r--r-- | net/core/netfilter.c | 17 | ||||
-rw-r--r-- | net/core/rtnetlink.c | 68 | ||||
-rw-r--r-- | net/core/scm.c | 1 | ||||
-rw-r--r-- | net/core/skbuff.c | 12 | ||||
-rw-r--r-- | net/core/sock.c | 27 | ||||
-rw-r--r-- | net/core/stream.c | 12 |
11 files changed, 107 insertions, 86 deletions
diff --git a/net/core/datagram.c b/net/core/datagram.c index d1bfd279cc1a..fcee054b6f75 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c | |||
@@ -115,10 +115,10 @@ out_noerr: | |||
115 | 115 | ||
116 | /** | 116 | /** |
117 | * skb_recv_datagram - Receive a datagram skbuff | 117 | * skb_recv_datagram - Receive a datagram skbuff |
118 | * @sk - socket | 118 | * @sk: socket |
119 | * @flags - MSG_ flags | 119 | * @flags: MSG_ flags |
120 | * @noblock - blocking operation? | 120 | * @noblock: blocking operation? |
121 | * @err - error code returned | 121 | * @err: error code returned |
122 | * | 122 | * |
123 | * Get a datagram skbuff, understands the peeking, nonblocking wakeups | 123 | * Get a datagram skbuff, understands the peeking, nonblocking wakeups |
124 | * and possible races. This replaces identical code in packet, raw and | 124 | * and possible races. This replaces identical code in packet, raw and |
@@ -201,10 +201,10 @@ void skb_free_datagram(struct sock *sk, struct sk_buff *skb) | |||
201 | 201 | ||
202 | /** | 202 | /** |
203 | * skb_copy_datagram_iovec - Copy a datagram to an iovec. | 203 | * skb_copy_datagram_iovec - Copy a datagram to an iovec. |
204 | * @skb - buffer to copy | 204 | * @skb: buffer to copy |
205 | * @offset - offset in the buffer to start copying from | 205 | * @offset: offset in the buffer to start copying from |
206 | * @iovec - io vector to copy to | 206 | * @to: io vector to copy to |
207 | * @len - amount of data to copy from buffer to iovec | 207 | * @len: amount of data to copy from buffer to iovec |
208 | * | 208 | * |
209 | * Note: the iovec is modified during the copy. | 209 | * Note: the iovec is modified during the copy. |
210 | */ | 210 | */ |
@@ -377,9 +377,9 @@ fault: | |||
377 | 377 | ||
378 | /** | 378 | /** |
379 | * skb_copy_and_csum_datagram_iovec - Copy and checkum skb to user iovec. | 379 | * skb_copy_and_csum_datagram_iovec - Copy and checkum skb to user iovec. |
380 | * @skb - skbuff | 380 | * @skb: skbuff |
381 | * @hlen - hardware length | 381 | * @hlen: hardware length |
382 | * @iovec - io vector | 382 | * @iov: io vector |
383 | * | 383 | * |
384 | * Caller _must_ check that skb will fit to this iovec. | 384 | * Caller _must_ check that skb will fit to this iovec. |
385 | * | 385 | * |
@@ -425,9 +425,9 @@ fault: | |||
425 | 425 | ||
426 | /** | 426 | /** |
427 | * datagram_poll - generic datagram poll | 427 | * datagram_poll - generic datagram poll |
428 | * @file - file struct | 428 | * @file: file struct |
429 | * @sock - socket | 429 | * @sock: socket |
430 | * @wait - poll table | 430 | * @wait: poll table |
431 | * | 431 | * |
432 | * Datagram poll: Again totally generic. This also handles | 432 | * Datagram poll: Again totally generic. This also handles |
433 | * sequenced packet sockets providing the socket receive queue | 433 | * sequenced packet sockets providing the socket receive queue |
diff --git a/net/core/dev.c b/net/core/dev.c index 42344d903692..d4d9e2680adb 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * 2 of the License, or (at your option) any later version. | 7 | * 2 of the License, or (at your option) any later version. |
8 | * | 8 | * |
9 | * Derived from the non IP parts of dev.c 1.0.19 | 9 | * Derived from the non IP parts of dev.c 1.0.19 |
10 | * Authors: Ross Biro, <bir7@leland.Stanford.Edu> | 10 | * Authors: Ross Biro |
11 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | 11 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
12 | * Mark Evans, <evansmp@uhura.aston.ac.uk> | 12 | * Mark Evans, <evansmp@uhura.aston.ac.uk> |
13 | * | 13 | * |
@@ -1214,6 +1214,19 @@ int __skb_linearize(struct sk_buff *skb, int gfp_mask) | |||
1214 | * A negative errno code is returned on a failure. A success does not | 1214 | * A negative errno code is returned on a failure. A success does not |
1215 | * guarantee the frame will be transmitted as it may be dropped due | 1215 | * guarantee the frame will be transmitted as it may be dropped due |
1216 | * to congestion or traffic shaping. | 1216 | * to congestion or traffic shaping. |
1217 | * | ||
1218 | * ----------------------------------------------------------------------------------- | ||
1219 | * I notice this method can also return errors from the queue disciplines, | ||
1220 | * including NET_XMIT_DROP, which is a positive value. So, errors can also | ||
1221 | * be positive. | ||
1222 | * | ||
1223 | * Regardless of the return value, the skb is consumed, so it is currently | ||
1224 | * difficult to retry a send to this method. (You can bump the ref count | ||
1225 | * before sending to hold a reference for retry if you are careful.) | ||
1226 | * | ||
1227 | * When calling this method, interrupts MUST be enabled. This is because | ||
1228 | * the BH enable code must have IRQs enabled so that it will not deadlock. | ||
1229 | * --BLG | ||
1217 | */ | 1230 | */ |
1218 | 1231 | ||
1219 | int dev_queue_xmit(struct sk_buff *skb) | 1232 | int dev_queue_xmit(struct sk_buff *skb) |
@@ -3078,7 +3091,7 @@ void free_netdev(struct net_device *dev) | |||
3078 | void synchronize_net(void) | 3091 | void synchronize_net(void) |
3079 | { | 3092 | { |
3080 | might_sleep(); | 3093 | might_sleep(); |
3081 | synchronize_kernel(); | 3094 | synchronize_rcu(); |
3082 | } | 3095 | } |
3083 | 3096 | ||
3084 | /** | 3097 | /** |
diff --git a/net/core/iovec.c b/net/core/iovec.c index d57ace949ab8..65e4b56fbc77 100644 --- a/net/core/iovec.c +++ b/net/core/iovec.c | |||
@@ -33,7 +33,7 @@ | |||
33 | * Verify iovec. The caller must ensure that the iovec is big enough | 33 | * Verify iovec. The caller must ensure that the iovec is big enough |
34 | * to hold the message iovec. | 34 | * to hold the message iovec. |
35 | * | 35 | * |
36 | * Save time not doing verify_area. copy_*_user will make this work | 36 | * Save time not doing access_ok. copy_*_user will make this work |
37 | * in any case. | 37 | * in any case. |
38 | */ | 38 | */ |
39 | 39 | ||
diff --git a/net/core/link_watch.c b/net/core/link_watch.c index 4859b7446c6f..d43d1201275c 100644 --- a/net/core/link_watch.c +++ b/net/core/link_watch.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/netdevice.h> | 16 | #include <linux/netdevice.h> |
17 | #include <linux/if.h> | 17 | #include <linux/if.h> |
18 | #include <net/sock.h> | 18 | #include <net/sock.h> |
19 | #include <net/pkt_sched.h> | ||
19 | #include <linux/rtnetlink.h> | 20 | #include <linux/rtnetlink.h> |
20 | #include <linux/jiffies.h> | 21 | #include <linux/jiffies.h> |
21 | #include <linux/spinlock.h> | 22 | #include <linux/spinlock.h> |
@@ -74,6 +75,12 @@ void linkwatch_run_queue(void) | |||
74 | clear_bit(__LINK_STATE_LINKWATCH_PENDING, &dev->state); | 75 | clear_bit(__LINK_STATE_LINKWATCH_PENDING, &dev->state); |
75 | 76 | ||
76 | if (dev->flags & IFF_UP) { | 77 | if (dev->flags & IFF_UP) { |
78 | if (netif_carrier_ok(dev)) { | ||
79 | WARN_ON(dev->qdisc_sleeping == &noop_qdisc); | ||
80 | dev_activate(dev); | ||
81 | } else | ||
82 | dev_deactivate(dev); | ||
83 | |||
77 | netdev_state_change(dev); | 84 | netdev_state_change(dev); |
78 | } | 85 | } |
79 | 86 | ||
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 0a2f67bbef2e..43bdc521e20d 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -1953,7 +1953,7 @@ static int neigh_stat_seq_show(struct seq_file *seq, void *v) | |||
1953 | struct neigh_statistics *st = v; | 1953 | struct neigh_statistics *st = v; |
1954 | 1954 | ||
1955 | if (v == SEQ_START_TOKEN) { | 1955 | if (v == SEQ_START_TOKEN) { |
1956 | seq_printf(seq, "entries allocs destroys hash_grows lookups hits res_failed rcv_probes_mcast rcv_probes_ucast periodic_gc_runs forced_gc_runs forced_gc_goal_miss\n"); | 1956 | seq_printf(seq, "entries allocs destroys hash_grows lookups hits res_failed rcv_probes_mcast rcv_probes_ucast periodic_gc_runs forced_gc_runs\n"); |
1957 | return 0; | 1957 | return 0; |
1958 | } | 1958 | } |
1959 | 1959 | ||
diff --git a/net/core/netfilter.c b/net/core/netfilter.c index e51cfa46950c..22a8f127c4aa 100644 --- a/net/core/netfilter.c +++ b/net/core/netfilter.c | |||
@@ -217,21 +217,10 @@ void nf_debug_ip_local_deliver(struct sk_buff *skb) | |||
217 | * NF_IP_RAW_INPUT and NF_IP_PRE_ROUTING. */ | 217 | * NF_IP_RAW_INPUT and NF_IP_PRE_ROUTING. */ |
218 | if (!skb->dev) { | 218 | if (!skb->dev) { |
219 | printk("ip_local_deliver: skb->dev is NULL.\n"); | 219 | printk("ip_local_deliver: skb->dev is NULL.\n"); |
220 | } | 220 | } else { |
221 | else if (strcmp(skb->dev->name, "lo") == 0) { | ||
222 | if (skb->nf_debug != ((1 << NF_IP_LOCAL_OUT) | ||
223 | | (1 << NF_IP_POST_ROUTING) | ||
224 | | (1 << NF_IP_PRE_ROUTING) | ||
225 | | (1 << NF_IP_LOCAL_IN))) { | ||
226 | printk("ip_local_deliver: bad loopback skb: "); | ||
227 | debug_print_hooks_ip(skb->nf_debug); | ||
228 | nf_dump_skb(PF_INET, skb); | ||
229 | } | ||
230 | } | ||
231 | else { | ||
232 | if (skb->nf_debug != ((1<<NF_IP_PRE_ROUTING) | 221 | if (skb->nf_debug != ((1<<NF_IP_PRE_ROUTING) |
233 | | (1<<NF_IP_LOCAL_IN))) { | 222 | | (1<<NF_IP_LOCAL_IN))) { |
234 | printk("ip_local_deliver: bad non-lo skb: "); | 223 | printk("ip_local_deliver: bad skb: "); |
235 | debug_print_hooks_ip(skb->nf_debug); | 224 | debug_print_hooks_ip(skb->nf_debug); |
236 | nf_dump_skb(PF_INET, skb); | 225 | nf_dump_skb(PF_INET, skb); |
237 | } | 226 | } |
@@ -247,8 +236,6 @@ void nf_debug_ip_loopback_xmit(struct sk_buff *newskb) | |||
247 | debug_print_hooks_ip(newskb->nf_debug); | 236 | debug_print_hooks_ip(newskb->nf_debug); |
248 | nf_dump_skb(PF_INET, newskb); | 237 | nf_dump_skb(PF_INET, newskb); |
249 | } | 238 | } |
250 | /* Clear to avoid confusing input check */ | ||
251 | newskb->nf_debug = 0; | ||
252 | } | 239 | } |
253 | 240 | ||
254 | void nf_debug_ip_finish_output2(struct sk_buff *skb) | 241 | void nf_debug_ip_finish_output2(struct sk_buff *skb) |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 44dfaf8f04af..00caf4b318b2 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/types.h> | 22 | #include <linux/types.h> |
23 | #include <linux/socket.h> | 23 | #include <linux/socket.h> |
24 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
25 | #include <linux/major.h> | ||
26 | #include <linux/sched.h> | 25 | #include <linux/sched.h> |
27 | #include <linux/timer.h> | 26 | #include <linux/timer.h> |
28 | #include <linux/string.h> | 27 | #include <linux/string.h> |
@@ -87,30 +86,33 @@ struct sock *rtnl; | |||
87 | 86 | ||
88 | struct rtnetlink_link * rtnetlink_links[NPROTO]; | 87 | struct rtnetlink_link * rtnetlink_links[NPROTO]; |
89 | 88 | ||
90 | static const int rtm_min[(RTM_MAX+1-RTM_BASE)/4] = | 89 | static const int rtm_min[RTM_NR_FAMILIES] = |
91 | { | 90 | { |
92 | NLMSG_LENGTH(sizeof(struct ifinfomsg)), | 91 | [RTM_FAM(RTM_NEWLINK)] = NLMSG_LENGTH(sizeof(struct ifinfomsg)), |
93 | NLMSG_LENGTH(sizeof(struct ifaddrmsg)), | 92 | [RTM_FAM(RTM_NEWADDR)] = NLMSG_LENGTH(sizeof(struct ifaddrmsg)), |
94 | NLMSG_LENGTH(sizeof(struct rtmsg)), | 93 | [RTM_FAM(RTM_NEWROUTE)] = NLMSG_LENGTH(sizeof(struct rtmsg)), |
95 | NLMSG_LENGTH(sizeof(struct ndmsg)), | 94 | [RTM_FAM(RTM_NEWNEIGH)] = NLMSG_LENGTH(sizeof(struct ndmsg)), |
96 | NLMSG_LENGTH(sizeof(struct rtmsg)), | 95 | [RTM_FAM(RTM_NEWRULE)] = NLMSG_LENGTH(sizeof(struct rtmsg)), |
97 | NLMSG_LENGTH(sizeof(struct tcmsg)), | 96 | [RTM_FAM(RTM_NEWQDISC)] = NLMSG_LENGTH(sizeof(struct tcmsg)), |
98 | NLMSG_LENGTH(sizeof(struct tcmsg)), | 97 | [RTM_FAM(RTM_NEWTCLASS)] = NLMSG_LENGTH(sizeof(struct tcmsg)), |
99 | NLMSG_LENGTH(sizeof(struct tcmsg)), | 98 | [RTM_FAM(RTM_NEWTFILTER)] = NLMSG_LENGTH(sizeof(struct tcmsg)), |
100 | NLMSG_LENGTH(sizeof(struct tcamsg)) | 99 | [RTM_FAM(RTM_NEWACTION)] = NLMSG_LENGTH(sizeof(struct tcamsg)), |
100 | [RTM_FAM(RTM_NEWPREFIX)] = NLMSG_LENGTH(sizeof(struct rtgenmsg)), | ||
101 | [RTM_FAM(RTM_GETMULTICAST)] = NLMSG_LENGTH(sizeof(struct rtgenmsg)), | ||
102 | [RTM_FAM(RTM_GETANYCAST)] = NLMSG_LENGTH(sizeof(struct rtgenmsg)), | ||
101 | }; | 103 | }; |
102 | 104 | ||
103 | static const int rta_max[(RTM_MAX+1-RTM_BASE)/4] = | 105 | static const int rta_max[RTM_NR_FAMILIES] = |
104 | { | 106 | { |
105 | IFLA_MAX, | 107 | [RTM_FAM(RTM_NEWLINK)] = IFLA_MAX, |
106 | IFA_MAX, | 108 | [RTM_FAM(RTM_NEWADDR)] = IFA_MAX, |
107 | RTA_MAX, | 109 | [RTM_FAM(RTM_NEWROUTE)] = RTA_MAX, |
108 | NDA_MAX, | 110 | [RTM_FAM(RTM_NEWNEIGH)] = NDA_MAX, |
109 | RTA_MAX, | 111 | [RTM_FAM(RTM_NEWRULE)] = RTA_MAX, |
110 | TCA_MAX, | 112 | [RTM_FAM(RTM_NEWQDISC)] = TCA_MAX, |
111 | TCA_MAX, | 113 | [RTM_FAM(RTM_NEWTCLASS)] = TCA_MAX, |
112 | TCA_MAX, | 114 | [RTM_FAM(RTM_NEWTFILTER)] = TCA_MAX, |
113 | TCAA_MAX | 115 | [RTM_FAM(RTM_NEWACTION)] = TCAA_MAX, |
114 | }; | 116 | }; |
115 | 117 | ||
116 | void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data) | 118 | void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data) |
@@ -607,27 +609,33 @@ static inline int rtnetlink_rcv_skb(struct sk_buff *skb) | |||
607 | 609 | ||
608 | /* | 610 | /* |
609 | * rtnetlink input queue processing routine: | 611 | * rtnetlink input queue processing routine: |
610 | * - try to acquire shared lock. If it is failed, defer processing. | 612 | * - process as much as there was in the queue upon entry. |
611 | * - feed skbs to rtnetlink_rcv_skb, until it refuse a message, | 613 | * - feed skbs to rtnetlink_rcv_skb, until it refuse a message, |
612 | * that will occur, when a dump started and/or acquisition of | 614 | * that will occur, when a dump started. |
613 | * exclusive lock failed. | ||
614 | */ | 615 | */ |
615 | 616 | ||
616 | static void rtnetlink_rcv(struct sock *sk, int len) | 617 | static void rtnetlink_rcv(struct sock *sk, int len) |
617 | { | 618 | { |
619 | unsigned int qlen = skb_queue_len(&sk->sk_receive_queue); | ||
620 | |||
618 | do { | 621 | do { |
619 | struct sk_buff *skb; | 622 | struct sk_buff *skb; |
620 | 623 | ||
621 | if (rtnl_shlock_nowait()) | 624 | rtnl_lock(); |
622 | return; | 625 | |
626 | if (qlen > skb_queue_len(&sk->sk_receive_queue)) | ||
627 | qlen = skb_queue_len(&sk->sk_receive_queue); | ||
623 | 628 | ||
624 | while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { | 629 | for (; qlen; qlen--) { |
630 | skb = skb_dequeue(&sk->sk_receive_queue); | ||
625 | if (rtnetlink_rcv_skb(skb)) { | 631 | if (rtnetlink_rcv_skb(skb)) { |
626 | if (skb->len) | 632 | if (skb->len) |
627 | skb_queue_head(&sk->sk_receive_queue, | 633 | skb_queue_head(&sk->sk_receive_queue, |
628 | skb); | 634 | skb); |
629 | else | 635 | else { |
630 | kfree_skb(skb); | 636 | kfree_skb(skb); |
637 | qlen--; | ||
638 | } | ||
631 | break; | 639 | break; |
632 | } | 640 | } |
633 | kfree_skb(skb); | 641 | kfree_skb(skb); |
@@ -636,10 +644,10 @@ static void rtnetlink_rcv(struct sock *sk, int len) | |||
636 | up(&rtnl_sem); | 644 | up(&rtnl_sem); |
637 | 645 | ||
638 | netdev_run_todo(); | 646 | netdev_run_todo(); |
639 | } while (rtnl && rtnl->sk_receive_queue.qlen); | 647 | } while (qlen); |
640 | } | 648 | } |
641 | 649 | ||
642 | static struct rtnetlink_link link_rtnetlink_table[RTM_MAX-RTM_BASE+1] = | 650 | static struct rtnetlink_link link_rtnetlink_table[RTM_NR_MSGTYPES] = |
643 | { | 651 | { |
644 | [RTM_GETLINK - RTM_BASE] = { .dumpit = rtnetlink_dump_ifinfo }, | 652 | [RTM_GETLINK - RTM_BASE] = { .dumpit = rtnetlink_dump_ifinfo }, |
645 | [RTM_SETLINK - RTM_BASE] = { .doit = do_setlink }, | 653 | [RTM_SETLINK - RTM_BASE] = { .doit = do_setlink }, |
diff --git a/net/core/scm.c b/net/core/scm.c index a2ebf30f6aa8..e887d19be506 100644 --- a/net/core/scm.c +++ b/net/core/scm.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/major.h> | ||
19 | #include <linux/stat.h> | 18 | #include <linux/stat.h> |
20 | #include <linux/socket.h> | 19 | #include <linux/socket.h> |
21 | #include <linux/file.h> | 20 | #include <linux/file.h> |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 1b64817d7de6..f65b3de590a9 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -86,8 +86,10 @@ static kmem_cache_t *skbuff_head_cache; | |||
86 | */ | 86 | */ |
87 | void skb_over_panic(struct sk_buff *skb, int sz, void *here) | 87 | void skb_over_panic(struct sk_buff *skb, int sz, void *here) |
88 | { | 88 | { |
89 | printk(KERN_INFO "skput:over: %p:%d put:%d dev:%s", | 89 | printk(KERN_EMERG "skb_over_panic: text:%p len:%d put:%d head:%p " |
90 | here, skb->len, sz, skb->dev ? skb->dev->name : "<NULL>"); | 90 | "data:%p tail:%p end:%p dev:%s\n", |
91 | here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end, | ||
92 | skb->dev ? skb->dev->name : "<NULL>"); | ||
91 | BUG(); | 93 | BUG(); |
92 | } | 94 | } |
93 | 95 | ||
@@ -102,8 +104,10 @@ void skb_over_panic(struct sk_buff *skb, int sz, void *here) | |||
102 | 104 | ||
103 | void skb_under_panic(struct sk_buff *skb, int sz, void *here) | 105 | void skb_under_panic(struct sk_buff *skb, int sz, void *here) |
104 | { | 106 | { |
105 | printk(KERN_INFO "skput:under: %p:%d put:%d dev:%s", | 107 | printk(KERN_EMERG "skb_under_panic: text:%p len:%d put:%d head:%p " |
106 | here, skb->len, sz, skb->dev ? skb->dev->name : "<NULL>"); | 108 | "data:%p tail:%p end:%p dev:%s\n", |
109 | here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end, | ||
110 | skb->dev ? skb->dev->name : "<NULL>"); | ||
107 | BUG(); | 111 | BUG(); |
108 | } | 112 | } |
109 | 113 | ||
diff --git a/net/core/sock.c b/net/core/sock.c index 4df4fa3c5de0..96e00b08698f 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -9,7 +9,7 @@ | |||
9 | * | 9 | * |
10 | * Version: $Id: sock.c,v 1.117 2002/02/01 22:01:03 davem Exp $ | 10 | * Version: $Id: sock.c,v 1.117 2002/02/01 22:01:03 davem Exp $ |
11 | * | 11 | * |
12 | * Authors: Ross Biro, <bir7@leland.Stanford.Edu> | 12 | * Authors: Ross Biro |
13 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | 13 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
14 | * Florian La Roche, <flla@stud.uni-sb.de> | 14 | * Florian La Roche, <flla@stud.uni-sb.de> |
15 | * Alan Cox, <A.Cox@swansea.ac.uk> | 15 | * Alan Cox, <A.Cox@swansea.ac.uk> |
@@ -97,7 +97,6 @@ | |||
97 | #include <linux/socket.h> | 97 | #include <linux/socket.h> |
98 | #include <linux/in.h> | 98 | #include <linux/in.h> |
99 | #include <linux/kernel.h> | 99 | #include <linux/kernel.h> |
100 | #include <linux/major.h> | ||
101 | #include <linux/module.h> | 100 | #include <linux/module.h> |
102 | #include <linux/proc_fs.h> | 101 | #include <linux/proc_fs.h> |
103 | #include <linux/seq_file.h> | 102 | #include <linux/seq_file.h> |
@@ -617,10 +616,10 @@ lenout: | |||
617 | 616 | ||
618 | /** | 617 | /** |
619 | * sk_alloc - All socket objects are allocated here | 618 | * sk_alloc - All socket objects are allocated here |
620 | * @family - protocol family | 619 | * @family: protocol family |
621 | * @priority - for allocation (%GFP_KERNEL, %GFP_ATOMIC, etc) | 620 | * @priority: for allocation (%GFP_KERNEL, %GFP_ATOMIC, etc) |
622 | * @prot - struct proto associated with this new sock instance | 621 | * @prot: struct proto associated with this new sock instance |
623 | * @zero_it - if we should zero the newly allocated sock | 622 | * @zero_it: if we should zero the newly allocated sock |
624 | */ | 623 | */ |
625 | struct sock *sk_alloc(int family, int priority, struct proto *prot, int zero_it) | 624 | struct sock *sk_alloc(int family, int priority, struct proto *prot, int zero_it) |
626 | { | 625 | { |
@@ -636,7 +635,11 @@ struct sock *sk_alloc(int family, int priority, struct proto *prot, int zero_it) | |||
636 | if (zero_it) { | 635 | if (zero_it) { |
637 | memset(sk, 0, prot->obj_size); | 636 | memset(sk, 0, prot->obj_size); |
638 | sk->sk_family = family; | 637 | sk->sk_family = family; |
639 | sk->sk_prot = prot; | 638 | /* |
639 | * See comment in struct sock definition to understand | ||
640 | * why we need sk_prot_creator -acme | ||
641 | */ | ||
642 | sk->sk_prot = sk->sk_prot_creator = prot; | ||
640 | sock_lock_init(sk); | 643 | sock_lock_init(sk); |
641 | } | 644 | } |
642 | 645 | ||
@@ -655,7 +658,7 @@ struct sock *sk_alloc(int family, int priority, struct proto *prot, int zero_it) | |||
655 | void sk_free(struct sock *sk) | 658 | void sk_free(struct sock *sk) |
656 | { | 659 | { |
657 | struct sk_filter *filter; | 660 | struct sk_filter *filter; |
658 | struct module *owner = sk->sk_prot->owner; | 661 | struct module *owner = sk->sk_prot_creator->owner; |
659 | 662 | ||
660 | if (sk->sk_destruct) | 663 | if (sk->sk_destruct) |
661 | sk->sk_destruct(sk); | 664 | sk->sk_destruct(sk); |
@@ -673,8 +676,8 @@ void sk_free(struct sock *sk) | |||
673 | __FUNCTION__, atomic_read(&sk->sk_omem_alloc)); | 676 | __FUNCTION__, atomic_read(&sk->sk_omem_alloc)); |
674 | 677 | ||
675 | security_sk_free(sk); | 678 | security_sk_free(sk); |
676 | if (sk->sk_prot->slab != NULL) | 679 | if (sk->sk_prot_creator->slab != NULL) |
677 | kmem_cache_free(sk->sk_prot->slab, sk); | 680 | kmem_cache_free(sk->sk_prot_creator->slab, sk); |
678 | else | 681 | else |
679 | kfree(sk); | 682 | kfree(sk); |
680 | module_put(owner); | 683 | module_put(owner); |
@@ -971,8 +974,8 @@ static void __release_sock(struct sock *sk) | |||
971 | 974 | ||
972 | /** | 975 | /** |
973 | * sk_wait_data - wait for data to arrive at sk_receive_queue | 976 | * sk_wait_data - wait for data to arrive at sk_receive_queue |
974 | * sk - sock to wait on | 977 | * @sk: sock to wait on |
975 | * timeo - for how long | 978 | * @timeo: for how long |
976 | * | 979 | * |
977 | * Now socket state including sk->sk_err is changed only under lock, | 980 | * Now socket state including sk->sk_err is changed only under lock, |
978 | * hence we may omit checks after joining wait queue. | 981 | * hence we may omit checks after joining wait queue. |
diff --git a/net/core/stream.c b/net/core/stream.c index 1e27a57b5a97..ac9edfdf8742 100644 --- a/net/core/stream.c +++ b/net/core/stream.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | /** | 22 | /** |
23 | * sk_stream_write_space - stream socket write_space callback. | 23 | * sk_stream_write_space - stream socket write_space callback. |
24 | * sk - socket | 24 | * @sk: socket |
25 | * | 25 | * |
26 | * FIXME: write proper description | 26 | * FIXME: write proper description |
27 | */ | 27 | */ |
@@ -43,8 +43,8 @@ EXPORT_SYMBOL(sk_stream_write_space); | |||
43 | 43 | ||
44 | /** | 44 | /** |
45 | * sk_stream_wait_connect - Wait for a socket to get into the connected state | 45 | * sk_stream_wait_connect - Wait for a socket to get into the connected state |
46 | * @sk - sock to wait on | 46 | * @sk: sock to wait on |
47 | * @timeo_p - for how long to wait | 47 | * @timeo_p: for how long to wait |
48 | * | 48 | * |
49 | * Must be called with the socket locked. | 49 | * Must be called with the socket locked. |
50 | */ | 50 | */ |
@@ -79,7 +79,7 @@ EXPORT_SYMBOL(sk_stream_wait_connect); | |||
79 | 79 | ||
80 | /** | 80 | /** |
81 | * sk_stream_closing - Return 1 if we still have things to send in our buffers. | 81 | * sk_stream_closing - Return 1 if we still have things to send in our buffers. |
82 | * @sk - socket to verify | 82 | * @sk: socket to verify |
83 | */ | 83 | */ |
84 | static inline int sk_stream_closing(struct sock *sk) | 84 | static inline int sk_stream_closing(struct sock *sk) |
85 | { | 85 | { |
@@ -107,8 +107,8 @@ EXPORT_SYMBOL(sk_stream_wait_close); | |||
107 | 107 | ||
108 | /** | 108 | /** |
109 | * sk_stream_wait_memory - Wait for more memory for a socket | 109 | * sk_stream_wait_memory - Wait for more memory for a socket |
110 | * @sk - socket to wait for memory | 110 | * @sk: socket to wait for memory |
111 | * @timeo_p - for how long | 111 | * @timeo_p: for how long |
112 | */ | 112 | */ |
113 | int sk_stream_wait_memory(struct sock *sk, long *timeo_p) | 113 | int sk_stream_wait_memory(struct sock *sk, long *timeo_p) |
114 | { | 114 | { |