diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/af_inet.c | 1 | ||||
-rw-r--r-- | net/ipv4/icmp.c | 9 | ||||
-rw-r--r-- | net/ipv4/multipath_drr.c | 2 | ||||
-rw-r--r-- | net/ipv4/multipath_random.c | 2 | ||||
-rw-r--r-- | net/ipv4/multipath_rr.c | 2 | ||||
-rw-r--r-- | net/ipv4/multipath_wrandom.c | 2 | ||||
-rw-r--r-- | net/ipv4/sysctl_net_ipv4.c | 9 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 2 | ||||
-rw-r--r-- | net/ipv6/addrconf.c | 1 | ||||
-rw-r--r-- | net/ipv6/icmp.c | 14 | ||||
-rw-r--r-- | net/sched/act_api.c | 2 | ||||
-rw-r--r-- | net/sctp/input.c | 49 | ||||
-rw-r--r-- | net/sctp/ipv6.c | 36 | ||||
-rw-r--r-- | net/sctp/proc.c | 194 | ||||
-rw-r--r-- | net/sctp/protocol.c | 7 | ||||
-rw-r--r-- | net/sctp/socket.c | 12 |
16 files changed, 255 insertions, 89 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index b3cb49ce5fad..03942f133944 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1181,6 +1181,7 @@ EXPORT_SYMBOL(inet_stream_connect); | |||
1181 | EXPORT_SYMBOL(inet_stream_ops); | 1181 | EXPORT_SYMBOL(inet_stream_ops); |
1182 | EXPORT_SYMBOL(inet_unregister_protosw); | 1182 | EXPORT_SYMBOL(inet_unregister_protosw); |
1183 | EXPORT_SYMBOL(net_statistics); | 1183 | EXPORT_SYMBOL(net_statistics); |
1184 | EXPORT_SYMBOL(sysctl_ip_nonlocal_bind); | ||
1184 | 1185 | ||
1185 | #ifdef INET_REFCNT_DEBUG | 1186 | #ifdef INET_REFCNT_DEBUG |
1186 | EXPORT_SYMBOL(inet_sock_nr); | 1187 | EXPORT_SYMBOL(inet_sock_nr); |
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 85bf0d3e294b..cb759484979d 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -207,6 +207,7 @@ int sysctl_icmp_ignore_bogus_error_responses; | |||
207 | 207 | ||
208 | int sysctl_icmp_ratelimit = 1 * HZ; | 208 | int sysctl_icmp_ratelimit = 1 * HZ; |
209 | int sysctl_icmp_ratemask = 0x1818; | 209 | int sysctl_icmp_ratemask = 0x1818; |
210 | int sysctl_icmp_errors_use_inbound_ifaddr; | ||
210 | 211 | ||
211 | /* | 212 | /* |
212 | * ICMP control array. This specifies what to do with each ICMP. | 213 | * ICMP control array. This specifies what to do with each ICMP. |
@@ -511,8 +512,12 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info) | |||
511 | */ | 512 | */ |
512 | 513 | ||
513 | saddr = iph->daddr; | 514 | saddr = iph->daddr; |
514 | if (!(rt->rt_flags & RTCF_LOCAL)) | 515 | if (!(rt->rt_flags & RTCF_LOCAL)) { |
515 | saddr = 0; | 516 | if (sysctl_icmp_errors_use_inbound_ifaddr) |
517 | saddr = inet_select_addr(skb_in->dev, 0, RT_SCOPE_LINK); | ||
518 | else | ||
519 | saddr = 0; | ||
520 | } | ||
516 | 521 | ||
517 | tos = icmp_pointers[type].error ? ((iph->tos & IPTOS_TOS_MASK) | | 522 | tos = icmp_pointers[type].error ? ((iph->tos & IPTOS_TOS_MASK) | |
518 | IPTOS_PREC_INTERNETCONTROL) : | 523 | IPTOS_PREC_INTERNETCONTROL) : |
diff --git a/net/ipv4/multipath_drr.c b/net/ipv4/multipath_drr.c index cf2e6bcf7973..c9cf8726051d 100644 --- a/net/ipv4/multipath_drr.c +++ b/net/ipv4/multipath_drr.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/igmp.h> | 31 | #include <linux/igmp.h> |
32 | #include <linux/proc_fs.h> | 32 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
34 | #include <linux/module.h> | ||
34 | #include <linux/mroute.h> | 35 | #include <linux/mroute.h> |
35 | #include <linux/init.h> | 36 | #include <linux/init.h> |
36 | #include <net/ip.h> | 37 | #include <net/ip.h> |
@@ -247,3 +248,4 @@ static void __exit drr_exit(void) | |||
247 | 248 | ||
248 | module_init(drr_init); | 249 | module_init(drr_init); |
249 | module_exit(drr_exit); | 250 | module_exit(drr_exit); |
251 | MODULE_LICENSE("GPL"); | ||
diff --git a/net/ipv4/multipath_random.c b/net/ipv4/multipath_random.c index 805a16e47de5..5249dbe7c559 100644 --- a/net/ipv4/multipath_random.c +++ b/net/ipv4/multipath_random.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/igmp.h> | 31 | #include <linux/igmp.h> |
32 | #include <linux/proc_fs.h> | 32 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
34 | #include <linux/module.h> | ||
34 | #include <linux/mroute.h> | 35 | #include <linux/mroute.h> |
35 | #include <linux/init.h> | 36 | #include <linux/init.h> |
36 | #include <net/ip.h> | 37 | #include <net/ip.h> |
@@ -126,3 +127,4 @@ static void __exit random_exit(void) | |||
126 | 127 | ||
127 | module_init(random_init); | 128 | module_init(random_init); |
128 | module_exit(random_exit); | 129 | module_exit(random_exit); |
130 | MODULE_LICENSE("GPL"); | ||
diff --git a/net/ipv4/multipath_rr.c b/net/ipv4/multipath_rr.c index 061b6b253982..b6cd2870478f 100644 --- a/net/ipv4/multipath_rr.c +++ b/net/ipv4/multipath_rr.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/igmp.h> | 31 | #include <linux/igmp.h> |
32 | #include <linux/proc_fs.h> | 32 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
34 | #include <linux/module.h> | ||
34 | #include <linux/mroute.h> | 35 | #include <linux/mroute.h> |
35 | #include <linux/init.h> | 36 | #include <linux/init.h> |
36 | #include <net/ip.h> | 37 | #include <net/ip.h> |
@@ -93,3 +94,4 @@ static void __exit rr_exit(void) | |||
93 | 94 | ||
94 | module_init(rr_init); | 95 | module_init(rr_init); |
95 | module_exit(rr_exit); | 96 | module_exit(rr_exit); |
97 | MODULE_LICENSE("GPL"); | ||
diff --git a/net/ipv4/multipath_wrandom.c b/net/ipv4/multipath_wrandom.c index c3d2ca1a6781..bd7d75b6abe0 100644 --- a/net/ipv4/multipath_wrandom.c +++ b/net/ipv4/multipath_wrandom.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/igmp.h> | 31 | #include <linux/igmp.h> |
32 | #include <linux/proc_fs.h> | 32 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
34 | #include <linux/module.h> | ||
34 | #include <linux/mroute.h> | 35 | #include <linux/mroute.h> |
35 | #include <linux/init.h> | 36 | #include <linux/init.h> |
36 | #include <net/ip.h> | 37 | #include <net/ip.h> |
@@ -342,3 +343,4 @@ static void __exit wrandom_exit(void) | |||
342 | 343 | ||
343 | module_init(wrandom_init); | 344 | module_init(wrandom_init); |
344 | module_exit(wrandom_exit); | 345 | module_exit(wrandom_exit); |
346 | MODULE_LICENSE("GPL"); | ||
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 3aafb298c1c1..23068bddbf0b 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c | |||
@@ -23,6 +23,7 @@ extern int sysctl_ip_nonlocal_bind; | |||
23 | extern int sysctl_icmp_echo_ignore_all; | 23 | extern int sysctl_icmp_echo_ignore_all; |
24 | extern int sysctl_icmp_echo_ignore_broadcasts; | 24 | extern int sysctl_icmp_echo_ignore_broadcasts; |
25 | extern int sysctl_icmp_ignore_bogus_error_responses; | 25 | extern int sysctl_icmp_ignore_bogus_error_responses; |
26 | extern int sysctl_icmp_errors_use_inbound_ifaddr; | ||
26 | 27 | ||
27 | /* From ip_fragment.c */ | 28 | /* From ip_fragment.c */ |
28 | extern int sysctl_ipfrag_low_thresh; | 29 | extern int sysctl_ipfrag_low_thresh; |
@@ -396,6 +397,14 @@ ctl_table ipv4_table[] = { | |||
396 | .proc_handler = &proc_dointvec | 397 | .proc_handler = &proc_dointvec |
397 | }, | 398 | }, |
398 | { | 399 | { |
400 | .ctl_name = NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR, | ||
401 | .procname = "icmp_errors_use_inbound_ifaddr", | ||
402 | .data = &sysctl_icmp_errors_use_inbound_ifaddr, | ||
403 | .maxlen = sizeof(int), | ||
404 | .mode = 0644, | ||
405 | .proc_handler = &proc_dointvec | ||
406 | }, | ||
407 | { | ||
399 | .ctl_name = NET_IPV4_ROUTE, | 408 | .ctl_name = NET_IPV4_ROUTE, |
400 | .procname = "route", | 409 | .procname = "route", |
401 | .maxlen = 0, | 410 | .maxlen = 0, |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index a037bafcba3c..0d9a4fd5f1a4 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -2338,7 +2338,7 @@ void __init tcp_init(void) | |||
2338 | (tcp_bhash_size * sizeof(struct tcp_bind_hashbucket)); | 2338 | (tcp_bhash_size * sizeof(struct tcp_bind_hashbucket)); |
2339 | order++) | 2339 | order++) |
2340 | ; | 2340 | ; |
2341 | if (order > 4) { | 2341 | if (order >= 4) { |
2342 | sysctl_local_port_range[0] = 32768; | 2342 | sysctl_local_port_range[0] = 32768; |
2343 | sysctl_local_port_range[1] = 61000; | 2343 | sysctl_local_port_range[1] = 61000; |
2344 | sysctl_tcp_max_tw_buckets = 180000; | 2344 | sysctl_tcp_max_tw_buckets = 180000; |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 7744a2592693..2720899d516c 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -372,6 +372,7 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev) | |||
372 | ndev->regen_timer.data = (unsigned long) ndev; | 372 | ndev->regen_timer.data = (unsigned long) ndev; |
373 | if ((dev->flags&IFF_LOOPBACK) || | 373 | if ((dev->flags&IFF_LOOPBACK) || |
374 | dev->type == ARPHRD_TUNNEL || | 374 | dev->type == ARPHRD_TUNNEL || |
375 | dev->type == ARPHRD_NONE || | ||
375 | dev->type == ARPHRD_SIT) { | 376 | dev->type == ARPHRD_SIT) { |
376 | printk(KERN_INFO | 377 | printk(KERN_INFO |
377 | "Disabled Privacy Extensions on device %p(%s)\n", | 378 | "Disabled Privacy Extensions on device %p(%s)\n", |
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 8e0f569b883e..ff3ec9822e36 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -277,8 +277,8 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, | |||
277 | { | 277 | { |
278 | struct inet6_dev *idev = NULL; | 278 | struct inet6_dev *idev = NULL; |
279 | struct ipv6hdr *hdr = skb->nh.ipv6h; | 279 | struct ipv6hdr *hdr = skb->nh.ipv6h; |
280 | struct sock *sk = icmpv6_socket->sk; | 280 | struct sock *sk; |
281 | struct ipv6_pinfo *np = inet6_sk(sk); | 281 | struct ipv6_pinfo *np; |
282 | struct in6_addr *saddr = NULL; | 282 | struct in6_addr *saddr = NULL; |
283 | struct dst_entry *dst; | 283 | struct dst_entry *dst; |
284 | struct icmp6hdr tmp_hdr; | 284 | struct icmp6hdr tmp_hdr; |
@@ -358,6 +358,9 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, | |||
358 | if (icmpv6_xmit_lock()) | 358 | if (icmpv6_xmit_lock()) |
359 | return; | 359 | return; |
360 | 360 | ||
361 | sk = icmpv6_socket->sk; | ||
362 | np = inet6_sk(sk); | ||
363 | |||
361 | if (!icmpv6_xrlim_allow(sk, type, &fl)) | 364 | if (!icmpv6_xrlim_allow(sk, type, &fl)) |
362 | goto out; | 365 | goto out; |
363 | 366 | ||
@@ -423,9 +426,9 @@ out: | |||
423 | 426 | ||
424 | static void icmpv6_echo_reply(struct sk_buff *skb) | 427 | static void icmpv6_echo_reply(struct sk_buff *skb) |
425 | { | 428 | { |
426 | struct sock *sk = icmpv6_socket->sk; | 429 | struct sock *sk; |
427 | struct inet6_dev *idev; | 430 | struct inet6_dev *idev; |
428 | struct ipv6_pinfo *np = inet6_sk(sk); | 431 | struct ipv6_pinfo *np; |
429 | struct in6_addr *saddr = NULL; | 432 | struct in6_addr *saddr = NULL; |
430 | struct icmp6hdr *icmph = (struct icmp6hdr *) skb->h.raw; | 433 | struct icmp6hdr *icmph = (struct icmp6hdr *) skb->h.raw; |
431 | struct icmp6hdr tmp_hdr; | 434 | struct icmp6hdr tmp_hdr; |
@@ -454,6 +457,9 @@ static void icmpv6_echo_reply(struct sk_buff *skb) | |||
454 | if (icmpv6_xmit_lock()) | 457 | if (icmpv6_xmit_lock()) |
455 | return; | 458 | return; |
456 | 459 | ||
460 | sk = icmpv6_socket->sk; | ||
461 | np = inet6_sk(sk); | ||
462 | |||
457 | if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) | 463 | if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) |
458 | fl.oif = np->mcast_oif; | 464 | fl.oif = np->mcast_oif; |
459 | 465 | ||
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index cafcb084098d..914c85ff8fe6 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -881,7 +881,7 @@ static int __init tc_action_init(void) | |||
881 | link_p[RTM_GETACTION-RTM_BASE].dumpit = tc_dump_action; | 881 | link_p[RTM_GETACTION-RTM_BASE].dumpit = tc_dump_action; |
882 | } | 882 | } |
883 | 883 | ||
884 | printk("TC classifier action (bugs to netdev@oss.sgi.com cc " | 884 | printk("TC classifier action (bugs to netdev@vger.kernel.org cc " |
885 | "hadi@cyberus.ca)\n"); | 885 | "hadi@cyberus.ca)\n"); |
886 | return 0; | 886 | return 0; |
887 | } | 887 | } |
diff --git a/net/sctp/input.c b/net/sctp/input.c index b719a77d66b4..fffc880a646d 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -178,6 +178,37 @@ int sctp_rcv(struct sk_buff *skb) | |||
178 | 178 | ||
179 | asoc = __sctp_rcv_lookup(skb, &src, &dest, &transport); | 179 | asoc = __sctp_rcv_lookup(skb, &src, &dest, &transport); |
180 | 180 | ||
181 | if (!asoc) | ||
182 | ep = __sctp_rcv_lookup_endpoint(&dest); | ||
183 | |||
184 | /* Retrieve the common input handling substructure. */ | ||
185 | rcvr = asoc ? &asoc->base : &ep->base; | ||
186 | sk = rcvr->sk; | ||
187 | |||
188 | /* | ||
189 | * If a frame arrives on an interface and the receiving socket is | ||
190 | * bound to another interface, via SO_BINDTODEVICE, treat it as OOTB | ||
191 | */ | ||
192 | if (sk->sk_bound_dev_if && (sk->sk_bound_dev_if != af->skb_iif(skb))) | ||
193 | { | ||
194 | sock_put(sk); | ||
195 | if (asoc) { | ||
196 | sctp_association_put(asoc); | ||
197 | asoc = NULL; | ||
198 | } else { | ||
199 | sctp_endpoint_put(ep); | ||
200 | ep = NULL; | ||
201 | } | ||
202 | sk = sctp_get_ctl_sock(); | ||
203 | ep = sctp_sk(sk)->ep; | ||
204 | sctp_endpoint_hold(ep); | ||
205 | sock_hold(sk); | ||
206 | rcvr = &ep->base; | ||
207 | } | ||
208 | |||
209 | if (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf) | ||
210 | goto discard_release; | ||
211 | |||
181 | /* | 212 | /* |
182 | * RFC 2960, 8.4 - Handle "Out of the blue" Packets. | 213 | * RFC 2960, 8.4 - Handle "Out of the blue" Packets. |
183 | * An SCTP packet is called an "out of the blue" (OOTB) | 214 | * An SCTP packet is called an "out of the blue" (OOTB) |
@@ -187,22 +218,12 @@ int sctp_rcv(struct sk_buff *skb) | |||
187 | * packet belongs. | 218 | * packet belongs. |
188 | */ | 219 | */ |
189 | if (!asoc) { | 220 | if (!asoc) { |
190 | ep = __sctp_rcv_lookup_endpoint(&dest); | ||
191 | if (sctp_rcv_ootb(skb)) { | 221 | if (sctp_rcv_ootb(skb)) { |
192 | SCTP_INC_STATS_BH(SCTP_MIB_OUTOFBLUES); | 222 | SCTP_INC_STATS_BH(SCTP_MIB_OUTOFBLUES); |
193 | goto discard_release; | 223 | goto discard_release; |
194 | } | 224 | } |
195 | } | 225 | } |
196 | 226 | ||
197 | /* Retrieve the common input handling substructure. */ | ||
198 | rcvr = asoc ? &asoc->base : &ep->base; | ||
199 | sk = rcvr->sk; | ||
200 | |||
201 | if ((sk) && (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf)) { | ||
202 | goto discard_release; | ||
203 | } | ||
204 | |||
205 | |||
206 | /* SCTP seems to always need a timestamp right now (FIXME) */ | 227 | /* SCTP seems to always need a timestamp right now (FIXME) */ |
207 | if (skb->stamp.tv_sec == 0) { | 228 | if (skb->stamp.tv_sec == 0) { |
208 | do_gettimeofday(&skb->stamp); | 229 | do_gettimeofday(&skb->stamp); |
@@ -265,13 +286,11 @@ discard_it: | |||
265 | 286 | ||
266 | discard_release: | 287 | discard_release: |
267 | /* Release any structures we may be holding. */ | 288 | /* Release any structures we may be holding. */ |
268 | if (asoc) { | 289 | sock_put(sk); |
269 | sock_put(asoc->base.sk); | 290 | if (asoc) |
270 | sctp_association_put(asoc); | 291 | sctp_association_put(asoc); |
271 | } else { | 292 | else |
272 | sock_put(ep->base.sk); | ||
273 | sctp_endpoint_put(ep); | 293 | sctp_endpoint_put(ep); |
274 | } | ||
275 | 294 | ||
276 | goto discard_it; | 295 | goto discard_it; |
277 | } | 296 | } |
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index c9d9ea064734..c7e42d125b9c 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -812,26 +812,23 @@ static int sctp_inet6_bind_verify(struct sctp_sock *opt, union sctp_addr *addr) | |||
812 | if (addr->sa.sa_family != AF_INET6) | 812 | if (addr->sa.sa_family != AF_INET6) |
813 | af = sctp_get_af_specific(addr->sa.sa_family); | 813 | af = sctp_get_af_specific(addr->sa.sa_family); |
814 | else { | 814 | else { |
815 | struct sock *sk; | ||
816 | int type = ipv6_addr_type(&addr->v6.sin6_addr); | 815 | int type = ipv6_addr_type(&addr->v6.sin6_addr); |
817 | sk = sctp_opt2sk(opt); | 816 | struct net_device *dev; |
817 | |||
818 | if (type & IPV6_ADDR_LINKLOCAL) { | 818 | if (type & IPV6_ADDR_LINKLOCAL) { |
819 | /* Note: Behavior similar to af_inet6.c: | 819 | if (!addr->v6.sin6_scope_id) |
820 | * 1) Overrides previous bound_dev_if | 820 | return 0; |
821 | * 2) Destructive even if bind isn't successful. | 821 | dev = dev_get_by_index(addr->v6.sin6_scope_id); |
822 | */ | 822 | if (!dev) |
823 | |||
824 | if (addr->v6.sin6_scope_id) | ||
825 | sk->sk_bound_dev_if = addr->v6.sin6_scope_id; | ||
826 | if (!sk->sk_bound_dev_if) | ||
827 | return 0; | 823 | return 0; |
824 | dev_put(dev); | ||
828 | } | 825 | } |
829 | af = opt->pf->af; | 826 | af = opt->pf->af; |
830 | } | 827 | } |
831 | return af->available(addr, opt); | 828 | return af->available(addr, opt); |
832 | } | 829 | } |
833 | 830 | ||
834 | /* Verify that the provided sockaddr looks bindable. Common verification, | 831 | /* Verify that the provided sockaddr looks sendable. Common verification, |
835 | * has already been taken care of. | 832 | * has already been taken care of. |
836 | */ | 833 | */ |
837 | static int sctp_inet6_send_verify(struct sctp_sock *opt, union sctp_addr *addr) | 834 | static int sctp_inet6_send_verify(struct sctp_sock *opt, union sctp_addr *addr) |
@@ -842,19 +839,16 @@ static int sctp_inet6_send_verify(struct sctp_sock *opt, union sctp_addr *addr) | |||
842 | if (addr->sa.sa_family != AF_INET6) | 839 | if (addr->sa.sa_family != AF_INET6) |
843 | af = sctp_get_af_specific(addr->sa.sa_family); | 840 | af = sctp_get_af_specific(addr->sa.sa_family); |
844 | else { | 841 | else { |
845 | struct sock *sk; | ||
846 | int type = ipv6_addr_type(&addr->v6.sin6_addr); | 842 | int type = ipv6_addr_type(&addr->v6.sin6_addr); |
847 | sk = sctp_opt2sk(opt); | 843 | struct net_device *dev; |
844 | |||
848 | if (type & IPV6_ADDR_LINKLOCAL) { | 845 | if (type & IPV6_ADDR_LINKLOCAL) { |
849 | /* Note: Behavior similar to af_inet6.c: | 846 | if (!addr->v6.sin6_scope_id) |
850 | * 1) Overrides previous bound_dev_if | 847 | return 0; |
851 | * 2) Destructive even if bind isn't successful. | 848 | dev = dev_get_by_index(addr->v6.sin6_scope_id); |
852 | */ | 849 | if (!dev) |
853 | |||
854 | if (addr->v6.sin6_scope_id) | ||
855 | sk->sk_bound_dev_if = addr->v6.sin6_scope_id; | ||
856 | if (!sk->sk_bound_dev_if) | ||
857 | return 0; | 850 | return 0; |
851 | dev_put(dev); | ||
858 | } | 852 | } |
859 | af = opt->pf->af; | 853 | af = opt->pf->af; |
860 | } | 854 | } |
diff --git a/net/sctp/proc.c b/net/sctp/proc.c index e42fd8c2916b..98d49ec9b74b 100644 --- a/net/sctp/proc.c +++ b/net/sctp/proc.c | |||
@@ -132,14 +132,25 @@ void sctp_snmp_proc_exit(void) | |||
132 | static void sctp_seq_dump_local_addrs(struct seq_file *seq, struct sctp_ep_common *epb) | 132 | static void sctp_seq_dump_local_addrs(struct seq_file *seq, struct sctp_ep_common *epb) |
133 | { | 133 | { |
134 | struct list_head *pos; | 134 | struct list_head *pos; |
135 | struct sctp_association *asoc; | ||
135 | struct sctp_sockaddr_entry *laddr; | 136 | struct sctp_sockaddr_entry *laddr; |
136 | union sctp_addr *addr; | 137 | struct sctp_transport *peer; |
138 | union sctp_addr *addr, *primary = NULL; | ||
137 | struct sctp_af *af; | 139 | struct sctp_af *af; |
138 | 140 | ||
141 | if (epb->type == SCTP_EP_TYPE_ASSOCIATION) { | ||
142 | asoc = sctp_assoc(epb); | ||
143 | peer = asoc->peer.primary_path; | ||
144 | primary = &peer->saddr; | ||
145 | } | ||
146 | |||
139 | list_for_each(pos, &epb->bind_addr.address_list) { | 147 | list_for_each(pos, &epb->bind_addr.address_list) { |
140 | laddr = list_entry(pos, struct sctp_sockaddr_entry, list); | 148 | laddr = list_entry(pos, struct sctp_sockaddr_entry, list); |
141 | addr = (union sctp_addr *)&laddr->a; | 149 | addr = (union sctp_addr *)&laddr->a; |
142 | af = sctp_get_af_specific(addr->sa.sa_family); | 150 | af = sctp_get_af_specific(addr->sa.sa_family); |
151 | if (primary && af->cmp_addr(addr, primary)) { | ||
152 | seq_printf(seq, "*"); | ||
153 | } | ||
143 | af->seq_dump_addr(seq, addr); | 154 | af->seq_dump_addr(seq, addr); |
144 | } | 155 | } |
145 | } | 156 | } |
@@ -149,17 +160,54 @@ static void sctp_seq_dump_remote_addrs(struct seq_file *seq, struct sctp_associa | |||
149 | { | 160 | { |
150 | struct list_head *pos; | 161 | struct list_head *pos; |
151 | struct sctp_transport *transport; | 162 | struct sctp_transport *transport; |
152 | union sctp_addr *addr; | 163 | union sctp_addr *addr, *primary; |
153 | struct sctp_af *af; | 164 | struct sctp_af *af; |
154 | 165 | ||
166 | primary = &(assoc->peer.primary_addr); | ||
155 | list_for_each(pos, &assoc->peer.transport_addr_list) { | 167 | list_for_each(pos, &assoc->peer.transport_addr_list) { |
156 | transport = list_entry(pos, struct sctp_transport, transports); | 168 | transport = list_entry(pos, struct sctp_transport, transports); |
157 | addr = (union sctp_addr *)&transport->ipaddr; | 169 | addr = (union sctp_addr *)&transport->ipaddr; |
158 | af = sctp_get_af_specific(addr->sa.sa_family); | 170 | af = sctp_get_af_specific(addr->sa.sa_family); |
171 | if (af->cmp_addr(addr, primary)) { | ||
172 | seq_printf(seq, "*"); | ||
173 | } | ||
159 | af->seq_dump_addr(seq, addr); | 174 | af->seq_dump_addr(seq, addr); |
160 | } | 175 | } |
161 | } | 176 | } |
162 | 177 | ||
178 | static void * sctp_eps_seq_start(struct seq_file *seq, loff_t *pos) | ||
179 | { | ||
180 | if (*pos > sctp_ep_hashsize) | ||
181 | return NULL; | ||
182 | |||
183 | if (*pos < 0) | ||
184 | *pos = 0; | ||
185 | |||
186 | if (*pos == 0) | ||
187 | seq_printf(seq, " ENDPT SOCK STY SST HBKT LPORT UID INODE LADDRS\n"); | ||
188 | |||
189 | ++*pos; | ||
190 | |||
191 | return (void *)pos; | ||
192 | } | ||
193 | |||
194 | static void sctp_eps_seq_stop(struct seq_file *seq, void *v) | ||
195 | { | ||
196 | return; | ||
197 | } | ||
198 | |||
199 | |||
200 | static void * sctp_eps_seq_next(struct seq_file *seq, void *v, loff_t *pos) | ||
201 | { | ||
202 | if (*pos > sctp_ep_hashsize) | ||
203 | return NULL; | ||
204 | |||
205 | ++*pos; | ||
206 | |||
207 | return pos; | ||
208 | } | ||
209 | |||
210 | |||
163 | /* Display sctp endpoints (/proc/net/sctp/eps). */ | 211 | /* Display sctp endpoints (/proc/net/sctp/eps). */ |
164 | static int sctp_eps_seq_show(struct seq_file *seq, void *v) | 212 | static int sctp_eps_seq_show(struct seq_file *seq, void *v) |
165 | { | 213 | { |
@@ -167,38 +215,50 @@ static int sctp_eps_seq_show(struct seq_file *seq, void *v) | |||
167 | struct sctp_ep_common *epb; | 215 | struct sctp_ep_common *epb; |
168 | struct sctp_endpoint *ep; | 216 | struct sctp_endpoint *ep; |
169 | struct sock *sk; | 217 | struct sock *sk; |
170 | int hash; | 218 | int hash = *(int *)v; |
171 | 219 | ||
172 | seq_printf(seq, " ENDPT SOCK STY SST HBKT LPORT LADDRS\n"); | 220 | if (hash > sctp_ep_hashsize) |
173 | for (hash = 0; hash < sctp_ep_hashsize; hash++) { | 221 | return -ENOMEM; |
174 | head = &sctp_ep_hashtable[hash]; | 222 | |
175 | read_lock(&head->lock); | 223 | head = &sctp_ep_hashtable[hash-1]; |
176 | for (epb = head->chain; epb; epb = epb->next) { | 224 | sctp_local_bh_disable(); |
177 | ep = sctp_ep(epb); | 225 | read_lock(&head->lock); |
178 | sk = epb->sk; | 226 | for (epb = head->chain; epb; epb = epb->next) { |
179 | seq_printf(seq, "%8p %8p %-3d %-3d %-4d %-5d ", ep, sk, | 227 | ep = sctp_ep(epb); |
180 | sctp_sk(sk)->type, sk->sk_state, hash, | 228 | sk = epb->sk; |
181 | epb->bind_addr.port); | 229 | seq_printf(seq, "%8p %8p %-3d %-3d %-4d %-5d %5d %5lu ", ep, sk, |
182 | sctp_seq_dump_local_addrs(seq, epb); | 230 | sctp_sk(sk)->type, sk->sk_state, hash-1, |
183 | seq_printf(seq, "\n"); | 231 | epb->bind_addr.port, |
184 | } | 232 | sock_i_uid(sk), sock_i_ino(sk)); |
185 | read_unlock(&head->lock); | 233 | |
234 | sctp_seq_dump_local_addrs(seq, epb); | ||
235 | seq_printf(seq, "\n"); | ||
186 | } | 236 | } |
237 | read_unlock(&head->lock); | ||
238 | sctp_local_bh_enable(); | ||
187 | 239 | ||
188 | return 0; | 240 | return 0; |
189 | } | 241 | } |
190 | 242 | ||
243 | static struct seq_operations sctp_eps_ops = { | ||
244 | .start = sctp_eps_seq_start, | ||
245 | .next = sctp_eps_seq_next, | ||
246 | .stop = sctp_eps_seq_stop, | ||
247 | .show = sctp_eps_seq_show, | ||
248 | }; | ||
249 | |||
250 | |||
191 | /* Initialize the seq file operations for 'eps' object. */ | 251 | /* Initialize the seq file operations for 'eps' object. */ |
192 | static int sctp_eps_seq_open(struct inode *inode, struct file *file) | 252 | static int sctp_eps_seq_open(struct inode *inode, struct file *file) |
193 | { | 253 | { |
194 | return single_open(file, sctp_eps_seq_show, NULL); | 254 | return seq_open(file, &sctp_eps_ops); |
195 | } | 255 | } |
196 | 256 | ||
197 | static struct file_operations sctp_eps_seq_fops = { | 257 | static struct file_operations sctp_eps_seq_fops = { |
198 | .open = sctp_eps_seq_open, | 258 | .open = sctp_eps_seq_open, |
199 | .read = seq_read, | 259 | .read = seq_read, |
200 | .llseek = seq_lseek, | 260 | .llseek = seq_lseek, |
201 | .release = single_release, | 261 | .release = seq_release, |
202 | }; | 262 | }; |
203 | 263 | ||
204 | /* Set up the proc fs entry for 'eps' object. */ | 264 | /* Set up the proc fs entry for 'eps' object. */ |
@@ -221,6 +281,40 @@ void sctp_eps_proc_exit(void) | |||
221 | remove_proc_entry("eps", proc_net_sctp); | 281 | remove_proc_entry("eps", proc_net_sctp); |
222 | } | 282 | } |
223 | 283 | ||
284 | |||
285 | static void * sctp_assocs_seq_start(struct seq_file *seq, loff_t *pos) | ||
286 | { | ||
287 | if (*pos > sctp_assoc_hashsize) | ||
288 | return NULL; | ||
289 | |||
290 | if (*pos < 0) | ||
291 | *pos = 0; | ||
292 | |||
293 | if (*pos == 0) | ||
294 | seq_printf(seq, " ASSOC SOCK STY SST ST HBKT ASSOC-ID TX_QUEUE RX_QUEUE UID INODE LPORT " | ||
295 | "RPORT LADDRS <-> RADDRS\n"); | ||
296 | |||
297 | ++*pos; | ||
298 | |||
299 | return (void *)pos; | ||
300 | } | ||
301 | |||
302 | static void sctp_assocs_seq_stop(struct seq_file *seq, void *v) | ||
303 | { | ||
304 | return; | ||
305 | } | ||
306 | |||
307 | |||
308 | static void * sctp_assocs_seq_next(struct seq_file *seq, void *v, loff_t *pos) | ||
309 | { | ||
310 | if (*pos > sctp_assoc_hashsize) | ||
311 | return NULL; | ||
312 | |||
313 | ++*pos; | ||
314 | |||
315 | return pos; | ||
316 | } | ||
317 | |||
224 | /* Display sctp associations (/proc/net/sctp/assocs). */ | 318 | /* Display sctp associations (/proc/net/sctp/assocs). */ |
225 | static int sctp_assocs_seq_show(struct seq_file *seq, void *v) | 319 | static int sctp_assocs_seq_show(struct seq_file *seq, void *v) |
226 | { | 320 | { |
@@ -228,43 +322,57 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v) | |||
228 | struct sctp_ep_common *epb; | 322 | struct sctp_ep_common *epb; |
229 | struct sctp_association *assoc; | 323 | struct sctp_association *assoc; |
230 | struct sock *sk; | 324 | struct sock *sk; |
231 | int hash; | 325 | int hash = *(int *)v; |
232 | 326 | ||
233 | seq_printf(seq, " ASSOC SOCK STY SST ST HBKT LPORT RPORT " | 327 | if (hash > sctp_assoc_hashsize) |
234 | "LADDRS <-> RADDRS\n"); | 328 | return -ENOMEM; |
235 | for (hash = 0; hash < sctp_assoc_hashsize; hash++) { | 329 | |
236 | head = &sctp_assoc_hashtable[hash]; | 330 | head = &sctp_assoc_hashtable[hash-1]; |
237 | read_lock(&head->lock); | 331 | sctp_local_bh_disable(); |
238 | for (epb = head->chain; epb; epb = epb->next) { | 332 | read_lock(&head->lock); |
239 | assoc = sctp_assoc(epb); | 333 | for (epb = head->chain; epb; epb = epb->next) { |
240 | sk = epb->sk; | 334 | assoc = sctp_assoc(epb); |
241 | seq_printf(seq, | 335 | sk = epb->sk; |
242 | "%8p %8p %-3d %-3d %-2d %-4d %-5d %-5d ", | 336 | seq_printf(seq, |
243 | assoc, sk, sctp_sk(sk)->type, sk->sk_state, | 337 | "%8p %8p %-3d %-3d %-2d %-4d %4d %8d %8d %7d %5lu %-5d %5d ", |
244 | assoc->state, hash, epb->bind_addr.port, | 338 | assoc, sk, sctp_sk(sk)->type, sk->sk_state, |
245 | assoc->peer.port); | 339 | assoc->state, hash-1, assoc->assoc_id, |
246 | sctp_seq_dump_local_addrs(seq, epb); | 340 | (sk->sk_rcvbuf - assoc->rwnd), |
247 | seq_printf(seq, "<-> "); | 341 | assoc->sndbuf_used, |
248 | sctp_seq_dump_remote_addrs(seq, assoc); | 342 | sock_i_uid(sk), sock_i_ino(sk), |
249 | seq_printf(seq, "\n"); | 343 | epb->bind_addr.port, |
250 | } | 344 | assoc->peer.port); |
251 | read_unlock(&head->lock); | 345 | |
346 | seq_printf(seq, " "); | ||
347 | sctp_seq_dump_local_addrs(seq, epb); | ||
348 | seq_printf(seq, "<-> "); | ||
349 | sctp_seq_dump_remote_addrs(seq, assoc); | ||
350 | seq_printf(seq, "\n"); | ||
252 | } | 351 | } |
352 | read_unlock(&head->lock); | ||
353 | sctp_local_bh_enable(); | ||
253 | 354 | ||
254 | return 0; | 355 | return 0; |
255 | } | 356 | } |
256 | 357 | ||
358 | static struct seq_operations sctp_assoc_ops = { | ||
359 | .start = sctp_assocs_seq_start, | ||
360 | .next = sctp_assocs_seq_next, | ||
361 | .stop = sctp_assocs_seq_stop, | ||
362 | .show = sctp_assocs_seq_show, | ||
363 | }; | ||
364 | |||
257 | /* Initialize the seq file operations for 'assocs' object. */ | 365 | /* Initialize the seq file operations for 'assocs' object. */ |
258 | static int sctp_assocs_seq_open(struct inode *inode, struct file *file) | 366 | static int sctp_assocs_seq_open(struct inode *inode, struct file *file) |
259 | { | 367 | { |
260 | return single_open(file, sctp_assocs_seq_show, NULL); | 368 | return seq_open(file, &sctp_assoc_ops); |
261 | } | 369 | } |
262 | 370 | ||
263 | static struct file_operations sctp_assocs_seq_fops = { | 371 | static struct file_operations sctp_assocs_seq_fops = { |
264 | .open = sctp_assocs_seq_open, | 372 | .open = sctp_assocs_seq_open, |
265 | .read = seq_read, | 373 | .read = seq_read, |
266 | .llseek = seq_lseek, | 374 | .llseek = seq_lseek, |
267 | .release = single_release, | 375 | .release = seq_release, |
268 | }; | 376 | }; |
269 | 377 | ||
270 | /* Set up the proc fs entry for 'assocs' object. */ | 378 | /* Set up the proc fs entry for 'assocs' object. */ |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 2e1f9c3556f5..5135e1a25d25 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -378,10 +378,13 @@ static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp) | |||
378 | { | 378 | { |
379 | int ret = inet_addr_type(addr->v4.sin_addr.s_addr); | 379 | int ret = inet_addr_type(addr->v4.sin_addr.s_addr); |
380 | 380 | ||
381 | /* FIXME: ip_nonlocal_bind sysctl support. */ | ||
382 | 381 | ||
383 | if (addr->v4.sin_addr.s_addr != INADDR_ANY && ret != RTN_LOCAL) | 382 | if (addr->v4.sin_addr.s_addr != INADDR_ANY && |
383 | ret != RTN_LOCAL && | ||
384 | !sp->inet.freebind && | ||
385 | !sysctl_ip_nonlocal_bind) | ||
384 | return 0; | 386 | return 0; |
387 | |||
385 | return 1; | 388 | return 1; |
386 | } | 389 | } |
387 | 390 | ||
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 0b338eca6dc0..2a3c0e08a090 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -4686,6 +4686,7 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
4686 | struct sctp_endpoint *newep = newsp->ep; | 4686 | struct sctp_endpoint *newep = newsp->ep; |
4687 | struct sk_buff *skb, *tmp; | 4687 | struct sk_buff *skb, *tmp; |
4688 | struct sctp_ulpevent *event; | 4688 | struct sctp_ulpevent *event; |
4689 | int flags = 0; | ||
4689 | 4690 | ||
4690 | /* Migrate socket buffer sizes and all the socket level options to the | 4691 | /* Migrate socket buffer sizes and all the socket level options to the |
4691 | * new socket. | 4692 | * new socket. |
@@ -4707,6 +4708,17 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
4707 | sctp_sk(newsk)->bind_hash = pp; | 4708 | sctp_sk(newsk)->bind_hash = pp; |
4708 | inet_sk(newsk)->num = inet_sk(oldsk)->num; | 4709 | inet_sk(newsk)->num = inet_sk(oldsk)->num; |
4709 | 4710 | ||
4711 | /* Copy the bind_addr list from the original endpoint to the new | ||
4712 | * endpoint so that we can handle restarts properly | ||
4713 | */ | ||
4714 | if (assoc->peer.ipv4_address) | ||
4715 | flags |= SCTP_ADDR4_PEERSUPP; | ||
4716 | if (assoc->peer.ipv6_address) | ||
4717 | flags |= SCTP_ADDR6_PEERSUPP; | ||
4718 | sctp_bind_addr_copy(&newsp->ep->base.bind_addr, | ||
4719 | &oldsp->ep->base.bind_addr, | ||
4720 | SCTP_SCOPE_GLOBAL, GFP_KERNEL, flags); | ||
4721 | |||
4710 | /* Move any messages in the old socket's receive queue that are for the | 4722 | /* Move any messages in the old socket's receive queue that are for the |
4711 | * peeled off association to the new socket's receive queue. | 4723 | * peeled off association to the new socket's receive queue. |
4712 | */ | 4724 | */ |