diff options
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/addrconf.c | 72 | ||||
-rw-r--r-- | net/ipv6/ah6.c | 2 | ||||
-rw-r--r-- | net/ipv6/anycast.c | 4 | ||||
-rw-r--r-- | net/ipv6/datagram.c | 6 | ||||
-rw-r--r-- | net/ipv6/esp6.c | 2 | ||||
-rw-r--r-- | net/ipv6/icmp.c | 14 | ||||
-rw-r--r-- | net/ipv6/ip6_fib.c | 19 | ||||
-rw-r--r-- | net/ipv6/ip6_flowlabel.c | 10 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 17 | ||||
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 1 | ||||
-rw-r--r-- | net/ipv6/ipcomp6.c | 9 | ||||
-rw-r--r-- | net/ipv6/ipv6_sockglue.c | 5 | ||||
-rw-r--r-- | net/ipv6/ipv6_syms.c | 1 | ||||
-rw-r--r-- | net/ipv6/mcast.c | 68 | ||||
-rw-r--r-- | net/ipv6/ndisc.c | 4 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6_tables.c | 1 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6t_LOG.c | 54 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6table_raw.c | 6 | ||||
-rw-r--r-- | net/ipv6/raw.c | 8 | ||||
-rw-r--r-- | net/ipv6/route.c | 79 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 148 | ||||
-rw-r--r-- | net/ipv6/udp.c | 4 | ||||
-rw-r--r-- | net/ipv6/xfrm6_output.c | 1 | ||||
-rw-r--r-- | net/ipv6/xfrm6_policy.c | 4 | ||||
-rw-r--r-- | net/ipv6/xfrm6_tunnel.c | 2 |
25 files changed, 281 insertions, 260 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 7744a2592693..14f5c53235fe 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -131,7 +131,7 @@ static void addrconf_leave_anycast(struct inet6_ifaddr *ifp); | |||
131 | 131 | ||
132 | static int addrconf_ifdown(struct net_device *dev, int how); | 132 | static int addrconf_ifdown(struct net_device *dev, int how); |
133 | 133 | ||
134 | static void addrconf_dad_start(struct inet6_ifaddr *ifp, int flags); | 134 | static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags); |
135 | static void addrconf_dad_timer(unsigned long data); | 135 | static void addrconf_dad_timer(unsigned long data); |
136 | static void addrconf_dad_completed(struct inet6_ifaddr *ifp); | 136 | static void addrconf_dad_completed(struct inet6_ifaddr *ifp); |
137 | static void addrconf_rs_timer(unsigned long data); | 137 | static void addrconf_rs_timer(unsigned long data); |
@@ -372,6 +372,7 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev) | |||
372 | ndev->regen_timer.data = (unsigned long) ndev; | 372 | ndev->regen_timer.data = (unsigned long) ndev; |
373 | if ((dev->flags&IFF_LOOPBACK) || | 373 | if ((dev->flags&IFF_LOOPBACK) || |
374 | dev->type == ARPHRD_TUNNEL || | 374 | dev->type == ARPHRD_TUNNEL || |
375 | dev->type == ARPHRD_NONE || | ||
375 | dev->type == ARPHRD_SIT) { | 376 | dev->type == ARPHRD_SIT) { |
376 | printk(KERN_INFO | 377 | printk(KERN_INFO |
377 | "Disabled Privacy Extensions on device %p(%s)\n", | 378 | "Disabled Privacy Extensions on device %p(%s)\n", |
@@ -491,7 +492,7 @@ void inet6_ifa_finish_destroy(struct inet6_ifaddr *ifp) | |||
491 | 492 | ||
492 | static struct inet6_ifaddr * | 493 | static struct inet6_ifaddr * |
493 | ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, | 494 | ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, |
494 | int scope, unsigned flags) | 495 | int scope, u32 flags) |
495 | { | 496 | { |
496 | struct inet6_ifaddr *ifa = NULL; | 497 | struct inet6_ifaddr *ifa = NULL; |
497 | struct rt6_info *rt; | 498 | struct rt6_info *rt; |
@@ -694,7 +695,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp) | |||
694 | 695 | ||
695 | if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { | 696 | if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { |
696 | if (onlink == 0) { | 697 | if (onlink == 0) { |
697 | ip6_del_rt(rt, NULL, NULL); | 698 | ip6_del_rt(rt, NULL, NULL, NULL); |
698 | rt = NULL; | 699 | rt = NULL; |
699 | } else if (!(rt->rt6i_flags & RTF_EXPIRES)) { | 700 | } else if (!(rt->rt6i_flags & RTF_EXPIRES)) { |
700 | rt->rt6i_expires = expires; | 701 | rt->rt6i_expires = expires; |
@@ -1319,7 +1320,7 @@ static int __ipv6_try_regen_rndid(struct inet6_dev *idev, struct in6_addr *tmpad | |||
1319 | 1320 | ||
1320 | static void | 1321 | static void |
1321 | addrconf_prefix_route(struct in6_addr *pfx, int plen, struct net_device *dev, | 1322 | addrconf_prefix_route(struct in6_addr *pfx, int plen, struct net_device *dev, |
1322 | unsigned long expires, unsigned flags) | 1323 | unsigned long expires, u32 flags) |
1323 | { | 1324 | { |
1324 | struct in6_rtmsg rtmsg; | 1325 | struct in6_rtmsg rtmsg; |
1325 | 1326 | ||
@@ -1339,7 +1340,7 @@ addrconf_prefix_route(struct in6_addr *pfx, int plen, struct net_device *dev, | |||
1339 | if (dev->type == ARPHRD_SIT && (dev->flags&IFF_POINTOPOINT)) | 1340 | if (dev->type == ARPHRD_SIT && (dev->flags&IFF_POINTOPOINT)) |
1340 | rtmsg.rtmsg_flags |= RTF_NONEXTHOP; | 1341 | rtmsg.rtmsg_flags |= RTF_NONEXTHOP; |
1341 | 1342 | ||
1342 | ip6_route_add(&rtmsg, NULL, NULL); | 1343 | ip6_route_add(&rtmsg, NULL, NULL, NULL); |
1343 | } | 1344 | } |
1344 | 1345 | ||
1345 | /* Create "default" multicast route to the interface */ | 1346 | /* Create "default" multicast route to the interface */ |
@@ -1356,7 +1357,7 @@ static void addrconf_add_mroute(struct net_device *dev) | |||
1356 | rtmsg.rtmsg_ifindex = dev->ifindex; | 1357 | rtmsg.rtmsg_ifindex = dev->ifindex; |
1357 | rtmsg.rtmsg_flags = RTF_UP; | 1358 | rtmsg.rtmsg_flags = RTF_UP; |
1358 | rtmsg.rtmsg_type = RTMSG_NEWROUTE; | 1359 | rtmsg.rtmsg_type = RTMSG_NEWROUTE; |
1359 | ip6_route_add(&rtmsg, NULL, NULL); | 1360 | ip6_route_add(&rtmsg, NULL, NULL, NULL); |
1360 | } | 1361 | } |
1361 | 1362 | ||
1362 | static void sit_route_add(struct net_device *dev) | 1363 | static void sit_route_add(struct net_device *dev) |
@@ -1373,7 +1374,7 @@ static void sit_route_add(struct net_device *dev) | |||
1373 | rtmsg.rtmsg_flags = RTF_UP|RTF_NONEXTHOP; | 1374 | rtmsg.rtmsg_flags = RTF_UP|RTF_NONEXTHOP; |
1374 | rtmsg.rtmsg_ifindex = dev->ifindex; | 1375 | rtmsg.rtmsg_ifindex = dev->ifindex; |
1375 | 1376 | ||
1376 | ip6_route_add(&rtmsg, NULL, NULL); | 1377 | ip6_route_add(&rtmsg, NULL, NULL, NULL); |
1377 | } | 1378 | } |
1378 | 1379 | ||
1379 | static void addrconf_add_lroute(struct net_device *dev) | 1380 | static void addrconf_add_lroute(struct net_device *dev) |
@@ -1466,7 +1467,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len) | |||
1466 | if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { | 1467 | if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { |
1467 | if (rt->rt6i_flags&RTF_EXPIRES) { | 1468 | if (rt->rt6i_flags&RTF_EXPIRES) { |
1468 | if (valid_lft == 0) { | 1469 | if (valid_lft == 0) { |
1469 | ip6_del_rt(rt, NULL, NULL); | 1470 | ip6_del_rt(rt, NULL, NULL, NULL); |
1470 | rt = NULL; | 1471 | rt = NULL; |
1471 | } else { | 1472 | } else { |
1472 | rt->rt6i_expires = rt_expires; | 1473 | rt->rt6i_expires = rt_expires; |
@@ -2228,7 +2229,7 @@ out: | |||
2228 | /* | 2229 | /* |
2229 | * Duplicate Address Detection | 2230 | * Duplicate Address Detection |
2230 | */ | 2231 | */ |
2231 | static void addrconf_dad_start(struct inet6_ifaddr *ifp, int flags) | 2232 | static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags) |
2232 | { | 2233 | { |
2233 | struct inet6_dev *idev = ifp->idev; | 2234 | struct inet6_dev *idev = ifp->idev; |
2234 | struct net_device *dev = idev->dev; | 2235 | struct net_device *dev = idev->dev; |
@@ -2621,15 +2622,14 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | |||
2621 | } | 2622 | } |
2622 | 2623 | ||
2623 | static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa, | 2624 | static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa, |
2624 | u32 pid, u32 seq, int event) | 2625 | u32 pid, u32 seq, int event, unsigned int flags) |
2625 | { | 2626 | { |
2626 | struct ifaddrmsg *ifm; | 2627 | struct ifaddrmsg *ifm; |
2627 | struct nlmsghdr *nlh; | 2628 | struct nlmsghdr *nlh; |
2628 | struct ifa_cacheinfo ci; | 2629 | struct ifa_cacheinfo ci; |
2629 | unsigned char *b = skb->tail; | 2630 | unsigned char *b = skb->tail; |
2630 | 2631 | ||
2631 | nlh = NLMSG_PUT(skb, pid, seq, event, sizeof(*ifm)); | 2632 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*ifm), flags); |
2632 | if (pid) nlh->nlmsg_flags |= NLM_F_MULTI; | ||
2633 | ifm = NLMSG_DATA(nlh); | 2633 | ifm = NLMSG_DATA(nlh); |
2634 | ifm->ifa_family = AF_INET6; | 2634 | ifm->ifa_family = AF_INET6; |
2635 | ifm->ifa_prefixlen = ifa->prefix_len; | 2635 | ifm->ifa_prefixlen = ifa->prefix_len; |
@@ -2671,15 +2671,14 @@ rtattr_failure: | |||
2671 | } | 2671 | } |
2672 | 2672 | ||
2673 | static int inet6_fill_ifmcaddr(struct sk_buff *skb, struct ifmcaddr6 *ifmca, | 2673 | static int inet6_fill_ifmcaddr(struct sk_buff *skb, struct ifmcaddr6 *ifmca, |
2674 | u32 pid, u32 seq, int event) | 2674 | u32 pid, u32 seq, int event, u16 flags) |
2675 | { | 2675 | { |
2676 | struct ifaddrmsg *ifm; | 2676 | struct ifaddrmsg *ifm; |
2677 | struct nlmsghdr *nlh; | 2677 | struct nlmsghdr *nlh; |
2678 | struct ifa_cacheinfo ci; | 2678 | struct ifa_cacheinfo ci; |
2679 | unsigned char *b = skb->tail; | 2679 | unsigned char *b = skb->tail; |
2680 | 2680 | ||
2681 | nlh = NLMSG_PUT(skb, pid, seq, event, sizeof(*ifm)); | 2681 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*ifm), flags); |
2682 | if (pid) nlh->nlmsg_flags |= NLM_F_MULTI; | ||
2683 | ifm = NLMSG_DATA(nlh); | 2682 | ifm = NLMSG_DATA(nlh); |
2684 | ifm->ifa_family = AF_INET6; | 2683 | ifm->ifa_family = AF_INET6; |
2685 | ifm->ifa_prefixlen = 128; | 2684 | ifm->ifa_prefixlen = 128; |
@@ -2708,15 +2707,14 @@ rtattr_failure: | |||
2708 | } | 2707 | } |
2709 | 2708 | ||
2710 | static int inet6_fill_ifacaddr(struct sk_buff *skb, struct ifacaddr6 *ifaca, | 2709 | static int inet6_fill_ifacaddr(struct sk_buff *skb, struct ifacaddr6 *ifaca, |
2711 | u32 pid, u32 seq, int event) | 2710 | u32 pid, u32 seq, int event, unsigned int flags) |
2712 | { | 2711 | { |
2713 | struct ifaddrmsg *ifm; | 2712 | struct ifaddrmsg *ifm; |
2714 | struct nlmsghdr *nlh; | 2713 | struct nlmsghdr *nlh; |
2715 | struct ifa_cacheinfo ci; | 2714 | struct ifa_cacheinfo ci; |
2716 | unsigned char *b = skb->tail; | 2715 | unsigned char *b = skb->tail; |
2717 | 2716 | ||
2718 | nlh = NLMSG_PUT(skb, pid, seq, event, sizeof(*ifm)); | 2717 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*ifm), flags); |
2719 | if (pid) nlh->nlmsg_flags |= NLM_F_MULTI; | ||
2720 | ifm = NLMSG_DATA(nlh); | 2718 | ifm = NLMSG_DATA(nlh); |
2721 | ifm->ifa_family = AF_INET6; | 2719 | ifm->ifa_family = AF_INET6; |
2722 | ifm->ifa_prefixlen = 128; | 2720 | ifm->ifa_prefixlen = 128; |
@@ -2785,7 +2783,8 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, | |||
2785 | continue; | 2783 | continue; |
2786 | if ((err = inet6_fill_ifaddr(skb, ifa, | 2784 | if ((err = inet6_fill_ifaddr(skb, ifa, |
2787 | NETLINK_CB(cb->skb).pid, | 2785 | NETLINK_CB(cb->skb).pid, |
2788 | cb->nlh->nlmsg_seq, RTM_NEWADDR)) <= 0) | 2786 | cb->nlh->nlmsg_seq, RTM_NEWADDR, |
2787 | NLM_F_MULTI)) <= 0) | ||
2789 | goto done; | 2788 | goto done; |
2790 | } | 2789 | } |
2791 | /* temp addr */ | 2790 | /* temp addr */ |
@@ -2796,7 +2795,8 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, | |||
2796 | continue; | 2795 | continue; |
2797 | if ((err = inet6_fill_ifaddr(skb, ifa, | 2796 | if ((err = inet6_fill_ifaddr(skb, ifa, |
2798 | NETLINK_CB(cb->skb).pid, | 2797 | NETLINK_CB(cb->skb).pid, |
2799 | cb->nlh->nlmsg_seq, RTM_NEWADDR)) <= 0) | 2798 | cb->nlh->nlmsg_seq, RTM_NEWADDR, |
2799 | NLM_F_MULTI)) <= 0) | ||
2800 | goto done; | 2800 | goto done; |
2801 | } | 2801 | } |
2802 | #endif | 2802 | #endif |
@@ -2809,7 +2809,8 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, | |||
2809 | continue; | 2809 | continue; |
2810 | if ((err = inet6_fill_ifmcaddr(skb, ifmca, | 2810 | if ((err = inet6_fill_ifmcaddr(skb, ifmca, |
2811 | NETLINK_CB(cb->skb).pid, | 2811 | NETLINK_CB(cb->skb).pid, |
2812 | cb->nlh->nlmsg_seq, RTM_GETMULTICAST)) <= 0) | 2812 | cb->nlh->nlmsg_seq, RTM_GETMULTICAST, |
2813 | NLM_F_MULTI)) <= 0) | ||
2813 | goto done; | 2814 | goto done; |
2814 | } | 2815 | } |
2815 | break; | 2816 | break; |
@@ -2821,7 +2822,8 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, | |||
2821 | continue; | 2822 | continue; |
2822 | if ((err = inet6_fill_ifacaddr(skb, ifaca, | 2823 | if ((err = inet6_fill_ifacaddr(skb, ifaca, |
2823 | NETLINK_CB(cb->skb).pid, | 2824 | NETLINK_CB(cb->skb).pid, |
2824 | cb->nlh->nlmsg_seq, RTM_GETANYCAST)) <= 0) | 2825 | cb->nlh->nlmsg_seq, RTM_GETANYCAST, |
2826 | NLM_F_MULTI)) <= 0) | ||
2825 | goto done; | 2827 | goto done; |
2826 | } | 2828 | } |
2827 | break; | 2829 | break; |
@@ -2871,7 +2873,7 @@ static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa) | |||
2871 | netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFADDR, ENOBUFS); | 2873 | netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFADDR, ENOBUFS); |
2872 | return; | 2874 | return; |
2873 | } | 2875 | } |
2874 | if (inet6_fill_ifaddr(skb, ifa, 0, 0, event) < 0) { | 2876 | if (inet6_fill_ifaddr(skb, ifa, current->pid, 0, event, 0) < 0) { |
2875 | kfree_skb(skb); | 2877 | kfree_skb(skb); |
2876 | netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFADDR, EINVAL); | 2878 | netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFADDR, EINVAL); |
2877 | return; | 2879 | return; |
@@ -2906,7 +2908,7 @@ static void inline ipv6_store_devconf(struct ipv6_devconf *cnf, | |||
2906 | } | 2908 | } |
2907 | 2909 | ||
2908 | static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev, | 2910 | static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev, |
2909 | u32 pid, u32 seq, int event) | 2911 | u32 pid, u32 seq, int event, unsigned int flags) |
2910 | { | 2912 | { |
2911 | struct net_device *dev = idev->dev; | 2913 | struct net_device *dev = idev->dev; |
2912 | __s32 *array = NULL; | 2914 | __s32 *array = NULL; |
@@ -2917,8 +2919,7 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev, | |||
2917 | __u32 mtu = dev->mtu; | 2919 | __u32 mtu = dev->mtu; |
2918 | struct ifla_cacheinfo ci; | 2920 | struct ifla_cacheinfo ci; |
2919 | 2921 | ||
2920 | nlh = NLMSG_PUT(skb, pid, seq, event, sizeof(*r)); | 2922 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*r), flags); |
2921 | if (pid) nlh->nlmsg_flags |= NLM_F_MULTI; | ||
2922 | r = NLMSG_DATA(nlh); | 2923 | r = NLMSG_DATA(nlh); |
2923 | r->ifi_family = AF_INET6; | 2924 | r->ifi_family = AF_INET6; |
2924 | r->ifi_type = dev->type; | 2925 | r->ifi_type = dev->type; |
@@ -2985,7 +2986,7 @@ static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) | |||
2985 | if ((idev = in6_dev_get(dev)) == NULL) | 2986 | if ((idev = in6_dev_get(dev)) == NULL) |
2986 | continue; | 2987 | continue; |
2987 | err = inet6_fill_ifinfo(skb, idev, NETLINK_CB(cb->skb).pid, | 2988 | err = inet6_fill_ifinfo(skb, idev, NETLINK_CB(cb->skb).pid, |
2988 | cb->nlh->nlmsg_seq, RTM_NEWLINK); | 2989 | cb->nlh->nlmsg_seq, RTM_NEWLINK, NLM_F_MULTI); |
2989 | in6_dev_put(idev); | 2990 | in6_dev_put(idev); |
2990 | if (err <= 0) | 2991 | if (err <= 0) |
2991 | break; | 2992 | break; |
@@ -3007,7 +3008,7 @@ void inet6_ifinfo_notify(int event, struct inet6_dev *idev) | |||
3007 | netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFINFO, ENOBUFS); | 3008 | netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFINFO, ENOBUFS); |
3008 | return; | 3009 | return; |
3009 | } | 3010 | } |
3010 | if (inet6_fill_ifinfo(skb, idev, 0, 0, event) < 0) { | 3011 | if (inet6_fill_ifinfo(skb, idev, current->pid, 0, event, 0) < 0) { |
3011 | kfree_skb(skb); | 3012 | kfree_skb(skb); |
3012 | netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFINFO, EINVAL); | 3013 | netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFINFO, EINVAL); |
3013 | return; | 3014 | return; |
@@ -3017,18 +3018,15 @@ void inet6_ifinfo_notify(int event, struct inet6_dev *idev) | |||
3017 | } | 3018 | } |
3018 | 3019 | ||
3019 | static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev, | 3020 | static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev, |
3020 | struct prefix_info *pinfo, u32 pid, u32 seq, int event) | 3021 | struct prefix_info *pinfo, u32 pid, u32 seq, |
3022 | int event, unsigned int flags) | ||
3021 | { | 3023 | { |
3022 | struct prefixmsg *pmsg; | 3024 | struct prefixmsg *pmsg; |
3023 | struct nlmsghdr *nlh; | 3025 | struct nlmsghdr *nlh; |
3024 | unsigned char *b = skb->tail; | 3026 | unsigned char *b = skb->tail; |
3025 | struct prefix_cacheinfo ci; | 3027 | struct prefix_cacheinfo ci; |
3026 | 3028 | ||
3027 | nlh = NLMSG_PUT(skb, pid, seq, event, sizeof(*pmsg)); | 3029 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*pmsg), flags); |
3028 | |||
3029 | if (pid) | ||
3030 | nlh->nlmsg_flags |= NLM_F_MULTI; | ||
3031 | |||
3032 | pmsg = NLMSG_DATA(nlh); | 3030 | pmsg = NLMSG_DATA(nlh); |
3033 | pmsg->prefix_family = AF_INET6; | 3031 | pmsg->prefix_family = AF_INET6; |
3034 | pmsg->prefix_ifindex = idev->dev->ifindex; | 3032 | pmsg->prefix_ifindex = idev->dev->ifindex; |
@@ -3067,7 +3065,7 @@ static void inet6_prefix_notify(int event, struct inet6_dev *idev, | |||
3067 | netlink_set_err(rtnl, 0, RTMGRP_IPV6_PREFIX, ENOBUFS); | 3065 | netlink_set_err(rtnl, 0, RTMGRP_IPV6_PREFIX, ENOBUFS); |
3068 | return; | 3066 | return; |
3069 | } | 3067 | } |
3070 | if (inet6_fill_prefix(skb, idev, pinfo, 0, 0, event) < 0) { | 3068 | if (inet6_fill_prefix(skb, idev, pinfo, current->pid, 0, event, 0) < 0) { |
3071 | kfree_skb(skb); | 3069 | kfree_skb(skb); |
3072 | netlink_set_err(rtnl, 0, RTMGRP_IPV6_PREFIX, EINVAL); | 3070 | netlink_set_err(rtnl, 0, RTMGRP_IPV6_PREFIX, EINVAL); |
3073 | return; | 3071 | return; |
@@ -3096,7 +3094,7 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) | |||
3096 | switch (event) { | 3094 | switch (event) { |
3097 | case RTM_NEWADDR: | 3095 | case RTM_NEWADDR: |
3098 | dst_hold(&ifp->rt->u.dst); | 3096 | dst_hold(&ifp->rt->u.dst); |
3099 | if (ip6_ins_rt(ifp->rt, NULL, NULL)) | 3097 | if (ip6_ins_rt(ifp->rt, NULL, NULL, NULL)) |
3100 | dst_release(&ifp->rt->u.dst); | 3098 | dst_release(&ifp->rt->u.dst); |
3101 | if (ifp->idev->cnf.forwarding) | 3099 | if (ifp->idev->cnf.forwarding) |
3102 | addrconf_join_anycast(ifp); | 3100 | addrconf_join_anycast(ifp); |
@@ -3106,7 +3104,7 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) | |||
3106 | addrconf_leave_anycast(ifp); | 3104 | addrconf_leave_anycast(ifp); |
3107 | addrconf_leave_solict(ifp->idev, &ifp->addr); | 3105 | addrconf_leave_solict(ifp->idev, &ifp->addr); |
3108 | dst_hold(&ifp->rt->u.dst); | 3106 | dst_hold(&ifp->rt->u.dst); |
3109 | if (ip6_del_rt(ifp->rt, NULL, NULL)) | 3107 | if (ip6_del_rt(ifp->rt, NULL, NULL, NULL)) |
3110 | dst_free(&ifp->rt->u.dst); | 3108 | dst_free(&ifp->rt->u.dst); |
3111 | else | 3109 | else |
3112 | dst_release(&ifp->rt->u.dst); | 3110 | dst_release(&ifp->rt->u.dst); |
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c index e3ecf626cbf7..986fdfdccbcd 100644 --- a/net/ipv6/ah6.c +++ b/net/ipv6/ah6.c | |||
@@ -339,7 +339,7 @@ static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
339 | xfrm_state_put(x); | 339 | xfrm_state_put(x); |
340 | } | 340 | } |
341 | 341 | ||
342 | static int ah6_init_state(struct xfrm_state *x, void *args) | 342 | static int ah6_init_state(struct xfrm_state *x) |
343 | { | 343 | { |
344 | struct ah_data *ahp = NULL; | 344 | struct ah_data *ahp = NULL; |
345 | struct xfrm_algo_desc *aalg_desc; | 345 | struct xfrm_algo_desc *aalg_desc; |
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c index 5d22ca3cca2e..6b7294047238 100644 --- a/net/ipv6/anycast.c +++ b/net/ipv6/anycast.c | |||
@@ -337,7 +337,7 @@ int ipv6_dev_ac_inc(struct net_device *dev, struct in6_addr *addr) | |||
337 | write_unlock_bh(&idev->lock); | 337 | write_unlock_bh(&idev->lock); |
338 | 338 | ||
339 | dst_hold(&rt->u.dst); | 339 | dst_hold(&rt->u.dst); |
340 | if (ip6_ins_rt(rt, NULL, NULL)) | 340 | if (ip6_ins_rt(rt, NULL, NULL, NULL)) |
341 | dst_release(&rt->u.dst); | 341 | dst_release(&rt->u.dst); |
342 | 342 | ||
343 | addrconf_join_solict(dev, &aca->aca_addr); | 343 | addrconf_join_solict(dev, &aca->aca_addr); |
@@ -380,7 +380,7 @@ int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr) | |||
380 | addrconf_leave_solict(idev, &aca->aca_addr); | 380 | addrconf_leave_solict(idev, &aca->aca_addr); |
381 | 381 | ||
382 | dst_hold(&aca->aca_rt->u.dst); | 382 | dst_hold(&aca->aca_rt->u.dst); |
383 | if (ip6_del_rt(aca->aca_rt, NULL, NULL)) | 383 | if (ip6_del_rt(aca->aca_rt, NULL, NULL, NULL)) |
384 | dst_free(&aca->aca_rt->u.dst); | 384 | dst_free(&aca->aca_rt->u.dst); |
385 | else | 385 | else |
386 | dst_release(&aca->aca_rt->u.dst); | 386 | dst_release(&aca->aca_rt->u.dst); |
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index 65b9375df57d..5229365cd8b4 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c | |||
@@ -353,14 +353,14 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len) | |||
353 | err = copied; | 353 | err = copied; |
354 | 354 | ||
355 | /* Reset and regenerate socket error */ | 355 | /* Reset and regenerate socket error */ |
356 | spin_lock_irq(&sk->sk_error_queue.lock); | 356 | spin_lock_bh(&sk->sk_error_queue.lock); |
357 | sk->sk_err = 0; | 357 | sk->sk_err = 0; |
358 | if ((skb2 = skb_peek(&sk->sk_error_queue)) != NULL) { | 358 | if ((skb2 = skb_peek(&sk->sk_error_queue)) != NULL) { |
359 | sk->sk_err = SKB_EXT_ERR(skb2)->ee.ee_errno; | 359 | sk->sk_err = SKB_EXT_ERR(skb2)->ee.ee_errno; |
360 | spin_unlock_irq(&sk->sk_error_queue.lock); | 360 | spin_unlock_bh(&sk->sk_error_queue.lock); |
361 | sk->sk_error_report(sk); | 361 | sk->sk_error_report(sk); |
362 | } else { | 362 | } else { |
363 | spin_unlock_irq(&sk->sk_error_queue.lock); | 363 | spin_unlock_bh(&sk->sk_error_queue.lock); |
364 | } | 364 | } |
365 | 365 | ||
366 | out_free_skb: | 366 | out_free_skb: |
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index be7095d6babe..324db62515a2 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c | |||
@@ -296,7 +296,7 @@ static void esp6_destroy(struct xfrm_state *x) | |||
296 | kfree(esp); | 296 | kfree(esp); |
297 | } | 297 | } |
298 | 298 | ||
299 | static int esp6_init_state(struct xfrm_state *x, void *args) | 299 | static int esp6_init_state(struct xfrm_state *x) |
300 | { | 300 | { |
301 | struct esp_data *esp = NULL; | 301 | struct esp_data *esp = NULL; |
302 | 302 | ||
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 8e0f569b883e..ff3ec9822e36 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -277,8 +277,8 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, | |||
277 | { | 277 | { |
278 | struct inet6_dev *idev = NULL; | 278 | struct inet6_dev *idev = NULL; |
279 | struct ipv6hdr *hdr = skb->nh.ipv6h; | 279 | struct ipv6hdr *hdr = skb->nh.ipv6h; |
280 | struct sock *sk = icmpv6_socket->sk; | 280 | struct sock *sk; |
281 | struct ipv6_pinfo *np = inet6_sk(sk); | 281 | struct ipv6_pinfo *np; |
282 | struct in6_addr *saddr = NULL; | 282 | struct in6_addr *saddr = NULL; |
283 | struct dst_entry *dst; | 283 | struct dst_entry *dst; |
284 | struct icmp6hdr tmp_hdr; | 284 | struct icmp6hdr tmp_hdr; |
@@ -358,6 +358,9 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, | |||
358 | if (icmpv6_xmit_lock()) | 358 | if (icmpv6_xmit_lock()) |
359 | return; | 359 | return; |
360 | 360 | ||
361 | sk = icmpv6_socket->sk; | ||
362 | np = inet6_sk(sk); | ||
363 | |||
361 | if (!icmpv6_xrlim_allow(sk, type, &fl)) | 364 | if (!icmpv6_xrlim_allow(sk, type, &fl)) |
362 | goto out; | 365 | goto out; |
363 | 366 | ||
@@ -423,9 +426,9 @@ out: | |||
423 | 426 | ||
424 | static void icmpv6_echo_reply(struct sk_buff *skb) | 427 | static void icmpv6_echo_reply(struct sk_buff *skb) |
425 | { | 428 | { |
426 | struct sock *sk = icmpv6_socket->sk; | 429 | struct sock *sk; |
427 | struct inet6_dev *idev; | 430 | struct inet6_dev *idev; |
428 | struct ipv6_pinfo *np = inet6_sk(sk); | 431 | struct ipv6_pinfo *np; |
429 | struct in6_addr *saddr = NULL; | 432 | struct in6_addr *saddr = NULL; |
430 | struct icmp6hdr *icmph = (struct icmp6hdr *) skb->h.raw; | 433 | struct icmp6hdr *icmph = (struct icmp6hdr *) skb->h.raw; |
431 | struct icmp6hdr tmp_hdr; | 434 | struct icmp6hdr tmp_hdr; |
@@ -454,6 +457,9 @@ static void icmpv6_echo_reply(struct sk_buff *skb) | |||
454 | if (icmpv6_xmit_lock()) | 457 | if (icmpv6_xmit_lock()) |
455 | return; | 458 | return; |
456 | 459 | ||
460 | sk = icmpv6_socket->sk; | ||
461 | np = inet6_sk(sk); | ||
462 | |||
457 | if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) | 463 | if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) |
458 | fl.oif = np->mcast_oif; | 464 | fl.oif = np->mcast_oif; |
459 | 465 | ||
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 405740b75abb..1b354aa97934 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -394,7 +394,7 @@ insert_above: | |||
394 | */ | 394 | */ |
395 | 395 | ||
396 | static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, | 396 | static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, |
397 | struct nlmsghdr *nlh) | 397 | struct nlmsghdr *nlh, struct netlink_skb_parms *req) |
398 | { | 398 | { |
399 | struct rt6_info *iter = NULL; | 399 | struct rt6_info *iter = NULL; |
400 | struct rt6_info **ins; | 400 | struct rt6_info **ins; |
@@ -449,7 +449,7 @@ out: | |||
449 | *ins = rt; | 449 | *ins = rt; |
450 | rt->rt6i_node = fn; | 450 | rt->rt6i_node = fn; |
451 | atomic_inc(&rt->rt6i_ref); | 451 | atomic_inc(&rt->rt6i_ref); |
452 | inet6_rt_notify(RTM_NEWROUTE, rt, nlh); | 452 | inet6_rt_notify(RTM_NEWROUTE, rt, nlh, req); |
453 | rt6_stats.fib_rt_entries++; | 453 | rt6_stats.fib_rt_entries++; |
454 | 454 | ||
455 | if ((fn->fn_flags & RTN_RTINFO) == 0) { | 455 | if ((fn->fn_flags & RTN_RTINFO) == 0) { |
@@ -479,7 +479,8 @@ void fib6_force_start_gc(void) | |||
479 | * with source addr info in sub-trees | 479 | * with source addr info in sub-trees |
480 | */ | 480 | */ |
481 | 481 | ||
482 | int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr) | 482 | int fib6_add(struct fib6_node *root, struct rt6_info *rt, |
483 | struct nlmsghdr *nlh, void *_rtattr, struct netlink_skb_parms *req) | ||
483 | { | 484 | { |
484 | struct fib6_node *fn; | 485 | struct fib6_node *fn; |
485 | int err = -ENOMEM; | 486 | int err = -ENOMEM; |
@@ -552,7 +553,7 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nlmsghdr *nlh, | |||
552 | } | 553 | } |
553 | #endif | 554 | #endif |
554 | 555 | ||
555 | err = fib6_add_rt2node(fn, rt, nlh); | 556 | err = fib6_add_rt2node(fn, rt, nlh, req); |
556 | 557 | ||
557 | if (err == 0) { | 558 | if (err == 0) { |
558 | fib6_start_gc(rt); | 559 | fib6_start_gc(rt); |
@@ -859,7 +860,7 @@ static struct fib6_node * fib6_repair_tree(struct fib6_node *fn) | |||
859 | } | 860 | } |
860 | 861 | ||
861 | static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp, | 862 | static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp, |
862 | struct nlmsghdr *nlh, void *_rtattr) | 863 | struct nlmsghdr *nlh, void *_rtattr, struct netlink_skb_parms *req) |
863 | { | 864 | { |
864 | struct fib6_walker_t *w; | 865 | struct fib6_walker_t *w; |
865 | struct rt6_info *rt = *rtp; | 866 | struct rt6_info *rt = *rtp; |
@@ -915,11 +916,11 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp, | |||
915 | if (atomic_read(&rt->rt6i_ref) != 1) BUG(); | 916 | if (atomic_read(&rt->rt6i_ref) != 1) BUG(); |
916 | } | 917 | } |
917 | 918 | ||
918 | inet6_rt_notify(RTM_DELROUTE, rt, nlh); | 919 | inet6_rt_notify(RTM_DELROUTE, rt, nlh, req); |
919 | rt6_release(rt); | 920 | rt6_release(rt); |
920 | } | 921 | } |
921 | 922 | ||
922 | int fib6_del(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr) | 923 | int fib6_del(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr, struct netlink_skb_parms *req) |
923 | { | 924 | { |
924 | struct fib6_node *fn = rt->rt6i_node; | 925 | struct fib6_node *fn = rt->rt6i_node; |
925 | struct rt6_info **rtp; | 926 | struct rt6_info **rtp; |
@@ -944,7 +945,7 @@ int fib6_del(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr) | |||
944 | 945 | ||
945 | for (rtp = &fn->leaf; *rtp; rtp = &(*rtp)->u.next) { | 946 | for (rtp = &fn->leaf; *rtp; rtp = &(*rtp)->u.next) { |
946 | if (*rtp == rt) { | 947 | if (*rtp == rt) { |
947 | fib6_del_route(fn, rtp, nlh, _rtattr); | 948 | fib6_del_route(fn, rtp, nlh, _rtattr, req); |
948 | return 0; | 949 | return 0; |
949 | } | 950 | } |
950 | } | 951 | } |
@@ -1073,7 +1074,7 @@ static int fib6_clean_node(struct fib6_walker_t *w) | |||
1073 | res = c->func(rt, c->arg); | 1074 | res = c->func(rt, c->arg); |
1074 | if (res < 0) { | 1075 | if (res < 0) { |
1075 | w->leaf = rt; | 1076 | w->leaf = rt; |
1076 | res = fib6_del(rt, NULL, NULL); | 1077 | res = fib6_del(rt, NULL, NULL, NULL); |
1077 | if (res) { | 1078 | if (res) { |
1078 | #if RT6_DEBUG >= 2 | 1079 | #if RT6_DEBUG >= 2 |
1079 | printk(KERN_DEBUG "fib6_clean_node: del failed: rt=%p@%p err=%d\n", rt, rt->rt6i_node, res); | 1080 | printk(KERN_DEBUG "fib6_clean_node: del failed: rt=%p@%p err=%d\n", rt, rt->rt6i_node, res); |
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index a93f6dc51979..0e5f7499debb 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c | |||
@@ -535,10 +535,12 @@ release: | |||
535 | if (err) | 535 | if (err) |
536 | goto done; | 536 | goto done; |
537 | 537 | ||
538 | /* Do not check for fault */ | 538 | if (!freq.flr_label) { |
539 | if (!freq.flr_label) | 539 | if (copy_to_user(&((struct in6_flowlabel_req __user *) optval)->flr_label, |
540 | copy_to_user(&((struct in6_flowlabel_req __user *) optval)->flr_label, | 540 | &fl->label, sizeof(fl->label))) { |
541 | &fl->label, sizeof(fl->label)); | 541 | /* Intentionally ignore fault. */ |
542 | } | ||
543 | } | ||
542 | 544 | ||
543 | sfl1->fl = fl; | 545 | sfl1->fl = fl; |
544 | sfl1->next = np->ipv6_fl_list; | 546 | sfl1->next = np->ipv6_fl_list; |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 0f0711417c9d..06e7cdaeedc5 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -484,9 +484,6 @@ static void ip6_copy_metadata(struct sk_buff *to, struct sk_buff *from) | |||
484 | to->nf_bridge = from->nf_bridge; | 484 | to->nf_bridge = from->nf_bridge; |
485 | nf_bridge_get(to->nf_bridge); | 485 | nf_bridge_get(to->nf_bridge); |
486 | #endif | 486 | #endif |
487 | #ifdef CONFIG_NETFILTER_DEBUG | ||
488 | to->nf_debug = from->nf_debug; | ||
489 | #endif | ||
490 | #endif | 487 | #endif |
491 | } | 488 | } |
492 | 489 | ||
@@ -552,13 +549,17 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) | |||
552 | skb_headroom(frag) < hlen) | 549 | skb_headroom(frag) < hlen) |
553 | goto slow_path; | 550 | goto slow_path; |
554 | 551 | ||
555 | /* Correct socket ownership. */ | ||
556 | if (frag->sk == NULL) | ||
557 | goto slow_path; | ||
558 | |||
559 | /* Partially cloned skb? */ | 552 | /* Partially cloned skb? */ |
560 | if (skb_shared(frag)) | 553 | if (skb_shared(frag)) |
561 | goto slow_path; | 554 | goto slow_path; |
555 | |||
556 | BUG_ON(frag->sk); | ||
557 | if (skb->sk) { | ||
558 | sock_hold(skb->sk); | ||
559 | frag->sk = skb->sk; | ||
560 | frag->destructor = sock_wfree; | ||
561 | skb->truesize -= frag->truesize; | ||
562 | } | ||
562 | } | 563 | } |
563 | 564 | ||
564 | err = 0; | 565 | err = 0; |
@@ -1116,12 +1117,10 @@ int ip6_push_pending_frames(struct sock *sk) | |||
1116 | tail_skb = &(tmp_skb->next); | 1117 | tail_skb = &(tmp_skb->next); |
1117 | skb->len += tmp_skb->len; | 1118 | skb->len += tmp_skb->len; |
1118 | skb->data_len += tmp_skb->len; | 1119 | skb->data_len += tmp_skb->len; |
1119 | #if 0 /* Logically correct, but useless work, ip_fragment() will have to undo */ | ||
1120 | skb->truesize += tmp_skb->truesize; | 1120 | skb->truesize += tmp_skb->truesize; |
1121 | __sock_put(tmp_skb->sk); | 1121 | __sock_put(tmp_skb->sk); |
1122 | tmp_skb->destructor = NULL; | 1122 | tmp_skb->destructor = NULL; |
1123 | tmp_skb->sk = NULL; | 1123 | tmp_skb->sk = NULL; |
1124 | #endif | ||
1125 | } | 1124 | } |
1126 | 1125 | ||
1127 | ipv6_addr_copy(final_dst, &fl->fl6_dst); | 1126 | ipv6_addr_copy(final_dst, &fl->fl6_dst); |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 3b1c9fa184ae..ba3b0c267f75 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -882,6 +882,7 @@ ip6ip6_tnl_change(struct ip6_tnl *t, struct ip6_tnl_parm *p) | |||
882 | t->parms.hop_limit = p->hop_limit; | 882 | t->parms.hop_limit = p->hop_limit; |
883 | t->parms.encap_limit = p->encap_limit; | 883 | t->parms.encap_limit = p->encap_limit; |
884 | t->parms.flowinfo = p->flowinfo; | 884 | t->parms.flowinfo = p->flowinfo; |
885 | t->parms.link = p->link; | ||
885 | ip6ip6_tnl_link_config(t); | 886 | ip6ip6_tnl_link_config(t); |
886 | return 0; | 887 | return 0; |
887 | } | 888 | } |
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c index 6cde5310cd76..423feb46ccc0 100644 --- a/net/ipv6/ipcomp6.c +++ b/net/ipv6/ipcomp6.c | |||
@@ -234,14 +234,9 @@ static struct xfrm_state *ipcomp6_tunnel_create(struct xfrm_state *x) | |||
234 | t->props.mode = 1; | 234 | t->props.mode = 1; |
235 | memcpy(t->props.saddr.a6, x->props.saddr.a6, sizeof(struct in6_addr)); | 235 | memcpy(t->props.saddr.a6, x->props.saddr.a6, sizeof(struct in6_addr)); |
236 | 236 | ||
237 | t->type = xfrm_get_type(IPPROTO_IPV6, t->props.family); | 237 | if (xfrm_init_state(t)) |
238 | if (t->type == NULL) | ||
239 | goto error; | 238 | goto error; |
240 | 239 | ||
241 | if (t->type->init_state(t, NULL)) | ||
242 | goto error; | ||
243 | |||
244 | t->km.state = XFRM_STATE_VALID; | ||
245 | atomic_set(&t->tunnel_users, 1); | 240 | atomic_set(&t->tunnel_users, 1); |
246 | 241 | ||
247 | out: | 242 | out: |
@@ -420,7 +415,7 @@ static void ipcomp6_destroy(struct xfrm_state *x) | |||
420 | xfrm6_tunnel_free_spi((xfrm_address_t *)&x->props.saddr); | 415 | xfrm6_tunnel_free_spi((xfrm_address_t *)&x->props.saddr); |
421 | } | 416 | } |
422 | 417 | ||
423 | static int ipcomp6_init_state(struct xfrm_state *x, void *args) | 418 | static int ipcomp6_init_state(struct xfrm_state *x) |
424 | { | 419 | { |
425 | int err; | 420 | int err; |
426 | struct ipcomp_data *ipcd; | 421 | struct ipcomp_data *ipcd; |
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index 279ab86be662..f3ef4c38d315 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
@@ -423,11 +423,12 @@ done: | |||
423 | psin6 = (struct sockaddr_in6 *)&greqs.gsr_group; | 423 | psin6 = (struct sockaddr_in6 *)&greqs.gsr_group; |
424 | retv = ipv6_sock_mc_join(sk, greqs.gsr_interface, | 424 | retv = ipv6_sock_mc_join(sk, greqs.gsr_interface, |
425 | &psin6->sin6_addr); | 425 | &psin6->sin6_addr); |
426 | if (retv) | 426 | /* prior join w/ different source is ok */ |
427 | if (retv && retv != -EADDRINUSE) | ||
427 | break; | 428 | break; |
428 | omode = MCAST_INCLUDE; | 429 | omode = MCAST_INCLUDE; |
429 | add = 1; | 430 | add = 1; |
430 | } else /*IP_DROP_SOURCE_MEMBERSHIP */ { | 431 | } else /* MCAST_LEAVE_SOURCE_GROUP */ { |
431 | omode = MCAST_INCLUDE; | 432 | omode = MCAST_INCLUDE; |
432 | add = 0; | 433 | add = 0; |
433 | } | 434 | } |
diff --git a/net/ipv6/ipv6_syms.c b/net/ipv6/ipv6_syms.c index 2f4c91ddc9a3..5ade5a5d1990 100644 --- a/net/ipv6/ipv6_syms.c +++ b/net/ipv6/ipv6_syms.c | |||
@@ -37,5 +37,4 @@ EXPORT_SYMBOL(in6_dev_finish_destroy); | |||
37 | EXPORT_SYMBOL(xfrm6_rcv); | 37 | EXPORT_SYMBOL(xfrm6_rcv); |
38 | #endif | 38 | #endif |
39 | EXPORT_SYMBOL(rt6_lookup); | 39 | EXPORT_SYMBOL(rt6_lookup); |
40 | EXPORT_SYMBOL(fl6_sock_lookup); | ||
41 | EXPORT_SYMBOL(ipv6_push_nfrag_opts); | 40 | EXPORT_SYMBOL(ipv6_push_nfrag_opts); |
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 393b6e6f50a9..562fcd14fdea 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -188,6 +188,16 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, struct in6_addr *addr) | |||
188 | if (!ipv6_addr_is_multicast(addr)) | 188 | if (!ipv6_addr_is_multicast(addr)) |
189 | return -EINVAL; | 189 | return -EINVAL; |
190 | 190 | ||
191 | read_lock_bh(&ipv6_sk_mc_lock); | ||
192 | for (mc_lst=np->ipv6_mc_list; mc_lst; mc_lst=mc_lst->next) { | ||
193 | if ((ifindex == 0 || mc_lst->ifindex == ifindex) && | ||
194 | ipv6_addr_equal(&mc_lst->addr, addr)) { | ||
195 | read_unlock_bh(&ipv6_sk_mc_lock); | ||
196 | return -EADDRINUSE; | ||
197 | } | ||
198 | } | ||
199 | read_unlock_bh(&ipv6_sk_mc_lock); | ||
200 | |||
191 | mc_lst = sock_kmalloc(sk, sizeof(struct ipv6_mc_socklist), GFP_KERNEL); | 201 | mc_lst = sock_kmalloc(sk, sizeof(struct ipv6_mc_socklist), GFP_KERNEL); |
192 | 202 | ||
193 | if (mc_lst == NULL) | 203 | if (mc_lst == NULL) |
@@ -349,6 +359,7 @@ int ip6_mc_source(int add, int omode, struct sock *sk, | |||
349 | struct ipv6_pinfo *inet6 = inet6_sk(sk); | 359 | struct ipv6_pinfo *inet6 = inet6_sk(sk); |
350 | struct ip6_sf_socklist *psl; | 360 | struct ip6_sf_socklist *psl; |
351 | int i, j, rv; | 361 | int i, j, rv; |
362 | int leavegroup = 0; | ||
352 | int err; | 363 | int err; |
353 | 364 | ||
354 | if (pgsr->gsr_group.ss_family != AF_INET6 || | 365 | if (pgsr->gsr_group.ss_family != AF_INET6 || |
@@ -368,6 +379,7 @@ int ip6_mc_source(int add, int omode, struct sock *sk, | |||
368 | 379 | ||
369 | err = -EADDRNOTAVAIL; | 380 | err = -EADDRNOTAVAIL; |
370 | 381 | ||
382 | read_lock_bh(&ipv6_sk_mc_lock); | ||
371 | for (pmc=inet6->ipv6_mc_list; pmc; pmc=pmc->next) { | 383 | for (pmc=inet6->ipv6_mc_list; pmc; pmc=pmc->next) { |
372 | if (pgsr->gsr_interface && pmc->ifindex != pgsr->gsr_interface) | 384 | if (pgsr->gsr_interface && pmc->ifindex != pgsr->gsr_interface) |
373 | continue; | 385 | continue; |
@@ -401,6 +413,12 @@ int ip6_mc_source(int add, int omode, struct sock *sk, | |||
401 | if (rv) /* source not found */ | 413 | if (rv) /* source not found */ |
402 | goto done; | 414 | goto done; |
403 | 415 | ||
416 | /* special case - (INCLUDE, empty) == LEAVE_GROUP */ | ||
417 | if (psl->sl_count == 1 && omode == MCAST_INCLUDE) { | ||
418 | leavegroup = 1; | ||
419 | goto done; | ||
420 | } | ||
421 | |||
404 | /* update the interface filter */ | 422 | /* update the interface filter */ |
405 | ip6_mc_del_src(idev, group, omode, 1, source, 1); | 423 | ip6_mc_del_src(idev, group, omode, 1, source, 1); |
406 | 424 | ||
@@ -453,9 +471,12 @@ int ip6_mc_source(int add, int omode, struct sock *sk, | |||
453 | /* update the interface list */ | 471 | /* update the interface list */ |
454 | ip6_mc_add_src(idev, group, omode, 1, source, 1); | 472 | ip6_mc_add_src(idev, group, omode, 1, source, 1); |
455 | done: | 473 | done: |
474 | read_unlock_bh(&ipv6_sk_mc_lock); | ||
456 | read_unlock_bh(&idev->lock); | 475 | read_unlock_bh(&idev->lock); |
457 | in6_dev_put(idev); | 476 | in6_dev_put(idev); |
458 | dev_put(dev); | 477 | dev_put(dev); |
478 | if (leavegroup) | ||
479 | return ipv6_sock_mc_drop(sk, pgsr->gsr_interface, group); | ||
459 | return err; | 480 | return err; |
460 | } | 481 | } |
461 | 482 | ||
@@ -1280,15 +1301,6 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size) | |||
1280 | return NULL; | 1301 | return NULL; |
1281 | 1302 | ||
1282 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); | 1303 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); |
1283 | if (dev->hard_header) { | ||
1284 | unsigned char ha[MAX_ADDR_LEN]; | ||
1285 | |||
1286 | ndisc_mc_map(&mld2_all_mcr, ha, dev, 1); | ||
1287 | if (dev->hard_header(skb, dev, ETH_P_IPV6,ha,NULL,size) < 0) { | ||
1288 | kfree_skb(skb); | ||
1289 | return NULL; | ||
1290 | } | ||
1291 | } | ||
1292 | 1304 | ||
1293 | if (ipv6_get_lladdr(dev, &addr_buf)) { | 1305 | if (ipv6_get_lladdr(dev, &addr_buf)) { |
1294 | /* <draft-ietf-magma-mld-source-05.txt>: | 1306 | /* <draft-ietf-magma-mld-source-05.txt>: |
@@ -1312,6 +1324,30 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size) | |||
1312 | return skb; | 1324 | return skb; |
1313 | } | 1325 | } |
1314 | 1326 | ||
1327 | static inline int mld_dev_queue_xmit2(struct sk_buff *skb) | ||
1328 | { | ||
1329 | struct net_device *dev = skb->dev; | ||
1330 | |||
1331 | if (dev->hard_header) { | ||
1332 | unsigned char ha[MAX_ADDR_LEN]; | ||
1333 | int err; | ||
1334 | |||
1335 | ndisc_mc_map(&skb->nh.ipv6h->daddr, ha, dev, 1); | ||
1336 | err = dev->hard_header(skb, dev, ETH_P_IPV6, ha, NULL, skb->len); | ||
1337 | if (err < 0) { | ||
1338 | kfree_skb(skb); | ||
1339 | return err; | ||
1340 | } | ||
1341 | } | ||
1342 | return dev_queue_xmit(skb); | ||
1343 | } | ||
1344 | |||
1345 | static inline int mld_dev_queue_xmit(struct sk_buff *skb) | ||
1346 | { | ||
1347 | return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb, NULL, skb->dev, | ||
1348 | mld_dev_queue_xmit2); | ||
1349 | } | ||
1350 | |||
1315 | static void mld_sendpack(struct sk_buff *skb) | 1351 | static void mld_sendpack(struct sk_buff *skb) |
1316 | { | 1352 | { |
1317 | struct ipv6hdr *pip6 = skb->nh.ipv6h; | 1353 | struct ipv6hdr *pip6 = skb->nh.ipv6h; |
@@ -1329,7 +1365,7 @@ static void mld_sendpack(struct sk_buff *skb) | |||
1329 | pmr->csum = csum_ipv6_magic(&pip6->saddr, &pip6->daddr, mldlen, | 1365 | pmr->csum = csum_ipv6_magic(&pip6->saddr, &pip6->daddr, mldlen, |
1330 | IPPROTO_ICMPV6, csum_partial(skb->h.raw, mldlen, 0)); | 1366 | IPPROTO_ICMPV6, csum_partial(skb->h.raw, mldlen, 0)); |
1331 | err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dev, | 1367 | err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dev, |
1332 | dev_queue_xmit); | 1368 | mld_dev_queue_xmit); |
1333 | if (!err) { | 1369 | if (!err) { |
1334 | ICMP6_INC_STATS(idev,ICMP6_MIB_OUTMSGS); | 1370 | ICMP6_INC_STATS(idev,ICMP6_MIB_OUTMSGS); |
1335 | IP6_INC_STATS(IPSTATS_MIB_OUTMCASTPKTS); | 1371 | IP6_INC_STATS(IPSTATS_MIB_OUTMCASTPKTS); |
@@ -1635,12 +1671,6 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) | |||
1635 | } | 1671 | } |
1636 | 1672 | ||
1637 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); | 1673 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); |
1638 | if (dev->hard_header) { | ||
1639 | unsigned char ha[MAX_ADDR_LEN]; | ||
1640 | ndisc_mc_map(snd_addr, ha, dev, 1); | ||
1641 | if (dev->hard_header(skb, dev, ETH_P_IPV6, ha, NULL, full_len) < 0) | ||
1642 | goto out; | ||
1643 | } | ||
1644 | 1674 | ||
1645 | if (ipv6_get_lladdr(dev, &addr_buf)) { | 1675 | if (ipv6_get_lladdr(dev, &addr_buf)) { |
1646 | /* <draft-ietf-magma-mld-source-05.txt>: | 1676 | /* <draft-ietf-magma-mld-source-05.txt>: |
@@ -1668,7 +1698,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) | |||
1668 | idev = in6_dev_get(skb->dev); | 1698 | idev = in6_dev_get(skb->dev); |
1669 | 1699 | ||
1670 | err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dev, | 1700 | err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dev, |
1671 | dev_queue_xmit); | 1701 | mld_dev_queue_xmit); |
1672 | if (!err) { | 1702 | if (!err) { |
1673 | if (type == ICMPV6_MGM_REDUCTION) | 1703 | if (type == ICMPV6_MGM_REDUCTION) |
1674 | ICMP6_INC_STATS(idev, ICMP6_MIB_OUTGROUPMEMBREDUCTIONS); | 1704 | ICMP6_INC_STATS(idev, ICMP6_MIB_OUTGROUPMEMBREDUCTIONS); |
@@ -1682,10 +1712,6 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) | |||
1682 | if (likely(idev != NULL)) | 1712 | if (likely(idev != NULL)) |
1683 | in6_dev_put(idev); | 1713 | in6_dev_put(idev); |
1684 | return; | 1714 | return; |
1685 | |||
1686 | out: | ||
1687 | IP6_INC_STATS(IPSTATS_MIB_OUTDISCARDS); | ||
1688 | kfree_skb(skb); | ||
1689 | } | 1715 | } |
1690 | 1716 | ||
1691 | static int ip6_mc_del1_src(struct ifmcaddr6 *pmc, int sfmode, | 1717 | static int ip6_mc_del1_src(struct ifmcaddr6 *pmc, int sfmode, |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 7c291f4e9edc..7ae72d4c9bd2 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -955,7 +955,7 @@ static void ndisc_recv_na(struct sk_buff *skb) | |||
955 | struct rt6_info *rt; | 955 | struct rt6_info *rt; |
956 | rt = rt6_get_dflt_router(saddr, dev); | 956 | rt = rt6_get_dflt_router(saddr, dev); |
957 | if (rt) | 957 | if (rt) |
958 | ip6_del_rt(rt, NULL, NULL); | 958 | ip6_del_rt(rt, NULL, NULL, NULL); |
959 | } | 959 | } |
960 | 960 | ||
961 | out: | 961 | out: |
@@ -1096,7 +1096,7 @@ static void ndisc_router_discovery(struct sk_buff *skb) | |||
1096 | 1096 | ||
1097 | if (rt && lifetime == 0) { | 1097 | if (rt && lifetime == 0) { |
1098 | neigh_clone(neigh); | 1098 | neigh_clone(neigh); |
1099 | ip6_del_rt(rt, NULL, NULL); | 1099 | ip6_del_rt(rt, NULL, NULL, NULL); |
1100 | rt = NULL; | 1100 | rt = NULL; |
1101 | } | 1101 | } |
1102 | 1102 | ||
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index c735276fdd5f..73034511c8db 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -71,7 +71,6 @@ static DECLARE_MUTEX(ip6t_mutex); | |||
71 | /* Must have mutex */ | 71 | /* Must have mutex */ |
72 | #define ASSERT_READ_LOCK(x) IP_NF_ASSERT(down_trylock(&ip6t_mutex) != 0) | 72 | #define ASSERT_READ_LOCK(x) IP_NF_ASSERT(down_trylock(&ip6t_mutex) != 0) |
73 | #define ASSERT_WRITE_LOCK(x) IP_NF_ASSERT(down_trylock(&ip6t_mutex) != 0) | 73 | #define ASSERT_WRITE_LOCK(x) IP_NF_ASSERT(down_trylock(&ip6t_mutex) != 0) |
74 | #include <linux/netfilter_ipv4/lockhelp.h> | ||
75 | #include <linux/netfilter_ipv4/listhelp.h> | 74 | #include <linux/netfilter_ipv4/listhelp.h> |
76 | 75 | ||
77 | #if 0 | 76 | #if 0 |
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c index bfc3d0185d19..c44685e391b7 100644 --- a/net/ipv6/netfilter/ip6t_LOG.c +++ b/net/ipv6/netfilter/ip6t_LOG.c | |||
@@ -366,8 +366,6 @@ ip6t_log_packet(unsigned int hooknum, | |||
366 | const char *level_string, | 366 | const char *level_string, |
367 | const char *prefix) | 367 | const char *prefix) |
368 | { | 368 | { |
369 | struct ipv6hdr *ipv6h = skb->nh.ipv6h; | ||
370 | |||
371 | spin_lock_bh(&log_lock); | 369 | spin_lock_bh(&log_lock); |
372 | printk(level_string); | 370 | printk(level_string); |
373 | printk("%sIN=%s OUT=%s ", | 371 | printk("%sIN=%s OUT=%s ", |
@@ -377,39 +375,25 @@ ip6t_log_packet(unsigned int hooknum, | |||
377 | if (in && !out) { | 375 | if (in && !out) { |
378 | /* MAC logging for input chain only. */ | 376 | /* MAC logging for input chain only. */ |
379 | printk("MAC="); | 377 | printk("MAC="); |
380 | if (skb->dev && skb->dev->hard_header_len && skb->mac.raw != (void*)ipv6h) { | 378 | if (skb->dev && skb->dev->hard_header_len && |
381 | if (skb->dev->type != ARPHRD_SIT){ | 379 | skb->mac.raw != skb->nh.raw) { |
382 | int i; | 380 | unsigned char *p = skb->mac.raw; |
383 | unsigned char *p = skb->mac.raw; | 381 | int i; |
384 | for (i = 0; i < skb->dev->hard_header_len; i++,p++) | 382 | |
385 | printk("%02x%c", *p, | 383 | if (skb->dev->type == ARPHRD_SIT && |
386 | i==skb->dev->hard_header_len - 1 | 384 | (p -= ETH_HLEN) < skb->head) |
387 | ? ' ':':'); | 385 | p = NULL; |
388 | } else { | 386 | |
389 | int i; | 387 | if (p != NULL) |
390 | unsigned char *p = skb->mac.raw; | 388 | for (i = 0; i < skb->dev->hard_header_len; i++) |
391 | if ( p - (ETH_ALEN*2+2) > skb->head ){ | 389 | printk("%02x", p[i]); |
392 | p -= (ETH_ALEN+2); | 390 | printk(" "); |
393 | for (i = 0; i < (ETH_ALEN); i++,p++) | 391 | |
394 | printk("%02x%s", *p, | 392 | if (skb->dev->type == ARPHRD_SIT) { |
395 | i == ETH_ALEN-1 ? "->" : ":"); | 393 | struct iphdr *iph = (struct iphdr *)skb->mac.raw; |
396 | p -= (ETH_ALEN*2); | 394 | printk("TUNNEL=%u.%u.%u.%u->%u.%u.%u.%u ", |
397 | for (i = 0; i < (ETH_ALEN); i++,p++) | 395 | NIPQUAD(iph->saddr), |
398 | printk("%02x%c", *p, | 396 | NIPQUAD(iph->daddr)); |
399 | i == ETH_ALEN-1 ? ' ' : ':'); | ||
400 | } | ||
401 | |||
402 | if ((skb->dev->addr_len == 4) && | ||
403 | skb->dev->hard_header_len > 20){ | ||
404 | printk("TUNNEL="); | ||
405 | p = skb->mac.raw + 12; | ||
406 | for (i = 0; i < 4; i++,p++) | ||
407 | printk("%3d%s", *p, | ||
408 | i == 3 ? "->" : "."); | ||
409 | for (i = 0; i < 4; i++,p++) | ||
410 | printk("%3d%c", *p, | ||
411 | i == 3 ? ' ' : '.'); | ||
412 | } | ||
413 | } | 397 | } |
414 | } else | 398 | } else |
415 | printk(" "); | 399 | printk(" "); |
diff --git a/net/ipv6/netfilter/ip6table_raw.c b/net/ipv6/netfilter/ip6table_raw.c index 71407beaf790..c2982efd14af 100644 --- a/net/ipv6/netfilter/ip6table_raw.c +++ b/net/ipv6/netfilter/ip6table_raw.c | |||
@@ -129,13 +129,15 @@ static struct nf_hook_ops ip6t_ops[] = { | |||
129 | .hook = ip6t_hook, | 129 | .hook = ip6t_hook, |
130 | .pf = PF_INET6, | 130 | .pf = PF_INET6, |
131 | .hooknum = NF_IP6_PRE_ROUTING, | 131 | .hooknum = NF_IP6_PRE_ROUTING, |
132 | .priority = NF_IP6_PRI_FIRST | 132 | .priority = NF_IP6_PRI_FIRST, |
133 | .owner = THIS_MODULE, | ||
133 | }, | 134 | }, |
134 | { | 135 | { |
135 | .hook = ip6t_hook, | 136 | .hook = ip6t_hook, |
136 | .pf = PF_INET6, | 137 | .pf = PF_INET6, |
137 | .hooknum = NF_IP6_LOCAL_OUT, | 138 | .hooknum = NF_IP6_LOCAL_OUT, |
138 | .priority = NF_IP6_PRI_FIRST | 139 | .priority = NF_IP6_PRI_FIRST, |
140 | .owner = THIS_MODULE, | ||
139 | }, | 141 | }, |
140 | }; | 142 | }; |
141 | 143 | ||
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 617645bc5ed6..e2b848ec9851 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -434,12 +434,12 @@ csum_copy_err: | |||
434 | /* Clear queue. */ | 434 | /* Clear queue. */ |
435 | if (flags&MSG_PEEK) { | 435 | if (flags&MSG_PEEK) { |
436 | int clear = 0; | 436 | int clear = 0; |
437 | spin_lock_irq(&sk->sk_receive_queue.lock); | 437 | spin_lock_bh(&sk->sk_receive_queue.lock); |
438 | if (skb == skb_peek(&sk->sk_receive_queue)) { | 438 | if (skb == skb_peek(&sk->sk_receive_queue)) { |
439 | __skb_unlink(skb, &sk->sk_receive_queue); | 439 | __skb_unlink(skb, &sk->sk_receive_queue); |
440 | clear = 1; | 440 | clear = 1; |
441 | } | 441 | } |
442 | spin_unlock_irq(&sk->sk_receive_queue.lock); | 442 | spin_unlock_bh(&sk->sk_receive_queue.lock); |
443 | if (clear) | 443 | if (clear) |
444 | kfree_skb(skb); | 444 | kfree_skb(skb); |
445 | } | 445 | } |
@@ -971,11 +971,11 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
971 | struct sk_buff *skb; | 971 | struct sk_buff *skb; |
972 | int amount = 0; | 972 | int amount = 0; |
973 | 973 | ||
974 | spin_lock_irq(&sk->sk_receive_queue.lock); | 974 | spin_lock_bh(&sk->sk_receive_queue.lock); |
975 | skb = skb_peek(&sk->sk_receive_queue); | 975 | skb = skb_peek(&sk->sk_receive_queue); |
976 | if (skb != NULL) | 976 | if (skb != NULL) |
977 | amount = skb->tail - skb->h.raw; | 977 | amount = skb->tail - skb->h.raw; |
978 | spin_unlock_irq(&sk->sk_receive_queue.lock); | 978 | spin_unlock_bh(&sk->sk_receive_queue.lock); |
979 | return put_user(amount, (int __user *)arg); | 979 | return put_user(amount, (int __user *)arg); |
980 | } | 980 | } |
981 | 981 | ||
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 3bf8a0254f81..878789b3122d 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -384,12 +384,13 @@ struct rt6_info *rt6_lookup(struct in6_addr *daddr, struct in6_addr *saddr, | |||
384 | be destroyed. | 384 | be destroyed. |
385 | */ | 385 | */ |
386 | 386 | ||
387 | int ip6_ins_rt(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr) | 387 | int ip6_ins_rt(struct rt6_info *rt, struct nlmsghdr *nlh, |
388 | void *_rtattr, struct netlink_skb_parms *req) | ||
388 | { | 389 | { |
389 | int err; | 390 | int err; |
390 | 391 | ||
391 | write_lock_bh(&rt6_lock); | 392 | write_lock_bh(&rt6_lock); |
392 | err = fib6_add(&ip6_routing_table, rt, nlh, _rtattr); | 393 | err = fib6_add(&ip6_routing_table, rt, nlh, _rtattr, req); |
393 | write_unlock_bh(&rt6_lock); | 394 | write_unlock_bh(&rt6_lock); |
394 | 395 | ||
395 | return err; | 396 | return err; |
@@ -400,7 +401,7 @@ int ip6_ins_rt(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr) | |||
400 | */ | 401 | */ |
401 | 402 | ||
402 | static struct rt6_info *rt6_cow(struct rt6_info *ort, struct in6_addr *daddr, | 403 | static struct rt6_info *rt6_cow(struct rt6_info *ort, struct in6_addr *daddr, |
403 | struct in6_addr *saddr) | 404 | struct in6_addr *saddr, struct netlink_skb_parms *req) |
404 | { | 405 | { |
405 | int err; | 406 | int err; |
406 | struct rt6_info *rt; | 407 | struct rt6_info *rt; |
@@ -432,7 +433,7 @@ static struct rt6_info *rt6_cow(struct rt6_info *ort, struct in6_addr *daddr, | |||
432 | 433 | ||
433 | dst_hold(&rt->u.dst); | 434 | dst_hold(&rt->u.dst); |
434 | 435 | ||
435 | err = ip6_ins_rt(rt, NULL, NULL); | 436 | err = ip6_ins_rt(rt, NULL, NULL, req); |
436 | if (err == 0) | 437 | if (err == 0) |
437 | return rt; | 438 | return rt; |
438 | 439 | ||
@@ -491,7 +492,8 @@ restart: | |||
491 | read_unlock_bh(&rt6_lock); | 492 | read_unlock_bh(&rt6_lock); |
492 | 493 | ||
493 | nrt = rt6_cow(rt, &skb->nh.ipv6h->daddr, | 494 | nrt = rt6_cow(rt, &skb->nh.ipv6h->daddr, |
494 | &skb->nh.ipv6h->saddr); | 495 | &skb->nh.ipv6h->saddr, |
496 | &NETLINK_CB(skb)); | ||
495 | 497 | ||
496 | dst_release(&rt->u.dst); | 498 | dst_release(&rt->u.dst); |
497 | rt = nrt; | 499 | rt = nrt; |
@@ -551,7 +553,7 @@ restart: | |||
551 | dst_hold(&rt->u.dst); | 553 | dst_hold(&rt->u.dst); |
552 | read_unlock_bh(&rt6_lock); | 554 | read_unlock_bh(&rt6_lock); |
553 | 555 | ||
554 | nrt = rt6_cow(rt, &fl->fl6_dst, &fl->fl6_src); | 556 | nrt = rt6_cow(rt, &fl->fl6_dst, &fl->fl6_src, NULL); |
555 | 557 | ||
556 | dst_release(&rt->u.dst); | 558 | dst_release(&rt->u.dst); |
557 | rt = nrt; | 559 | rt = nrt; |
@@ -598,7 +600,7 @@ static struct dst_entry *ip6_negative_advice(struct dst_entry *dst) | |||
598 | 600 | ||
599 | if (rt) { | 601 | if (rt) { |
600 | if (rt->rt6i_flags & RTF_CACHE) | 602 | if (rt->rt6i_flags & RTF_CACHE) |
601 | ip6_del_rt(rt, NULL, NULL); | 603 | ip6_del_rt(rt, NULL, NULL, NULL); |
602 | else | 604 | else |
603 | dst_release(dst); | 605 | dst_release(dst); |
604 | } | 606 | } |
@@ -787,7 +789,8 @@ int ipv6_get_hoplimit(struct net_device *dev) | |||
787 | * | 789 | * |
788 | */ | 790 | */ |
789 | 791 | ||
790 | int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr) | 792 | int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, |
793 | void *_rtattr, struct netlink_skb_parms *req) | ||
791 | { | 794 | { |
792 | int err; | 795 | int err; |
793 | struct rtmsg *r; | 796 | struct rtmsg *r; |
@@ -974,7 +977,7 @@ install_route: | |||
974 | rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_mtu(&rt->u.dst)); | 977 | rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_mtu(&rt->u.dst)); |
975 | rt->u.dst.dev = dev; | 978 | rt->u.dst.dev = dev; |
976 | rt->rt6i_idev = idev; | 979 | rt->rt6i_idev = idev; |
977 | return ip6_ins_rt(rt, nlh, _rtattr); | 980 | return ip6_ins_rt(rt, nlh, _rtattr, req); |
978 | 981 | ||
979 | out: | 982 | out: |
980 | if (dev) | 983 | if (dev) |
@@ -986,7 +989,7 @@ out: | |||
986 | return err; | 989 | return err; |
987 | } | 990 | } |
988 | 991 | ||
989 | int ip6_del_rt(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr) | 992 | int ip6_del_rt(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr, struct netlink_skb_parms *req) |
990 | { | 993 | { |
991 | int err; | 994 | int err; |
992 | 995 | ||
@@ -994,7 +997,7 @@ int ip6_del_rt(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr) | |||
994 | 997 | ||
995 | rt6_reset_dflt_pointer(NULL); | 998 | rt6_reset_dflt_pointer(NULL); |
996 | 999 | ||
997 | err = fib6_del(rt, nlh, _rtattr); | 1000 | err = fib6_del(rt, nlh, _rtattr, req); |
998 | dst_release(&rt->u.dst); | 1001 | dst_release(&rt->u.dst); |
999 | 1002 | ||
1000 | write_unlock_bh(&rt6_lock); | 1003 | write_unlock_bh(&rt6_lock); |
@@ -1002,7 +1005,7 @@ int ip6_del_rt(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr) | |||
1002 | return err; | 1005 | return err; |
1003 | } | 1006 | } |
1004 | 1007 | ||
1005 | static int ip6_route_del(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr) | 1008 | static int ip6_route_del(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr, struct netlink_skb_parms *req) |
1006 | { | 1009 | { |
1007 | struct fib6_node *fn; | 1010 | struct fib6_node *fn; |
1008 | struct rt6_info *rt; | 1011 | struct rt6_info *rt; |
@@ -1029,7 +1032,7 @@ static int ip6_route_del(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_r | |||
1029 | dst_hold(&rt->u.dst); | 1032 | dst_hold(&rt->u.dst); |
1030 | read_unlock_bh(&rt6_lock); | 1033 | read_unlock_bh(&rt6_lock); |
1031 | 1034 | ||
1032 | return ip6_del_rt(rt, nlh, _rtattr); | 1035 | return ip6_del_rt(rt, nlh, _rtattr, req); |
1033 | } | 1036 | } |
1034 | } | 1037 | } |
1035 | read_unlock_bh(&rt6_lock); | 1038 | read_unlock_bh(&rt6_lock); |
@@ -1136,11 +1139,11 @@ source_ok: | |||
1136 | nrt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(neigh->dev); | 1139 | nrt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(neigh->dev); |
1137 | nrt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_mtu(&nrt->u.dst)); | 1140 | nrt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_mtu(&nrt->u.dst)); |
1138 | 1141 | ||
1139 | if (ip6_ins_rt(nrt, NULL, NULL)) | 1142 | if (ip6_ins_rt(nrt, NULL, NULL, NULL)) |
1140 | goto out; | 1143 | goto out; |
1141 | 1144 | ||
1142 | if (rt->rt6i_flags&RTF_CACHE) { | 1145 | if (rt->rt6i_flags&RTF_CACHE) { |
1143 | ip6_del_rt(rt, NULL, NULL); | 1146 | ip6_del_rt(rt, NULL, NULL, NULL); |
1144 | return; | 1147 | return; |
1145 | } | 1148 | } |
1146 | 1149 | ||
@@ -1204,7 +1207,7 @@ void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr, | |||
1204 | 2. It is gatewayed route or NONEXTHOP route. Action: clone it. | 1207 | 2. It is gatewayed route or NONEXTHOP route. Action: clone it. |
1205 | */ | 1208 | */ |
1206 | if (!rt->rt6i_nexthop && !(rt->rt6i_flags & RTF_NONEXTHOP)) { | 1209 | if (!rt->rt6i_nexthop && !(rt->rt6i_flags & RTF_NONEXTHOP)) { |
1207 | nrt = rt6_cow(rt, daddr, saddr); | 1210 | nrt = rt6_cow(rt, daddr, saddr, NULL); |
1208 | if (!nrt->u.dst.error) { | 1211 | if (!nrt->u.dst.error) { |
1209 | nrt->u.dst.metrics[RTAX_MTU-1] = pmtu; | 1212 | nrt->u.dst.metrics[RTAX_MTU-1] = pmtu; |
1210 | if (allfrag) | 1213 | if (allfrag) |
@@ -1232,7 +1235,7 @@ void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr, | |||
1232 | nrt->u.dst.metrics[RTAX_MTU-1] = pmtu; | 1235 | nrt->u.dst.metrics[RTAX_MTU-1] = pmtu; |
1233 | if (allfrag) | 1236 | if (allfrag) |
1234 | nrt->u.dst.metrics[RTAX_FEATURES-1] |= RTAX_FEATURE_ALLFRAG; | 1237 | nrt->u.dst.metrics[RTAX_FEATURES-1] |= RTAX_FEATURE_ALLFRAG; |
1235 | ip6_ins_rt(nrt, NULL, NULL); | 1238 | ip6_ins_rt(nrt, NULL, NULL, NULL); |
1236 | } | 1239 | } |
1237 | 1240 | ||
1238 | out: | 1241 | out: |
@@ -1305,7 +1308,7 @@ struct rt6_info *rt6_add_dflt_router(struct in6_addr *gwaddr, | |||
1305 | 1308 | ||
1306 | rtmsg.rtmsg_ifindex = dev->ifindex; | 1309 | rtmsg.rtmsg_ifindex = dev->ifindex; |
1307 | 1310 | ||
1308 | ip6_route_add(&rtmsg, NULL, NULL); | 1311 | ip6_route_add(&rtmsg, NULL, NULL, NULL); |
1309 | return rt6_get_dflt_router(gwaddr, dev); | 1312 | return rt6_get_dflt_router(gwaddr, dev); |
1310 | } | 1313 | } |
1311 | 1314 | ||
@@ -1323,7 +1326,7 @@ restart: | |||
1323 | 1326 | ||
1324 | read_unlock_bh(&rt6_lock); | 1327 | read_unlock_bh(&rt6_lock); |
1325 | 1328 | ||
1326 | ip6_del_rt(rt, NULL, NULL); | 1329 | ip6_del_rt(rt, NULL, NULL, NULL); |
1327 | 1330 | ||
1328 | goto restart; | 1331 | goto restart; |
1329 | } | 1332 | } |
@@ -1349,10 +1352,10 @@ int ipv6_route_ioctl(unsigned int cmd, void __user *arg) | |||
1349 | rtnl_lock(); | 1352 | rtnl_lock(); |
1350 | switch (cmd) { | 1353 | switch (cmd) { |
1351 | case SIOCADDRT: | 1354 | case SIOCADDRT: |
1352 | err = ip6_route_add(&rtmsg, NULL, NULL); | 1355 | err = ip6_route_add(&rtmsg, NULL, NULL, NULL); |
1353 | break; | 1356 | break; |
1354 | case SIOCDELRT: | 1357 | case SIOCDELRT: |
1355 | err = ip6_route_del(&rtmsg, NULL, NULL); | 1358 | err = ip6_route_del(&rtmsg, NULL, NULL, NULL); |
1356 | break; | 1359 | break; |
1357 | default: | 1360 | default: |
1358 | err = -EINVAL; | 1361 | err = -EINVAL; |
@@ -1546,7 +1549,7 @@ int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | |||
1546 | 1549 | ||
1547 | if (inet6_rtm_to_rtmsg(r, arg, &rtmsg)) | 1550 | if (inet6_rtm_to_rtmsg(r, arg, &rtmsg)) |
1548 | return -EINVAL; | 1551 | return -EINVAL; |
1549 | return ip6_route_del(&rtmsg, nlh, arg); | 1552 | return ip6_route_del(&rtmsg, nlh, arg, &NETLINK_CB(skb)); |
1550 | } | 1553 | } |
1551 | 1554 | ||
1552 | int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | 1555 | int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) |
@@ -1556,7 +1559,7 @@ int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | |||
1556 | 1559 | ||
1557 | if (inet6_rtm_to_rtmsg(r, arg, &rtmsg)) | 1560 | if (inet6_rtm_to_rtmsg(r, arg, &rtmsg)) |
1558 | return -EINVAL; | 1561 | return -EINVAL; |
1559 | return ip6_route_add(&rtmsg, nlh, arg); | 1562 | return ip6_route_add(&rtmsg, nlh, arg, &NETLINK_CB(skb)); |
1560 | } | 1563 | } |
1561 | 1564 | ||
1562 | struct rt6_rtnl_dump_arg | 1565 | struct rt6_rtnl_dump_arg |
@@ -1566,11 +1569,9 @@ struct rt6_rtnl_dump_arg | |||
1566 | }; | 1569 | }; |
1567 | 1570 | ||
1568 | static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt, | 1571 | static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt, |
1569 | struct in6_addr *dst, | 1572 | struct in6_addr *dst, struct in6_addr *src, |
1570 | struct in6_addr *src, | 1573 | int iif, int type, u32 pid, u32 seq, |
1571 | int iif, | 1574 | int prefix, unsigned int flags) |
1572 | int type, u32 pid, u32 seq, | ||
1573 | struct nlmsghdr *in_nlh, int prefix) | ||
1574 | { | 1575 | { |
1575 | struct rtmsg *rtm; | 1576 | struct rtmsg *rtm; |
1576 | struct nlmsghdr *nlh; | 1577 | struct nlmsghdr *nlh; |
@@ -1584,11 +1585,7 @@ static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt, | |||
1584 | } | 1585 | } |
1585 | } | 1586 | } |
1586 | 1587 | ||
1587 | if (!pid && in_nlh) { | 1588 | nlh = NLMSG_NEW(skb, pid, seq, type, sizeof(*rtm), flags); |
1588 | pid = in_nlh->nlmsg_pid; | ||
1589 | } | ||
1590 | |||
1591 | nlh = NLMSG_PUT(skb, pid, seq, type, sizeof(*rtm)); | ||
1592 | rtm = NLMSG_DATA(nlh); | 1589 | rtm = NLMSG_DATA(nlh); |
1593 | rtm->rtm_family = AF_INET6; | 1590 | rtm->rtm_family = AF_INET6; |
1594 | rtm->rtm_dst_len = rt->rt6i_dst.plen; | 1591 | rtm->rtm_dst_len = rt->rt6i_dst.plen; |
@@ -1674,7 +1671,7 @@ static int rt6_dump_route(struct rt6_info *rt, void *p_arg) | |||
1674 | 1671 | ||
1675 | return rt6_fill_node(arg->skb, rt, NULL, NULL, 0, RTM_NEWROUTE, | 1672 | return rt6_fill_node(arg->skb, rt, NULL, NULL, 0, RTM_NEWROUTE, |
1676 | NETLINK_CB(arg->cb->skb).pid, arg->cb->nlh->nlmsg_seq, | 1673 | NETLINK_CB(arg->cb->skb).pid, arg->cb->nlh->nlmsg_seq, |
1677 | NULL, prefix); | 1674 | prefix, NLM_F_MULTI); |
1678 | } | 1675 | } |
1679 | 1676 | ||
1680 | static int fib6_dump_node(struct fib6_walker_t *w) | 1677 | static int fib6_dump_node(struct fib6_walker_t *w) |
@@ -1822,7 +1819,7 @@ int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) | |||
1822 | &fl.fl6_dst, &fl.fl6_src, | 1819 | &fl.fl6_dst, &fl.fl6_src, |
1823 | iif, | 1820 | iif, |
1824 | RTM_NEWROUTE, NETLINK_CB(in_skb).pid, | 1821 | RTM_NEWROUTE, NETLINK_CB(in_skb).pid, |
1825 | nlh->nlmsg_seq, nlh, 0); | 1822 | nlh->nlmsg_seq, 0, 0); |
1826 | if (err < 0) { | 1823 | if (err < 0) { |
1827 | err = -EMSGSIZE; | 1824 | err = -EMSGSIZE; |
1828 | goto out_free; | 1825 | goto out_free; |
@@ -1838,17 +1835,25 @@ out_free: | |||
1838 | goto out; | 1835 | goto out; |
1839 | } | 1836 | } |
1840 | 1837 | ||
1841 | void inet6_rt_notify(int event, struct rt6_info *rt, struct nlmsghdr *nlh) | 1838 | void inet6_rt_notify(int event, struct rt6_info *rt, struct nlmsghdr *nlh, |
1839 | struct netlink_skb_parms *req) | ||
1842 | { | 1840 | { |
1843 | struct sk_buff *skb; | 1841 | struct sk_buff *skb; |
1844 | int size = NLMSG_SPACE(sizeof(struct rtmsg)+256); | 1842 | int size = NLMSG_SPACE(sizeof(struct rtmsg)+256); |
1843 | u32 pid = current->pid; | ||
1844 | u32 seq = 0; | ||
1845 | 1845 | ||
1846 | if (req) | ||
1847 | pid = req->pid; | ||
1848 | if (nlh) | ||
1849 | seq = nlh->nlmsg_seq; | ||
1850 | |||
1846 | skb = alloc_skb(size, gfp_any()); | 1851 | skb = alloc_skb(size, gfp_any()); |
1847 | if (!skb) { | 1852 | if (!skb) { |
1848 | netlink_set_err(rtnl, 0, RTMGRP_IPV6_ROUTE, ENOBUFS); | 1853 | netlink_set_err(rtnl, 0, RTMGRP_IPV6_ROUTE, ENOBUFS); |
1849 | return; | 1854 | return; |
1850 | } | 1855 | } |
1851 | if (rt6_fill_node(skb, rt, NULL, NULL, 0, event, 0, 0, nlh, 0) < 0) { | 1856 | if (rt6_fill_node(skb, rt, NULL, NULL, 0, event, pid, seq, 0, 0) < 0) { |
1852 | kfree_skb(skb); | 1857 | kfree_skb(skb); |
1853 | netlink_set_err(rtnl, 0, RTMGRP_IPV6_ROUTE, EINVAL); | 1858 | netlink_set_err(rtnl, 0, RTMGRP_IPV6_ROUTE, EINVAL); |
1854 | return; | 1859 | return; |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 0f69e800a0ad..2414937f2a83 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -65,7 +65,7 @@ | |||
65 | #include <linux/seq_file.h> | 65 | #include <linux/seq_file.h> |
66 | 66 | ||
67 | static void tcp_v6_send_reset(struct sk_buff *skb); | 67 | static void tcp_v6_send_reset(struct sk_buff *skb); |
68 | static void tcp_v6_or_send_ack(struct sk_buff *skb, struct open_request *req); | 68 | static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req); |
69 | static void tcp_v6_send_check(struct sock *sk, struct tcphdr *th, int len, | 69 | static void tcp_v6_send_check(struct sock *sk, struct tcphdr *th, int len, |
70 | struct sk_buff *skb); | 70 | struct sk_buff *skb); |
71 | 71 | ||
@@ -394,24 +394,26 @@ static u32 tcp_v6_synq_hash(struct in6_addr *raddr, u16 rport, u32 rnd) | |||
394 | return c & (TCP_SYNQ_HSIZE - 1); | 394 | return c & (TCP_SYNQ_HSIZE - 1); |
395 | } | 395 | } |
396 | 396 | ||
397 | static struct open_request *tcp_v6_search_req(struct tcp_sock *tp, | 397 | static struct request_sock *tcp_v6_search_req(struct tcp_sock *tp, |
398 | struct open_request ***prevp, | 398 | struct request_sock ***prevp, |
399 | __u16 rport, | 399 | __u16 rport, |
400 | struct in6_addr *raddr, | 400 | struct in6_addr *raddr, |
401 | struct in6_addr *laddr, | 401 | struct in6_addr *laddr, |
402 | int iif) | 402 | int iif) |
403 | { | 403 | { |
404 | struct tcp_listen_opt *lopt = tp->listen_opt; | 404 | struct listen_sock *lopt = tp->accept_queue.listen_opt; |
405 | struct open_request *req, **prev; | 405 | struct request_sock *req, **prev; |
406 | 406 | ||
407 | for (prev = &lopt->syn_table[tcp_v6_synq_hash(raddr, rport, lopt->hash_rnd)]; | 407 | for (prev = &lopt->syn_table[tcp_v6_synq_hash(raddr, rport, lopt->hash_rnd)]; |
408 | (req = *prev) != NULL; | 408 | (req = *prev) != NULL; |
409 | prev = &req->dl_next) { | 409 | prev = &req->dl_next) { |
410 | if (req->rmt_port == rport && | 410 | const struct tcp6_request_sock *treq = tcp6_rsk(req); |
411 | req->class->family == AF_INET6 && | 411 | |
412 | ipv6_addr_equal(&req->af.v6_req.rmt_addr, raddr) && | 412 | if (inet_rsk(req)->rmt_port == rport && |
413 | ipv6_addr_equal(&req->af.v6_req.loc_addr, laddr) && | 413 | req->rsk_ops->family == AF_INET6 && |
414 | (!req->af.v6_req.iif || req->af.v6_req.iif == iif)) { | 414 | ipv6_addr_equal(&treq->rmt_addr, raddr) && |
415 | ipv6_addr_equal(&treq->loc_addr, laddr) && | ||
416 | (!treq->iif || treq->iif == iif)) { | ||
415 | BUG_TRAP(req->sk == NULL); | 417 | BUG_TRAP(req->sk == NULL); |
416 | *prevp = prev; | 418 | *prevp = prev; |
417 | return req; | 419 | return req; |
@@ -906,9 +908,9 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
906 | 908 | ||
907 | icmpv6_err_convert(type, code, &err); | 909 | icmpv6_err_convert(type, code, &err); |
908 | 910 | ||
909 | /* Might be for an open_request */ | 911 | /* Might be for an request_sock */ |
910 | switch (sk->sk_state) { | 912 | switch (sk->sk_state) { |
911 | struct open_request *req, **prev; | 913 | struct request_sock *req, **prev; |
912 | case TCP_LISTEN: | 914 | case TCP_LISTEN: |
913 | if (sock_owned_by_user(sk)) | 915 | if (sock_owned_by_user(sk)) |
914 | goto out; | 916 | goto out; |
@@ -923,7 +925,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
923 | */ | 925 | */ |
924 | BUG_TRAP(req->sk == NULL); | 926 | BUG_TRAP(req->sk == NULL); |
925 | 927 | ||
926 | if (seq != req->snt_isn) { | 928 | if (seq != tcp_rsk(req)->snt_isn) { |
927 | NET_INC_STATS_BH(LINUX_MIB_OUTOFWINDOWICMPS); | 929 | NET_INC_STATS_BH(LINUX_MIB_OUTOFWINDOWICMPS); |
928 | goto out; | 930 | goto out; |
929 | } | 931 | } |
@@ -957,9 +959,10 @@ out: | |||
957 | } | 959 | } |
958 | 960 | ||
959 | 961 | ||
960 | static int tcp_v6_send_synack(struct sock *sk, struct open_request *req, | 962 | static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req, |
961 | struct dst_entry *dst) | 963 | struct dst_entry *dst) |
962 | { | 964 | { |
965 | struct tcp6_request_sock *treq = tcp6_rsk(req); | ||
963 | struct ipv6_pinfo *np = inet6_sk(sk); | 966 | struct ipv6_pinfo *np = inet6_sk(sk); |
964 | struct sk_buff * skb; | 967 | struct sk_buff * skb; |
965 | struct ipv6_txoptions *opt = NULL; | 968 | struct ipv6_txoptions *opt = NULL; |
@@ -969,19 +972,19 @@ static int tcp_v6_send_synack(struct sock *sk, struct open_request *req, | |||
969 | 972 | ||
970 | memset(&fl, 0, sizeof(fl)); | 973 | memset(&fl, 0, sizeof(fl)); |
971 | fl.proto = IPPROTO_TCP; | 974 | fl.proto = IPPROTO_TCP; |
972 | ipv6_addr_copy(&fl.fl6_dst, &req->af.v6_req.rmt_addr); | 975 | ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr); |
973 | ipv6_addr_copy(&fl.fl6_src, &req->af.v6_req.loc_addr); | 976 | ipv6_addr_copy(&fl.fl6_src, &treq->loc_addr); |
974 | fl.fl6_flowlabel = 0; | 977 | fl.fl6_flowlabel = 0; |
975 | fl.oif = req->af.v6_req.iif; | 978 | fl.oif = treq->iif; |
976 | fl.fl_ip_dport = req->rmt_port; | 979 | fl.fl_ip_dport = inet_rsk(req)->rmt_port; |
977 | fl.fl_ip_sport = inet_sk(sk)->sport; | 980 | fl.fl_ip_sport = inet_sk(sk)->sport; |
978 | 981 | ||
979 | if (dst == NULL) { | 982 | if (dst == NULL) { |
980 | opt = np->opt; | 983 | opt = np->opt; |
981 | if (opt == NULL && | 984 | if (opt == NULL && |
982 | np->rxopt.bits.srcrt == 2 && | 985 | np->rxopt.bits.srcrt == 2 && |
983 | req->af.v6_req.pktopts) { | 986 | treq->pktopts) { |
984 | struct sk_buff *pktopts = req->af.v6_req.pktopts; | 987 | struct sk_buff *pktopts = treq->pktopts; |
985 | struct inet6_skb_parm *rxopt = IP6CB(pktopts); | 988 | struct inet6_skb_parm *rxopt = IP6CB(pktopts); |
986 | if (rxopt->srcrt) | 989 | if (rxopt->srcrt) |
987 | opt = ipv6_invert_rthdr(sk, (struct ipv6_rt_hdr*)(pktopts->nh.raw + rxopt->srcrt)); | 990 | opt = ipv6_invert_rthdr(sk, (struct ipv6_rt_hdr*)(pktopts->nh.raw + rxopt->srcrt)); |
@@ -1008,10 +1011,10 @@ static int tcp_v6_send_synack(struct sock *sk, struct open_request *req, | |||
1008 | struct tcphdr *th = skb->h.th; | 1011 | struct tcphdr *th = skb->h.th; |
1009 | 1012 | ||
1010 | th->check = tcp_v6_check(th, skb->len, | 1013 | th->check = tcp_v6_check(th, skb->len, |
1011 | &req->af.v6_req.loc_addr, &req->af.v6_req.rmt_addr, | 1014 | &treq->loc_addr, &treq->rmt_addr, |
1012 | csum_partial((char *)th, skb->len, skb->csum)); | 1015 | csum_partial((char *)th, skb->len, skb->csum)); |
1013 | 1016 | ||
1014 | ipv6_addr_copy(&fl.fl6_dst, &req->af.v6_req.rmt_addr); | 1017 | ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr); |
1015 | err = ip6_xmit(sk, skb, &fl, opt, 0); | 1018 | err = ip6_xmit(sk, skb, &fl, opt, 0); |
1016 | if (err == NET_XMIT_CN) | 1019 | if (err == NET_XMIT_CN) |
1017 | err = 0; | 1020 | err = 0; |
@@ -1024,17 +1027,18 @@ done: | |||
1024 | return err; | 1027 | return err; |
1025 | } | 1028 | } |
1026 | 1029 | ||
1027 | static void tcp_v6_or_free(struct open_request *req) | 1030 | static void tcp_v6_reqsk_destructor(struct request_sock *req) |
1028 | { | 1031 | { |
1029 | if (req->af.v6_req.pktopts) | 1032 | if (tcp6_rsk(req)->pktopts) |
1030 | kfree_skb(req->af.v6_req.pktopts); | 1033 | kfree_skb(tcp6_rsk(req)->pktopts); |
1031 | } | 1034 | } |
1032 | 1035 | ||
1033 | static struct or_calltable or_ipv6 = { | 1036 | static struct request_sock_ops tcp6_request_sock_ops = { |
1034 | .family = AF_INET6, | 1037 | .family = AF_INET6, |
1038 | .obj_size = sizeof(struct tcp6_request_sock), | ||
1035 | .rtx_syn_ack = tcp_v6_send_synack, | 1039 | .rtx_syn_ack = tcp_v6_send_synack, |
1036 | .send_ack = tcp_v6_or_send_ack, | 1040 | .send_ack = tcp_v6_reqsk_send_ack, |
1037 | .destructor = tcp_v6_or_free, | 1041 | .destructor = tcp_v6_reqsk_destructor, |
1038 | .send_reset = tcp_v6_send_reset | 1042 | .send_reset = tcp_v6_send_reset |
1039 | }; | 1043 | }; |
1040 | 1044 | ||
@@ -1219,15 +1223,15 @@ static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb) | |||
1219 | tcp_tw_put(tw); | 1223 | tcp_tw_put(tw); |
1220 | } | 1224 | } |
1221 | 1225 | ||
1222 | static void tcp_v6_or_send_ack(struct sk_buff *skb, struct open_request *req) | 1226 | static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req) |
1223 | { | 1227 | { |
1224 | tcp_v6_send_ack(skb, req->snt_isn+1, req->rcv_isn+1, req->rcv_wnd, req->ts_recent); | 1228 | tcp_v6_send_ack(skb, tcp_rsk(req)->snt_isn + 1, tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd, req->ts_recent); |
1225 | } | 1229 | } |
1226 | 1230 | ||
1227 | 1231 | ||
1228 | static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) | 1232 | static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) |
1229 | { | 1233 | { |
1230 | struct open_request *req, **prev; | 1234 | struct request_sock *req, **prev; |
1231 | struct tcphdr *th = skb->h.th; | 1235 | struct tcphdr *th = skb->h.th; |
1232 | struct tcp_sock *tp = tcp_sk(sk); | 1236 | struct tcp_sock *tp = tcp_sk(sk); |
1233 | struct sock *nsk; | 1237 | struct sock *nsk; |
@@ -1260,21 +1264,13 @@ static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) | |||
1260 | return sk; | 1264 | return sk; |
1261 | } | 1265 | } |
1262 | 1266 | ||
1263 | static void tcp_v6_synq_add(struct sock *sk, struct open_request *req) | 1267 | static void tcp_v6_synq_add(struct sock *sk, struct request_sock *req) |
1264 | { | 1268 | { |
1265 | struct tcp_sock *tp = tcp_sk(sk); | 1269 | struct tcp_sock *tp = tcp_sk(sk); |
1266 | struct tcp_listen_opt *lopt = tp->listen_opt; | 1270 | struct listen_sock *lopt = tp->accept_queue.listen_opt; |
1267 | u32 h = tcp_v6_synq_hash(&req->af.v6_req.rmt_addr, req->rmt_port, lopt->hash_rnd); | 1271 | u32 h = tcp_v6_synq_hash(&tcp6_rsk(req)->rmt_addr, inet_rsk(req)->rmt_port, lopt->hash_rnd); |
1268 | |||
1269 | req->sk = NULL; | ||
1270 | req->expires = jiffies + TCP_TIMEOUT_INIT; | ||
1271 | req->retrans = 0; | ||
1272 | req->dl_next = lopt->syn_table[h]; | ||
1273 | |||
1274 | write_lock(&tp->syn_wait_lock); | ||
1275 | lopt->syn_table[h] = req; | ||
1276 | write_unlock(&tp->syn_wait_lock); | ||
1277 | 1272 | ||
1273 | reqsk_queue_hash_req(&tp->accept_queue, h, req, TCP_TIMEOUT_INIT); | ||
1278 | tcp_synq_added(sk); | 1274 | tcp_synq_added(sk); |
1279 | } | 1275 | } |
1280 | 1276 | ||
@@ -1284,10 +1280,11 @@ static void tcp_v6_synq_add(struct sock *sk, struct open_request *req) | |||
1284 | */ | 1280 | */ |
1285 | static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | 1281 | static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) |
1286 | { | 1282 | { |
1283 | struct tcp6_request_sock *treq; | ||
1287 | struct ipv6_pinfo *np = inet6_sk(sk); | 1284 | struct ipv6_pinfo *np = inet6_sk(sk); |
1288 | struct tcp_options_received tmp_opt; | 1285 | struct tcp_options_received tmp_opt; |
1289 | struct tcp_sock *tp = tcp_sk(sk); | 1286 | struct tcp_sock *tp = tcp_sk(sk); |
1290 | struct open_request *req = NULL; | 1287 | struct request_sock *req = NULL; |
1291 | __u32 isn = TCP_SKB_CB(skb)->when; | 1288 | __u32 isn = TCP_SKB_CB(skb)->when; |
1292 | 1289 | ||
1293 | if (skb->protocol == htons(ETH_P_IP)) | 1290 | if (skb->protocol == htons(ETH_P_IP)) |
@@ -1308,7 +1305,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1308 | if (sk_acceptq_is_full(sk) && tcp_synq_young(sk) > 1) | 1305 | if (sk_acceptq_is_full(sk) && tcp_synq_young(sk) > 1) |
1309 | goto drop; | 1306 | goto drop; |
1310 | 1307 | ||
1311 | req = tcp_openreq_alloc(); | 1308 | req = reqsk_alloc(&tcp6_request_sock_ops); |
1312 | if (req == NULL) | 1309 | if (req == NULL) |
1313 | goto drop; | 1310 | goto drop; |
1314 | 1311 | ||
@@ -1321,28 +1318,28 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1321 | tmp_opt.tstamp_ok = tmp_opt.saw_tstamp; | 1318 | tmp_opt.tstamp_ok = tmp_opt.saw_tstamp; |
1322 | tcp_openreq_init(req, &tmp_opt, skb); | 1319 | tcp_openreq_init(req, &tmp_opt, skb); |
1323 | 1320 | ||
1324 | req->class = &or_ipv6; | 1321 | treq = tcp6_rsk(req); |
1325 | ipv6_addr_copy(&req->af.v6_req.rmt_addr, &skb->nh.ipv6h->saddr); | 1322 | ipv6_addr_copy(&treq->rmt_addr, &skb->nh.ipv6h->saddr); |
1326 | ipv6_addr_copy(&req->af.v6_req.loc_addr, &skb->nh.ipv6h->daddr); | 1323 | ipv6_addr_copy(&treq->loc_addr, &skb->nh.ipv6h->daddr); |
1327 | TCP_ECN_create_request(req, skb->h.th); | 1324 | TCP_ECN_create_request(req, skb->h.th); |
1328 | req->af.v6_req.pktopts = NULL; | 1325 | treq->pktopts = NULL; |
1329 | if (ipv6_opt_accepted(sk, skb) || | 1326 | if (ipv6_opt_accepted(sk, skb) || |
1330 | np->rxopt.bits.rxinfo || | 1327 | np->rxopt.bits.rxinfo || |
1331 | np->rxopt.bits.rxhlim) { | 1328 | np->rxopt.bits.rxhlim) { |
1332 | atomic_inc(&skb->users); | 1329 | atomic_inc(&skb->users); |
1333 | req->af.v6_req.pktopts = skb; | 1330 | treq->pktopts = skb; |
1334 | } | 1331 | } |
1335 | req->af.v6_req.iif = sk->sk_bound_dev_if; | 1332 | treq->iif = sk->sk_bound_dev_if; |
1336 | 1333 | ||
1337 | /* So that link locals have meaning */ | 1334 | /* So that link locals have meaning */ |
1338 | if (!sk->sk_bound_dev_if && | 1335 | if (!sk->sk_bound_dev_if && |
1339 | ipv6_addr_type(&req->af.v6_req.rmt_addr) & IPV6_ADDR_LINKLOCAL) | 1336 | ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL) |
1340 | req->af.v6_req.iif = tcp_v6_iif(skb); | 1337 | treq->iif = tcp_v6_iif(skb); |
1341 | 1338 | ||
1342 | if (isn == 0) | 1339 | if (isn == 0) |
1343 | isn = tcp_v6_init_sequence(sk,skb); | 1340 | isn = tcp_v6_init_sequence(sk,skb); |
1344 | 1341 | ||
1345 | req->snt_isn = isn; | 1342 | tcp_rsk(req)->snt_isn = isn; |
1346 | 1343 | ||
1347 | if (tcp_v6_send_synack(sk, req, NULL)) | 1344 | if (tcp_v6_send_synack(sk, req, NULL)) |
1348 | goto drop; | 1345 | goto drop; |
@@ -1353,16 +1350,17 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1353 | 1350 | ||
1354 | drop: | 1351 | drop: |
1355 | if (req) | 1352 | if (req) |
1356 | tcp_openreq_free(req); | 1353 | reqsk_free(req); |
1357 | 1354 | ||
1358 | TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS); | 1355 | TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS); |
1359 | return 0; /* don't send reset */ | 1356 | return 0; /* don't send reset */ |
1360 | } | 1357 | } |
1361 | 1358 | ||
1362 | static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | 1359 | static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, |
1363 | struct open_request *req, | 1360 | struct request_sock *req, |
1364 | struct dst_entry *dst) | 1361 | struct dst_entry *dst) |
1365 | { | 1362 | { |
1363 | struct tcp6_request_sock *treq = tcp6_rsk(req); | ||
1366 | struct ipv6_pinfo *newnp, *np = inet6_sk(sk); | 1364 | struct ipv6_pinfo *newnp, *np = inet6_sk(sk); |
1367 | struct tcp6_sock *newtcp6sk; | 1365 | struct tcp6_sock *newtcp6sk; |
1368 | struct inet_sock *newinet; | 1366 | struct inet_sock *newinet; |
@@ -1426,10 +1424,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1426 | goto out_overflow; | 1424 | goto out_overflow; |
1427 | 1425 | ||
1428 | if (np->rxopt.bits.srcrt == 2 && | 1426 | if (np->rxopt.bits.srcrt == 2 && |
1429 | opt == NULL && req->af.v6_req.pktopts) { | 1427 | opt == NULL && treq->pktopts) { |
1430 | struct inet6_skb_parm *rxopt = IP6CB(req->af.v6_req.pktopts); | 1428 | struct inet6_skb_parm *rxopt = IP6CB(treq->pktopts); |
1431 | if (rxopt->srcrt) | 1429 | if (rxopt->srcrt) |
1432 | opt = ipv6_invert_rthdr(sk, (struct ipv6_rt_hdr*)(req->af.v6_req.pktopts->nh.raw+rxopt->srcrt)); | 1430 | opt = ipv6_invert_rthdr(sk, (struct ipv6_rt_hdr *)(treq->pktopts->nh.raw + rxopt->srcrt)); |
1433 | } | 1431 | } |
1434 | 1432 | ||
1435 | if (dst == NULL) { | 1433 | if (dst == NULL) { |
@@ -1438,16 +1436,16 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1438 | 1436 | ||
1439 | memset(&fl, 0, sizeof(fl)); | 1437 | memset(&fl, 0, sizeof(fl)); |
1440 | fl.proto = IPPROTO_TCP; | 1438 | fl.proto = IPPROTO_TCP; |
1441 | ipv6_addr_copy(&fl.fl6_dst, &req->af.v6_req.rmt_addr); | 1439 | ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr); |
1442 | if (opt && opt->srcrt) { | 1440 | if (opt && opt->srcrt) { |
1443 | struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt; | 1441 | struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt; |
1444 | ipv6_addr_copy(&final, &fl.fl6_dst); | 1442 | ipv6_addr_copy(&final, &fl.fl6_dst); |
1445 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | 1443 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); |
1446 | final_p = &final; | 1444 | final_p = &final; |
1447 | } | 1445 | } |
1448 | ipv6_addr_copy(&fl.fl6_src, &req->af.v6_req.loc_addr); | 1446 | ipv6_addr_copy(&fl.fl6_src, &treq->loc_addr); |
1449 | fl.oif = sk->sk_bound_dev_if; | 1447 | fl.oif = sk->sk_bound_dev_if; |
1450 | fl.fl_ip_dport = req->rmt_port; | 1448 | fl.fl_ip_dport = inet_rsk(req)->rmt_port; |
1451 | fl.fl_ip_sport = inet_sk(sk)->sport; | 1449 | fl.fl_ip_sport = inet_sk(sk)->sport; |
1452 | 1450 | ||
1453 | if (ip6_dst_lookup(sk, &dst, &fl)) | 1451 | if (ip6_dst_lookup(sk, &dst, &fl)) |
@@ -1482,10 +1480,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1482 | 1480 | ||
1483 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); | 1481 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); |
1484 | 1482 | ||
1485 | ipv6_addr_copy(&newnp->daddr, &req->af.v6_req.rmt_addr); | 1483 | ipv6_addr_copy(&newnp->daddr, &treq->rmt_addr); |
1486 | ipv6_addr_copy(&newnp->saddr, &req->af.v6_req.loc_addr); | 1484 | ipv6_addr_copy(&newnp->saddr, &treq->loc_addr); |
1487 | ipv6_addr_copy(&newnp->rcv_saddr, &req->af.v6_req.loc_addr); | 1485 | ipv6_addr_copy(&newnp->rcv_saddr, &treq->loc_addr); |
1488 | newsk->sk_bound_dev_if = req->af.v6_req.iif; | 1486 | newsk->sk_bound_dev_if = treq->iif; |
1489 | 1487 | ||
1490 | /* Now IPv6 options... | 1488 | /* Now IPv6 options... |
1491 | 1489 | ||
@@ -1498,11 +1496,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1498 | 1496 | ||
1499 | /* Clone pktoptions received with SYN */ | 1497 | /* Clone pktoptions received with SYN */ |
1500 | newnp->pktoptions = NULL; | 1498 | newnp->pktoptions = NULL; |
1501 | if (req->af.v6_req.pktopts) { | 1499 | if (treq->pktopts != NULL) { |
1502 | newnp->pktoptions = skb_clone(req->af.v6_req.pktopts, | 1500 | newnp->pktoptions = skb_clone(treq->pktopts, GFP_ATOMIC); |
1503 | GFP_ATOMIC); | 1501 | kfree_skb(treq->pktopts); |
1504 | kfree_skb(req->af.v6_req.pktopts); | 1502 | treq->pktopts = NULL; |
1505 | req->af.v6_req.pktopts = NULL; | ||
1506 | if (newnp->pktoptions) | 1503 | if (newnp->pktoptions) |
1507 | skb_set_owner_r(newnp->pktoptions, newsk); | 1504 | skb_set_owner_r(newnp->pktoptions, newsk); |
1508 | } | 1505 | } |
@@ -2050,7 +2047,7 @@ static int tcp_v6_destroy_sock(struct sock *sk) | |||
2050 | 2047 | ||
2051 | /* Proc filesystem TCPv6 sock list dumping. */ | 2048 | /* Proc filesystem TCPv6 sock list dumping. */ |
2052 | static void get_openreq6(struct seq_file *seq, | 2049 | static void get_openreq6(struct seq_file *seq, |
2053 | struct sock *sk, struct open_request *req, int i, int uid) | 2050 | struct sock *sk, struct request_sock *req, int i, int uid) |
2054 | { | 2051 | { |
2055 | struct in6_addr *dest, *src; | 2052 | struct in6_addr *dest, *src; |
2056 | int ttd = req->expires - jiffies; | 2053 | int ttd = req->expires - jiffies; |
@@ -2058,8 +2055,8 @@ static void get_openreq6(struct seq_file *seq, | |||
2058 | if (ttd < 0) | 2055 | if (ttd < 0) |
2059 | ttd = 0; | 2056 | ttd = 0; |
2060 | 2057 | ||
2061 | src = &req->af.v6_req.loc_addr; | 2058 | src = &tcp6_rsk(req)->loc_addr; |
2062 | dest = &req->af.v6_req.rmt_addr; | 2059 | dest = &tcp6_rsk(req)->rmt_addr; |
2063 | seq_printf(seq, | 2060 | seq_printf(seq, |
2064 | "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " | 2061 | "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " |
2065 | "%02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %p\n", | 2062 | "%02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %p\n", |
@@ -2069,7 +2066,7 @@ static void get_openreq6(struct seq_file *seq, | |||
2069 | ntohs(inet_sk(sk)->sport), | 2066 | ntohs(inet_sk(sk)->sport), |
2070 | dest->s6_addr32[0], dest->s6_addr32[1], | 2067 | dest->s6_addr32[0], dest->s6_addr32[1], |
2071 | dest->s6_addr32[2], dest->s6_addr32[3], | 2068 | dest->s6_addr32[2], dest->s6_addr32[3], |
2072 | ntohs(req->rmt_port), | 2069 | ntohs(inet_rsk(req)->rmt_port), |
2073 | TCP_SYN_RECV, | 2070 | TCP_SYN_RECV, |
2074 | 0,0, /* could print option size, but that is af dependent. */ | 2071 | 0,0, /* could print option size, but that is af dependent. */ |
2075 | 1, /* timers active (only the expire timer) */ | 2072 | 1, /* timers active (only the expire timer) */ |
@@ -2239,6 +2236,7 @@ struct proto tcpv6_prot = { | |||
2239 | .sysctl_rmem = sysctl_tcp_rmem, | 2236 | .sysctl_rmem = sysctl_tcp_rmem, |
2240 | .max_header = MAX_TCP_HEADER, | 2237 | .max_header = MAX_TCP_HEADER, |
2241 | .obj_size = sizeof(struct tcp6_sock), | 2238 | .obj_size = sizeof(struct tcp6_sock), |
2239 | .rsk_prot = &tcp6_request_sock_ops, | ||
2242 | }; | 2240 | }; |
2243 | 2241 | ||
2244 | static struct inet6_protocol tcpv6_protocol = { | 2242 | static struct inet6_protocol tcpv6_protocol = { |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index e251d0ba4f39..eff050ac7049 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -300,12 +300,12 @@ csum_copy_err: | |||
300 | /* Clear queue. */ | 300 | /* Clear queue. */ |
301 | if (flags&MSG_PEEK) { | 301 | if (flags&MSG_PEEK) { |
302 | int clear = 0; | 302 | int clear = 0; |
303 | spin_lock_irq(&sk->sk_receive_queue.lock); | 303 | spin_lock_bh(&sk->sk_receive_queue.lock); |
304 | if (skb == skb_peek(&sk->sk_receive_queue)) { | 304 | if (skb == skb_peek(&sk->sk_receive_queue)) { |
305 | __skb_unlink(skb, &sk->sk_receive_queue); | 305 | __skb_unlink(skb, &sk->sk_receive_queue); |
306 | clear = 1; | 306 | clear = 1; |
307 | } | 307 | } |
308 | spin_unlock_irq(&sk->sk_receive_queue.lock); | 308 | spin_unlock_bh(&sk->sk_receive_queue.lock); |
309 | if (clear) | 309 | if (clear) |
310 | kfree_skb(skb); | 310 | kfree_skb(skb); |
311 | } | 311 | } |
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c index 601a148f60f3..6b9867717d11 100644 --- a/net/ipv6/xfrm6_output.c +++ b/net/ipv6/xfrm6_output.c | |||
@@ -84,6 +84,7 @@ static int xfrm6_tunnel_check_size(struct sk_buff *skb) | |||
84 | mtu = IPV6_MIN_MTU; | 84 | mtu = IPV6_MIN_MTU; |
85 | 85 | ||
86 | if (skb->len > mtu) { | 86 | if (skb->len > mtu) { |
87 | skb->dev = dst->dev; | ||
87 | icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); | 88 | icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); |
88 | ret = -EMSGSIZE; | 89 | ret = -EMSGSIZE; |
89 | } | 90 | } |
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 4429b1a1fe5f..cf1d91e74c82 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -113,6 +113,8 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int | |||
113 | 113 | ||
114 | xdst = (struct xfrm_dst *)dst1; | 114 | xdst = (struct xfrm_dst *)dst1; |
115 | xdst->route = &rt->u.dst; | 115 | xdst->route = &rt->u.dst; |
116 | if (rt->rt6i_node) | ||
117 | xdst->route_cookie = rt->rt6i_node->fn_sernum; | ||
116 | 118 | ||
117 | dst1->next = dst_prev; | 119 | dst1->next = dst_prev; |
118 | dst_prev = dst1; | 120 | dst_prev = dst1; |
@@ -137,6 +139,8 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int | |||
137 | 139 | ||
138 | dst_prev->child = &rt->u.dst; | 140 | dst_prev->child = &rt->u.dst; |
139 | dst->path = &rt->u.dst; | 141 | dst->path = &rt->u.dst; |
142 | if (rt->rt6i_node) | ||
143 | ((struct xfrm_dst *)dst)->path_cookie = rt->rt6i_node->fn_sernum; | ||
140 | 144 | ||
141 | *dst_p = dst; | 145 | *dst_p = dst; |
142 | dst = dst_prev; | 146 | dst = dst_prev; |
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c index ffcadd68b951..60c26c87277e 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c | |||
@@ -466,7 +466,7 @@ static void xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
466 | return; | 466 | return; |
467 | } | 467 | } |
468 | 468 | ||
469 | static int xfrm6_tunnel_init_state(struct xfrm_state *x, void *args) | 469 | static int xfrm6_tunnel_init_state(struct xfrm_state *x) |
470 | { | 470 | { |
471 | if (!x->props.mode) | 471 | if (!x->props.mode) |
472 | return -EINVAL; | 472 | return -EINVAL; |