diff options
Diffstat (limited to 'net')
44 files changed, 463 insertions, 490 deletions
diff --git a/net/bluetooth/bnep/bnep.h b/net/bluetooth/bnep/bnep.h index 0d9e506f5d5a..70672544db86 100644 --- a/net/bluetooth/bnep/bnep.h +++ b/net/bluetooth/bnep/bnep.h | |||
@@ -86,26 +86,26 @@ struct bnep_setup_conn_req { | |||
86 | __u8 ctrl; | 86 | __u8 ctrl; |
87 | __u8 uuid_size; | 87 | __u8 uuid_size; |
88 | __u8 service[0]; | 88 | __u8 service[0]; |
89 | } __attribute__((packed)); | 89 | } __packed; |
90 | 90 | ||
91 | struct bnep_set_filter_req { | 91 | struct bnep_set_filter_req { |
92 | __u8 type; | 92 | __u8 type; |
93 | __u8 ctrl; | 93 | __u8 ctrl; |
94 | __be16 len; | 94 | __be16 len; |
95 | __u8 list[0]; | 95 | __u8 list[0]; |
96 | } __attribute__((packed)); | 96 | } __packed; |
97 | 97 | ||
98 | struct bnep_control_rsp { | 98 | struct bnep_control_rsp { |
99 | __u8 type; | 99 | __u8 type; |
100 | __u8 ctrl; | 100 | __u8 ctrl; |
101 | __be16 resp; | 101 | __be16 resp; |
102 | } __attribute__((packed)); | 102 | } __packed; |
103 | 103 | ||
104 | struct bnep_ext_hdr { | 104 | struct bnep_ext_hdr { |
105 | __u8 type; | 105 | __u8 type; |
106 | __u8 len; | 106 | __u8 len; |
107 | __u8 data[0]; | 107 | __u8 data[0]; |
108 | } __attribute__((packed)); | 108 | } __packed; |
109 | 109 | ||
110 | /* BNEP ioctl defines */ | 110 | /* BNEP ioctl defines */ |
111 | #define BNEPCONNADD _IOW('B', 200, int) | 111 | #define BNEPCONNADD _IOW('B', 200, int) |
diff --git a/net/bridge/br.c b/net/bridge/br.c index 76357b547752..c8436fa31344 100644 --- a/net/bridge/br.c +++ b/net/bridge/br.c | |||
@@ -63,7 +63,6 @@ static int __init br_init(void) | |||
63 | goto err_out4; | 63 | goto err_out4; |
64 | 64 | ||
65 | brioctl_set(br_ioctl_deviceless_stub); | 65 | brioctl_set(br_ioctl_deviceless_stub); |
66 | br_handle_frame_hook = br_handle_frame; | ||
67 | 66 | ||
68 | #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) | 67 | #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) |
69 | br_fdb_test_addr_hook = br_fdb_test_addr; | 68 | br_fdb_test_addr_hook = br_fdb_test_addr; |
@@ -100,7 +99,6 @@ static void __exit br_deinit(void) | |||
100 | br_fdb_test_addr_hook = NULL; | 99 | br_fdb_test_addr_hook = NULL; |
101 | #endif | 100 | #endif |
102 | 101 | ||
103 | br_handle_frame_hook = NULL; | ||
104 | br_fdb_fini(); | 102 | br_fdb_fini(); |
105 | } | 103 | } |
106 | 104 | ||
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 18b245e2c00e..d9242342837e 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -147,6 +147,7 @@ static void del_nbp(struct net_bridge_port *p) | |||
147 | 147 | ||
148 | list_del_rcu(&p->list); | 148 | list_del_rcu(&p->list); |
149 | 149 | ||
150 | netdev_rx_handler_unregister(dev); | ||
150 | rcu_assign_pointer(dev->br_port, NULL); | 151 | rcu_assign_pointer(dev->br_port, NULL); |
151 | 152 | ||
152 | br_multicast_del_port(p); | 153 | br_multicast_del_port(p); |
@@ -429,6 +430,11 @@ int br_add_if(struct net_bridge *br, struct net_device *dev) | |||
429 | goto err2; | 430 | goto err2; |
430 | 431 | ||
431 | rcu_assign_pointer(dev->br_port, p); | 432 | rcu_assign_pointer(dev->br_port, p); |
433 | |||
434 | err = netdev_rx_handler_register(dev, br_handle_frame); | ||
435 | if (err) | ||
436 | goto err3; | ||
437 | |||
432 | dev_disable_lro(dev); | 438 | dev_disable_lro(dev); |
433 | 439 | ||
434 | list_add_rcu(&p->list, &br->port_list); | 440 | list_add_rcu(&p->list, &br->port_list); |
@@ -451,6 +457,8 @@ int br_add_if(struct net_bridge *br, struct net_device *dev) | |||
451 | br_netpoll_enable(br, dev); | 457 | br_netpoll_enable(br, dev); |
452 | 458 | ||
453 | return 0; | 459 | return 0; |
460 | err3: | ||
461 | rcu_assign_pointer(dev->br_port, NULL); | ||
454 | err2: | 462 | err2: |
455 | br_fdb_delete_by_port(br, p, 1); | 463 | br_fdb_delete_by_port(br, p, 1); |
456 | err1: | 464 | err1: |
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index d36e700f7a26..99647d8f95c8 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c | |||
@@ -131,15 +131,19 @@ static inline int is_link_local(const unsigned char *dest) | |||
131 | } | 131 | } |
132 | 132 | ||
133 | /* | 133 | /* |
134 | * Called via br_handle_frame_hook. | ||
135 | * Return NULL if skb is handled | 134 | * Return NULL if skb is handled |
136 | * note: already called with rcu_read_lock (preempt_disabled) | 135 | * note: already called with rcu_read_lock (preempt_disabled) from |
136 | * netif_receive_skb | ||
137 | */ | 137 | */ |
138 | struct sk_buff *br_handle_frame(struct net_bridge_port *p, struct sk_buff *skb) | 138 | struct sk_buff *br_handle_frame(struct sk_buff *skb) |
139 | { | 139 | { |
140 | struct net_bridge_port *p; | ||
140 | const unsigned char *dest = eth_hdr(skb)->h_dest; | 141 | const unsigned char *dest = eth_hdr(skb)->h_dest; |
141 | int (*rhook)(struct sk_buff *skb); | 142 | int (*rhook)(struct sk_buff *skb); |
142 | 143 | ||
144 | if (skb->pkt_type == PACKET_LOOPBACK) | ||
145 | return skb; | ||
146 | |||
143 | if (!is_valid_ether_addr(eth_hdr(skb)->h_source)) | 147 | if (!is_valid_ether_addr(eth_hdr(skb)->h_source)) |
144 | goto drop; | 148 | goto drop; |
145 | 149 | ||
@@ -147,6 +151,8 @@ struct sk_buff *br_handle_frame(struct net_bridge_port *p, struct sk_buff *skb) | |||
147 | if (!skb) | 151 | if (!skb) |
148 | return NULL; | 152 | return NULL; |
149 | 153 | ||
154 | p = rcu_dereference(skb->dev->br_port); | ||
155 | |||
150 | if (unlikely(is_link_local(dest))) { | 156 | if (unlikely(is_link_local(dest))) { |
151 | /* Pause frames shouldn't be passed up by driver anyway */ | 157 | /* Pause frames shouldn't be passed up by driver anyway */ |
152 | if (skb->protocol == htons(ETH_P_PAUSE)) | 158 | if (skb->protocol == htons(ETH_P_PAUSE)) |
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 0f4a74bc6a9b..c83519b555bb 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
@@ -331,8 +331,7 @@ extern void br_features_recompute(struct net_bridge *br); | |||
331 | 331 | ||
332 | /* br_input.c */ | 332 | /* br_input.c */ |
333 | extern int br_handle_frame_finish(struct sk_buff *skb); | 333 | extern int br_handle_frame_finish(struct sk_buff *skb); |
334 | extern struct sk_buff *br_handle_frame(struct net_bridge_port *p, | 334 | extern struct sk_buff *br_handle_frame(struct sk_buff *skb); |
335 | struct sk_buff *skb); | ||
336 | 335 | ||
337 | /* br_ioctl.c */ | 336 | /* br_ioctl.c */ |
338 | extern int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | 337 | extern int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); |
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c index 3d0e09584fae..791249316ef3 100644 --- a/net/caif/caif_socket.c +++ b/net/caif/caif_socket.c | |||
@@ -874,8 +874,7 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr, | |||
874 | sk_stream_kill_queues(&cf_sk->sk); | 874 | sk_stream_kill_queues(&cf_sk->sk); |
875 | 875 | ||
876 | err = -EINVAL; | 876 | err = -EINVAL; |
877 | if (addr_len != sizeof(struct sockaddr_caif) || | 877 | if (addr_len != sizeof(struct sockaddr_caif)) |
878 | !uaddr) | ||
879 | goto out; | 878 | goto out; |
880 | 879 | ||
881 | memcpy(&cf_sk->conn_req.sockaddr, uaddr, | 880 | memcpy(&cf_sk->conn_req.sockaddr, uaddr, |
diff --git a/net/caif/cfcnfg.c b/net/caif/cfcnfg.c index df43f264d9fb..7c81974a45c4 100644 --- a/net/caif/cfcnfg.c +++ b/net/caif/cfcnfg.c | |||
@@ -308,19 +308,15 @@ cfcnfg_linkup_rsp(struct cflayer *layer, u8 channel_id, enum cfctrl_srv serv, | |||
308 | caif_assert(cnfg != NULL); | 308 | caif_assert(cnfg != NULL); |
309 | caif_assert(phyid != 0); | 309 | caif_assert(phyid != 0); |
310 | phyinfo = &cnfg->phy_layers[phyid]; | 310 | phyinfo = &cnfg->phy_layers[phyid]; |
311 | caif_assert(phyinfo != NULL); | ||
312 | caif_assert(phyinfo->id == phyid); | 311 | caif_assert(phyinfo->id == phyid); |
313 | caif_assert(phyinfo->phy_layer != NULL); | 312 | caif_assert(phyinfo->phy_layer != NULL); |
314 | caif_assert(phyinfo->phy_layer->id == phyid); | 313 | caif_assert(phyinfo->phy_layer->id == phyid); |
315 | 314 | ||
316 | if (phyinfo != NULL && | 315 | phyinfo->phy_ref_count++; |
317 | phyinfo->phy_ref_count++ == 0 && | 316 | if (phyinfo->phy_ref_count == 1 && |
318 | phyinfo->phy_layer != NULL && | ||
319 | phyinfo->phy_layer->modemcmd != NULL) { | 317 | phyinfo->phy_layer->modemcmd != NULL) { |
320 | caif_assert(phyinfo->phy_layer->id == phyid); | ||
321 | phyinfo->phy_layer->modemcmd(phyinfo->phy_layer, | 318 | phyinfo->phy_layer->modemcmd(phyinfo->phy_layer, |
322 | _CAIF_MODEMCMD_PHYIF_USEFULL); | 319 | _CAIF_MODEMCMD_PHYIF_USEFULL); |
323 | |||
324 | } | 320 | } |
325 | adapt_layer->id = channel_id; | 321 | adapt_layer->id = channel_id; |
326 | 322 | ||
diff --git a/net/can/raw.c b/net/can/raw.c index da99cf153b33..ccfe633eec8e 100644 --- a/net/can/raw.c +++ b/net/can/raw.c | |||
@@ -436,14 +436,9 @@ static int raw_setsockopt(struct socket *sock, int level, int optname, | |||
436 | 436 | ||
437 | if (count > 1) { | 437 | if (count > 1) { |
438 | /* filter does not fit into dfilter => alloc space */ | 438 | /* filter does not fit into dfilter => alloc space */ |
439 | filter = kmalloc(optlen, GFP_KERNEL); | 439 | filter = memdup_user(optval, optlen); |
440 | if (!filter) | 440 | if (IS_ERR(filter)) |
441 | return -ENOMEM; | 441 | return PTR_ERR(filter); |
442 | |||
443 | if (copy_from_user(filter, optval, optlen)) { | ||
444 | kfree(filter); | ||
445 | return -EFAULT; | ||
446 | } | ||
447 | } else if (count == 1) { | 442 | } else if (count == 1) { |
448 | if (copy_from_user(&sfilter, optval, sizeof(sfilter))) | 443 | if (copy_from_user(&sfilter, optval, sizeof(sfilter))) |
449 | return -EFAULT; | 444 | return -EFAULT; |
diff --git a/net/compat.c b/net/compat.c index ec24d9edb025..63d260e81472 100644 --- a/net/compat.c +++ b/net/compat.c | |||
@@ -81,7 +81,7 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov, | |||
81 | int tot_len; | 81 | int tot_len; |
82 | 82 | ||
83 | if (kern_msg->msg_namelen) { | 83 | if (kern_msg->msg_namelen) { |
84 | if (mode==VERIFY_READ) { | 84 | if (mode == VERIFY_READ) { |
85 | int err = move_addr_to_kernel(kern_msg->msg_name, | 85 | int err = move_addr_to_kernel(kern_msg->msg_name, |
86 | kern_msg->msg_namelen, | 86 | kern_msg->msg_namelen, |
87 | kern_address); | 87 | kern_address); |
@@ -354,7 +354,7 @@ static int do_set_attach_filter(struct socket *sock, int level, int optname, | |||
354 | static int do_set_sock_timeout(struct socket *sock, int level, | 354 | static int do_set_sock_timeout(struct socket *sock, int level, |
355 | int optname, char __user *optval, unsigned int optlen) | 355 | int optname, char __user *optval, unsigned int optlen) |
356 | { | 356 | { |
357 | struct compat_timeval __user *up = (struct compat_timeval __user *) optval; | 357 | struct compat_timeval __user *up = (struct compat_timeval __user *)optval; |
358 | struct timeval ktime; | 358 | struct timeval ktime; |
359 | mm_segment_t old_fs; | 359 | mm_segment_t old_fs; |
360 | int err; | 360 | int err; |
@@ -367,7 +367,7 @@ static int do_set_sock_timeout(struct socket *sock, int level, | |||
367 | return -EFAULT; | 367 | return -EFAULT; |
368 | old_fs = get_fs(); | 368 | old_fs = get_fs(); |
369 | set_fs(KERNEL_DS); | 369 | set_fs(KERNEL_DS); |
370 | err = sock_setsockopt(sock, level, optname, (char *) &ktime, sizeof(ktime)); | 370 | err = sock_setsockopt(sock, level, optname, (char *)&ktime, sizeof(ktime)); |
371 | set_fs(old_fs); | 371 | set_fs(old_fs); |
372 | 372 | ||
373 | return err; | 373 | return err; |
@@ -389,11 +389,10 @@ asmlinkage long compat_sys_setsockopt(int fd, int level, int optname, | |||
389 | char __user *optval, unsigned int optlen) | 389 | char __user *optval, unsigned int optlen) |
390 | { | 390 | { |
391 | int err; | 391 | int err; |
392 | struct socket *sock; | 392 | struct socket *sock = sockfd_lookup(fd, &err); |
393 | 393 | ||
394 | if ((sock = sockfd_lookup(fd, &err))!=NULL) | 394 | if (sock) { |
395 | { | 395 | err = security_socket_setsockopt(sock, level, optname); |
396 | err = security_socket_setsockopt(sock,level,optname); | ||
397 | if (err) { | 396 | if (err) { |
398 | sockfd_put(sock); | 397 | sockfd_put(sock); |
399 | return err; | 398 | return err; |
@@ -453,7 +452,7 @@ static int compat_sock_getsockopt(struct socket *sock, int level, int optname, | |||
453 | int compat_sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp) | 452 | int compat_sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp) |
454 | { | 453 | { |
455 | struct compat_timeval __user *ctv = | 454 | struct compat_timeval __user *ctv = |
456 | (struct compat_timeval __user*) userstamp; | 455 | (struct compat_timeval __user *) userstamp; |
457 | int err = -ENOENT; | 456 | int err = -ENOENT; |
458 | struct timeval tv; | 457 | struct timeval tv; |
459 | 458 | ||
@@ -477,7 +476,7 @@ EXPORT_SYMBOL(compat_sock_get_timestamp); | |||
477 | int compat_sock_get_timestampns(struct sock *sk, struct timespec __user *userstamp) | 476 | int compat_sock_get_timestampns(struct sock *sk, struct timespec __user *userstamp) |
478 | { | 477 | { |
479 | struct compat_timespec __user *ctv = | 478 | struct compat_timespec __user *ctv = |
480 | (struct compat_timespec __user*) userstamp; | 479 | (struct compat_timespec __user *) userstamp; |
481 | int err = -ENOENT; | 480 | int err = -ENOENT; |
482 | struct timespec ts; | 481 | struct timespec ts; |
483 | 482 | ||
@@ -502,12 +501,10 @@ asmlinkage long compat_sys_getsockopt(int fd, int level, int optname, | |||
502 | char __user *optval, int __user *optlen) | 501 | char __user *optval, int __user *optlen) |
503 | { | 502 | { |
504 | int err; | 503 | int err; |
505 | struct socket *sock; | 504 | struct socket *sock = sockfd_lookup(fd, &err); |
506 | 505 | ||
507 | if ((sock = sockfd_lookup(fd, &err))!=NULL) | 506 | if (sock) { |
508 | { | 507 | err = security_socket_getsockopt(sock, level, optname); |
509 | err = security_socket_getsockopt(sock, level, | ||
510 | optname); | ||
511 | if (err) { | 508 | if (err) { |
512 | sockfd_put(sock); | 509 | sockfd_put(sock); |
513 | return err; | 510 | return err; |
@@ -531,7 +528,7 @@ struct compat_group_req { | |||
531 | __u32 gr_interface; | 528 | __u32 gr_interface; |
532 | struct __kernel_sockaddr_storage gr_group | 529 | struct __kernel_sockaddr_storage gr_group |
533 | __attribute__ ((aligned(4))); | 530 | __attribute__ ((aligned(4))); |
534 | } __attribute__ ((packed)); | 531 | } __packed; |
535 | 532 | ||
536 | struct compat_group_source_req { | 533 | struct compat_group_source_req { |
537 | __u32 gsr_interface; | 534 | __u32 gsr_interface; |
@@ -539,7 +536,7 @@ struct compat_group_source_req { | |||
539 | __attribute__ ((aligned(4))); | 536 | __attribute__ ((aligned(4))); |
540 | struct __kernel_sockaddr_storage gsr_source | 537 | struct __kernel_sockaddr_storage gsr_source |
541 | __attribute__ ((aligned(4))); | 538 | __attribute__ ((aligned(4))); |
542 | } __attribute__ ((packed)); | 539 | } __packed; |
543 | 540 | ||
544 | struct compat_group_filter { | 541 | struct compat_group_filter { |
545 | __u32 gf_interface; | 542 | __u32 gf_interface; |
@@ -549,7 +546,7 @@ struct compat_group_filter { | |||
549 | __u32 gf_numsrc; | 546 | __u32 gf_numsrc; |
550 | struct __kernel_sockaddr_storage gf_slist[1] | 547 | struct __kernel_sockaddr_storage gf_slist[1] |
551 | __attribute__ ((aligned(4))); | 548 | __attribute__ ((aligned(4))); |
552 | } __attribute__ ((packed)); | 549 | } __packed; |
553 | 550 | ||
554 | #define __COMPAT_GF0_SIZE (sizeof(struct compat_group_filter) - \ | 551 | #define __COMPAT_GF0_SIZE (sizeof(struct compat_group_filter) - \ |
555 | sizeof(struct __kernel_sockaddr_storage)) | 552 | sizeof(struct __kernel_sockaddr_storage)) |
@@ -557,7 +554,7 @@ struct compat_group_filter { | |||
557 | 554 | ||
558 | int compat_mc_setsockopt(struct sock *sock, int level, int optname, | 555 | int compat_mc_setsockopt(struct sock *sock, int level, int optname, |
559 | char __user *optval, unsigned int optlen, | 556 | char __user *optval, unsigned int optlen, |
560 | int (*setsockopt)(struct sock *,int,int,char __user *,unsigned int)) | 557 | int (*setsockopt)(struct sock *, int, int, char __user *, unsigned int)) |
561 | { | 558 | { |
562 | char __user *koptval = optval; | 559 | char __user *koptval = optval; |
563 | int koptlen = optlen; | 560 | int koptlen = optlen; |
@@ -640,12 +637,11 @@ int compat_mc_setsockopt(struct sock *sock, int level, int optname, | |||
640 | } | 637 | } |
641 | return setsockopt(sock, level, optname, koptval, koptlen); | 638 | return setsockopt(sock, level, optname, koptval, koptlen); |
642 | } | 639 | } |
643 | |||
644 | EXPORT_SYMBOL(compat_mc_setsockopt); | 640 | EXPORT_SYMBOL(compat_mc_setsockopt); |
645 | 641 | ||
646 | int compat_mc_getsockopt(struct sock *sock, int level, int optname, | 642 | int compat_mc_getsockopt(struct sock *sock, int level, int optname, |
647 | char __user *optval, int __user *optlen, | 643 | char __user *optval, int __user *optlen, |
648 | int (*getsockopt)(struct sock *,int,int,char __user *,int __user *)) | 644 | int (*getsockopt)(struct sock *, int, int, char __user *, int __user *)) |
649 | { | 645 | { |
650 | struct compat_group_filter __user *gf32 = (void *)optval; | 646 | struct compat_group_filter __user *gf32 = (void *)optval; |
651 | struct group_filter __user *kgf; | 647 | struct group_filter __user *kgf; |
@@ -681,7 +677,7 @@ int compat_mc_getsockopt(struct sock *sock, int level, int optname, | |||
681 | __put_user(interface, &kgf->gf_interface) || | 677 | __put_user(interface, &kgf->gf_interface) || |
682 | __put_user(fmode, &kgf->gf_fmode) || | 678 | __put_user(fmode, &kgf->gf_fmode) || |
683 | __put_user(numsrc, &kgf->gf_numsrc) || | 679 | __put_user(numsrc, &kgf->gf_numsrc) || |
684 | copy_in_user(&kgf->gf_group,&gf32->gf_group,sizeof(kgf->gf_group))) | 680 | copy_in_user(&kgf->gf_group, &gf32->gf_group, sizeof(kgf->gf_group))) |
685 | return -EFAULT; | 681 | return -EFAULT; |
686 | 682 | ||
687 | err = getsockopt(sock, level, optname, (char __user *)kgf, koptlen); | 683 | err = getsockopt(sock, level, optname, (char __user *)kgf, koptlen); |
@@ -714,21 +710,22 @@ int compat_mc_getsockopt(struct sock *sock, int level, int optname, | |||
714 | copylen = numsrc * sizeof(gf32->gf_slist[0]); | 710 | copylen = numsrc * sizeof(gf32->gf_slist[0]); |
715 | if (copylen > klen) | 711 | if (copylen > klen) |
716 | copylen = klen; | 712 | copylen = klen; |
717 | if (copy_in_user(gf32->gf_slist, kgf->gf_slist, copylen)) | 713 | if (copy_in_user(gf32->gf_slist, kgf->gf_slist, copylen)) |
718 | return -EFAULT; | 714 | return -EFAULT; |
719 | } | 715 | } |
720 | return err; | 716 | return err; |
721 | } | 717 | } |
722 | |||
723 | EXPORT_SYMBOL(compat_mc_getsockopt); | 718 | EXPORT_SYMBOL(compat_mc_getsockopt); |
724 | 719 | ||
725 | 720 | ||
726 | /* Argument list sizes for compat_sys_socketcall */ | 721 | /* Argument list sizes for compat_sys_socketcall */ |
727 | #define AL(x) ((x) * sizeof(u32)) | 722 | #define AL(x) ((x) * sizeof(u32)) |
728 | static unsigned char nas[20]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3), | 723 | static unsigned char nas[20] = { |
729 | AL(3),AL(3),AL(4),AL(4),AL(4),AL(6), | 724 | AL(0), AL(3), AL(3), AL(3), AL(2), AL(3), |
730 | AL(6),AL(2),AL(5),AL(5),AL(3),AL(3), | 725 | AL(3), AL(3), AL(4), AL(4), AL(4), AL(6), |
731 | AL(4),AL(5)}; | 726 | AL(6), AL(2), AL(5), AL(5), AL(3), AL(3), |
727 | AL(4), AL(5) | ||
728 | }; | ||
732 | #undef AL | 729 | #undef AL |
733 | 730 | ||
734 | asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, unsigned flags) | 731 | asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, unsigned flags) |
@@ -827,7 +824,7 @@ asmlinkage long compat_sys_socketcall(int call, u32 __user *args) | |||
827 | compat_ptr(a[4]), compat_ptr(a[5])); | 824 | compat_ptr(a[4]), compat_ptr(a[5])); |
828 | break; | 825 | break; |
829 | case SYS_SHUTDOWN: | 826 | case SYS_SHUTDOWN: |
830 | ret = sys_shutdown(a0,a1); | 827 | ret = sys_shutdown(a0, a1); |
831 | break; | 828 | break; |
832 | case SYS_SETSOCKOPT: | 829 | case SYS_SETSOCKOPT: |
833 | ret = compat_sys_setsockopt(a0, a1, a[2], | 830 | ret = compat_sys_setsockopt(a0, a1, a[2], |
diff --git a/net/core/dev.c b/net/core/dev.c index d03470f5260a..b65347c2cf2a 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1577,7 +1577,9 @@ EXPORT_SYMBOL(__netif_schedule); | |||
1577 | 1577 | ||
1578 | void dev_kfree_skb_irq(struct sk_buff *skb) | 1578 | void dev_kfree_skb_irq(struct sk_buff *skb) |
1579 | { | 1579 | { |
1580 | if (atomic_dec_and_test(&skb->users)) { | 1580 | if (!skb->destructor) |
1581 | dev_kfree_skb(skb); | ||
1582 | else if (atomic_dec_and_test(&skb->users)) { | ||
1581 | struct softnet_data *sd; | 1583 | struct softnet_data *sd; |
1582 | unsigned long flags; | 1584 | unsigned long flags; |
1583 | 1585 | ||
@@ -2038,14 +2040,24 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q, | |||
2038 | struct netdev_queue *txq) | 2040 | struct netdev_queue *txq) |
2039 | { | 2041 | { |
2040 | spinlock_t *root_lock = qdisc_lock(q); | 2042 | spinlock_t *root_lock = qdisc_lock(q); |
2043 | bool contended = qdisc_is_running(q); | ||
2041 | int rc; | 2044 | int rc; |
2042 | 2045 | ||
2046 | /* | ||
2047 | * Heuristic to force contended enqueues to serialize on a | ||
2048 | * separate lock before trying to get qdisc main lock. | ||
2049 | * This permits __QDISC_STATE_RUNNING owner to get the lock more often | ||
2050 | * and dequeue packets faster. | ||
2051 | */ | ||
2052 | if (unlikely(contended)) | ||
2053 | spin_lock(&q->busylock); | ||
2054 | |||
2043 | spin_lock(root_lock); | 2055 | spin_lock(root_lock); |
2044 | if (unlikely(test_bit(__QDISC_STATE_DEACTIVATED, &q->state))) { | 2056 | if (unlikely(test_bit(__QDISC_STATE_DEACTIVATED, &q->state))) { |
2045 | kfree_skb(skb); | 2057 | kfree_skb(skb); |
2046 | rc = NET_XMIT_DROP; | 2058 | rc = NET_XMIT_DROP; |
2047 | } else if ((q->flags & TCQ_F_CAN_BYPASS) && !qdisc_qlen(q) && | 2059 | } else if ((q->flags & TCQ_F_CAN_BYPASS) && !qdisc_qlen(q) && |
2048 | !test_and_set_bit(__QDISC_STATE_RUNNING, &q->state)) { | 2060 | qdisc_run_begin(q)) { |
2049 | /* | 2061 | /* |
2050 | * This is a work-conserving queue; there are no old skbs | 2062 | * This is a work-conserving queue; there are no old skbs |
2051 | * waiting to be sent out; and the qdisc is not running - | 2063 | * waiting to be sent out; and the qdisc is not running - |
@@ -2054,19 +2066,30 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q, | |||
2054 | if (!(dev->priv_flags & IFF_XMIT_DST_RELEASE)) | 2066 | if (!(dev->priv_flags & IFF_XMIT_DST_RELEASE)) |
2055 | skb_dst_force(skb); | 2067 | skb_dst_force(skb); |
2056 | __qdisc_update_bstats(q, skb->len); | 2068 | __qdisc_update_bstats(q, skb->len); |
2057 | if (sch_direct_xmit(skb, q, dev, txq, root_lock)) | 2069 | if (sch_direct_xmit(skb, q, dev, txq, root_lock)) { |
2070 | if (unlikely(contended)) { | ||
2071 | spin_unlock(&q->busylock); | ||
2072 | contended = false; | ||
2073 | } | ||
2058 | __qdisc_run(q); | 2074 | __qdisc_run(q); |
2059 | else | 2075 | } else |
2060 | clear_bit(__QDISC_STATE_RUNNING, &q->state); | 2076 | qdisc_run_end(q); |
2061 | 2077 | ||
2062 | rc = NET_XMIT_SUCCESS; | 2078 | rc = NET_XMIT_SUCCESS; |
2063 | } else { | 2079 | } else { |
2064 | skb_dst_force(skb); | 2080 | skb_dst_force(skb); |
2065 | rc = qdisc_enqueue_root(skb, q); | 2081 | rc = qdisc_enqueue_root(skb, q); |
2066 | qdisc_run(q); | 2082 | if (qdisc_run_begin(q)) { |
2083 | if (unlikely(contended)) { | ||
2084 | spin_unlock(&q->busylock); | ||
2085 | contended = false; | ||
2086 | } | ||
2087 | __qdisc_run(q); | ||
2088 | } | ||
2067 | } | 2089 | } |
2068 | spin_unlock(root_lock); | 2090 | spin_unlock(root_lock); |
2069 | 2091 | if (unlikely(contended)) | |
2092 | spin_unlock(&q->busylock); | ||
2070 | return rc; | 2093 | return rc; |
2071 | } | 2094 | } |
2072 | 2095 | ||
@@ -2080,9 +2103,10 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q, | |||
2080 | static inline int skb_needs_linearize(struct sk_buff *skb, | 2103 | static inline int skb_needs_linearize(struct sk_buff *skb, |
2081 | struct net_device *dev) | 2104 | struct net_device *dev) |
2082 | { | 2105 | { |
2083 | return (skb_has_frags(skb) && !(dev->features & NETIF_F_FRAGLIST)) || | 2106 | return skb_is_nonlinear(skb) && |
2084 | (skb_shinfo(skb)->nr_frags && (!(dev->features & NETIF_F_SG) || | 2107 | ((skb_has_frags(skb) && !(dev->features & NETIF_F_FRAGLIST)) || |
2085 | illegal_highdma(dev, skb))); | 2108 | (skb_shinfo(skb)->nr_frags && (!(dev->features & NETIF_F_SG) || |
2109 | illegal_highdma(dev, skb)))); | ||
2086 | } | 2110 | } |
2087 | 2111 | ||
2088 | /** | 2112 | /** |
@@ -2581,70 +2605,14 @@ static inline int deliver_skb(struct sk_buff *skb, | |||
2581 | return pt_prev->func(skb, skb->dev, pt_prev, orig_dev); | 2605 | return pt_prev->func(skb, skb->dev, pt_prev, orig_dev); |
2582 | } | 2606 | } |
2583 | 2607 | ||
2584 | #if defined(CONFIG_BRIDGE) || defined (CONFIG_BRIDGE_MODULE) | 2608 | #if (defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)) && \ |
2585 | 2609 | (defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)) | |
2586 | #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) | ||
2587 | /* This hook is defined here for ATM LANE */ | 2610 | /* This hook is defined here for ATM LANE */ |
2588 | int (*br_fdb_test_addr_hook)(struct net_device *dev, | 2611 | int (*br_fdb_test_addr_hook)(struct net_device *dev, |
2589 | unsigned char *addr) __read_mostly; | 2612 | unsigned char *addr) __read_mostly; |
2590 | EXPORT_SYMBOL_GPL(br_fdb_test_addr_hook); | 2613 | EXPORT_SYMBOL_GPL(br_fdb_test_addr_hook); |
2591 | #endif | 2614 | #endif |
2592 | 2615 | ||
2593 | /* | ||
2594 | * If bridge module is loaded call bridging hook. | ||
2595 | * returns NULL if packet was consumed. | ||
2596 | */ | ||
2597 | struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p, | ||
2598 | struct sk_buff *skb) __read_mostly; | ||
2599 | EXPORT_SYMBOL_GPL(br_handle_frame_hook); | ||
2600 | |||
2601 | static inline struct sk_buff *handle_bridge(struct sk_buff *skb, | ||
2602 | struct packet_type **pt_prev, int *ret, | ||
2603 | struct net_device *orig_dev) | ||
2604 | { | ||
2605 | struct net_bridge_port *port; | ||
2606 | |||
2607 | if (skb->pkt_type == PACKET_LOOPBACK || | ||
2608 | (port = rcu_dereference(skb->dev->br_port)) == NULL) | ||
2609 | return skb; | ||
2610 | |||
2611 | if (*pt_prev) { | ||
2612 | *ret = deliver_skb(skb, *pt_prev, orig_dev); | ||
2613 | *pt_prev = NULL; | ||
2614 | } | ||
2615 | |||
2616 | return br_handle_frame_hook(port, skb); | ||
2617 | } | ||
2618 | #else | ||
2619 | #define handle_bridge(skb, pt_prev, ret, orig_dev) (skb) | ||
2620 | #endif | ||
2621 | |||
2622 | #if defined(CONFIG_MACVLAN) || defined(CONFIG_MACVLAN_MODULE) | ||
2623 | struct sk_buff *(*macvlan_handle_frame_hook)(struct macvlan_port *p, | ||
2624 | struct sk_buff *skb) __read_mostly; | ||
2625 | EXPORT_SYMBOL_GPL(macvlan_handle_frame_hook); | ||
2626 | |||
2627 | static inline struct sk_buff *handle_macvlan(struct sk_buff *skb, | ||
2628 | struct packet_type **pt_prev, | ||
2629 | int *ret, | ||
2630 | struct net_device *orig_dev) | ||
2631 | { | ||
2632 | struct macvlan_port *port; | ||
2633 | |||
2634 | port = rcu_dereference(skb->dev->macvlan_port); | ||
2635 | if (!port) | ||
2636 | return skb; | ||
2637 | |||
2638 | if (*pt_prev) { | ||
2639 | *ret = deliver_skb(skb, *pt_prev, orig_dev); | ||
2640 | *pt_prev = NULL; | ||
2641 | } | ||
2642 | return macvlan_handle_frame_hook(port, skb); | ||
2643 | } | ||
2644 | #else | ||
2645 | #define handle_macvlan(skb, pt_prev, ret, orig_dev) (skb) | ||
2646 | #endif | ||
2647 | |||
2648 | #ifdef CONFIG_NET_CLS_ACT | 2616 | #ifdef CONFIG_NET_CLS_ACT |
2649 | /* TODO: Maybe we should just force sch_ingress to be compiled in | 2617 | /* TODO: Maybe we should just force sch_ingress to be compiled in |
2650 | * when CONFIG_NET_CLS_ACT is? otherwise some useless instructions | 2618 | * when CONFIG_NET_CLS_ACT is? otherwise some useless instructions |
@@ -2740,6 +2708,47 @@ void netif_nit_deliver(struct sk_buff *skb) | |||
2740 | rcu_read_unlock(); | 2708 | rcu_read_unlock(); |
2741 | } | 2709 | } |
2742 | 2710 | ||
2711 | /** | ||
2712 | * netdev_rx_handler_register - register receive handler | ||
2713 | * @dev: device to register a handler for | ||
2714 | * @rx_handler: receive handler to register | ||
2715 | * | ||
2716 | * Register a receive hander for a device. This handler will then be | ||
2717 | * called from __netif_receive_skb. A negative errno code is returned | ||
2718 | * on a failure. | ||
2719 | * | ||
2720 | * The caller must hold the rtnl_mutex. | ||
2721 | */ | ||
2722 | int netdev_rx_handler_register(struct net_device *dev, | ||
2723 | rx_handler_func_t *rx_handler) | ||
2724 | { | ||
2725 | ASSERT_RTNL(); | ||
2726 | |||
2727 | if (dev->rx_handler) | ||
2728 | return -EBUSY; | ||
2729 | |||
2730 | rcu_assign_pointer(dev->rx_handler, rx_handler); | ||
2731 | |||
2732 | return 0; | ||
2733 | } | ||
2734 | EXPORT_SYMBOL_GPL(netdev_rx_handler_register); | ||
2735 | |||
2736 | /** | ||
2737 | * netdev_rx_handler_unregister - unregister receive handler | ||
2738 | * @dev: device to unregister a handler from | ||
2739 | * | ||
2740 | * Unregister a receive hander from a device. | ||
2741 | * | ||
2742 | * The caller must hold the rtnl_mutex. | ||
2743 | */ | ||
2744 | void netdev_rx_handler_unregister(struct net_device *dev) | ||
2745 | { | ||
2746 | |||
2747 | ASSERT_RTNL(); | ||
2748 | rcu_assign_pointer(dev->rx_handler, NULL); | ||
2749 | } | ||
2750 | EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister); | ||
2751 | |||
2743 | static inline void skb_bond_set_mac_by_master(struct sk_buff *skb, | 2752 | static inline void skb_bond_set_mac_by_master(struct sk_buff *skb, |
2744 | struct net_device *master) | 2753 | struct net_device *master) |
2745 | { | 2754 | { |
@@ -2792,6 +2801,7 @@ EXPORT_SYMBOL(__skb_bond_should_drop); | |||
2792 | static int __netif_receive_skb(struct sk_buff *skb) | 2801 | static int __netif_receive_skb(struct sk_buff *skb) |
2793 | { | 2802 | { |
2794 | struct packet_type *ptype, *pt_prev; | 2803 | struct packet_type *ptype, *pt_prev; |
2804 | rx_handler_func_t *rx_handler; | ||
2795 | struct net_device *orig_dev; | 2805 | struct net_device *orig_dev; |
2796 | struct net_device *master; | 2806 | struct net_device *master; |
2797 | struct net_device *null_or_orig; | 2807 | struct net_device *null_or_orig; |
@@ -2822,8 +2832,7 @@ static int __netif_receive_skb(struct sk_buff *skb) | |||
2822 | skb->dev = master; | 2832 | skb->dev = master; |
2823 | } | 2833 | } |
2824 | 2834 | ||
2825 | __get_cpu_var(softnet_data).processed++; | 2835 | __this_cpu_inc(softnet_data.processed); |
2826 | |||
2827 | skb_reset_network_header(skb); | 2836 | skb_reset_network_header(skb); |
2828 | skb_reset_transport_header(skb); | 2837 | skb_reset_transport_header(skb); |
2829 | skb->mac_len = skb->network_header - skb->mac_header; | 2838 | skb->mac_len = skb->network_header - skb->mac_header; |
@@ -2855,12 +2864,17 @@ static int __netif_receive_skb(struct sk_buff *skb) | |||
2855 | ncls: | 2864 | ncls: |
2856 | #endif | 2865 | #endif |
2857 | 2866 | ||
2858 | skb = handle_bridge(skb, &pt_prev, &ret, orig_dev); | 2867 | /* Handle special case of bridge or macvlan */ |
2859 | if (!skb) | 2868 | rx_handler = rcu_dereference(skb->dev->rx_handler); |
2860 | goto out; | 2869 | if (rx_handler) { |
2861 | skb = handle_macvlan(skb, &pt_prev, &ret, orig_dev); | 2870 | if (pt_prev) { |
2862 | if (!skb) | 2871 | ret = deliver_skb(skb, pt_prev, orig_dev); |
2863 | goto out; | 2872 | pt_prev = NULL; |
2873 | } | ||
2874 | skb = rx_handler(skb); | ||
2875 | if (!skb) | ||
2876 | goto out; | ||
2877 | } | ||
2864 | 2878 | ||
2865 | /* | 2879 | /* |
2866 | * Make sure frames received on VLAN interfaces stacked on | 2880 | * Make sure frames received on VLAN interfaces stacked on |
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 94825b109551..e034342c819c 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -49,7 +49,6 @@ static atomic_t trapped; | |||
49 | (MAX_UDP_CHUNK + sizeof(struct udphdr) + \ | 49 | (MAX_UDP_CHUNK + sizeof(struct udphdr) + \ |
50 | sizeof(struct iphdr) + sizeof(struct ethhdr)) | 50 | sizeof(struct iphdr) + sizeof(struct ethhdr)) |
51 | 51 | ||
52 | static void zap_completion_queue(void); | ||
53 | static void arp_reply(struct sk_buff *skb); | 52 | static void arp_reply(struct sk_buff *skb); |
54 | 53 | ||
55 | static unsigned int carrier_timeout = 4; | 54 | static unsigned int carrier_timeout = 4; |
@@ -197,7 +196,6 @@ void netpoll_poll_dev(struct net_device *dev) | |||
197 | 196 | ||
198 | service_arp_queue(dev->npinfo); | 197 | service_arp_queue(dev->npinfo); |
199 | 198 | ||
200 | zap_completion_queue(); | ||
201 | } | 199 | } |
202 | 200 | ||
203 | void netpoll_poll(struct netpoll *np) | 201 | void netpoll_poll(struct netpoll *np) |
@@ -221,40 +219,11 @@ static void refill_skbs(void) | |||
221 | spin_unlock_irqrestore(&skb_pool.lock, flags); | 219 | spin_unlock_irqrestore(&skb_pool.lock, flags); |
222 | } | 220 | } |
223 | 221 | ||
224 | static void zap_completion_queue(void) | ||
225 | { | ||
226 | unsigned long flags; | ||
227 | struct softnet_data *sd = &get_cpu_var(softnet_data); | ||
228 | |||
229 | if (sd->completion_queue) { | ||
230 | struct sk_buff *clist; | ||
231 | |||
232 | local_irq_save(flags); | ||
233 | clist = sd->completion_queue; | ||
234 | sd->completion_queue = NULL; | ||
235 | local_irq_restore(flags); | ||
236 | |||
237 | while (clist != NULL) { | ||
238 | struct sk_buff *skb = clist; | ||
239 | clist = clist->next; | ||
240 | if (skb->destructor) { | ||
241 | atomic_inc(&skb->users); | ||
242 | dev_kfree_skb_any(skb); /* put this one back */ | ||
243 | } else { | ||
244 | __kfree_skb(skb); | ||
245 | } | ||
246 | } | ||
247 | } | ||
248 | |||
249 | put_cpu_var(softnet_data); | ||
250 | } | ||
251 | |||
252 | static struct sk_buff *find_skb(struct netpoll *np, int len, int reserve) | 222 | static struct sk_buff *find_skb(struct netpoll *np, int len, int reserve) |
253 | { | 223 | { |
254 | int count = 0; | 224 | int count = 0; |
255 | struct sk_buff *skb; | 225 | struct sk_buff *skb; |
256 | 226 | ||
257 | zap_completion_queue(); | ||
258 | refill_skbs(); | 227 | refill_skbs(); |
259 | repeat: | 228 | repeat: |
260 | 229 | ||
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 091698899594..6e3f32575df7 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -248,7 +248,7 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req, | |||
248 | struct ipv6_pinfo *np = inet6_sk(sk); | 248 | struct ipv6_pinfo *np = inet6_sk(sk); |
249 | struct sk_buff *skb; | 249 | struct sk_buff *skb; |
250 | struct ipv6_txoptions *opt = NULL; | 250 | struct ipv6_txoptions *opt = NULL; |
251 | struct in6_addr *final_p = NULL, final; | 251 | struct in6_addr *final_p, final; |
252 | struct flowi fl; | 252 | struct flowi fl; |
253 | int err = -1; | 253 | int err = -1; |
254 | struct dst_entry *dst; | 254 | struct dst_entry *dst; |
@@ -265,13 +265,7 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req, | |||
265 | 265 | ||
266 | opt = np->opt; | 266 | opt = np->opt; |
267 | 267 | ||
268 | if (opt != NULL && opt->srcrt != NULL) { | 268 | final_p = fl6_update_dst(&fl, opt, &final); |
269 | const struct rt0_hdr *rt0 = (struct rt0_hdr *)opt->srcrt; | ||
270 | |||
271 | ipv6_addr_copy(&final, &fl.fl6_dst); | ||
272 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | ||
273 | final_p = &final; | ||
274 | } | ||
275 | 269 | ||
276 | err = ip6_dst_lookup(sk, &dst, &fl); | 270 | err = ip6_dst_lookup(sk, &dst, &fl); |
277 | if (err) | 271 | if (err) |
@@ -545,19 +539,13 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, | |||
545 | goto out_overflow; | 539 | goto out_overflow; |
546 | 540 | ||
547 | if (dst == NULL) { | 541 | if (dst == NULL) { |
548 | struct in6_addr *final_p = NULL, final; | 542 | struct in6_addr *final_p, final; |
549 | struct flowi fl; | 543 | struct flowi fl; |
550 | 544 | ||
551 | memset(&fl, 0, sizeof(fl)); | 545 | memset(&fl, 0, sizeof(fl)); |
552 | fl.proto = IPPROTO_DCCP; | 546 | fl.proto = IPPROTO_DCCP; |
553 | ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr); | 547 | ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr); |
554 | if (opt != NULL && opt->srcrt != NULL) { | 548 | final_p = fl6_update_dst(&fl, opt, &final); |
555 | const struct rt0_hdr *rt0 = (struct rt0_hdr *)opt->srcrt; | ||
556 | |||
557 | ipv6_addr_copy(&final, &fl.fl6_dst); | ||
558 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | ||
559 | final_p = &final; | ||
560 | } | ||
561 | ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr); | 549 | ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr); |
562 | fl.oif = sk->sk_bound_dev_if; | 550 | fl.oif = sk->sk_bound_dev_if; |
563 | fl.fl_ip_dport = inet_rsk(req)->rmt_port; | 551 | fl.fl_ip_dport = inet_rsk(req)->rmt_port; |
@@ -885,7 +873,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
885 | struct inet_sock *inet = inet_sk(sk); | 873 | struct inet_sock *inet = inet_sk(sk); |
886 | struct ipv6_pinfo *np = inet6_sk(sk); | 874 | struct ipv6_pinfo *np = inet6_sk(sk); |
887 | struct dccp_sock *dp = dccp_sk(sk); | 875 | struct dccp_sock *dp = dccp_sk(sk); |
888 | struct in6_addr *saddr = NULL, *final_p = NULL, final; | 876 | struct in6_addr *saddr = NULL, *final_p, final; |
889 | struct flowi fl; | 877 | struct flowi fl; |
890 | struct dst_entry *dst; | 878 | struct dst_entry *dst; |
891 | int addr_type; | 879 | int addr_type; |
@@ -988,13 +976,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
988 | fl.fl_ip_sport = inet->inet_sport; | 976 | fl.fl_ip_sport = inet->inet_sport; |
989 | security_sk_classify_flow(sk, &fl); | 977 | security_sk_classify_flow(sk, &fl); |
990 | 978 | ||
991 | if (np->opt != NULL && np->opt->srcrt != NULL) { | 979 | final_p = fl6_update_dst(&fl, np->opt, &final); |
992 | const struct rt0_hdr *rt0 = (struct rt0_hdr *)np->opt->srcrt; | ||
993 | |||
994 | ipv6_addr_copy(&final, &fl.fl6_dst); | ||
995 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | ||
996 | final_p = &final; | ||
997 | } | ||
998 | 980 | ||
999 | err = ip6_dst_lookup(sk, &dst, &fl); | 981 | err = ip6_dst_lookup(sk, &dst, &fl); |
1000 | if (err) | 982 | if (err) |
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index b03ecf6b2bb0..f79bcef5088f 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -473,14 +473,9 @@ static int dccp_setsockopt_ccid(struct sock *sk, int type, | |||
473 | if (optlen < 1 || optlen > DCCP_FEAT_MAX_SP_VALS) | 473 | if (optlen < 1 || optlen > DCCP_FEAT_MAX_SP_VALS) |
474 | return -EINVAL; | 474 | return -EINVAL; |
475 | 475 | ||
476 | val = kmalloc(optlen, GFP_KERNEL); | 476 | val = memdup_user(optval, optlen); |
477 | if (val == NULL) | 477 | if (IS_ERR(val)) |
478 | return -ENOMEM; | 478 | return PTR_ERR(val); |
479 | |||
480 | if (copy_from_user(val, optval, optlen)) { | ||
481 | kfree(val); | ||
482 | return -EFAULT; | ||
483 | } | ||
484 | 479 | ||
485 | lock_sock(sk); | 480 | lock_sock(sk); |
486 | if (type == DCCP_SOCKOPT_TX_CCID || type == DCCP_SOCKOPT_CCID) | 481 | if (type == DCCP_SOCKOPT_TX_CCID || type == DCCP_SOCKOPT_CCID) |
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index f094b75810db..917d2d66162e 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -545,10 +545,10 @@ static inline int arp_fwd_proxy(struct in_device *in_dev, | |||
545 | 545 | ||
546 | /* place to check for proxy_arp for routes */ | 546 | /* place to check for proxy_arp for routes */ |
547 | 547 | ||
548 | if ((out_dev = in_dev_get(rt->u.dst.dev)) != NULL) { | 548 | out_dev = __in_dev_get_rcu(rt->u.dst.dev); |
549 | if (out_dev) | ||
549 | omi = IN_DEV_MEDIUM_ID(out_dev); | 550 | omi = IN_DEV_MEDIUM_ID(out_dev); |
550 | in_dev_put(out_dev); | 551 | |
551 | } | ||
552 | return (omi != imi && omi != -1); | 552 | return (omi != imi && omi != -1); |
553 | } | 553 | } |
554 | 554 | ||
@@ -741,7 +741,7 @@ void arp_send(int type, int ptype, __be32 dest_ip, | |||
741 | static int arp_process(struct sk_buff *skb) | 741 | static int arp_process(struct sk_buff *skb) |
742 | { | 742 | { |
743 | struct net_device *dev = skb->dev; | 743 | struct net_device *dev = skb->dev; |
744 | struct in_device *in_dev = in_dev_get(dev); | 744 | struct in_device *in_dev = __in_dev_get_rcu(dev); |
745 | struct arphdr *arp; | 745 | struct arphdr *arp; |
746 | unsigned char *arp_ptr; | 746 | unsigned char *arp_ptr; |
747 | struct rtable *rt; | 747 | struct rtable *rt; |
@@ -890,7 +890,6 @@ static int arp_process(struct sk_buff *skb) | |||
890 | arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); | 890 | arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); |
891 | } else { | 891 | } else { |
892 | pneigh_enqueue(&arp_tbl, in_dev->arp_parms, skb); | 892 | pneigh_enqueue(&arp_tbl, in_dev->arp_parms, skb); |
893 | in_dev_put(in_dev); | ||
894 | return 0; | 893 | return 0; |
895 | } | 894 | } |
896 | goto out; | 895 | goto out; |
@@ -936,8 +935,6 @@ static int arp_process(struct sk_buff *skb) | |||
936 | } | 935 | } |
937 | 936 | ||
938 | out: | 937 | out: |
939 | if (in_dev) | ||
940 | in_dev_put(in_dev); | ||
941 | consume_skb(skb); | 938 | consume_skb(skb); |
942 | return 0; | 939 | return 0; |
943 | } | 940 | } |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 382bc768ed56..da14c49284f4 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1081,6 +1081,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, | |||
1081 | } | 1081 | } |
1082 | ip_mc_up(in_dev); | 1082 | ip_mc_up(in_dev); |
1083 | /* fall through */ | 1083 | /* fall through */ |
1084 | case NETDEV_NOTIFY_PEERS: | ||
1084 | case NETDEV_CHANGEADDR: | 1085 | case NETDEV_CHANGEADDR: |
1085 | /* Send gratuitous ARP to notify of link change */ | 1086 | /* Send gratuitous ARP to notify of link change */ |
1086 | if (IN_DEV_ARP_NOTIFY(in_dev)) { | 1087 | if (IN_DEV_ARP_NOTIFY(in_dev)) { |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 4f0ed458c883..e830f7a123bd 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -284,7 +284,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, | |||
284 | if (no_addr) | 284 | if (no_addr) |
285 | goto last_resort; | 285 | goto last_resort; |
286 | if (rpf == 1) | 286 | if (rpf == 1) |
287 | goto e_inval; | 287 | goto e_rpf; |
288 | fl.oif = dev->ifindex; | 288 | fl.oif = dev->ifindex; |
289 | 289 | ||
290 | ret = 0; | 290 | ret = 0; |
@@ -299,7 +299,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, | |||
299 | 299 | ||
300 | last_resort: | 300 | last_resort: |
301 | if (rpf) | 301 | if (rpf) |
302 | goto e_inval; | 302 | goto e_rpf; |
303 | *spec_dst = inet_select_addr(dev, 0, RT_SCOPE_UNIVERSE); | 303 | *spec_dst = inet_select_addr(dev, 0, RT_SCOPE_UNIVERSE); |
304 | *itag = 0; | 304 | *itag = 0; |
305 | return 0; | 305 | return 0; |
@@ -308,6 +308,8 @@ e_inval_res: | |||
308 | fib_res_put(&res); | 308 | fib_res_put(&res); |
309 | e_inval: | 309 | e_inval: |
310 | return -EINVAL; | 310 | return -EINVAL; |
311 | e_rpf: | ||
312 | return -EXDEV; | ||
311 | } | 313 | } |
312 | 314 | ||
313 | static inline __be32 sk_extract_addr(struct sockaddr *addr) | 315 | static inline __be32 sk_extract_addr(struct sockaddr *addr) |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 5fff865a4fa7..250cb5e1af48 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -1646,8 +1646,7 @@ static int sf_setstate(struct ip_mc_list *pmc) | |||
1646 | if (dpsf->sf_inaddr == psf->sf_inaddr) | 1646 | if (dpsf->sf_inaddr == psf->sf_inaddr) |
1647 | break; | 1647 | break; |
1648 | if (!dpsf) { | 1648 | if (!dpsf) { |
1649 | dpsf = (struct ip_sf_list *) | 1649 | dpsf = kmalloc(sizeof(*dpsf), GFP_ATOMIC); |
1650 | kmalloc(sizeof(*dpsf), GFP_ATOMIC); | ||
1651 | if (!dpsf) | 1650 | if (!dpsf) |
1652 | continue; | 1651 | continue; |
1653 | *dpsf = *psf; | 1652 | *dpsf = *psf; |
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index d930dc5e4d85..d52c9da644cf 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c | |||
@@ -340,6 +340,9 @@ static int ip_rcv_finish(struct sk_buff *skb) | |||
340 | else if (err == -ENETUNREACH) | 340 | else if (err == -ENETUNREACH) |
341 | IP_INC_STATS_BH(dev_net(skb->dev), | 341 | IP_INC_STATS_BH(dev_net(skb->dev), |
342 | IPSTATS_MIB_INNOROUTES); | 342 | IPSTATS_MIB_INNOROUTES); |
343 | else if (err == -EXDEV) | ||
344 | NET_INC_STATS_BH(dev_net(skb->dev), | ||
345 | LINUX_MIB_IPRPFILTER); | ||
343 | goto drop; | 346 | goto drop; |
344 | } | 347 | } |
345 | } | 348 | } |
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index b9d84e800cf4..3a6e1ec5e9ae 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c | |||
@@ -665,6 +665,13 @@ ic_dhcp_init_options(u8 *options) | |||
665 | memcpy(e, ic_req_params, sizeof(ic_req_params)); | 665 | memcpy(e, ic_req_params, sizeof(ic_req_params)); |
666 | e += sizeof(ic_req_params); | 666 | e += sizeof(ic_req_params); |
667 | 667 | ||
668 | if (ic_host_name_set) { | ||
669 | *e++ = 12; /* host-name */ | ||
670 | len = strlen(utsname()->nodename); | ||
671 | *e++ = len; | ||
672 | memcpy(e, utsname()->nodename, len); | ||
673 | e += len; | ||
674 | } | ||
668 | if (*vendor_class_identifier) { | 675 | if (*vendor_class_identifier) { |
669 | printk(KERN_INFO "DHCP: sending class identifier \"%s\"\n", | 676 | printk(KERN_INFO "DHCP: sending class identifier \"%s\"\n", |
670 | vendor_class_identifier); | 677 | vendor_class_identifier); |
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index 3dc9914c1dce..e320ca6b3ef3 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
@@ -252,6 +252,7 @@ static const struct snmp_mib snmp4_net_list[] = { | |||
252 | SNMP_MIB_ITEM("TCPBacklogDrop", LINUX_MIB_TCPBACKLOGDROP), | 252 | SNMP_MIB_ITEM("TCPBacklogDrop", LINUX_MIB_TCPBACKLOGDROP), |
253 | SNMP_MIB_ITEM("TCPMinTTLDrop", LINUX_MIB_TCPMINTTLDROP), | 253 | SNMP_MIB_ITEM("TCPMinTTLDrop", LINUX_MIB_TCPMINTTLDROP), |
254 | SNMP_MIB_ITEM("TCPDeferAcceptDrop", LINUX_MIB_TCPDEFERACCEPTDROP), | 254 | SNMP_MIB_ITEM("TCPDeferAcceptDrop", LINUX_MIB_TCPDEFERACCEPTDROP), |
255 | SNMP_MIB_ITEM("IPReversePathFilter", LINUX_MIB_IPRPFILTER), | ||
255 | SNMP_MIB_SENTINEL | 256 | SNMP_MIB_SENTINEL |
256 | }; | 257 | }; |
257 | 258 | ||
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 560acc677ce4..7b8eacd5ac26 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -253,8 +253,7 @@ static unsigned rt_hash_mask __read_mostly; | |||
253 | static unsigned int rt_hash_log __read_mostly; | 253 | static unsigned int rt_hash_log __read_mostly; |
254 | 254 | ||
255 | static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat); | 255 | static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat); |
256 | #define RT_CACHE_STAT_INC(field) \ | 256 | #define RT_CACHE_STAT_INC(field) __this_cpu_inc(rt_cache_stat.field) |
257 | (__raw_get_cpu_var(rt_cache_stat).field++) | ||
258 | 257 | ||
259 | static inline unsigned int rt_hash(__be32 daddr, __be32 saddr, int idx, | 258 | static inline unsigned int rt_hash(__be32 daddr, __be32 saddr, int idx, |
260 | int genid) | 259 | int genid) |
@@ -1844,14 +1843,16 @@ static void rt_set_nexthop(struct rtable *rt, struct fib_result *res, u32 itag) | |||
1844 | rt->rt_type = res->type; | 1843 | rt->rt_type = res->type; |
1845 | } | 1844 | } |
1846 | 1845 | ||
1846 | /* called in rcu_read_lock() section */ | ||
1847 | static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, | 1847 | static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, |
1848 | u8 tos, struct net_device *dev, int our) | 1848 | u8 tos, struct net_device *dev, int our) |
1849 | { | 1849 | { |
1850 | unsigned hash; | 1850 | unsigned int hash; |
1851 | struct rtable *rth; | 1851 | struct rtable *rth; |
1852 | __be32 spec_dst; | 1852 | __be32 spec_dst; |
1853 | struct in_device *in_dev = in_dev_get(dev); | 1853 | struct in_device *in_dev = __in_dev_get_rcu(dev); |
1854 | u32 itag = 0; | 1854 | u32 itag = 0; |
1855 | int err; | ||
1855 | 1856 | ||
1856 | /* Primary sanity checks. */ | 1857 | /* Primary sanity checks. */ |
1857 | 1858 | ||
@@ -1866,10 +1867,12 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
1866 | if (!ipv4_is_local_multicast(daddr)) | 1867 | if (!ipv4_is_local_multicast(daddr)) |
1867 | goto e_inval; | 1868 | goto e_inval; |
1868 | spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK); | 1869 | spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK); |
1869 | } else if (fib_validate_source(saddr, 0, tos, 0, | 1870 | } else { |
1870 | dev, &spec_dst, &itag, 0) < 0) | 1871 | err = fib_validate_source(saddr, 0, tos, 0, dev, &spec_dst, |
1871 | goto e_inval; | 1872 | &itag, 0); |
1872 | 1873 | if (err < 0) | |
1874 | goto e_err; | ||
1875 | } | ||
1873 | rth = dst_alloc(&ipv4_dst_ops); | 1876 | rth = dst_alloc(&ipv4_dst_ops); |
1874 | if (!rth) | 1877 | if (!rth) |
1875 | goto e_nobufs; | 1878 | goto e_nobufs; |
@@ -1912,17 +1915,15 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
1912 | #endif | 1915 | #endif |
1913 | RT_CACHE_STAT_INC(in_slow_mc); | 1916 | RT_CACHE_STAT_INC(in_slow_mc); |
1914 | 1917 | ||
1915 | in_dev_put(in_dev); | ||
1916 | hash = rt_hash(daddr, saddr, dev->ifindex, rt_genid(dev_net(dev))); | 1918 | hash = rt_hash(daddr, saddr, dev->ifindex, rt_genid(dev_net(dev))); |
1917 | return rt_intern_hash(hash, rth, NULL, skb, dev->ifindex); | 1919 | return rt_intern_hash(hash, rth, NULL, skb, dev->ifindex); |
1918 | 1920 | ||
1919 | e_nobufs: | 1921 | e_nobufs: |
1920 | in_dev_put(in_dev); | ||
1921 | return -ENOBUFS; | 1922 | return -ENOBUFS; |
1922 | |||
1923 | e_inval: | 1923 | e_inval: |
1924 | in_dev_put(in_dev); | ||
1925 | return -EINVAL; | 1924 | return -EINVAL; |
1925 | e_err: | ||
1926 | return err; | ||
1926 | } | 1927 | } |
1927 | 1928 | ||
1928 | 1929 | ||
@@ -1956,22 +1957,22 @@ static void ip_handle_martian_source(struct net_device *dev, | |||
1956 | #endif | 1957 | #endif |
1957 | } | 1958 | } |
1958 | 1959 | ||
1960 | /* called in rcu_read_lock() section */ | ||
1959 | static int __mkroute_input(struct sk_buff *skb, | 1961 | static int __mkroute_input(struct sk_buff *skb, |
1960 | struct fib_result *res, | 1962 | struct fib_result *res, |
1961 | struct in_device *in_dev, | 1963 | struct in_device *in_dev, |
1962 | __be32 daddr, __be32 saddr, u32 tos, | 1964 | __be32 daddr, __be32 saddr, u32 tos, |
1963 | struct rtable **result) | 1965 | struct rtable **result) |
1964 | { | 1966 | { |
1965 | |||
1966 | struct rtable *rth; | 1967 | struct rtable *rth; |
1967 | int err; | 1968 | int err; |
1968 | struct in_device *out_dev; | 1969 | struct in_device *out_dev; |
1969 | unsigned flags = 0; | 1970 | unsigned int flags = 0; |
1970 | __be32 spec_dst; | 1971 | __be32 spec_dst; |
1971 | u32 itag; | 1972 | u32 itag; |
1972 | 1973 | ||
1973 | /* get a working reference to the output device */ | 1974 | /* get a working reference to the output device */ |
1974 | out_dev = in_dev_get(FIB_RES_DEV(*res)); | 1975 | out_dev = __in_dev_get_rcu(FIB_RES_DEV(*res)); |
1975 | if (out_dev == NULL) { | 1976 | if (out_dev == NULL) { |
1976 | if (net_ratelimit()) | 1977 | if (net_ratelimit()) |
1977 | printk(KERN_CRIT "Bug in ip_route_input" \ | 1978 | printk(KERN_CRIT "Bug in ip_route_input" \ |
@@ -1986,7 +1987,6 @@ static int __mkroute_input(struct sk_buff *skb, | |||
1986 | ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr, | 1987 | ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr, |
1987 | saddr); | 1988 | saddr); |
1988 | 1989 | ||
1989 | err = -EINVAL; | ||
1990 | goto cleanup; | 1990 | goto cleanup; |
1991 | } | 1991 | } |
1992 | 1992 | ||
@@ -2053,8 +2053,6 @@ static int __mkroute_input(struct sk_buff *skb, | |||
2053 | *result = rth; | 2053 | *result = rth; |
2054 | err = 0; | 2054 | err = 0; |
2055 | cleanup: | 2055 | cleanup: |
2056 | /* release the working reference to the output device */ | ||
2057 | in_dev_put(out_dev); | ||
2058 | return err; | 2056 | return err; |
2059 | } | 2057 | } |
2060 | 2058 | ||
@@ -2098,7 +2096,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2098 | u8 tos, struct net_device *dev) | 2096 | u8 tos, struct net_device *dev) |
2099 | { | 2097 | { |
2100 | struct fib_result res; | 2098 | struct fib_result res; |
2101 | struct in_device *in_dev = in_dev_get(dev); | 2099 | struct in_device *in_dev = __in_dev_get_rcu(dev); |
2102 | struct flowi fl = { .nl_u = { .ip4_u = | 2100 | struct flowi fl = { .nl_u = { .ip4_u = |
2103 | { .daddr = daddr, | 2101 | { .daddr = daddr, |
2104 | .saddr = saddr, | 2102 | .saddr = saddr, |
@@ -2158,13 +2156,12 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2158 | goto brd_input; | 2156 | goto brd_input; |
2159 | 2157 | ||
2160 | if (res.type == RTN_LOCAL) { | 2158 | if (res.type == RTN_LOCAL) { |
2161 | int result; | 2159 | err = fib_validate_source(saddr, daddr, tos, |
2162 | result = fib_validate_source(saddr, daddr, tos, | ||
2163 | net->loopback_dev->ifindex, | 2160 | net->loopback_dev->ifindex, |
2164 | dev, &spec_dst, &itag, skb->mark); | 2161 | dev, &spec_dst, &itag, skb->mark); |
2165 | if (result < 0) | 2162 | if (err < 0) |
2166 | goto martian_source; | 2163 | goto martian_source_keep_err; |
2167 | if (result) | 2164 | if (err) |
2168 | flags |= RTCF_DIRECTSRC; | 2165 | flags |= RTCF_DIRECTSRC; |
2169 | spec_dst = daddr; | 2166 | spec_dst = daddr; |
2170 | goto local_input; | 2167 | goto local_input; |
@@ -2177,7 +2174,6 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2177 | 2174 | ||
2178 | err = ip_mkroute_input(skb, &res, &fl, in_dev, daddr, saddr, tos); | 2175 | err = ip_mkroute_input(skb, &res, &fl, in_dev, daddr, saddr, tos); |
2179 | done: | 2176 | done: |
2180 | in_dev_put(in_dev); | ||
2181 | if (free_res) | 2177 | if (free_res) |
2182 | fib_res_put(&res); | 2178 | fib_res_put(&res); |
2183 | out: return err; | 2179 | out: return err; |
@@ -2192,7 +2188,7 @@ brd_input: | |||
2192 | err = fib_validate_source(saddr, 0, tos, 0, dev, &spec_dst, | 2188 | err = fib_validate_source(saddr, 0, tos, 0, dev, &spec_dst, |
2193 | &itag, skb->mark); | 2189 | &itag, skb->mark); |
2194 | if (err < 0) | 2190 | if (err < 0) |
2195 | goto martian_source; | 2191 | goto martian_source_keep_err; |
2196 | if (err) | 2192 | if (err) |
2197 | flags |= RTCF_DIRECTSRC; | 2193 | flags |= RTCF_DIRECTSRC; |
2198 | } | 2194 | } |
@@ -2273,8 +2269,10 @@ e_nobufs: | |||
2273 | goto done; | 2269 | goto done; |
2274 | 2270 | ||
2275 | martian_source: | 2271 | martian_source: |
2272 | err = -EINVAL; | ||
2273 | martian_source_keep_err: | ||
2276 | ip_handle_martian_source(dev, in_dev, skb, daddr, saddr); | 2274 | ip_handle_martian_source(dev, in_dev, skb, daddr, saddr); |
2277 | goto e_inval; | 2275 | goto done; |
2278 | } | 2276 | } |
2279 | 2277 | ||
2280 | int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr, | 2278 | int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr, |
@@ -2284,16 +2282,18 @@ int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2284 | unsigned hash; | 2282 | unsigned hash; |
2285 | int iif = dev->ifindex; | 2283 | int iif = dev->ifindex; |
2286 | struct net *net; | 2284 | struct net *net; |
2285 | int res; | ||
2287 | 2286 | ||
2288 | net = dev_net(dev); | 2287 | net = dev_net(dev); |
2289 | 2288 | ||
2289 | rcu_read_lock(); | ||
2290 | |||
2290 | if (!rt_caching(net)) | 2291 | if (!rt_caching(net)) |
2291 | goto skip_cache; | 2292 | goto skip_cache; |
2292 | 2293 | ||
2293 | tos &= IPTOS_RT_MASK; | 2294 | tos &= IPTOS_RT_MASK; |
2294 | hash = rt_hash(daddr, saddr, iif, rt_genid(net)); | 2295 | hash = rt_hash(daddr, saddr, iif, rt_genid(net)); |
2295 | 2296 | ||
2296 | rcu_read_lock(); | ||
2297 | for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; | 2297 | for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; |
2298 | rth = rcu_dereference(rth->u.dst.rt_next)) { | 2298 | rth = rcu_dereference(rth->u.dst.rt_next)) { |
2299 | if ((((__force u32)rth->fl.fl4_dst ^ (__force u32)daddr) | | 2299 | if ((((__force u32)rth->fl.fl4_dst ^ (__force u32)daddr) | |
@@ -2317,7 +2317,6 @@ int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2317 | } | 2317 | } |
2318 | RT_CACHE_STAT_INC(in_hlist_search); | 2318 | RT_CACHE_STAT_INC(in_hlist_search); |
2319 | } | 2319 | } |
2320 | rcu_read_unlock(); | ||
2321 | 2320 | ||
2322 | skip_cache: | 2321 | skip_cache: |
2323 | /* Multicast recognition logic is moved from route cache to here. | 2322 | /* Multicast recognition logic is moved from route cache to here. |
@@ -2332,12 +2331,11 @@ skip_cache: | |||
2332 | route cache entry is created eventually. | 2331 | route cache entry is created eventually. |
2333 | */ | 2332 | */ |
2334 | if (ipv4_is_multicast(daddr)) { | 2333 | if (ipv4_is_multicast(daddr)) { |
2335 | struct in_device *in_dev; | 2334 | struct in_device *in_dev = __in_dev_get_rcu(dev); |
2336 | 2335 | ||
2337 | rcu_read_lock(); | 2336 | if (in_dev) { |
2338 | if ((in_dev = __in_dev_get_rcu(dev)) != NULL) { | ||
2339 | int our = ip_check_mc(in_dev, daddr, saddr, | 2337 | int our = ip_check_mc(in_dev, daddr, saddr, |
2340 | ip_hdr(skb)->protocol); | 2338 | ip_hdr(skb)->protocol); |
2341 | if (our | 2339 | if (our |
2342 | #ifdef CONFIG_IP_MROUTE | 2340 | #ifdef CONFIG_IP_MROUTE |
2343 | || | 2341 | || |
@@ -2345,15 +2343,18 @@ skip_cache: | |||
2345 | IN_DEV_MFORWARD(in_dev)) | 2343 | IN_DEV_MFORWARD(in_dev)) |
2346 | #endif | 2344 | #endif |
2347 | ) { | 2345 | ) { |
2346 | int res = ip_route_input_mc(skb, daddr, saddr, | ||
2347 | tos, dev, our); | ||
2348 | rcu_read_unlock(); | 2348 | rcu_read_unlock(); |
2349 | return ip_route_input_mc(skb, daddr, saddr, | 2349 | return res; |
2350 | tos, dev, our); | ||
2351 | } | 2350 | } |
2352 | } | 2351 | } |
2353 | rcu_read_unlock(); | 2352 | rcu_read_unlock(); |
2354 | return -EINVAL; | 2353 | return -EINVAL; |
2355 | } | 2354 | } |
2356 | return ip_route_input_slow(skb, daddr, saddr, tos, dev); | 2355 | res = ip_route_input_slow(skb, daddr, saddr, tos, dev); |
2356 | rcu_read_unlock(); | ||
2357 | return res; | ||
2357 | } | 2358 | } |
2358 | EXPORT_SYMBOL(ip_route_input_common); | 2359 | EXPORT_SYMBOL(ip_route_input_common); |
2359 | 2360 | ||
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index 9f6b22206c52..5c48124332de 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c | |||
@@ -138,23 +138,23 @@ static __u32 check_tcp_syn_cookie(__u32 cookie, __be32 saddr, __be32 daddr, | |||
138 | } | 138 | } |
139 | 139 | ||
140 | /* | 140 | /* |
141 | * This table has to be sorted and terminated with (__u16)-1. | 141 | * MSS Values are taken from the 2009 paper |
142 | * XXX generate a better table. | 142 | * 'Measuring TCP Maximum Segment Size' by S. Alcock and R. Nelson: |
143 | * Unresolved Issues: HIPPI with a 64k MSS is not well supported. | 143 | * - values 1440 to 1460 accounted for 80% of observed mss values |
144 | * - values outside the 536-1460 range are rare (<0.2%). | ||
145 | * | ||
146 | * Table must be sorted. | ||
144 | */ | 147 | */ |
145 | static __u16 const msstab[] = { | 148 | static __u16 const msstab[] = { |
146 | 64 - 1, | 149 | 64, |
147 | 256 - 1, | 150 | 512, |
148 | 512 - 1, | 151 | 536, |
149 | 536 - 1, | 152 | 1024, |
150 | 1024 - 1, | 153 | 1440, |
151 | 1440 - 1, | 154 | 1460, |
152 | 1460 - 1, | 155 | 4312, |
153 | 4312 - 1, | 156 | 8960, |
154 | (__u16)-1 | ||
155 | }; | 157 | }; |
156 | /* The number doesn't include the -1 terminator */ | ||
157 | #define NUM_MSS (ARRAY_SIZE(msstab) - 1) | ||
158 | 158 | ||
159 | /* | 159 | /* |
160 | * Generate a syncookie. mssp points to the mss, which is returned | 160 | * Generate a syncookie. mssp points to the mss, which is returned |
@@ -169,10 +169,10 @@ __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mssp) | |||
169 | 169 | ||
170 | tcp_synq_overflow(sk); | 170 | tcp_synq_overflow(sk); |
171 | 171 | ||
172 | /* XXX sort msstab[] by probability? Binary search? */ | 172 | for (mssind = ARRAY_SIZE(msstab) - 1; mssind ; mssind--) |
173 | for (mssind = 0; mss > msstab[mssind + 1]; mssind++) | 173 | if (mss >= msstab[mssind]) |
174 | ; | 174 | break; |
175 | *mssp = msstab[mssind] + 1; | 175 | *mssp = msstab[mssind]; |
176 | 176 | ||
177 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_SYNCOOKIESSENT); | 177 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_SYNCOOKIESSENT); |
178 | 178 | ||
@@ -202,7 +202,7 @@ static inline int cookie_check(struct sk_buff *skb, __u32 cookie) | |||
202 | jiffies / (HZ * 60), | 202 | jiffies / (HZ * 60), |
203 | COUNTER_TRIES); | 203 | COUNTER_TRIES); |
204 | 204 | ||
205 | return mssind < NUM_MSS ? msstab[mssind] + 1 : 0; | 205 | return mssind < ARRAY_SIZE(msstab) ? msstab[mssind] : 0; |
206 | } | 206 | } |
207 | 207 | ||
208 | static inline struct sock *get_cookie_sock(struct sock *sk, struct sk_buff *skb, | 208 | static inline struct sock *get_cookie_sock(struct sock *sk, struct sk_buff *skb, |
@@ -266,7 +266,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, | |||
266 | struct rtable *rt; | 266 | struct rtable *rt; |
267 | __u8 rcv_wscale; | 267 | __u8 rcv_wscale; |
268 | 268 | ||
269 | if (!sysctl_tcp_syncookies || !th->ack) | 269 | if (!sysctl_tcp_syncookies || !th->ack || th->rst) |
270 | goto out; | 270 | goto out; |
271 | 271 | ||
272 | if (tcp_synq_no_recent_overflow(sk) || | 272 | if (tcp_synq_no_recent_overflow(sk) || |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 6596b4feeddc..49d0d2b8900c 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -2999,6 +2999,7 @@ int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *hp, | |||
2999 | const unsigned head_data_len = skb_headlen(skb) > header_len ? | 2999 | const unsigned head_data_len = skb_headlen(skb) > header_len ? |
3000 | skb_headlen(skb) - header_len : 0; | 3000 | skb_headlen(skb) - header_len : 0; |
3001 | const struct skb_shared_info *shi = skb_shinfo(skb); | 3001 | const struct skb_shared_info *shi = skb_shinfo(skb); |
3002 | struct sk_buff *frag_iter; | ||
3002 | 3003 | ||
3003 | sg_init_table(&sg, 1); | 3004 | sg_init_table(&sg, 1); |
3004 | 3005 | ||
@@ -3013,6 +3014,10 @@ int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *hp, | |||
3013 | return 1; | 3014 | return 1; |
3014 | } | 3015 | } |
3015 | 3016 | ||
3017 | skb_walk_frags(skb, frag_iter) | ||
3018 | if (tcp_md5_hash_skb_data(hp, frag_iter, 0)) | ||
3019 | return 1; | ||
3020 | |||
3016 | return 0; | 3021 | return 0; |
3017 | } | 3022 | } |
3018 | 3023 | ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index fe193e53af44..acdc4c989853 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -793,19 +793,20 @@ static void tcp_v4_reqsk_destructor(struct request_sock *req) | |||
793 | kfree(inet_rsk(req)->opt); | 793 | kfree(inet_rsk(req)->opt); |
794 | } | 794 | } |
795 | 795 | ||
796 | #ifdef CONFIG_SYN_COOKIES | 796 | static void syn_flood_warning(const struct sk_buff *skb) |
797 | static void syn_flood_warning(struct sk_buff *skb) | ||
798 | { | 797 | { |
799 | static unsigned long warntime; | 798 | const char *msg; |
800 | 799 | ||
801 | if (time_after(jiffies, (warntime + HZ * 60))) { | 800 | #ifdef CONFIG_SYN_COOKIES |
802 | warntime = jiffies; | 801 | if (sysctl_tcp_syncookies) |
803 | printk(KERN_INFO | 802 | msg = "Sending cookies"; |
804 | "possible SYN flooding on port %d. Sending cookies.\n", | 803 | else |
805 | ntohs(tcp_hdr(skb)->dest)); | ||
806 | } | ||
807 | } | ||
808 | #endif | 804 | #endif |
805 | msg = "Dropping request"; | ||
806 | |||
807 | pr_info("TCP: Possible SYN flooding on port %d. %s.\n", | ||
808 | ntohs(tcp_hdr(skb)->dest), msg); | ||
809 | } | ||
809 | 810 | ||
810 | /* | 811 | /* |
811 | * Save and compile IPv4 options into the request_sock if needed. | 812 | * Save and compile IPv4 options into the request_sock if needed. |
@@ -1243,6 +1244,8 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1243 | * evidently real one. | 1244 | * evidently real one. |
1244 | */ | 1245 | */ |
1245 | if (inet_csk_reqsk_queue_is_full(sk) && !isn) { | 1246 | if (inet_csk_reqsk_queue_is_full(sk) && !isn) { |
1247 | if (net_ratelimit()) | ||
1248 | syn_flood_warning(skb); | ||
1246 | #ifdef CONFIG_SYN_COOKIES | 1249 | #ifdef CONFIG_SYN_COOKIES |
1247 | if (sysctl_tcp_syncookies) { | 1250 | if (sysctl_tcp_syncookies) { |
1248 | want_cookie = 1; | 1251 | want_cookie = 1; |
@@ -1328,7 +1331,6 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1328 | 1331 | ||
1329 | if (want_cookie) { | 1332 | if (want_cookie) { |
1330 | #ifdef CONFIG_SYN_COOKIES | 1333 | #ifdef CONFIG_SYN_COOKIES |
1331 | syn_flood_warning(skb); | ||
1332 | req->cookie_ts = tmp_opt.tstamp_ok; | 1334 | req->cookie_ts = tmp_opt.tstamp_ok; |
1333 | #endif | 1335 | #endif |
1334 | isn = cookie_v4_init_sequence(sk, skb, &req->mss); | 1336 | isn = cookie_v4_init_sequence(sk, skb, &req->mss); |
@@ -1504,7 +1506,7 @@ static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb) | |||
1504 | } | 1506 | } |
1505 | 1507 | ||
1506 | #ifdef CONFIG_SYN_COOKIES | 1508 | #ifdef CONFIG_SYN_COOKIES |
1507 | if (!th->rst && !th->syn && th->ack) | 1509 | if (!th->syn) |
1508 | sk = cookie_v4_check(sk, skb, &(IPCB(skb)->opt)); | 1510 | sk = cookie_v4_check(sk, skb, &(IPCB(skb)->opt)); |
1509 | #endif | 1511 | #endif |
1510 | return sk; | 1512 | return sk; |
diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c index 8c4348cb1950..f0e774cea386 100644 --- a/net/ipv6/addrlabel.c +++ b/net/ipv6/addrlabel.c | |||
@@ -53,11 +53,7 @@ static struct ip6addrlbl_table | |||
53 | static inline | 53 | static inline |
54 | struct net *ip6addrlbl_net(const struct ip6addrlbl_entry *lbl) | 54 | struct net *ip6addrlbl_net(const struct ip6addrlbl_entry *lbl) |
55 | { | 55 | { |
56 | #ifdef CONFIG_NET_NS | 56 | return read_pnet(&lbl->lbl_net); |
57 | return lbl->lbl_net; | ||
58 | #else | ||
59 | return &init_net; | ||
60 | #endif | ||
61 | } | 57 | } |
62 | 58 | ||
63 | /* | 59 | /* |
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index e733942dafe1..94b1b9c954bf 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -651,7 +651,7 @@ int inet6_sk_rebuild_header(struct sock *sk) | |||
651 | 651 | ||
652 | if (dst == NULL) { | 652 | if (dst == NULL) { |
653 | struct inet_sock *inet = inet_sk(sk); | 653 | struct inet_sock *inet = inet_sk(sk); |
654 | struct in6_addr *final_p = NULL, final; | 654 | struct in6_addr *final_p, final; |
655 | struct flowi fl; | 655 | struct flowi fl; |
656 | 656 | ||
657 | memset(&fl, 0, sizeof(fl)); | 657 | memset(&fl, 0, sizeof(fl)); |
@@ -665,12 +665,7 @@ int inet6_sk_rebuild_header(struct sock *sk) | |||
665 | fl.fl_ip_sport = inet->inet_sport; | 665 | fl.fl_ip_sport = inet->inet_sport; |
666 | security_sk_classify_flow(sk, &fl); | 666 | security_sk_classify_flow(sk, &fl); |
667 | 667 | ||
668 | if (np->opt && np->opt->srcrt) { | 668 | final_p = fl6_update_dst(&fl, np->opt, &final); |
669 | struct rt0_hdr *rt0 = (struct rt0_hdr *) np->opt->srcrt; | ||
670 | ipv6_addr_copy(&final, &fl.fl6_dst); | ||
671 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | ||
672 | final_p = &final; | ||
673 | } | ||
674 | 669 | ||
675 | err = ip6_dst_lookup(sk, &dst, &fl); | 670 | err = ip6_dst_lookup(sk, &dst, &fl); |
676 | if (err) { | 671 | if (err) { |
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index 712684687c9a..7d929a22cbc2 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c | |||
@@ -38,10 +38,11 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
38 | struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr; | 38 | struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr; |
39 | struct inet_sock *inet = inet_sk(sk); | 39 | struct inet_sock *inet = inet_sk(sk); |
40 | struct ipv6_pinfo *np = inet6_sk(sk); | 40 | struct ipv6_pinfo *np = inet6_sk(sk); |
41 | struct in6_addr *daddr, *final_p = NULL, final; | 41 | struct in6_addr *daddr, *final_p, final; |
42 | struct dst_entry *dst; | 42 | struct dst_entry *dst; |
43 | struct flowi fl; | 43 | struct flowi fl; |
44 | struct ip6_flowlabel *flowlabel = NULL; | 44 | struct ip6_flowlabel *flowlabel = NULL; |
45 | struct ipv6_txoptions *opt; | ||
45 | int addr_type; | 46 | int addr_type; |
46 | int err; | 47 | int err; |
47 | 48 | ||
@@ -155,19 +156,8 @@ ipv4_connected: | |||
155 | 156 | ||
156 | security_sk_classify_flow(sk, &fl); | 157 | security_sk_classify_flow(sk, &fl); |
157 | 158 | ||
158 | if (flowlabel) { | 159 | opt = flowlabel ? flowlabel->opt : np->opt; |
159 | if (flowlabel->opt && flowlabel->opt->srcrt) { | 160 | final_p = fl6_update_dst(&fl, opt, &final); |
160 | struct rt0_hdr *rt0 = (struct rt0_hdr *) flowlabel->opt->srcrt; | ||
161 | ipv6_addr_copy(&final, &fl.fl6_dst); | ||
162 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | ||
163 | final_p = &final; | ||
164 | } | ||
165 | } else if (np->opt && np->opt->srcrt) { | ||
166 | struct rt0_hdr *rt0 = (struct rt0_hdr *)np->opt->srcrt; | ||
167 | ipv6_addr_copy(&final, &fl.fl6_dst); | ||
168 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | ||
169 | final_p = &final; | ||
170 | } | ||
171 | 161 | ||
172 | err = ip6_dst_lookup(sk, &dst, &fl); | 162 | err = ip6_dst_lookup(sk, &dst, &fl); |
173 | if (err) | 163 | if (err) |
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index 8a659f92d17a..853a633a94d4 100644 --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c | |||
@@ -874,3 +874,27 @@ struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, | |||
874 | return opt; | 874 | return opt; |
875 | } | 875 | } |
876 | 876 | ||
877 | /** | ||
878 | * fl6_update_dst - update flowi destination address with info given | ||
879 | * by srcrt option, if any. | ||
880 | * | ||
881 | * @fl: flowi for which fl6_dst is to be updated | ||
882 | * @opt: struct ipv6_txoptions in which to look for srcrt opt | ||
883 | * @orig: copy of original fl6_dst address if modified | ||
884 | * | ||
885 | * Returns NULL if no txoptions or no srcrt, otherwise returns orig | ||
886 | * and initial value of fl->fl6_dst set in orig | ||
887 | */ | ||
888 | struct in6_addr *fl6_update_dst(struct flowi *fl, | ||
889 | const struct ipv6_txoptions *opt, | ||
890 | struct in6_addr *orig) | ||
891 | { | ||
892 | if (!opt || !opt->srcrt) | ||
893 | return NULL; | ||
894 | |||
895 | ipv6_addr_copy(orig, &fl->fl6_dst); | ||
896 | ipv6_addr_copy(&fl->fl6_dst, ((struct rt0_hdr *)opt->srcrt)->addr); | ||
897 | return orig; | ||
898 | } | ||
899 | |||
900 | EXPORT_SYMBOL_GPL(fl6_update_dst); | ||
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index 0c5e3c3b7fd5..8a1628023bd1 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c | |||
@@ -185,7 +185,7 @@ int inet6_csk_xmit(struct sk_buff *skb) | |||
185 | struct ipv6_pinfo *np = inet6_sk(sk); | 185 | struct ipv6_pinfo *np = inet6_sk(sk); |
186 | struct flowi fl; | 186 | struct flowi fl; |
187 | struct dst_entry *dst; | 187 | struct dst_entry *dst; |
188 | struct in6_addr *final_p = NULL, final; | 188 | struct in6_addr *final_p, final; |
189 | 189 | ||
190 | memset(&fl, 0, sizeof(fl)); | 190 | memset(&fl, 0, sizeof(fl)); |
191 | fl.proto = sk->sk_protocol; | 191 | fl.proto = sk->sk_protocol; |
@@ -199,12 +199,7 @@ int inet6_csk_xmit(struct sk_buff *skb) | |||
199 | fl.fl_ip_dport = inet->inet_dport; | 199 | fl.fl_ip_dport = inet->inet_dport; |
200 | security_sk_classify_flow(sk, &fl); | 200 | security_sk_classify_flow(sk, &fl); |
201 | 201 | ||
202 | if (np->opt && np->opt->srcrt) { | 202 | final_p = fl6_update_dst(&fl, np->opt, &final); |
203 | struct rt0_hdr *rt0 = (struct rt0_hdr *)np->opt->srcrt; | ||
204 | ipv6_addr_copy(&final, &fl.fl6_dst); | ||
205 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | ||
206 | final_p = &final; | ||
207 | } | ||
208 | 203 | ||
209 | dst = __inet6_csk_dst_check(sk, np->dst_cookie); | 204 | dst = __inet6_csk_dst_check(sk, np->dst_cookie); |
210 | 205 | ||
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index ab1622d7d409..8752e8084806 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -1998,8 +1998,7 @@ static int sf_setstate(struct ifmcaddr6 *pmc) | |||
1998 | &psf->sf_addr)) | 1998 | &psf->sf_addr)) |
1999 | break; | 1999 | break; |
2000 | if (!dpsf) { | 2000 | if (!dpsf) { |
2001 | dpsf = (struct ip6_sf_list *) | 2001 | dpsf = kmalloc(sizeof(*dpsf), GFP_ATOMIC); |
2002 | kmalloc(sizeof(*dpsf), GFP_ATOMIC); | ||
2003 | if (!dpsf) | 2002 | if (!dpsf) |
2004 | continue; | 2003 | continue; |
2005 | *dpsf = *psf; | 2004 | *dpsf = *psf; |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 4a4dcbe4f8b2..864eb8e03b1b 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -725,7 +725,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
725 | { | 725 | { |
726 | struct ipv6_txoptions opt_space; | 726 | struct ipv6_txoptions opt_space; |
727 | struct sockaddr_in6 * sin6 = (struct sockaddr_in6 *) msg->msg_name; | 727 | struct sockaddr_in6 * sin6 = (struct sockaddr_in6 *) msg->msg_name; |
728 | struct in6_addr *daddr, *final_p = NULL, final; | 728 | struct in6_addr *daddr, *final_p, final; |
729 | struct inet_sock *inet = inet_sk(sk); | 729 | struct inet_sock *inet = inet_sk(sk); |
730 | struct ipv6_pinfo *np = inet6_sk(sk); | 730 | struct ipv6_pinfo *np = inet6_sk(sk); |
731 | struct raw6_sock *rp = raw6_sk(sk); | 731 | struct raw6_sock *rp = raw6_sk(sk); |
@@ -847,13 +847,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
847 | if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr)) | 847 | if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr)) |
848 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); | 848 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); |
849 | 849 | ||
850 | /* merge ip6_build_xmit from ip6_output */ | 850 | final_p = fl6_update_dst(&fl, opt, &final); |
851 | if (opt && opt->srcrt) { | ||
852 | struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt; | ||
853 | ipv6_addr_copy(&final, &fl.fl6_dst); | ||
854 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | ||
855 | final_p = &final; | ||
856 | } | ||
857 | 851 | ||
858 | if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) | 852 | if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) |
859 | fl.oif = np->mcast_oif; | 853 | fl.oif = np->mcast_oif; |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index e51e650ea80b..702c532ec21e 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -249,8 +249,6 @@ failed: | |||
249 | return NULL; | 249 | return NULL; |
250 | } | 250 | } |
251 | 251 | ||
252 | static DEFINE_SPINLOCK(ipip6_prl_lock); | ||
253 | |||
254 | #define for_each_prl_rcu(start) \ | 252 | #define for_each_prl_rcu(start) \ |
255 | for (prl = rcu_dereference(start); \ | 253 | for (prl = rcu_dereference(start); \ |
256 | prl; \ | 254 | prl; \ |
@@ -340,7 +338,7 @@ ipip6_tunnel_add_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a, int chg) | |||
340 | if (a->addr == htonl(INADDR_ANY)) | 338 | if (a->addr == htonl(INADDR_ANY)) |
341 | return -EINVAL; | 339 | return -EINVAL; |
342 | 340 | ||
343 | spin_lock(&ipip6_prl_lock); | 341 | ASSERT_RTNL(); |
344 | 342 | ||
345 | for (p = t->prl; p; p = p->next) { | 343 | for (p = t->prl; p; p = p->next) { |
346 | if (p->addr == a->addr) { | 344 | if (p->addr == a->addr) { |
@@ -370,7 +368,6 @@ ipip6_tunnel_add_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a, int chg) | |||
370 | t->prl_count++; | 368 | t->prl_count++; |
371 | rcu_assign_pointer(t->prl, p); | 369 | rcu_assign_pointer(t->prl, p); |
372 | out: | 370 | out: |
373 | spin_unlock(&ipip6_prl_lock); | ||
374 | return err; | 371 | return err; |
375 | } | 372 | } |
376 | 373 | ||
@@ -397,7 +394,7 @@ ipip6_tunnel_del_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a) | |||
397 | struct ip_tunnel_prl_entry *x, **p; | 394 | struct ip_tunnel_prl_entry *x, **p; |
398 | int err = 0; | 395 | int err = 0; |
399 | 396 | ||
400 | spin_lock(&ipip6_prl_lock); | 397 | ASSERT_RTNL(); |
401 | 398 | ||
402 | if (a && a->addr != htonl(INADDR_ANY)) { | 399 | if (a && a->addr != htonl(INADDR_ANY)) { |
403 | for (p = &t->prl; *p; p = &(*p)->next) { | 400 | for (p = &t->prl; *p; p = &(*p)->next) { |
@@ -419,7 +416,6 @@ ipip6_tunnel_del_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a) | |||
419 | } | 416 | } |
420 | } | 417 | } |
421 | out: | 418 | out: |
422 | spin_unlock(&ipip6_prl_lock); | ||
423 | return err; | 419 | return err; |
424 | } | 420 | } |
425 | 421 | ||
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c index 34d1f0690d7e..70d330f8c990 100644 --- a/net/ipv6/syncookies.c +++ b/net/ipv6/syncookies.c | |||
@@ -27,28 +27,17 @@ extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; | |||
27 | #define COOKIEBITS 24 /* Upper bits store count */ | 27 | #define COOKIEBITS 24 /* Upper bits store count */ |
28 | #define COOKIEMASK (((__u32)1 << COOKIEBITS) - 1) | 28 | #define COOKIEMASK (((__u32)1 << COOKIEBITS) - 1) |
29 | 29 | ||
30 | /* | 30 | /* Table must be sorted. */ |
31 | * This table has to be sorted and terminated with (__u16)-1. | ||
32 | * XXX generate a better table. | ||
33 | * Unresolved Issues: HIPPI with a 64k MSS is not well supported. | ||
34 | * | ||
35 | * Taken directly from ipv4 implementation. | ||
36 | * Should this list be modified for ipv6 use or is it close enough? | ||
37 | * rfc 2460 8.3 suggests mss values 20 bytes less than ipv4 counterpart | ||
38 | */ | ||
39 | static __u16 const msstab[] = { | 31 | static __u16 const msstab[] = { |
40 | 64 - 1, | 32 | 64, |
41 | 256 - 1, | 33 | 512, |
42 | 512 - 1, | 34 | 536, |
43 | 536 - 1, | 35 | 1280 - 60, |
44 | 1024 - 1, | 36 | 1480 - 60, |
45 | 1440 - 1, | 37 | 1500 - 60, |
46 | 1460 - 1, | 38 | 4460 - 60, |
47 | 4312 - 1, | 39 | 9000 - 60, |
48 | (__u16)-1 | ||
49 | }; | 40 | }; |
50 | /* The number doesn't include the -1 terminator */ | ||
51 | #define NUM_MSS (ARRAY_SIZE(msstab) - 1) | ||
52 | 41 | ||
53 | /* | 42 | /* |
54 | * This (misnamed) value is the age of syncookie which is permitted. | 43 | * This (misnamed) value is the age of syncookie which is permitted. |
@@ -134,9 +123,11 @@ __u32 cookie_v6_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mssp) | |||
134 | 123 | ||
135 | tcp_synq_overflow(sk); | 124 | tcp_synq_overflow(sk); |
136 | 125 | ||
137 | for (mssind = 0; mss > msstab[mssind + 1]; mssind++) | 126 | for (mssind = ARRAY_SIZE(msstab) - 1; mssind ; mssind--) |
138 | ; | 127 | if (mss >= msstab[mssind]) |
139 | *mssp = msstab[mssind] + 1; | 128 | break; |
129 | |||
130 | *mssp = msstab[mssind]; | ||
140 | 131 | ||
141 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_SYNCOOKIESSENT); | 132 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_SYNCOOKIESSENT); |
142 | 133 | ||
@@ -154,7 +145,7 @@ static inline int cookie_check(struct sk_buff *skb, __u32 cookie) | |||
154 | th->source, th->dest, seq, | 145 | th->source, th->dest, seq, |
155 | jiffies / (HZ * 60), COUNTER_TRIES); | 146 | jiffies / (HZ * 60), COUNTER_TRIES); |
156 | 147 | ||
157 | return mssind < NUM_MSS ? msstab[mssind] + 1 : 0; | 148 | return mssind < ARRAY_SIZE(msstab) ? msstab[mssind] : 0; |
158 | } | 149 | } |
159 | 150 | ||
160 | struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) | 151 | struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) |
@@ -174,7 +165,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) | |||
174 | struct dst_entry *dst; | 165 | struct dst_entry *dst; |
175 | __u8 rcv_wscale; | 166 | __u8 rcv_wscale; |
176 | 167 | ||
177 | if (!sysctl_tcp_syncookies || !th->ack) | 168 | if (!sysctl_tcp_syncookies || !th->ack || th->rst) |
178 | goto out; | 169 | goto out; |
179 | 170 | ||
180 | if (tcp_synq_no_recent_overflow(sk) || | 171 | if (tcp_synq_no_recent_overflow(sk) || |
@@ -240,17 +231,12 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) | |||
240 | * me if there is a preferred way. | 231 | * me if there is a preferred way. |
241 | */ | 232 | */ |
242 | { | 233 | { |
243 | struct in6_addr *final_p = NULL, final; | 234 | struct in6_addr *final_p, final; |
244 | struct flowi fl; | 235 | struct flowi fl; |
245 | memset(&fl, 0, sizeof(fl)); | 236 | memset(&fl, 0, sizeof(fl)); |
246 | fl.proto = IPPROTO_TCP; | 237 | fl.proto = IPPROTO_TCP; |
247 | ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr); | 238 | ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr); |
248 | if (np->opt && np->opt->srcrt) { | 239 | final_p = fl6_update_dst(&fl, np->opt, &final); |
249 | struct rt0_hdr *rt0 = (struct rt0_hdr *) np->opt->srcrt; | ||
250 | ipv6_addr_copy(&final, &fl.fl6_dst); | ||
251 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | ||
252 | final_p = &final; | ||
253 | } | ||
254 | ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr); | 240 | ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr); |
255 | fl.oif = sk->sk_bound_dev_if; | 241 | fl.oif = sk->sk_bound_dev_if; |
256 | fl.mark = sk->sk_mark; | 242 | fl.mark = sk->sk_mark; |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 2b7c3a100e2c..5887141ad641 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -129,7 +129,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
129 | struct inet_connection_sock *icsk = inet_csk(sk); | 129 | struct inet_connection_sock *icsk = inet_csk(sk); |
130 | struct ipv6_pinfo *np = inet6_sk(sk); | 130 | struct ipv6_pinfo *np = inet6_sk(sk); |
131 | struct tcp_sock *tp = tcp_sk(sk); | 131 | struct tcp_sock *tp = tcp_sk(sk); |
132 | struct in6_addr *saddr = NULL, *final_p = NULL, final; | 132 | struct in6_addr *saddr = NULL, *final_p, final; |
133 | struct flowi fl; | 133 | struct flowi fl; |
134 | struct dst_entry *dst; | 134 | struct dst_entry *dst; |
135 | int addr_type; | 135 | int addr_type; |
@@ -250,12 +250,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
250 | fl.fl_ip_dport = usin->sin6_port; | 250 | fl.fl_ip_dport = usin->sin6_port; |
251 | fl.fl_ip_sport = inet->inet_sport; | 251 | fl.fl_ip_sport = inet->inet_sport; |
252 | 252 | ||
253 | if (np->opt && np->opt->srcrt) { | 253 | final_p = fl6_update_dst(&fl, np->opt, &final); |
254 | struct rt0_hdr *rt0 = (struct rt0_hdr *)np->opt->srcrt; | ||
255 | ipv6_addr_copy(&final, &fl.fl6_dst); | ||
256 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | ||
257 | final_p = &final; | ||
258 | } | ||
259 | 254 | ||
260 | security_sk_classify_flow(sk, &fl); | 255 | security_sk_classify_flow(sk, &fl); |
261 | 256 | ||
@@ -477,7 +472,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req, | |||
477 | struct ipv6_pinfo *np = inet6_sk(sk); | 472 | struct ipv6_pinfo *np = inet6_sk(sk); |
478 | struct sk_buff * skb; | 473 | struct sk_buff * skb; |
479 | struct ipv6_txoptions *opt = NULL; | 474 | struct ipv6_txoptions *opt = NULL; |
480 | struct in6_addr * final_p = NULL, final; | 475 | struct in6_addr * final_p, final; |
481 | struct flowi fl; | 476 | struct flowi fl; |
482 | struct dst_entry *dst; | 477 | struct dst_entry *dst; |
483 | int err = -1; | 478 | int err = -1; |
@@ -494,12 +489,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req, | |||
494 | security_req_classify_flow(req, &fl); | 489 | security_req_classify_flow(req, &fl); |
495 | 490 | ||
496 | opt = np->opt; | 491 | opt = np->opt; |
497 | if (opt && opt->srcrt) { | 492 | final_p = fl6_update_dst(&fl, opt, &final); |
498 | struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt; | ||
499 | ipv6_addr_copy(&final, &fl.fl6_dst); | ||
500 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | ||
501 | final_p = &final; | ||
502 | } | ||
503 | 493 | ||
504 | err = ip6_dst_lookup(sk, &dst, &fl); | 494 | err = ip6_dst_lookup(sk, &dst, &fl); |
505 | if (err) | 495 | if (err) |
@@ -1167,7 +1157,7 @@ static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) | |||
1167 | } | 1157 | } |
1168 | 1158 | ||
1169 | #ifdef CONFIG_SYN_COOKIES | 1159 | #ifdef CONFIG_SYN_COOKIES |
1170 | if (!th->rst && !th->syn && th->ack) | 1160 | if (!th->syn) |
1171 | sk = cookie_v6_check(sk, skb); | 1161 | sk = cookie_v6_check(sk, skb); |
1172 | #endif | 1162 | #endif |
1173 | return sk; | 1163 | return sk; |
@@ -1392,18 +1382,13 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1392 | goto out_overflow; | 1382 | goto out_overflow; |
1393 | 1383 | ||
1394 | if (dst == NULL) { | 1384 | if (dst == NULL) { |
1395 | struct in6_addr *final_p = NULL, final; | 1385 | struct in6_addr *final_p, final; |
1396 | struct flowi fl; | 1386 | struct flowi fl; |
1397 | 1387 | ||
1398 | memset(&fl, 0, sizeof(fl)); | 1388 | memset(&fl, 0, sizeof(fl)); |
1399 | fl.proto = IPPROTO_TCP; | 1389 | fl.proto = IPPROTO_TCP; |
1400 | ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr); | 1390 | ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr); |
1401 | if (opt && opt->srcrt) { | 1391 | final_p = fl6_update_dst(&fl, opt, &final); |
1402 | struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt; | ||
1403 | ipv6_addr_copy(&final, &fl.fl6_dst); | ||
1404 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | ||
1405 | final_p = &final; | ||
1406 | } | ||
1407 | ipv6_addr_copy(&fl.fl6_src, &treq->loc_addr); | 1392 | ipv6_addr_copy(&fl.fl6_src, &treq->loc_addr); |
1408 | fl.oif = sk->sk_bound_dev_if; | 1393 | fl.oif = sk->sk_bound_dev_if; |
1409 | fl.mark = sk->sk_mark; | 1394 | fl.mark = sk->sk_mark; |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 87be58673b55..1dd1affdead2 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -927,7 +927,7 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
927 | struct inet_sock *inet = inet_sk(sk); | 927 | struct inet_sock *inet = inet_sk(sk); |
928 | struct ipv6_pinfo *np = inet6_sk(sk); | 928 | struct ipv6_pinfo *np = inet6_sk(sk); |
929 | struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) msg->msg_name; | 929 | struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) msg->msg_name; |
930 | struct in6_addr *daddr, *final_p = NULL, final; | 930 | struct in6_addr *daddr, *final_p, final; |
931 | struct ipv6_txoptions *opt = NULL; | 931 | struct ipv6_txoptions *opt = NULL; |
932 | struct ip6_flowlabel *flowlabel = NULL; | 932 | struct ip6_flowlabel *flowlabel = NULL; |
933 | struct flowi fl; | 933 | struct flowi fl; |
@@ -1097,14 +1097,9 @@ do_udp_sendmsg: | |||
1097 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); | 1097 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); |
1098 | fl.fl_ip_sport = inet->inet_sport; | 1098 | fl.fl_ip_sport = inet->inet_sport; |
1099 | 1099 | ||
1100 | /* merge ip6_build_xmit from ip6_output */ | 1100 | final_p = fl6_update_dst(&fl, opt, &final); |
1101 | if (opt && opt->srcrt) { | 1101 | if (final_p) |
1102 | struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt; | ||
1103 | ipv6_addr_copy(&final, &fl.fl6_dst); | ||
1104 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | ||
1105 | final_p = &final; | ||
1106 | connected = 0; | 1102 | connected = 0; |
1107 | } | ||
1108 | 1103 | ||
1109 | if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) { | 1104 | if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) { |
1110 | fl.oif = np->mcast_oif; | 1105 | fl.oif = np->mcast_oif; |
diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c index f28ad2cc8428..499c045d6910 100644 --- a/net/iucv/iucv.c +++ b/net/iucv/iucv.c | |||
@@ -1463,7 +1463,7 @@ struct iucv_path_pending { | |||
1463 | u32 res3; | 1463 | u32 res3; |
1464 | u8 ippollfg; | 1464 | u8 ippollfg; |
1465 | u8 res4[3]; | 1465 | u8 res4[3]; |
1466 | } __attribute__ ((packed)); | 1466 | } __packed; |
1467 | 1467 | ||
1468 | static void iucv_path_pending(struct iucv_irq_data *data) | 1468 | static void iucv_path_pending(struct iucv_irq_data *data) |
1469 | { | 1469 | { |
@@ -1524,7 +1524,7 @@ struct iucv_path_complete { | |||
1524 | u32 res3; | 1524 | u32 res3; |
1525 | u8 ippollfg; | 1525 | u8 ippollfg; |
1526 | u8 res4[3]; | 1526 | u8 res4[3]; |
1527 | } __attribute__ ((packed)); | 1527 | } __packed; |
1528 | 1528 | ||
1529 | static void iucv_path_complete(struct iucv_irq_data *data) | 1529 | static void iucv_path_complete(struct iucv_irq_data *data) |
1530 | { | 1530 | { |
@@ -1554,7 +1554,7 @@ struct iucv_path_severed { | |||
1554 | u32 res4; | 1554 | u32 res4; |
1555 | u8 ippollfg; | 1555 | u8 ippollfg; |
1556 | u8 res5[3]; | 1556 | u8 res5[3]; |
1557 | } __attribute__ ((packed)); | 1557 | } __packed; |
1558 | 1558 | ||
1559 | static void iucv_path_severed(struct iucv_irq_data *data) | 1559 | static void iucv_path_severed(struct iucv_irq_data *data) |
1560 | { | 1560 | { |
@@ -1590,7 +1590,7 @@ struct iucv_path_quiesced { | |||
1590 | u32 res4; | 1590 | u32 res4; |
1591 | u8 ippollfg; | 1591 | u8 ippollfg; |
1592 | u8 res5[3]; | 1592 | u8 res5[3]; |
1593 | } __attribute__ ((packed)); | 1593 | } __packed; |
1594 | 1594 | ||
1595 | static void iucv_path_quiesced(struct iucv_irq_data *data) | 1595 | static void iucv_path_quiesced(struct iucv_irq_data *data) |
1596 | { | 1596 | { |
@@ -1618,7 +1618,7 @@ struct iucv_path_resumed { | |||
1618 | u32 res4; | 1618 | u32 res4; |
1619 | u8 ippollfg; | 1619 | u8 ippollfg; |
1620 | u8 res5[3]; | 1620 | u8 res5[3]; |
1621 | } __attribute__ ((packed)); | 1621 | } __packed; |
1622 | 1622 | ||
1623 | static void iucv_path_resumed(struct iucv_irq_data *data) | 1623 | static void iucv_path_resumed(struct iucv_irq_data *data) |
1624 | { | 1624 | { |
@@ -1649,7 +1649,7 @@ struct iucv_message_complete { | |||
1649 | u32 ipbfln2f; | 1649 | u32 ipbfln2f; |
1650 | u8 ippollfg; | 1650 | u8 ippollfg; |
1651 | u8 res2[3]; | 1651 | u8 res2[3]; |
1652 | } __attribute__ ((packed)); | 1652 | } __packed; |
1653 | 1653 | ||
1654 | static void iucv_message_complete(struct iucv_irq_data *data) | 1654 | static void iucv_message_complete(struct iucv_irq_data *data) |
1655 | { | 1655 | { |
@@ -1694,7 +1694,7 @@ struct iucv_message_pending { | |||
1694 | u32 ipbfln2f; | 1694 | u32 ipbfln2f; |
1695 | u8 ippollfg; | 1695 | u8 ippollfg; |
1696 | u8 res2[3]; | 1696 | u8 res2[3]; |
1697 | } __attribute__ ((packed)); | 1697 | } __packed; |
1698 | 1698 | ||
1699 | static void iucv_message_pending(struct iucv_irq_data *data) | 1699 | static void iucv_message_pending(struct iucv_irq_data *data) |
1700 | { | 1700 | { |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index c7000a6ca379..a2ed0f7b5568 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -600,7 +600,7 @@ struct iapp_layer2_update { | |||
600 | u8 ssap; /* 0 */ | 600 | u8 ssap; /* 0 */ |
601 | u8 control; | 601 | u8 control; |
602 | u8 xid_info[3]; | 602 | u8 xid_info[3]; |
603 | } __attribute__ ((packed)); | 603 | } __packed; |
604 | 604 | ||
605 | static void ieee80211_send_layer2_update(struct sta_info *sta) | 605 | static void ieee80211_send_layer2_update(struct sta_info *sta) |
606 | { | 606 | { |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 1a9e2da37a93..ec3e5c3e27bd 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -1084,7 +1084,7 @@ struct ieee80211_tx_status_rtap_hdr { | |||
1084 | u8 padding_for_rate; | 1084 | u8 padding_for_rate; |
1085 | __le16 tx_flags; | 1085 | __le16 tx_flags; |
1086 | u8 data_retries; | 1086 | u8 data_retries; |
1087 | } __attribute__ ((packed)); | 1087 | } __packed; |
1088 | 1088 | ||
1089 | 1089 | ||
1090 | /* HT */ | 1090 | /* HT */ |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 5e0b65406c44..dd232061e4c4 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -2148,7 +2148,7 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx, | |||
2148 | u8 rate_or_pad; | 2148 | u8 rate_or_pad; |
2149 | __le16 chan_freq; | 2149 | __le16 chan_freq; |
2150 | __le16 chan_flags; | 2150 | __le16 chan_flags; |
2151 | } __attribute__ ((packed)) *rthdr; | 2151 | } __packed *rthdr; |
2152 | struct sk_buff *skb = rx->skb, *skb2; | 2152 | struct sk_buff *skb = rx->skb, *skb2; |
2153 | struct net_device *prev_dev = NULL; | 2153 | struct net_device *prev_dev = NULL; |
2154 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | 2154 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index eeeb8bc73982..77288980fae0 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -619,9 +619,7 @@ struct nf_conn *nf_conntrack_alloc(struct net *net, u16 zone, | |||
619 | ct->tuplehash[IP_CT_DIR_REPLY].hnnode.pprev = NULL; | 619 | ct->tuplehash[IP_CT_DIR_REPLY].hnnode.pprev = NULL; |
620 | /* Don't set timer yet: wait for confirmation */ | 620 | /* Don't set timer yet: wait for confirmation */ |
621 | setup_timer(&ct->timeout, death_by_timeout, (unsigned long)ct); | 621 | setup_timer(&ct->timeout, death_by_timeout, (unsigned long)ct); |
622 | #ifdef CONFIG_NET_NS | 622 | write_pnet(&ct->ct_net, net); |
623 | ct->ct_net = net; | ||
624 | #endif | ||
625 | #ifdef CONFIG_NF_CONNTRACK_ZONES | 623 | #ifdef CONFIG_NF_CONNTRACK_ZONES |
626 | if (zone) { | 624 | if (zone) { |
627 | struct nf_conntrack_zone *nf_ct_zone; | 625 | struct nf_conntrack_zone *nf_ct_zone; |
@@ -1363,9 +1361,7 @@ static int nf_conntrack_init_init_net(void) | |||
1363 | goto err_extend; | 1361 | goto err_extend; |
1364 | #endif | 1362 | #endif |
1365 | /* Set up fake conntrack: to never be deleted, not in any hashes */ | 1363 | /* Set up fake conntrack: to never be deleted, not in any hashes */ |
1366 | #ifdef CONFIG_NET_NS | 1364 | write_pnet(&nf_conntrack_untracked.ct_net, &init_net); |
1367 | nf_conntrack_untracked.ct_net = &init_net; | ||
1368 | #endif | ||
1369 | atomic_set(&nf_conntrack_untracked.ct_general.use, 1); | 1365 | atomic_set(&nf_conntrack_untracked.ct_general.use, 1); |
1370 | /* - and look it like as a confirmed connection */ | 1366 | /* - and look it like as a confirmed connection */ |
1371 | set_bit(IPS_CONFIRMED_BIT, &nf_conntrack_untracked.status); | 1367 | set_bit(IPS_CONFIRMED_BIT, &nf_conntrack_untracked.status); |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 2078a277e06b..9a17f28b1253 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -83,6 +83,7 @@ | |||
83 | #include <linux/if_vlan.h> | 83 | #include <linux/if_vlan.h> |
84 | #include <linux/virtio_net.h> | 84 | #include <linux/virtio_net.h> |
85 | #include <linux/errqueue.h> | 85 | #include <linux/errqueue.h> |
86 | #include <linux/net_tstamp.h> | ||
86 | 87 | ||
87 | #ifdef CONFIG_INET | 88 | #ifdef CONFIG_INET |
88 | #include <net/inet_common.h> | 89 | #include <net/inet_common.h> |
@@ -202,6 +203,7 @@ struct packet_sock { | |||
202 | unsigned int tp_hdrlen; | 203 | unsigned int tp_hdrlen; |
203 | unsigned int tp_reserve; | 204 | unsigned int tp_reserve; |
204 | unsigned int tp_loss:1; | 205 | unsigned int tp_loss:1; |
206 | unsigned int tp_tstamp; | ||
205 | struct packet_type prot_hook ____cacheline_aligned_in_smp; | 207 | struct packet_type prot_hook ____cacheline_aligned_in_smp; |
206 | }; | 208 | }; |
207 | 209 | ||
@@ -656,6 +658,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, | |||
656 | struct sk_buff *copy_skb = NULL; | 658 | struct sk_buff *copy_skb = NULL; |
657 | struct timeval tv; | 659 | struct timeval tv; |
658 | struct timespec ts; | 660 | struct timespec ts; |
661 | struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb); | ||
659 | 662 | ||
660 | if (skb->pkt_type == PACKET_LOOPBACK) | 663 | if (skb->pkt_type == PACKET_LOOPBACK) |
661 | goto drop; | 664 | goto drop; |
@@ -737,7 +740,13 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, | |||
737 | h.h1->tp_snaplen = snaplen; | 740 | h.h1->tp_snaplen = snaplen; |
738 | h.h1->tp_mac = macoff; | 741 | h.h1->tp_mac = macoff; |
739 | h.h1->tp_net = netoff; | 742 | h.h1->tp_net = netoff; |
740 | if (skb->tstamp.tv64) | 743 | if ((po->tp_tstamp & SOF_TIMESTAMPING_SYS_HARDWARE) |
744 | && shhwtstamps->syststamp.tv64) | ||
745 | tv = ktime_to_timeval(shhwtstamps->syststamp); | ||
746 | else if ((po->tp_tstamp & SOF_TIMESTAMPING_RAW_HARDWARE) | ||
747 | && shhwtstamps->hwtstamp.tv64) | ||
748 | tv = ktime_to_timeval(shhwtstamps->hwtstamp); | ||
749 | else if (skb->tstamp.tv64) | ||
741 | tv = ktime_to_timeval(skb->tstamp); | 750 | tv = ktime_to_timeval(skb->tstamp); |
742 | else | 751 | else |
743 | do_gettimeofday(&tv); | 752 | do_gettimeofday(&tv); |
@@ -750,7 +759,13 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, | |||
750 | h.h2->tp_snaplen = snaplen; | 759 | h.h2->tp_snaplen = snaplen; |
751 | h.h2->tp_mac = macoff; | 760 | h.h2->tp_mac = macoff; |
752 | h.h2->tp_net = netoff; | 761 | h.h2->tp_net = netoff; |
753 | if (skb->tstamp.tv64) | 762 | if ((po->tp_tstamp & SOF_TIMESTAMPING_SYS_HARDWARE) |
763 | && shhwtstamps->syststamp.tv64) | ||
764 | ts = ktime_to_timespec(shhwtstamps->syststamp); | ||
765 | else if ((po->tp_tstamp & SOF_TIMESTAMPING_RAW_HARDWARE) | ||
766 | && shhwtstamps->hwtstamp.tv64) | ||
767 | ts = ktime_to_timespec(shhwtstamps->hwtstamp); | ||
768 | else if (skb->tstamp.tv64) | ||
754 | ts = ktime_to_timespec(skb->tstamp); | 769 | ts = ktime_to_timespec(skb->tstamp); |
755 | else | 770 | else |
756 | getnstimeofday(&ts); | 771 | getnstimeofday(&ts); |
@@ -2027,6 +2042,18 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv | |||
2027 | po->has_vnet_hdr = !!val; | 2042 | po->has_vnet_hdr = !!val; |
2028 | return 0; | 2043 | return 0; |
2029 | } | 2044 | } |
2045 | case PACKET_TIMESTAMP: | ||
2046 | { | ||
2047 | int val; | ||
2048 | |||
2049 | if (optlen != sizeof(val)) | ||
2050 | return -EINVAL; | ||
2051 | if (copy_from_user(&val, optval, sizeof(val))) | ||
2052 | return -EFAULT; | ||
2053 | |||
2054 | po->tp_tstamp = val; | ||
2055 | return 0; | ||
2056 | } | ||
2030 | default: | 2057 | default: |
2031 | return -ENOPROTOOPT; | 2058 | return -ENOPROTOOPT; |
2032 | } | 2059 | } |
@@ -2119,6 +2146,12 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, | |||
2119 | val = po->tp_loss; | 2146 | val = po->tp_loss; |
2120 | data = &val; | 2147 | data = &val; |
2121 | break; | 2148 | break; |
2149 | case PACKET_TIMESTAMP: | ||
2150 | if (len > sizeof(int)) | ||
2151 | len = sizeof(int); | ||
2152 | val = po->tp_tstamp; | ||
2153 | data = &val; | ||
2154 | break; | ||
2122 | default: | 2155 | default: |
2123 | return -ENOPROTOOPT; | 2156 | return -ENOPROTOOPT; |
2124 | } | 2157 | } |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index a63029ef3edd..d20fcd2a5519 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -205,7 +205,7 @@ void __qdisc_run(struct Qdisc *q) | |||
205 | } | 205 | } |
206 | } | 206 | } |
207 | 207 | ||
208 | clear_bit(__QDISC_STATE_RUNNING, &q->state); | 208 | qdisc_run_end(q); |
209 | } | 209 | } |
210 | 210 | ||
211 | unsigned long dev_trans_start(struct net_device *dev) | 211 | unsigned long dev_trans_start(struct net_device *dev) |
@@ -327,6 +327,24 @@ void netif_carrier_off(struct net_device *dev) | |||
327 | } | 327 | } |
328 | EXPORT_SYMBOL(netif_carrier_off); | 328 | EXPORT_SYMBOL(netif_carrier_off); |
329 | 329 | ||
330 | /** | ||
331 | * netif_notify_peers - notify network peers about existence of @dev | ||
332 | * @dev: network device | ||
333 | * | ||
334 | * Generate traffic such that interested network peers are aware of | ||
335 | * @dev, such as by generating a gratuitous ARP. This may be used when | ||
336 | * a device wants to inform the rest of the network about some sort of | ||
337 | * reconfiguration such as a failover event or virtual machine | ||
338 | * migration. | ||
339 | */ | ||
340 | void netif_notify_peers(struct net_device *dev) | ||
341 | { | ||
342 | rtnl_lock(); | ||
343 | call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, dev); | ||
344 | rtnl_unlock(); | ||
345 | } | ||
346 | EXPORT_SYMBOL(netif_notify_peers); | ||
347 | |||
330 | /* "NOOP" scheduler: the best scheduler, recommended for all interfaces | 348 | /* "NOOP" scheduler: the best scheduler, recommended for all interfaces |
331 | under all circumstances. It is difficult to invent anything faster or | 349 | under all circumstances. It is difficult to invent anything faster or |
332 | cheaper. | 350 | cheaper. |
@@ -543,6 +561,7 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, | |||
543 | 561 | ||
544 | INIT_LIST_HEAD(&sch->list); | 562 | INIT_LIST_HEAD(&sch->list); |
545 | skb_queue_head_init(&sch->q); | 563 | skb_queue_head_init(&sch->q); |
564 | spin_lock_init(&sch->busylock); | ||
546 | sch->ops = ops; | 565 | sch->ops = ops; |
547 | sch->enqueue = ops->enqueue; | 566 | sch->enqueue = ops->enqueue; |
548 | sch->dequeue = ops->dequeue; | 567 | sch->dequeue = ops->dequeue; |
@@ -779,7 +798,7 @@ static bool some_qdisc_is_busy(struct net_device *dev) | |||
779 | 798 | ||
780 | spin_lock_bh(root_lock); | 799 | spin_lock_bh(root_lock); |
781 | 800 | ||
782 | val = (test_bit(__QDISC_STATE_RUNNING, &q->state) || | 801 | val = (qdisc_is_running(q) || |
783 | test_bit(__QDISC_STATE_SCHED, &q->state)); | 802 | test_bit(__QDISC_STATE_SCHED, &q->state)); |
784 | 803 | ||
785 | spin_unlock_bh(root_lock); | 804 | spin_unlock_bh(root_lock); |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index bd2a50b482ac..246f92924658 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -1817,7 +1817,7 @@ malformed: | |||
1817 | struct __sctp_missing { | 1817 | struct __sctp_missing { |
1818 | __be32 num_missing; | 1818 | __be32 num_missing; |
1819 | __be16 type; | 1819 | __be16 type; |
1820 | } __attribute__((packed)); | 1820 | } __packed; |
1821 | 1821 | ||
1822 | /* | 1822 | /* |
1823 | * Report a missing mandatory parameter. | 1823 | * Report a missing mandatory parameter. |
diff --git a/net/socket.c b/net/socket.c index 367d5477d00f..acfa1738663d 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -124,7 +124,7 @@ static int sock_fasync(int fd, struct file *filp, int on); | |||
124 | static ssize_t sock_sendpage(struct file *file, struct page *page, | 124 | static ssize_t sock_sendpage(struct file *file, struct page *page, |
125 | int offset, size_t size, loff_t *ppos, int more); | 125 | int offset, size_t size, loff_t *ppos, int more); |
126 | static ssize_t sock_splice_read(struct file *file, loff_t *ppos, | 126 | static ssize_t sock_splice_read(struct file *file, loff_t *ppos, |
127 | struct pipe_inode_info *pipe, size_t len, | 127 | struct pipe_inode_info *pipe, size_t len, |
128 | unsigned int flags); | 128 | unsigned int flags); |
129 | 129 | ||
130 | /* | 130 | /* |
@@ -162,7 +162,7 @@ static const struct net_proto_family *net_families[NPROTO] __read_mostly; | |||
162 | * Statistics counters of the socket lists | 162 | * Statistics counters of the socket lists |
163 | */ | 163 | */ |
164 | 164 | ||
165 | static DEFINE_PER_CPU(int, sockets_in_use) = 0; | 165 | static DEFINE_PER_CPU(int, sockets_in_use); |
166 | 166 | ||
167 | /* | 167 | /* |
168 | * Support routines. | 168 | * Support routines. |
@@ -309,9 +309,9 @@ static int init_inodecache(void) | |||
309 | } | 309 | } |
310 | 310 | ||
311 | static const struct super_operations sockfs_ops = { | 311 | static const struct super_operations sockfs_ops = { |
312 | .alloc_inode = sock_alloc_inode, | 312 | .alloc_inode = sock_alloc_inode, |
313 | .destroy_inode =sock_destroy_inode, | 313 | .destroy_inode = sock_destroy_inode, |
314 | .statfs = simple_statfs, | 314 | .statfs = simple_statfs, |
315 | }; | 315 | }; |
316 | 316 | ||
317 | static int sockfs_get_sb(struct file_system_type *fs_type, | 317 | static int sockfs_get_sb(struct file_system_type *fs_type, |
@@ -411,6 +411,7 @@ int sock_map_fd(struct socket *sock, int flags) | |||
411 | 411 | ||
412 | return fd; | 412 | return fd; |
413 | } | 413 | } |
414 | EXPORT_SYMBOL(sock_map_fd); | ||
414 | 415 | ||
415 | static struct socket *sock_from_file(struct file *file, int *err) | 416 | static struct socket *sock_from_file(struct file *file, int *err) |
416 | { | 417 | { |
@@ -422,7 +423,7 @@ static struct socket *sock_from_file(struct file *file, int *err) | |||
422 | } | 423 | } |
423 | 424 | ||
424 | /** | 425 | /** |
425 | * sockfd_lookup - Go from a file number to its socket slot | 426 | * sockfd_lookup - Go from a file number to its socket slot |
426 | * @fd: file handle | 427 | * @fd: file handle |
427 | * @err: pointer to an error code return | 428 | * @err: pointer to an error code return |
428 | * | 429 | * |
@@ -450,6 +451,7 @@ struct socket *sockfd_lookup(int fd, int *err) | |||
450 | fput(file); | 451 | fput(file); |
451 | return sock; | 452 | return sock; |
452 | } | 453 | } |
454 | EXPORT_SYMBOL(sockfd_lookup); | ||
453 | 455 | ||
454 | static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed) | 456 | static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed) |
455 | { | 457 | { |
@@ -540,6 +542,7 @@ void sock_release(struct socket *sock) | |||
540 | } | 542 | } |
541 | sock->file = NULL; | 543 | sock->file = NULL; |
542 | } | 544 | } |
545 | EXPORT_SYMBOL(sock_release); | ||
543 | 546 | ||
544 | int sock_tx_timestamp(struct msghdr *msg, struct sock *sk, | 547 | int sock_tx_timestamp(struct msghdr *msg, struct sock *sk, |
545 | union skb_shared_tx *shtx) | 548 | union skb_shared_tx *shtx) |
@@ -586,6 +589,7 @@ int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) | |||
586 | ret = wait_on_sync_kiocb(&iocb); | 589 | ret = wait_on_sync_kiocb(&iocb); |
587 | return ret; | 590 | return ret; |
588 | } | 591 | } |
592 | EXPORT_SYMBOL(sock_sendmsg); | ||
589 | 593 | ||
590 | int kernel_sendmsg(struct socket *sock, struct msghdr *msg, | 594 | int kernel_sendmsg(struct socket *sock, struct msghdr *msg, |
591 | struct kvec *vec, size_t num, size_t size) | 595 | struct kvec *vec, size_t num, size_t size) |
@@ -604,6 +608,7 @@ int kernel_sendmsg(struct socket *sock, struct msghdr *msg, | |||
604 | set_fs(oldfs); | 608 | set_fs(oldfs); |
605 | return result; | 609 | return result; |
606 | } | 610 | } |
611 | EXPORT_SYMBOL(kernel_sendmsg); | ||
607 | 612 | ||
608 | static int ktime2ts(ktime_t kt, struct timespec *ts) | 613 | static int ktime2ts(ktime_t kt, struct timespec *ts) |
609 | { | 614 | { |
@@ -664,7 +669,6 @@ void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, | |||
664 | put_cmsg(msg, SOL_SOCKET, | 669 | put_cmsg(msg, SOL_SOCKET, |
665 | SCM_TIMESTAMPING, sizeof(ts), &ts); | 670 | SCM_TIMESTAMPING, sizeof(ts), &ts); |
666 | } | 671 | } |
667 | |||
668 | EXPORT_SYMBOL_GPL(__sock_recv_timestamp); | 672 | EXPORT_SYMBOL_GPL(__sock_recv_timestamp); |
669 | 673 | ||
670 | inline void sock_recv_drops(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) | 674 | inline void sock_recv_drops(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) |
@@ -720,6 +724,7 @@ int sock_recvmsg(struct socket *sock, struct msghdr *msg, | |||
720 | ret = wait_on_sync_kiocb(&iocb); | 724 | ret = wait_on_sync_kiocb(&iocb); |
721 | return ret; | 725 | return ret; |
722 | } | 726 | } |
727 | EXPORT_SYMBOL(sock_recvmsg); | ||
723 | 728 | ||
724 | static int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg, | 729 | static int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg, |
725 | size_t size, int flags) | 730 | size_t size, int flags) |
@@ -752,6 +757,7 @@ int kernel_recvmsg(struct socket *sock, struct msghdr *msg, | |||
752 | set_fs(oldfs); | 757 | set_fs(oldfs); |
753 | return result; | 758 | return result; |
754 | } | 759 | } |
760 | EXPORT_SYMBOL(kernel_recvmsg); | ||
755 | 761 | ||
756 | static void sock_aio_dtor(struct kiocb *iocb) | 762 | static void sock_aio_dtor(struct kiocb *iocb) |
757 | { | 763 | { |
@@ -774,7 +780,7 @@ static ssize_t sock_sendpage(struct file *file, struct page *page, | |||
774 | } | 780 | } |
775 | 781 | ||
776 | static ssize_t sock_splice_read(struct file *file, loff_t *ppos, | 782 | static ssize_t sock_splice_read(struct file *file, loff_t *ppos, |
777 | struct pipe_inode_info *pipe, size_t len, | 783 | struct pipe_inode_info *pipe, size_t len, |
778 | unsigned int flags) | 784 | unsigned int flags) |
779 | { | 785 | { |
780 | struct socket *sock = file->private_data; | 786 | struct socket *sock = file->private_data; |
@@ -887,7 +893,7 @@ static ssize_t sock_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
887 | */ | 893 | */ |
888 | 894 | ||
889 | static DEFINE_MUTEX(br_ioctl_mutex); | 895 | static DEFINE_MUTEX(br_ioctl_mutex); |
890 | static int (*br_ioctl_hook) (struct net *, unsigned int cmd, void __user *arg) = NULL; | 896 | static int (*br_ioctl_hook) (struct net *, unsigned int cmd, void __user *arg); |
891 | 897 | ||
892 | void brioctl_set(int (*hook) (struct net *, unsigned int, void __user *)) | 898 | void brioctl_set(int (*hook) (struct net *, unsigned int, void __user *)) |
893 | { | 899 | { |
@@ -895,7 +901,6 @@ void brioctl_set(int (*hook) (struct net *, unsigned int, void __user *)) | |||
895 | br_ioctl_hook = hook; | 901 | br_ioctl_hook = hook; |
896 | mutex_unlock(&br_ioctl_mutex); | 902 | mutex_unlock(&br_ioctl_mutex); |
897 | } | 903 | } |
898 | |||
899 | EXPORT_SYMBOL(brioctl_set); | 904 | EXPORT_SYMBOL(brioctl_set); |
900 | 905 | ||
901 | static DEFINE_MUTEX(vlan_ioctl_mutex); | 906 | static DEFINE_MUTEX(vlan_ioctl_mutex); |
@@ -907,7 +912,6 @@ void vlan_ioctl_set(int (*hook) (struct net *, void __user *)) | |||
907 | vlan_ioctl_hook = hook; | 912 | vlan_ioctl_hook = hook; |
908 | mutex_unlock(&vlan_ioctl_mutex); | 913 | mutex_unlock(&vlan_ioctl_mutex); |
909 | } | 914 | } |
910 | |||
911 | EXPORT_SYMBOL(vlan_ioctl_set); | 915 | EXPORT_SYMBOL(vlan_ioctl_set); |
912 | 916 | ||
913 | static DEFINE_MUTEX(dlci_ioctl_mutex); | 917 | static DEFINE_MUTEX(dlci_ioctl_mutex); |
@@ -919,7 +923,6 @@ void dlci_ioctl_set(int (*hook) (unsigned int, void __user *)) | |||
919 | dlci_ioctl_hook = hook; | 923 | dlci_ioctl_hook = hook; |
920 | mutex_unlock(&dlci_ioctl_mutex); | 924 | mutex_unlock(&dlci_ioctl_mutex); |
921 | } | 925 | } |
922 | |||
923 | EXPORT_SYMBOL(dlci_ioctl_set); | 926 | EXPORT_SYMBOL(dlci_ioctl_set); |
924 | 927 | ||
925 | static long sock_do_ioctl(struct net *net, struct socket *sock, | 928 | static long sock_do_ioctl(struct net *net, struct socket *sock, |
@@ -1047,6 +1050,7 @@ out_release: | |||
1047 | sock = NULL; | 1050 | sock = NULL; |
1048 | goto out; | 1051 | goto out; |
1049 | } | 1052 | } |
1053 | EXPORT_SYMBOL(sock_create_lite); | ||
1050 | 1054 | ||
1051 | /* No kernel lock held - perfect */ | 1055 | /* No kernel lock held - perfect */ |
1052 | static unsigned int sock_poll(struct file *file, poll_table *wait) | 1056 | static unsigned int sock_poll(struct file *file, poll_table *wait) |
@@ -1147,6 +1151,7 @@ call_kill: | |||
1147 | rcu_read_unlock(); | 1151 | rcu_read_unlock(); |
1148 | return 0; | 1152 | return 0; |
1149 | } | 1153 | } |
1154 | EXPORT_SYMBOL(sock_wake_async); | ||
1150 | 1155 | ||
1151 | static int __sock_create(struct net *net, int family, int type, int protocol, | 1156 | static int __sock_create(struct net *net, int family, int type, int protocol, |
1152 | struct socket **res, int kern) | 1157 | struct socket **res, int kern) |
@@ -1265,11 +1270,13 @@ int sock_create(int family, int type, int protocol, struct socket **res) | |||
1265 | { | 1270 | { |
1266 | return __sock_create(current->nsproxy->net_ns, family, type, protocol, res, 0); | 1271 | return __sock_create(current->nsproxy->net_ns, family, type, protocol, res, 0); |
1267 | } | 1272 | } |
1273 | EXPORT_SYMBOL(sock_create); | ||
1268 | 1274 | ||
1269 | int sock_create_kern(int family, int type, int protocol, struct socket **res) | 1275 | int sock_create_kern(int family, int type, int protocol, struct socket **res) |
1270 | { | 1276 | { |
1271 | return __sock_create(&init_net, family, type, protocol, res, 1); | 1277 | return __sock_create(&init_net, family, type, protocol, res, 1); |
1272 | } | 1278 | } |
1279 | EXPORT_SYMBOL(sock_create_kern); | ||
1273 | 1280 | ||
1274 | SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol) | 1281 | SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol) |
1275 | { | 1282 | { |
@@ -1474,7 +1481,8 @@ SYSCALL_DEFINE4(accept4, int, fd, struct sockaddr __user *, upeer_sockaddr, | |||
1474 | goto out; | 1481 | goto out; |
1475 | 1482 | ||
1476 | err = -ENFILE; | 1483 | err = -ENFILE; |
1477 | if (!(newsock = sock_alloc())) | 1484 | newsock = sock_alloc(); |
1485 | if (!newsock) | ||
1478 | goto out_put; | 1486 | goto out_put; |
1479 | 1487 | ||
1480 | newsock->type = sock->type; | 1488 | newsock->type = sock->type; |
@@ -1861,8 +1869,7 @@ SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned, flags) | |||
1861 | if (MSG_CMSG_COMPAT & flags) { | 1869 | if (MSG_CMSG_COMPAT & flags) { |
1862 | if (get_compat_msghdr(&msg_sys, msg_compat)) | 1870 | if (get_compat_msghdr(&msg_sys, msg_compat)) |
1863 | return -EFAULT; | 1871 | return -EFAULT; |
1864 | } | 1872 | } else if (copy_from_user(&msg_sys, msg, sizeof(struct msghdr))) |
1865 | else if (copy_from_user(&msg_sys, msg, sizeof(struct msghdr))) | ||
1866 | return -EFAULT; | 1873 | return -EFAULT; |
1867 | 1874 | ||
1868 | sock = sockfd_lookup_light(fd, &err, &fput_needed); | 1875 | sock = sockfd_lookup_light(fd, &err, &fput_needed); |
@@ -1964,8 +1971,7 @@ static int __sys_recvmsg(struct socket *sock, struct msghdr __user *msg, | |||
1964 | if (MSG_CMSG_COMPAT & flags) { | 1971 | if (MSG_CMSG_COMPAT & flags) { |
1965 | if (get_compat_msghdr(msg_sys, msg_compat)) | 1972 | if (get_compat_msghdr(msg_sys, msg_compat)) |
1966 | return -EFAULT; | 1973 | return -EFAULT; |
1967 | } | 1974 | } else if (copy_from_user(msg_sys, msg, sizeof(struct msghdr))) |
1968 | else if (copy_from_user(msg_sys, msg, sizeof(struct msghdr))) | ||
1969 | return -EFAULT; | 1975 | return -EFAULT; |
1970 | 1976 | ||
1971 | err = -EMSGSIZE; | 1977 | err = -EMSGSIZE; |
@@ -2191,10 +2197,10 @@ SYSCALL_DEFINE5(recvmmsg, int, fd, struct mmsghdr __user *, mmsg, | |||
2191 | /* Argument list sizes for sys_socketcall */ | 2197 | /* Argument list sizes for sys_socketcall */ |
2192 | #define AL(x) ((x) * sizeof(unsigned long)) | 2198 | #define AL(x) ((x) * sizeof(unsigned long)) |
2193 | static const unsigned char nargs[20] = { | 2199 | static const unsigned char nargs[20] = { |
2194 | AL(0),AL(3),AL(3),AL(3),AL(2),AL(3), | 2200 | AL(0), AL(3), AL(3), AL(3), AL(2), AL(3), |
2195 | AL(3),AL(3),AL(4),AL(4),AL(4),AL(6), | 2201 | AL(3), AL(3), AL(4), AL(4), AL(4), AL(6), |
2196 | AL(6),AL(2),AL(5),AL(5),AL(3),AL(3), | 2202 | AL(6), AL(2), AL(5), AL(5), AL(3), AL(3), |
2197 | AL(4),AL(5) | 2203 | AL(4), AL(5) |
2198 | }; | 2204 | }; |
2199 | 2205 | ||
2200 | #undef AL | 2206 | #undef AL |
@@ -2340,6 +2346,7 @@ int sock_register(const struct net_proto_family *ops) | |||
2340 | printk(KERN_INFO "NET: Registered protocol family %d\n", ops->family); | 2346 | printk(KERN_INFO "NET: Registered protocol family %d\n", ops->family); |
2341 | return err; | 2347 | return err; |
2342 | } | 2348 | } |
2349 | EXPORT_SYMBOL(sock_register); | ||
2343 | 2350 | ||
2344 | /** | 2351 | /** |
2345 | * sock_unregister - remove a protocol handler | 2352 | * sock_unregister - remove a protocol handler |
@@ -2366,6 +2373,7 @@ void sock_unregister(int family) | |||
2366 | 2373 | ||
2367 | printk(KERN_INFO "NET: Unregistered protocol family %d\n", family); | 2374 | printk(KERN_INFO "NET: Unregistered protocol family %d\n", family); |
2368 | } | 2375 | } |
2376 | EXPORT_SYMBOL(sock_unregister); | ||
2369 | 2377 | ||
2370 | static int __init sock_init(void) | 2378 | static int __init sock_init(void) |
2371 | { | 2379 | { |
@@ -2490,13 +2498,13 @@ static int dev_ifconf(struct net *net, struct compat_ifconf __user *uifc32) | |||
2490 | ifc.ifc_req = NULL; | 2498 | ifc.ifc_req = NULL; |
2491 | uifc = compat_alloc_user_space(sizeof(struct ifconf)); | 2499 | uifc = compat_alloc_user_space(sizeof(struct ifconf)); |
2492 | } else { | 2500 | } else { |
2493 | size_t len =((ifc32.ifc_len / sizeof (struct compat_ifreq)) + 1) * | 2501 | size_t len = ((ifc32.ifc_len / sizeof(struct compat_ifreq)) + 1) * |
2494 | sizeof (struct ifreq); | 2502 | sizeof(struct ifreq); |
2495 | uifc = compat_alloc_user_space(sizeof(struct ifconf) + len); | 2503 | uifc = compat_alloc_user_space(sizeof(struct ifconf) + len); |
2496 | ifc.ifc_len = len; | 2504 | ifc.ifc_len = len; |
2497 | ifr = ifc.ifc_req = (void __user *)(uifc + 1); | 2505 | ifr = ifc.ifc_req = (void __user *)(uifc + 1); |
2498 | ifr32 = compat_ptr(ifc32.ifcbuf); | 2506 | ifr32 = compat_ptr(ifc32.ifcbuf); |
2499 | for (i = 0; i < ifc32.ifc_len; i += sizeof (struct compat_ifreq)) { | 2507 | for (i = 0; i < ifc32.ifc_len; i += sizeof(struct compat_ifreq)) { |
2500 | if (copy_in_user(ifr, ifr32, sizeof(struct compat_ifreq))) | 2508 | if (copy_in_user(ifr, ifr32, sizeof(struct compat_ifreq))) |
2501 | return -EFAULT; | 2509 | return -EFAULT; |
2502 | ifr++; | 2510 | ifr++; |
@@ -2516,9 +2524,9 @@ static int dev_ifconf(struct net *net, struct compat_ifconf __user *uifc32) | |||
2516 | ifr = ifc.ifc_req; | 2524 | ifr = ifc.ifc_req; |
2517 | ifr32 = compat_ptr(ifc32.ifcbuf); | 2525 | ifr32 = compat_ptr(ifc32.ifcbuf); |
2518 | for (i = 0, j = 0; | 2526 | for (i = 0, j = 0; |
2519 | i + sizeof (struct compat_ifreq) <= ifc32.ifc_len && j < ifc.ifc_len; | 2527 | i + sizeof(struct compat_ifreq) <= ifc32.ifc_len && j < ifc.ifc_len; |
2520 | i += sizeof (struct compat_ifreq), j += sizeof (struct ifreq)) { | 2528 | i += sizeof(struct compat_ifreq), j += sizeof(struct ifreq)) { |
2521 | if (copy_in_user(ifr32, ifr, sizeof (struct compat_ifreq))) | 2529 | if (copy_in_user(ifr32, ifr, sizeof(struct compat_ifreq))) |
2522 | return -EFAULT; | 2530 | return -EFAULT; |
2523 | ifr32++; | 2531 | ifr32++; |
2524 | ifr++; | 2532 | ifr++; |
@@ -2567,7 +2575,7 @@ static int compat_siocwandev(struct net *net, struct compat_ifreq __user *uifr32 | |||
2567 | compat_uptr_t uptr32; | 2575 | compat_uptr_t uptr32; |
2568 | struct ifreq __user *uifr; | 2576 | struct ifreq __user *uifr; |
2569 | 2577 | ||
2570 | uifr = compat_alloc_user_space(sizeof (*uifr)); | 2578 | uifr = compat_alloc_user_space(sizeof(*uifr)); |
2571 | if (copy_in_user(uifr, uifr32, sizeof(struct compat_ifreq))) | 2579 | if (copy_in_user(uifr, uifr32, sizeof(struct compat_ifreq))) |
2572 | return -EFAULT; | 2580 | return -EFAULT; |
2573 | 2581 | ||
@@ -2601,9 +2609,9 @@ static int bond_ioctl(struct net *net, unsigned int cmd, | |||
2601 | return -EFAULT; | 2609 | return -EFAULT; |
2602 | 2610 | ||
2603 | old_fs = get_fs(); | 2611 | old_fs = get_fs(); |
2604 | set_fs (KERNEL_DS); | 2612 | set_fs(KERNEL_DS); |
2605 | err = dev_ioctl(net, cmd, &kifr); | 2613 | err = dev_ioctl(net, cmd, &kifr); |
2606 | set_fs (old_fs); | 2614 | set_fs(old_fs); |
2607 | 2615 | ||
2608 | return err; | 2616 | return err; |
2609 | case SIOCBONDSLAVEINFOQUERY: | 2617 | case SIOCBONDSLAVEINFOQUERY: |
@@ -2710,9 +2718,9 @@ static int compat_sioc_ifmap(struct net *net, unsigned int cmd, | |||
2710 | return -EFAULT; | 2718 | return -EFAULT; |
2711 | 2719 | ||
2712 | old_fs = get_fs(); | 2720 | old_fs = get_fs(); |
2713 | set_fs (KERNEL_DS); | 2721 | set_fs(KERNEL_DS); |
2714 | err = dev_ioctl(net, cmd, (void __user *)&ifr); | 2722 | err = dev_ioctl(net, cmd, (void __user *)&ifr); |
2715 | set_fs (old_fs); | 2723 | set_fs(old_fs); |
2716 | 2724 | ||
2717 | if (cmd == SIOCGIFMAP && !err) { | 2725 | if (cmd == SIOCGIFMAP && !err) { |
2718 | err = copy_to_user(uifr32, &ifr, sizeof(ifr.ifr_name)); | 2726 | err = copy_to_user(uifr32, &ifr, sizeof(ifr.ifr_name)); |
@@ -2734,7 +2742,7 @@ static int compat_siocshwtstamp(struct net *net, struct compat_ifreq __user *uif | |||
2734 | compat_uptr_t uptr32; | 2742 | compat_uptr_t uptr32; |
2735 | struct ifreq __user *uifr; | 2743 | struct ifreq __user *uifr; |
2736 | 2744 | ||
2737 | uifr = compat_alloc_user_space(sizeof (*uifr)); | 2745 | uifr = compat_alloc_user_space(sizeof(*uifr)); |
2738 | if (copy_in_user(uifr, uifr32, sizeof(struct compat_ifreq))) | 2746 | if (copy_in_user(uifr, uifr32, sizeof(struct compat_ifreq))) |
2739 | return -EFAULT; | 2747 | return -EFAULT; |
2740 | 2748 | ||
@@ -2750,20 +2758,20 @@ static int compat_siocshwtstamp(struct net *net, struct compat_ifreq __user *uif | |||
2750 | } | 2758 | } |
2751 | 2759 | ||
2752 | struct rtentry32 { | 2760 | struct rtentry32 { |
2753 | u32 rt_pad1; | 2761 | u32 rt_pad1; |
2754 | struct sockaddr rt_dst; /* target address */ | 2762 | struct sockaddr rt_dst; /* target address */ |
2755 | struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */ | 2763 | struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */ |
2756 | struct sockaddr rt_genmask; /* target network mask (IP) */ | 2764 | struct sockaddr rt_genmask; /* target network mask (IP) */ |
2757 | unsigned short rt_flags; | 2765 | unsigned short rt_flags; |
2758 | short rt_pad2; | 2766 | short rt_pad2; |
2759 | u32 rt_pad3; | 2767 | u32 rt_pad3; |
2760 | unsigned char rt_tos; | 2768 | unsigned char rt_tos; |
2761 | unsigned char rt_class; | 2769 | unsigned char rt_class; |
2762 | short rt_pad4; | 2770 | short rt_pad4; |
2763 | short rt_metric; /* +1 for binary compatibility! */ | 2771 | short rt_metric; /* +1 for binary compatibility! */ |
2764 | /* char * */ u32 rt_dev; /* forcing the device at add */ | 2772 | /* char * */ u32 rt_dev; /* forcing the device at add */ |
2765 | u32 rt_mtu; /* per route MTU/Window */ | 2773 | u32 rt_mtu; /* per route MTU/Window */ |
2766 | u32 rt_window; /* Window clamping */ | 2774 | u32 rt_window; /* Window clamping */ |
2767 | unsigned short rt_irtt; /* Initial RTT */ | 2775 | unsigned short rt_irtt; /* Initial RTT */ |
2768 | }; | 2776 | }; |
2769 | 2777 | ||
@@ -2793,29 +2801,29 @@ static int routing_ioctl(struct net *net, struct socket *sock, | |||
2793 | 2801 | ||
2794 | if (sock && sock->sk && sock->sk->sk_family == AF_INET6) { /* ipv6 */ | 2802 | if (sock && sock->sk && sock->sk->sk_family == AF_INET6) { /* ipv6 */ |
2795 | struct in6_rtmsg32 __user *ur6 = argp; | 2803 | struct in6_rtmsg32 __user *ur6 = argp; |
2796 | ret = copy_from_user (&r6.rtmsg_dst, &(ur6->rtmsg_dst), | 2804 | ret = copy_from_user(&r6.rtmsg_dst, &(ur6->rtmsg_dst), |
2797 | 3 * sizeof(struct in6_addr)); | 2805 | 3 * sizeof(struct in6_addr)); |
2798 | ret |= __get_user (r6.rtmsg_type, &(ur6->rtmsg_type)); | 2806 | ret |= __get_user(r6.rtmsg_type, &(ur6->rtmsg_type)); |
2799 | ret |= __get_user (r6.rtmsg_dst_len, &(ur6->rtmsg_dst_len)); | 2807 | ret |= __get_user(r6.rtmsg_dst_len, &(ur6->rtmsg_dst_len)); |
2800 | ret |= __get_user (r6.rtmsg_src_len, &(ur6->rtmsg_src_len)); | 2808 | ret |= __get_user(r6.rtmsg_src_len, &(ur6->rtmsg_src_len)); |
2801 | ret |= __get_user (r6.rtmsg_metric, &(ur6->rtmsg_metric)); | 2809 | ret |= __get_user(r6.rtmsg_metric, &(ur6->rtmsg_metric)); |
2802 | ret |= __get_user (r6.rtmsg_info, &(ur6->rtmsg_info)); | 2810 | ret |= __get_user(r6.rtmsg_info, &(ur6->rtmsg_info)); |
2803 | ret |= __get_user (r6.rtmsg_flags, &(ur6->rtmsg_flags)); | 2811 | ret |= __get_user(r6.rtmsg_flags, &(ur6->rtmsg_flags)); |
2804 | ret |= __get_user (r6.rtmsg_ifindex, &(ur6->rtmsg_ifindex)); | 2812 | ret |= __get_user(r6.rtmsg_ifindex, &(ur6->rtmsg_ifindex)); |
2805 | 2813 | ||
2806 | r = (void *) &r6; | 2814 | r = (void *) &r6; |
2807 | } else { /* ipv4 */ | 2815 | } else { /* ipv4 */ |
2808 | struct rtentry32 __user *ur4 = argp; | 2816 | struct rtentry32 __user *ur4 = argp; |
2809 | ret = copy_from_user (&r4.rt_dst, &(ur4->rt_dst), | 2817 | ret = copy_from_user(&r4.rt_dst, &(ur4->rt_dst), |
2810 | 3 * sizeof(struct sockaddr)); | 2818 | 3 * sizeof(struct sockaddr)); |
2811 | ret |= __get_user (r4.rt_flags, &(ur4->rt_flags)); | 2819 | ret |= __get_user(r4.rt_flags, &(ur4->rt_flags)); |
2812 | ret |= __get_user (r4.rt_metric, &(ur4->rt_metric)); | 2820 | ret |= __get_user(r4.rt_metric, &(ur4->rt_metric)); |
2813 | ret |= __get_user (r4.rt_mtu, &(ur4->rt_mtu)); | 2821 | ret |= __get_user(r4.rt_mtu, &(ur4->rt_mtu)); |
2814 | ret |= __get_user (r4.rt_window, &(ur4->rt_window)); | 2822 | ret |= __get_user(r4.rt_window, &(ur4->rt_window)); |
2815 | ret |= __get_user (r4.rt_irtt, &(ur4->rt_irtt)); | 2823 | ret |= __get_user(r4.rt_irtt, &(ur4->rt_irtt)); |
2816 | ret |= __get_user (rtdev, &(ur4->rt_dev)); | 2824 | ret |= __get_user(rtdev, &(ur4->rt_dev)); |
2817 | if (rtdev) { | 2825 | if (rtdev) { |
2818 | ret |= copy_from_user (devname, compat_ptr(rtdev), 15); | 2826 | ret |= copy_from_user(devname, compat_ptr(rtdev), 15); |
2819 | r4.rt_dev = devname; devname[15] = 0; | 2827 | r4.rt_dev = devname; devname[15] = 0; |
2820 | } else | 2828 | } else |
2821 | r4.rt_dev = NULL; | 2829 | r4.rt_dev = NULL; |
@@ -2828,9 +2836,9 @@ static int routing_ioctl(struct net *net, struct socket *sock, | |||
2828 | goto out; | 2836 | goto out; |
2829 | } | 2837 | } |
2830 | 2838 | ||
2831 | set_fs (KERNEL_DS); | 2839 | set_fs(KERNEL_DS); |
2832 | ret = sock_do_ioctl(net, sock, cmd, (unsigned long) r); | 2840 | ret = sock_do_ioctl(net, sock, cmd, (unsigned long) r); |
2833 | set_fs (old_fs); | 2841 | set_fs(old_fs); |
2834 | 2842 | ||
2835 | out: | 2843 | out: |
2836 | return ret; | 2844 | return ret; |
@@ -2993,11 +3001,13 @@ int kernel_bind(struct socket *sock, struct sockaddr *addr, int addrlen) | |||
2993 | { | 3001 | { |
2994 | return sock->ops->bind(sock, addr, addrlen); | 3002 | return sock->ops->bind(sock, addr, addrlen); |
2995 | } | 3003 | } |
3004 | EXPORT_SYMBOL(kernel_bind); | ||
2996 | 3005 | ||
2997 | int kernel_listen(struct socket *sock, int backlog) | 3006 | int kernel_listen(struct socket *sock, int backlog) |
2998 | { | 3007 | { |
2999 | return sock->ops->listen(sock, backlog); | 3008 | return sock->ops->listen(sock, backlog); |
3000 | } | 3009 | } |
3010 | EXPORT_SYMBOL(kernel_listen); | ||
3001 | 3011 | ||
3002 | int kernel_accept(struct socket *sock, struct socket **newsock, int flags) | 3012 | int kernel_accept(struct socket *sock, struct socket **newsock, int flags) |
3003 | { | 3013 | { |
@@ -3022,24 +3032,28 @@ int kernel_accept(struct socket *sock, struct socket **newsock, int flags) | |||
3022 | done: | 3032 | done: |
3023 | return err; | 3033 | return err; |
3024 | } | 3034 | } |
3035 | EXPORT_SYMBOL(kernel_accept); | ||
3025 | 3036 | ||
3026 | int kernel_connect(struct socket *sock, struct sockaddr *addr, int addrlen, | 3037 | int kernel_connect(struct socket *sock, struct sockaddr *addr, int addrlen, |
3027 | int flags) | 3038 | int flags) |
3028 | { | 3039 | { |
3029 | return sock->ops->connect(sock, addr, addrlen, flags); | 3040 | return sock->ops->connect(sock, addr, addrlen, flags); |
3030 | } | 3041 | } |
3042 | EXPORT_SYMBOL(kernel_connect); | ||
3031 | 3043 | ||
3032 | int kernel_getsockname(struct socket *sock, struct sockaddr *addr, | 3044 | int kernel_getsockname(struct socket *sock, struct sockaddr *addr, |
3033 | int *addrlen) | 3045 | int *addrlen) |
3034 | { | 3046 | { |
3035 | return sock->ops->getname(sock, addr, addrlen, 0); | 3047 | return sock->ops->getname(sock, addr, addrlen, 0); |
3036 | } | 3048 | } |
3049 | EXPORT_SYMBOL(kernel_getsockname); | ||
3037 | 3050 | ||
3038 | int kernel_getpeername(struct socket *sock, struct sockaddr *addr, | 3051 | int kernel_getpeername(struct socket *sock, struct sockaddr *addr, |
3039 | int *addrlen) | 3052 | int *addrlen) |
3040 | { | 3053 | { |
3041 | return sock->ops->getname(sock, addr, addrlen, 1); | 3054 | return sock->ops->getname(sock, addr, addrlen, 1); |
3042 | } | 3055 | } |
3056 | EXPORT_SYMBOL(kernel_getpeername); | ||
3043 | 3057 | ||
3044 | int kernel_getsockopt(struct socket *sock, int level, int optname, | 3058 | int kernel_getsockopt(struct socket *sock, int level, int optname, |
3045 | char *optval, int *optlen) | 3059 | char *optval, int *optlen) |
@@ -3056,6 +3070,7 @@ int kernel_getsockopt(struct socket *sock, int level, int optname, | |||
3056 | set_fs(oldfs); | 3070 | set_fs(oldfs); |
3057 | return err; | 3071 | return err; |
3058 | } | 3072 | } |
3073 | EXPORT_SYMBOL(kernel_getsockopt); | ||
3059 | 3074 | ||
3060 | int kernel_setsockopt(struct socket *sock, int level, int optname, | 3075 | int kernel_setsockopt(struct socket *sock, int level, int optname, |
3061 | char *optval, unsigned int optlen) | 3076 | char *optval, unsigned int optlen) |
@@ -3072,6 +3087,7 @@ int kernel_setsockopt(struct socket *sock, int level, int optname, | |||
3072 | set_fs(oldfs); | 3087 | set_fs(oldfs); |
3073 | return err; | 3088 | return err; |
3074 | } | 3089 | } |
3090 | EXPORT_SYMBOL(kernel_setsockopt); | ||
3075 | 3091 | ||
3076 | int kernel_sendpage(struct socket *sock, struct page *page, int offset, | 3092 | int kernel_sendpage(struct socket *sock, struct page *page, int offset, |
3077 | size_t size, int flags) | 3093 | size_t size, int flags) |
@@ -3083,6 +3099,7 @@ int kernel_sendpage(struct socket *sock, struct page *page, int offset, | |||
3083 | 3099 | ||
3084 | return sock_no_sendpage(sock, page, offset, size, flags); | 3100 | return sock_no_sendpage(sock, page, offset, size, flags); |
3085 | } | 3101 | } |
3102 | EXPORT_SYMBOL(kernel_sendpage); | ||
3086 | 3103 | ||
3087 | int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg) | 3104 | int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg) |
3088 | { | 3105 | { |
@@ -3095,33 +3112,10 @@ int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg) | |||
3095 | 3112 | ||
3096 | return err; | 3113 | return err; |
3097 | } | 3114 | } |
3115 | EXPORT_SYMBOL(kernel_sock_ioctl); | ||
3098 | 3116 | ||
3099 | int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how) | 3117 | int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how) |
3100 | { | 3118 | { |
3101 | return sock->ops->shutdown(sock, how); | 3119 | return sock->ops->shutdown(sock, how); |
3102 | } | 3120 | } |
3103 | |||
3104 | EXPORT_SYMBOL(sock_create); | ||
3105 | EXPORT_SYMBOL(sock_create_kern); | ||
3106 | EXPORT_SYMBOL(sock_create_lite); | ||
3107 | EXPORT_SYMBOL(sock_map_fd); | ||
3108 | EXPORT_SYMBOL(sock_recvmsg); | ||
3109 | EXPORT_SYMBOL(sock_register); | ||
3110 | EXPORT_SYMBOL(sock_release); | ||
3111 | EXPORT_SYMBOL(sock_sendmsg); | ||
3112 | EXPORT_SYMBOL(sock_unregister); | ||
3113 | EXPORT_SYMBOL(sock_wake_async); | ||
3114 | EXPORT_SYMBOL(sockfd_lookup); | ||
3115 | EXPORT_SYMBOL(kernel_sendmsg); | ||
3116 | EXPORT_SYMBOL(kernel_recvmsg); | ||
3117 | EXPORT_SYMBOL(kernel_bind); | ||
3118 | EXPORT_SYMBOL(kernel_listen); | ||
3119 | EXPORT_SYMBOL(kernel_accept); | ||
3120 | EXPORT_SYMBOL(kernel_connect); | ||
3121 | EXPORT_SYMBOL(kernel_getsockname); | ||
3122 | EXPORT_SYMBOL(kernel_getpeername); | ||
3123 | EXPORT_SYMBOL(kernel_getsockopt); | ||
3124 | EXPORT_SYMBOL(kernel_setsockopt); | ||
3125 | EXPORT_SYMBOL(kernel_sendpage); | ||
3126 | EXPORT_SYMBOL(kernel_sock_ioctl); | ||
3127 | EXPORT_SYMBOL(kernel_sock_shutdown); | 3121 | EXPORT_SYMBOL(kernel_sock_shutdown); |