aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-19 18:50:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-19 18:50:47 -0500
commit1ee2dcc2245340cf4ac94b99c4d00efbeba61824 (patch)
tree5339e55add987379525177011dde6e3756b1430c /net/ipv6
parent4457e6f6c9f6052cd5f44a79037108b5ddeb0ce7 (diff)
parent091e0662ee2c37867ad918ce7b6ddd17f0e090e2 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: "Mostly these are fixes for fallout due to merge window changes, as well as cures for problems that have been with us for a much longer period of time" 1) Johannes Berg noticed two major deficiencies in our genetlink registration. Some genetlink protocols we passing in constant counts for their ops array rather than something like ARRAY_SIZE(ops) or similar. Also, some genetlink protocols were using fixed IDs for their multicast groups. We have to retain these fixed IDs to keep existing userland tools working, but reserve them so that other multicast groups used by other protocols can not possibly conflict. In dealing with these two problems, we actually now use less state management for genetlink operations and multicast groups. 2) When configuring interface hardware timestamping, fix several drivers that simply do not validate that the hwtstamp_config value is one the driver actually supports. From Ben Hutchings. 3) Invalid memory references in mwifiex driver, from Amitkumar Karwar. 4) In dev_forward_skb(), set the skb->protocol in the right order relative to skb_scrub_packet(). From Alexei Starovoitov. 5) Bridge erroneously fails to use the proper wrapper functions to make calls to netdev_ops->ndo_vlan_rx_{add,kill}_vid. Fix from Toshiaki Makita. 6) When detaching a bridge port, make sure to flush all VLAN IDs to prevent them from leaking, also from Toshiaki Makita. 7) Put in a compromise for TCP Small Queues so that deep queued devices that delay TX reclaim non-trivially don't have such a performance decrease. One particularly problematic area is 802.11 AMPDU in wireless. From Eric Dumazet. 8) Fix crashes in tcp_fastopen_cache_get(), we can see NULL socket dsts here. Fix from Eric Dumzaet, reported by Dave Jones. 9) Fix use after free in ipv6 SIT driver, from Willem de Bruijn. 10) When computing mergeable buffer sizes, virtio-net fails to take the virtio-net header into account. From Michael Dalton. 11) Fix seqlock deadlock in ip4_datagram_connect() wrt. statistic bumping, this one has been with us for a while. From Eric Dumazet. 12) Fix NULL deref in the new TIPC fragmentation handling, from Erik Hugne. 13) 6lowpan bit used for traffic classification was wrong, from Jukka Rissanen. 14) macvlan has the same issue as normal vlans did wrt. propagating LRO disabling down to the real device, fix it the same way. From Michal Kubecek. 15) CPSW driver needs to soft reset all slaves during suspend, from Daniel Mack. 16) Fix small frame pacing in FQ packet scheduler, from Eric Dumazet. 17) The xen-netfront RX buffer refill timer isn't properly scheduled on partial RX allocation success, from Ma JieYue. 18) When ipv6 ping protocol support was added, the AF_INET6 protocol initialization cleanup path on failure was borked a little. Fix from Vlad Yasevich. 19) If a socket disconnects during a read/recvmsg/recvfrom/etc that blocks we can do the wrong thing with the msg_name we write back to userspace. From Hannes Frederic Sowa. There is another fix in the works from Hannes which will prevent future problems of this nature. 20) Fix route leak in VTI tunnel transmit, from Fan Du. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (106 commits) genetlink: make multicast groups const, prevent abuse genetlink: pass family to functions using groups genetlink: add and use genl_set_err() genetlink: remove family pointer from genl_multicast_group genetlink: remove genl_unregister_mc_group() hsr: don't call genl_unregister_mc_group() quota/genetlink: use proper genetlink multicast APIs drop_monitor/genetlink: use proper genetlink multicast APIs genetlink: only pass array to genl_register_family_with_ops() tcp: don't update snd_nxt, when a socket is switched from repair mode atm: idt77252: fix dev refcnt leak xfrm: Release dst if this dst is improper for vti tunnel netlink: fix documentation typo in netlink_set_err() be2net: Delete secondary unicast MAC addresses during be_close be2net: Fix unconditional enabling of Rx interface options net, virtio_net: replace the magic value ping: prevent NULL pointer dereference on write to msg_name bnx2x: Prevent "timeout waiting for state X" bnx2x: prevent CFC attention bnx2x: Prevent panic during DMAE timeout ...
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/addrconf.c38
-rw-r--r--net/ipv6/af_inet6.c4
-rw-r--r--net/ipv6/ip6_tunnel.c18
-rw-r--r--net/ipv6/ndisc.c2
-rw-r--r--net/ipv6/raw.c4
-rw-r--r--net/ipv6/sit.c18
-rw-r--r--net/ipv6/udp.c5
7 files changed, 41 insertions, 48 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 5658d9d51637..12c97d8aa6bb 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1996,23 +1996,6 @@ static void addrconf_add_mroute(struct net_device *dev)
1996 ip6_route_add(&cfg); 1996 ip6_route_add(&cfg);
1997} 1997}
1998 1998
1999#if IS_ENABLED(CONFIG_IPV6_SIT)
2000static void sit_route_add(struct net_device *dev)
2001{
2002 struct fib6_config cfg = {
2003 .fc_table = RT6_TABLE_MAIN,
2004 .fc_metric = IP6_RT_PRIO_ADDRCONF,
2005 .fc_ifindex = dev->ifindex,
2006 .fc_dst_len = 96,
2007 .fc_flags = RTF_UP | RTF_NONEXTHOP,
2008 .fc_nlinfo.nl_net = dev_net(dev),
2009 };
2010
2011 /* prefix length - 96 bits "::d.d.d.d" */
2012 ip6_route_add(&cfg);
2013}
2014#endif
2015
2016static struct inet6_dev *addrconf_add_dev(struct net_device *dev) 1999static struct inet6_dev *addrconf_add_dev(struct net_device *dev)
2017{ 2000{
2018 struct inet6_dev *idev; 2001 struct inet6_dev *idev;
@@ -2542,7 +2525,8 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
2542 struct in6_addr addr; 2525 struct in6_addr addr;
2543 struct net_device *dev; 2526 struct net_device *dev;
2544 struct net *net = dev_net(idev->dev); 2527 struct net *net = dev_net(idev->dev);
2545 int scope; 2528 int scope, plen;
2529 u32 pflags = 0;
2546 2530
2547 ASSERT_RTNL(); 2531 ASSERT_RTNL();
2548 2532
@@ -2552,12 +2536,16 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
2552 if (idev->dev->flags&IFF_POINTOPOINT) { 2536 if (idev->dev->flags&IFF_POINTOPOINT) {
2553 addr.s6_addr32[0] = htonl(0xfe800000); 2537 addr.s6_addr32[0] = htonl(0xfe800000);
2554 scope = IFA_LINK; 2538 scope = IFA_LINK;
2539 plen = 64;
2555 } else { 2540 } else {
2556 scope = IPV6_ADDR_COMPATv4; 2541 scope = IPV6_ADDR_COMPATv4;
2542 plen = 96;
2543 pflags |= RTF_NONEXTHOP;
2557 } 2544 }
2558 2545
2559 if (addr.s6_addr32[3]) { 2546 if (addr.s6_addr32[3]) {
2560 add_addr(idev, &addr, 128, scope); 2547 add_addr(idev, &addr, plen, scope);
2548 addrconf_prefix_route(&addr, plen, idev->dev, 0, pflags);
2561 return; 2549 return;
2562 } 2550 }
2563 2551
@@ -2569,7 +2557,6 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
2569 int flag = scope; 2557 int flag = scope;
2570 2558
2571 for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { 2559 for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
2572 int plen;
2573 2560
2574 addr.s6_addr32[3] = ifa->ifa_local; 2561 addr.s6_addr32[3] = ifa->ifa_local;
2575 2562
@@ -2580,12 +2567,10 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
2580 continue; 2567 continue;
2581 flag |= IFA_HOST; 2568 flag |= IFA_HOST;
2582 } 2569 }
2583 if (idev->dev->flags&IFF_POINTOPOINT)
2584 plen = 64;
2585 else
2586 plen = 96;
2587 2570
2588 add_addr(idev, &addr, plen, flag); 2571 add_addr(idev, &addr, plen, flag);
2572 addrconf_prefix_route(&addr, plen, idev->dev, 0,
2573 pflags);
2589 } 2574 }
2590 } 2575 }
2591 } 2576 }
@@ -2711,7 +2696,6 @@ static void addrconf_sit_config(struct net_device *dev)
2711 struct in6_addr addr; 2696 struct in6_addr addr;
2712 2697
2713 ipv6_addr_set(&addr, htonl(0xFE800000), 0, 0, 0); 2698 ipv6_addr_set(&addr, htonl(0xFE800000), 0, 0, 0);
2714 addrconf_prefix_route(&addr, 64, dev, 0, 0);
2715 if (!ipv6_generate_eui64(addr.s6_addr + 8, dev)) 2699 if (!ipv6_generate_eui64(addr.s6_addr + 8, dev))
2716 addrconf_add_linklocal(idev, &addr); 2700 addrconf_add_linklocal(idev, &addr);
2717 return; 2701 return;
@@ -2721,8 +2705,6 @@ static void addrconf_sit_config(struct net_device *dev)
2721 2705
2722 if (dev->flags&IFF_POINTOPOINT) 2706 if (dev->flags&IFF_POINTOPOINT)
2723 addrconf_add_mroute(dev); 2707 addrconf_add_mroute(dev);
2724 else
2725 sit_route_add(dev);
2726} 2708}
2727#endif 2709#endif
2728 2710
@@ -2740,8 +2722,6 @@ static void addrconf_gre_config(struct net_device *dev)
2740 } 2722 }
2741 2723
2742 ipv6_addr_set(&addr, htonl(0xFE800000), 0, 0, 0); 2724 ipv6_addr_set(&addr, htonl(0xFE800000), 0, 0, 0);
2743 addrconf_prefix_route(&addr, 64, dev, 0, 0);
2744
2745 if (!ipv6_generate_eui64(addr.s6_addr + 8, dev)) 2725 if (!ipv6_generate_eui64(addr.s6_addr + 8, dev))
2746 addrconf_add_linklocal(idev, &addr); 2726 addrconf_add_linklocal(idev, &addr);
2747} 2727}
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index ff75313f27a8..4fbdb7046d28 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -972,10 +972,10 @@ out:
972 972
973#ifdef CONFIG_SYSCTL 973#ifdef CONFIG_SYSCTL
974sysctl_fail: 974sysctl_fail:
975 ipv6_packet_cleanup(); 975 pingv6_exit();
976#endif 976#endif
977pingv6_fail: 977pingv6_fail:
978 pingv6_exit(); 978 ipv6_packet_cleanup();
979ipv6_packet_fail: 979ipv6_packet_fail:
980 tcpv6_exit(); 980 tcpv6_exit();
981tcpv6_fail: 981tcpv6_fail:
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index df1fa58528c6..d6062325db08 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1642,6 +1642,15 @@ static int ip6_tnl_changelink(struct net_device *dev, struct nlattr *tb[],
1642 return ip6_tnl_update(t, &p); 1642 return ip6_tnl_update(t, &p);
1643} 1643}
1644 1644
1645static void ip6_tnl_dellink(struct net_device *dev, struct list_head *head)
1646{
1647 struct net *net = dev_net(dev);
1648 struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
1649
1650 if (dev != ip6n->fb_tnl_dev)
1651 unregister_netdevice_queue(dev, head);
1652}
1653
1645static size_t ip6_tnl_get_size(const struct net_device *dev) 1654static size_t ip6_tnl_get_size(const struct net_device *dev)
1646{ 1655{
1647 return 1656 return
@@ -1706,6 +1715,7 @@ static struct rtnl_link_ops ip6_link_ops __read_mostly = {
1706 .validate = ip6_tnl_validate, 1715 .validate = ip6_tnl_validate,
1707 .newlink = ip6_tnl_newlink, 1716 .newlink = ip6_tnl_newlink,
1708 .changelink = ip6_tnl_changelink, 1717 .changelink = ip6_tnl_changelink,
1718 .dellink = ip6_tnl_dellink,
1709 .get_size = ip6_tnl_get_size, 1719 .get_size = ip6_tnl_get_size,
1710 .fill_info = ip6_tnl_fill_info, 1720 .fill_info = ip6_tnl_fill_info,
1711}; 1721};
@@ -1722,9 +1732,9 @@ static struct xfrm6_tunnel ip6ip6_handler __read_mostly = {
1722 .priority = 1, 1732 .priority = 1,
1723}; 1733};
1724 1734
1725static void __net_exit ip6_tnl_destroy_tunnels(struct ip6_tnl_net *ip6n) 1735static void __net_exit ip6_tnl_destroy_tunnels(struct net *net)
1726{ 1736{
1727 struct net *net = dev_net(ip6n->fb_tnl_dev); 1737 struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
1728 struct net_device *dev, *aux; 1738 struct net_device *dev, *aux;
1729 int h; 1739 int h;
1730 struct ip6_tnl *t; 1740 struct ip6_tnl *t;
@@ -1792,10 +1802,8 @@ err_alloc_dev:
1792 1802
1793static void __net_exit ip6_tnl_exit_net(struct net *net) 1803static void __net_exit ip6_tnl_exit_net(struct net *net)
1794{ 1804{
1795 struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
1796
1797 rtnl_lock(); 1805 rtnl_lock();
1798 ip6_tnl_destroy_tunnels(ip6n); 1806 ip6_tnl_destroy_tunnels(net);
1799 rtnl_unlock(); 1807 rtnl_unlock();
1800} 1808}
1801 1809
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index f8a55ff1971b..3512177deb4d 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1726,8 +1726,8 @@ int __init ndisc_init(void)
1726 &ndisc_ifinfo_sysctl_change); 1726 &ndisc_ifinfo_sysctl_change);
1727 if (err) 1727 if (err)
1728 goto out_unregister_pernet; 1728 goto out_unregister_pernet;
1729#endif
1730out: 1729out:
1730#endif
1731 return err; 1731 return err;
1732 1732
1733#ifdef CONFIG_SYSCTL 1733#ifdef CONFIG_SYSCTL
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 3c00842b0079..e24ff1df0401 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -465,9 +465,6 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk,
465 if (flags & MSG_OOB) 465 if (flags & MSG_OOB)
466 return -EOPNOTSUPP; 466 return -EOPNOTSUPP;
467 467
468 if (addr_len)
469 *addr_len=sizeof(*sin6);
470
471 if (flags & MSG_ERRQUEUE) 468 if (flags & MSG_ERRQUEUE)
472 return ipv6_recv_error(sk, msg, len); 469 return ipv6_recv_error(sk, msg, len);
473 470
@@ -506,6 +503,7 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk,
506 sin6->sin6_flowinfo = 0; 503 sin6->sin6_flowinfo = 0;
507 sin6->sin6_scope_id = ipv6_iface_scope_id(&sin6->sin6_addr, 504 sin6->sin6_scope_id = ipv6_iface_scope_id(&sin6->sin6_addr,
508 IP6CB(skb)->iif); 505 IP6CB(skb)->iif);
506 *addr_len = sizeof(*sin6);
509 } 507 }
510 508
511 sock_recv_ts_and_drops(msg, sk, skb); 509 sock_recv_ts_and_drops(msg, sk, skb);
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index bfc6fcea3841..1b4a4a953675 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1619,6 +1619,15 @@ static const struct nla_policy ipip6_policy[IFLA_IPTUN_MAX + 1] = {
1619#endif 1619#endif
1620}; 1620};
1621 1621
1622static void ipip6_dellink(struct net_device *dev, struct list_head *head)
1623{
1624 struct net *net = dev_net(dev);
1625 struct sit_net *sitn = net_generic(net, sit_net_id);
1626
1627 if (dev != sitn->fb_tunnel_dev)
1628 unregister_netdevice_queue(dev, head);
1629}
1630
1622static struct rtnl_link_ops sit_link_ops __read_mostly = { 1631static struct rtnl_link_ops sit_link_ops __read_mostly = {
1623 .kind = "sit", 1632 .kind = "sit",
1624 .maxtype = IFLA_IPTUN_MAX, 1633 .maxtype = IFLA_IPTUN_MAX,
@@ -1630,6 +1639,7 @@ static struct rtnl_link_ops sit_link_ops __read_mostly = {
1630 .changelink = ipip6_changelink, 1639 .changelink = ipip6_changelink,
1631 .get_size = ipip6_get_size, 1640 .get_size = ipip6_get_size,
1632 .fill_info = ipip6_fill_info, 1641 .fill_info = ipip6_fill_info,
1642 .dellink = ipip6_dellink,
1633}; 1643};
1634 1644
1635static struct xfrm_tunnel sit_handler __read_mostly = { 1645static struct xfrm_tunnel sit_handler __read_mostly = {
@@ -1644,9 +1654,10 @@ static struct xfrm_tunnel ipip_handler __read_mostly = {
1644 .priority = 2, 1654 .priority = 2,
1645}; 1655};
1646 1656
1647static void __net_exit sit_destroy_tunnels(struct sit_net *sitn, struct list_head *head) 1657static void __net_exit sit_destroy_tunnels(struct net *net,
1658 struct list_head *head)
1648{ 1659{
1649 struct net *net = dev_net(sitn->fb_tunnel_dev); 1660 struct sit_net *sitn = net_generic(net, sit_net_id);
1650 struct net_device *dev, *aux; 1661 struct net_device *dev, *aux;
1651 int prio; 1662 int prio;
1652 1663
@@ -1721,11 +1732,10 @@ err_alloc_dev:
1721 1732
1722static void __net_exit sit_exit_net(struct net *net) 1733static void __net_exit sit_exit_net(struct net *net)
1723{ 1734{
1724 struct sit_net *sitn = net_generic(net, sit_net_id);
1725 LIST_HEAD(list); 1735 LIST_HEAD(list);
1726 1736
1727 rtnl_lock(); 1737 rtnl_lock();
1728 sit_destroy_tunnels(sitn, &list); 1738 sit_destroy_tunnels(net, &list);
1729 unregister_netdevice_many(&list); 1739 unregister_netdevice_many(&list);
1730 rtnl_unlock(); 1740 rtnl_unlock();
1731} 1741}
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index f3893e897f72..81eb8cf8389b 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -392,9 +392,6 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk,
392 int is_udp4; 392 int is_udp4;
393 bool slow; 393 bool slow;
394 394
395 if (addr_len)
396 *addr_len = sizeof(struct sockaddr_in6);
397
398 if (flags & MSG_ERRQUEUE) 395 if (flags & MSG_ERRQUEUE)
399 return ipv6_recv_error(sk, msg, len); 396 return ipv6_recv_error(sk, msg, len);
400 397
@@ -480,7 +477,7 @@ try_again:
480 ipv6_iface_scope_id(&sin6->sin6_addr, 477 ipv6_iface_scope_id(&sin6->sin6_addr,
481 IP6CB(skb)->iif); 478 IP6CB(skb)->iif);
482 } 479 }
483 480 *addr_len = sizeof(*sin6);
484 } 481 }
485 if (is_udp4) { 482 if (is_udp4) {
486 if (inet->cmsg_flags) 483 if (inet->cmsg_flags)