aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorChris Zankel <chris@zankel.net>2014-12-15 23:09:06 -0500
committerChris Zankel <chris@zankel.net>2014-12-15 23:09:06 -0500
commit865566ed33f08637c3486b4d301e96a9064ad2eb (patch)
treedfa26622c8feaa57153d87d207133f01aff5858b /net/ipv6
parentc0d7aa07504a8f4abd7b02b9144c4a92b7565f45 (diff)
parentb2776bf7149bddd1f4161f14f79520f17fc1d71d (diff)
Merge tag 'v3.18' into for_next
Linux 3.18
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/ip6_gre.c9
-rw-r--r--net/ipv6/ip6_offload.c3
-rw-r--r--net/ipv6/ip6_tunnel.c10
-rw-r--r--net/ipv6/ip6_udp_tunnel.c4
-rw-r--r--net/ipv6/ip6_vti.c22
-rw-r--r--net/ipv6/ip6mr.c4
-rw-r--r--net/ipv6/mcast.c9
-rw-r--r--net/ipv6/netfilter/nft_masq_ipv6.c1
-rw-r--r--net/ipv6/sit.c15
-rw-r--r--net/ipv6/tcp_ipv6.c5
10 files changed, 41 insertions, 41 deletions
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 12c3c8ef3849..0e32d2e1bdbf 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -502,11 +502,11 @@ static int ip6gre_rcv(struct sk_buff *skb)
502 502
503 skb->protocol = gre_proto; 503 skb->protocol = gre_proto;
504 /* WCCP version 1 and 2 protocol decoding. 504 /* WCCP version 1 and 2 protocol decoding.
505 * - Change protocol to IP 505 * - Change protocol to IPv6
506 * - When dealing with WCCPv2, Skip extra 4 bytes in GRE header 506 * - When dealing with WCCPv2, Skip extra 4 bytes in GRE header
507 */ 507 */
508 if (flags == 0 && gre_proto == htons(ETH_P_WCCP)) { 508 if (flags == 0 && gre_proto == htons(ETH_P_WCCP)) {
509 skb->protocol = htons(ETH_P_IP); 509 skb->protocol = htons(ETH_P_IPV6);
510 if ((*(h + offset) & 0xF0) != 0x40) 510 if ((*(h + offset) & 0xF0) != 0x40)
511 offset += 4; 511 offset += 4;
512 } 512 }
@@ -961,8 +961,6 @@ static void ip6gre_tnl_link_config(struct ip6_tnl *t, int set_mtu)
961 else 961 else
962 dev->flags &= ~IFF_POINTOPOINT; 962 dev->flags &= ~IFF_POINTOPOINT;
963 963
964 dev->iflink = p->link;
965
966 /* Precalculate GRE options length */ 964 /* Precalculate GRE options length */
967 if (t->parms.o_flags&(GRE_CSUM|GRE_KEY|GRE_SEQ)) { 965 if (t->parms.o_flags&(GRE_CSUM|GRE_KEY|GRE_SEQ)) {
968 if (t->parms.o_flags&GRE_CSUM) 966 if (t->parms.o_flags&GRE_CSUM)
@@ -1272,6 +1270,7 @@ static int ip6gre_tunnel_init(struct net_device *dev)
1272 u64_stats_init(&ip6gre_tunnel_stats->syncp); 1270 u64_stats_init(&ip6gre_tunnel_stats->syncp);
1273 } 1271 }
1274 1272
1273 dev->iflink = tunnel->parms.link;
1275 1274
1276 return 0; 1275 return 0;
1277} 1276}
@@ -1481,6 +1480,8 @@ static int ip6gre_tap_init(struct net_device *dev)
1481 if (!dev->tstats) 1480 if (!dev->tstats)
1482 return -ENOMEM; 1481 return -ENOMEM;
1483 1482
1483 dev->iflink = tunnel->parms.link;
1484
1484 return 0; 1485 return 0;
1485} 1486}
1486 1487
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
index a071563a7e6e..01e12d0d8fcc 100644
--- a/net/ipv6/ip6_offload.c
+++ b/net/ipv6/ip6_offload.c
@@ -69,7 +69,8 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
69 int nhoff; 69 int nhoff;
70 70
71 if (unlikely(skb_shinfo(skb)->gso_type & 71 if (unlikely(skb_shinfo(skb)->gso_type &
72 ~(SKB_GSO_UDP | 72 ~(SKB_GSO_TCPV4 |
73 SKB_GSO_UDP |
73 SKB_GSO_DODGY | 74 SKB_GSO_DODGY |
74 SKB_GSO_TCP_ECN | 75 SKB_GSO_TCP_ECN |
75 SKB_GSO_GRE | 76 SKB_GSO_GRE |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 9409887fb664..9cb94cfa0ae7 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -272,9 +272,6 @@ static int ip6_tnl_create2(struct net_device *dev)
272 int err; 272 int err;
273 273
274 t = netdev_priv(dev); 274 t = netdev_priv(dev);
275 err = ip6_tnl_dev_init(dev);
276 if (err < 0)
277 goto out;
278 275
279 err = register_netdevice(dev); 276 err = register_netdevice(dev);
280 if (err < 0) 277 if (err < 0)
@@ -1462,6 +1459,7 @@ ip6_tnl_change_mtu(struct net_device *dev, int new_mtu)
1462 1459
1463 1460
1464static const struct net_device_ops ip6_tnl_netdev_ops = { 1461static const struct net_device_ops ip6_tnl_netdev_ops = {
1462 .ndo_init = ip6_tnl_dev_init,
1465 .ndo_uninit = ip6_tnl_dev_uninit, 1463 .ndo_uninit = ip6_tnl_dev_uninit,
1466 .ndo_start_xmit = ip6_tnl_xmit, 1464 .ndo_start_xmit = ip6_tnl_xmit,
1467 .ndo_do_ioctl = ip6_tnl_ioctl, 1465 .ndo_do_ioctl = ip6_tnl_ioctl,
@@ -1546,16 +1544,10 @@ static int __net_init ip6_fb_tnl_dev_init(struct net_device *dev)
1546 struct ip6_tnl *t = netdev_priv(dev); 1544 struct ip6_tnl *t = netdev_priv(dev);
1547 struct net *net = dev_net(dev); 1545 struct net *net = dev_net(dev);
1548 struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); 1546 struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
1549 int err = ip6_tnl_dev_init_gen(dev);
1550
1551 if (err)
1552 return err;
1553 1547
1554 t->parms.proto = IPPROTO_IPV6; 1548 t->parms.proto = IPPROTO_IPV6;
1555 dev_hold(dev); 1549 dev_hold(dev);
1556 1550
1557 ip6_tnl_link_config(t);
1558
1559 rcu_assign_pointer(ip6n->tnls_wc[0], t); 1551 rcu_assign_pointer(ip6n->tnls_wc[0], t);
1560 return 0; 1552 return 0;
1561} 1553}
diff --git a/net/ipv6/ip6_udp_tunnel.c b/net/ipv6/ip6_udp_tunnel.c
index b04ed72c4542..8db6c98fe218 100644
--- a/net/ipv6/ip6_udp_tunnel.c
+++ b/net/ipv6/ip6_udp_tunnel.c
@@ -79,15 +79,13 @@ int udp_tunnel6_xmit_skb(struct socket *sock, struct dst_entry *dst,
79 uh->source = src_port; 79 uh->source = src_port;
80 80
81 uh->len = htons(skb->len); 81 uh->len = htons(skb->len);
82 uh->check = 0;
83 82
84 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); 83 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
85 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED 84 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED
86 | IPSKB_REROUTED); 85 | IPSKB_REROUTED);
87 skb_dst_set(skb, dst); 86 skb_dst_set(skb, dst);
88 87
89 udp6_set_csum(udp_get_no_check6_tx(sk), skb, &inet6_sk(sk)->saddr, 88 udp6_set_csum(udp_get_no_check6_tx(sk), skb, saddr, daddr, skb->len);
90 &sk->sk_v6_daddr, skb->len);
91 89
92 __skb_push(skb, sizeof(*ip6h)); 90 __skb_push(skb, sizeof(*ip6h));
93 skb_reset_network_header(skb); 91 skb_reset_network_header(skb);
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index d440bb585524..bcda14de7f84 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -172,10 +172,6 @@ static int vti6_tnl_create2(struct net_device *dev)
172 struct vti6_net *ip6n = net_generic(net, vti6_net_id); 172 struct vti6_net *ip6n = net_generic(net, vti6_net_id);
173 int err; 173 int err;
174 174
175 err = vti6_dev_init(dev);
176 if (err < 0)
177 goto out;
178
179 err = register_netdevice(dev); 175 err = register_netdevice(dev);
180 if (err < 0) 176 if (err < 0)
181 goto out; 177 goto out;
@@ -783,6 +779,7 @@ static int vti6_change_mtu(struct net_device *dev, int new_mtu)
783} 779}
784 780
785static const struct net_device_ops vti6_netdev_ops = { 781static const struct net_device_ops vti6_netdev_ops = {
782 .ndo_init = vti6_dev_init,
786 .ndo_uninit = vti6_dev_uninit, 783 .ndo_uninit = vti6_dev_uninit,
787 .ndo_start_xmit = vti6_tnl_xmit, 784 .ndo_start_xmit = vti6_tnl_xmit,
788 .ndo_do_ioctl = vti6_ioctl, 785 .ndo_do_ioctl = vti6_ioctl,
@@ -852,16 +849,10 @@ static int __net_init vti6_fb_tnl_dev_init(struct net_device *dev)
852 struct ip6_tnl *t = netdev_priv(dev); 849 struct ip6_tnl *t = netdev_priv(dev);
853 struct net *net = dev_net(dev); 850 struct net *net = dev_net(dev);
854 struct vti6_net *ip6n = net_generic(net, vti6_net_id); 851 struct vti6_net *ip6n = net_generic(net, vti6_net_id);
855 int err = vti6_dev_init_gen(dev);
856
857 if (err)
858 return err;
859 852
860 t->parms.proto = IPPROTO_IPV6; 853 t->parms.proto = IPPROTO_IPV6;
861 dev_hold(dev); 854 dev_hold(dev);
862 855
863 vti6_link_config(t);
864
865 rcu_assign_pointer(ip6n->tnls_wc[0], t); 856 rcu_assign_pointer(ip6n->tnls_wc[0], t);
866 return 0; 857 return 0;
867} 858}
@@ -914,6 +905,15 @@ static int vti6_newlink(struct net *src_net, struct net_device *dev,
914 return vti6_tnl_create2(dev); 905 return vti6_tnl_create2(dev);
915} 906}
916 907
908static void vti6_dellink(struct net_device *dev, struct list_head *head)
909{
910 struct net *net = dev_net(dev);
911 struct vti6_net *ip6n = net_generic(net, vti6_net_id);
912
913 if (dev != ip6n->fb_tnl_dev)
914 unregister_netdevice_queue(dev, head);
915}
916
917static int vti6_changelink(struct net_device *dev, struct nlattr *tb[], 917static int vti6_changelink(struct net_device *dev, struct nlattr *tb[],
918 struct nlattr *data[]) 918 struct nlattr *data[])
919{ 919{
@@ -989,6 +989,7 @@ static struct rtnl_link_ops vti6_link_ops __read_mostly = {
989 .setup = vti6_dev_setup, 989 .setup = vti6_dev_setup,
990 .validate = vti6_validate, 990 .validate = vti6_validate,
991 .newlink = vti6_newlink, 991 .newlink = vti6_newlink,
992 .dellink = vti6_dellink,
992 .changelink = vti6_changelink, 993 .changelink = vti6_changelink,
993 .get_size = vti6_get_size, 994 .get_size = vti6_get_size,
994 .fill_info = vti6_fill_info, 995 .fill_info = vti6_fill_info,
@@ -1029,6 +1030,7 @@ static int __net_init vti6_init_net(struct net *net)
1029 if (!ip6n->fb_tnl_dev) 1030 if (!ip6n->fb_tnl_dev)
1030 goto err_alloc_dev; 1031 goto err_alloc_dev;
1031 dev_net_set(ip6n->fb_tnl_dev, net); 1032 dev_net_set(ip6n->fb_tnl_dev, net);
1033 ip6n->fb_tnl_dev->rtnl_link_ops = &vti6_link_ops;
1032 1034
1033 err = vti6_fb_tnl_dev_init(ip6n->fb_tnl_dev); 1035 err = vti6_fb_tnl_dev_init(ip6n->fb_tnl_dev);
1034 if (err < 0) 1036 if (err < 0)
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 0171f08325c3..1a01d79b8698 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1439,6 +1439,10 @@ reg_pernet_fail:
1439 1439
1440void ip6_mr_cleanup(void) 1440void ip6_mr_cleanup(void)
1441{ 1441{
1442 rtnl_unregister(RTNL_FAMILY_IP6MR, RTM_GETROUTE);
1443#ifdef CONFIG_IPV6_PIMSM_V2
1444 inet6_del_protocol(&pim6_protocol, IPPROTO_PIM);
1445#endif
1442 unregister_netdevice_notifier(&ip6_mr_notifier); 1446 unregister_netdevice_notifier(&ip6_mr_notifier);
1443 unregister_pernet_subsys(&ip6mr_net_ops); 1447 unregister_pernet_subsys(&ip6mr_net_ops);
1444 kmem_cache_destroy(mrt_cachep); 1448 kmem_cache_destroy(mrt_cachep);
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 9648de2b6745..ed2c4e400b46 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1550,7 +1550,7 @@ static void ip6_mc_hdr(struct sock *sk, struct sk_buff *skb,
1550 hdr->daddr = *daddr; 1550 hdr->daddr = *daddr;
1551} 1551}
1552 1552
1553static struct sk_buff *mld_newpack(struct inet6_dev *idev, int size) 1553static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu)
1554{ 1554{
1555 struct net_device *dev = idev->dev; 1555 struct net_device *dev = idev->dev;
1556 struct net *net = dev_net(dev); 1556 struct net *net = dev_net(dev);
@@ -1561,13 +1561,13 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, int size)
1561 const struct in6_addr *saddr; 1561 const struct in6_addr *saddr;
1562 int hlen = LL_RESERVED_SPACE(dev); 1562 int hlen = LL_RESERVED_SPACE(dev);
1563 int tlen = dev->needed_tailroom; 1563 int tlen = dev->needed_tailroom;
1564 unsigned int size = mtu + hlen + tlen;
1564 int err; 1565 int err;
1565 u8 ra[8] = { IPPROTO_ICMPV6, 0, 1566 u8 ra[8] = { IPPROTO_ICMPV6, 0,
1566 IPV6_TLV_ROUTERALERT, 2, 0, 0, 1567 IPV6_TLV_ROUTERALERT, 2, 0, 0,
1567 IPV6_TLV_PADN, 0 }; 1568 IPV6_TLV_PADN, 0 };
1568 1569
1569 /* we assume size > sizeof(ra) here */ 1570 /* we assume size > sizeof(ra) here */
1570 size += hlen + tlen;
1571 /* limit our allocations to order-0 page */ 1571 /* limit our allocations to order-0 page */
1572 size = min_t(int, size, SKB_MAX_ORDER(0, 0)); 1572 size = min_t(int, size, SKB_MAX_ORDER(0, 0));
1573 skb = sock_alloc_send_skb(sk, size, 1, &err); 1573 skb = sock_alloc_send_skb(sk, size, 1, &err);
@@ -1576,6 +1576,8 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, int size)
1576 return NULL; 1576 return NULL;
1577 1577
1578 skb->priority = TC_PRIO_CONTROL; 1578 skb->priority = TC_PRIO_CONTROL;
1579 skb->reserved_tailroom = skb_end_offset(skb) -
1580 min(mtu, skb_end_offset(skb));
1579 skb_reserve(skb, hlen); 1581 skb_reserve(skb, hlen);
1580 1582
1581 if (__ipv6_get_lladdr(idev, &addr_buf, IFA_F_TENTATIVE)) { 1583 if (__ipv6_get_lladdr(idev, &addr_buf, IFA_F_TENTATIVE)) {
@@ -1690,8 +1692,7 @@ static struct sk_buff *add_grhead(struct sk_buff *skb, struct ifmcaddr6 *pmc,
1690 return skb; 1692 return skb;
1691} 1693}
1692 1694
1693#define AVAILABLE(skb) ((skb) ? ((skb)->dev ? (skb)->dev->mtu - (skb)->len : \ 1695#define AVAILABLE(skb) ((skb) ? skb_availroom(skb) : 0)
1694 skb_tailroom(skb)) : 0)
1695 1696
1696static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, 1697static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc,
1697 int type, int gdeleted, int sdeleted, int crsend) 1698 int type, int gdeleted, int sdeleted, int crsend)
diff --git a/net/ipv6/netfilter/nft_masq_ipv6.c b/net/ipv6/netfilter/nft_masq_ipv6.c
index 8a7ac685076d..529c119cbb14 100644
--- a/net/ipv6/netfilter/nft_masq_ipv6.c
+++ b/net/ipv6/netfilter/nft_masq_ipv6.c
@@ -25,6 +25,7 @@ static void nft_masq_ipv6_eval(const struct nft_expr *expr,
25 struct nf_nat_range range; 25 struct nf_nat_range range;
26 unsigned int verdict; 26 unsigned int verdict;
27 27
28 memset(&range, 0, sizeof(range));
28 range.flags = priv->flags; 29 range.flags = priv->flags;
29 30
30 verdict = nf_nat_masquerade_ipv6(pkt->skb, &range, pkt->out); 31 verdict = nf_nat_masquerade_ipv6(pkt->skb, &range, pkt->out);
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 58e5b4710127..a24557a1c1d8 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -195,10 +195,8 @@ static int ipip6_tunnel_create(struct net_device *dev)
195 struct sit_net *sitn = net_generic(net, sit_net_id); 195 struct sit_net *sitn = net_generic(net, sit_net_id);
196 int err; 196 int err;
197 197
198 err = ipip6_tunnel_init(dev); 198 memcpy(dev->dev_addr, &t->parms.iph.saddr, 4);
199 if (err < 0) 199 memcpy(dev->broadcast, &t->parms.iph.daddr, 4);
200 goto out;
201 ipip6_tunnel_clone_6rd(dev, sitn);
202 200
203 if ((__force u16)t->parms.i_flags & SIT_ISATAP) 201 if ((__force u16)t->parms.i_flags & SIT_ISATAP)
204 dev->priv_flags |= IFF_ISATAP; 202 dev->priv_flags |= IFF_ISATAP;
@@ -207,7 +205,8 @@ static int ipip6_tunnel_create(struct net_device *dev)
207 if (err < 0) 205 if (err < 0)
208 goto out; 206 goto out;
209 207
210 strcpy(t->parms.name, dev->name); 208 ipip6_tunnel_clone_6rd(dev, sitn);
209
211 dev->rtnl_link_ops = &sit_link_ops; 210 dev->rtnl_link_ops = &sit_link_ops;
212 211
213 dev_hold(dev); 212 dev_hold(dev);
@@ -1330,6 +1329,7 @@ static int ipip6_tunnel_change_mtu(struct net_device *dev, int new_mtu)
1330} 1329}
1331 1330
1332static const struct net_device_ops ipip6_netdev_ops = { 1331static const struct net_device_ops ipip6_netdev_ops = {
1332 .ndo_init = ipip6_tunnel_init,
1333 .ndo_uninit = ipip6_tunnel_uninit, 1333 .ndo_uninit = ipip6_tunnel_uninit,
1334 .ndo_start_xmit = sit_tunnel_xmit, 1334 .ndo_start_xmit = sit_tunnel_xmit,
1335 .ndo_do_ioctl = ipip6_tunnel_ioctl, 1335 .ndo_do_ioctl = ipip6_tunnel_ioctl,
@@ -1378,9 +1378,7 @@ static int ipip6_tunnel_init(struct net_device *dev)
1378 1378
1379 tunnel->dev = dev; 1379 tunnel->dev = dev;
1380 tunnel->net = dev_net(dev); 1380 tunnel->net = dev_net(dev);
1381 1381 strcpy(tunnel->parms.name, dev->name);
1382 memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4);
1383 memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);
1384 1382
1385 ipip6_tunnel_bind_dev(dev); 1383 ipip6_tunnel_bind_dev(dev);
1386 dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); 1384 dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
@@ -1405,7 +1403,6 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev)
1405 1403
1406 tunnel->dev = dev; 1404 tunnel->dev = dev;
1407 tunnel->net = dev_net(dev); 1405 tunnel->net = dev_net(dev);
1408 strcpy(tunnel->parms.name, dev->name);
1409 1406
1410 iph->version = 4; 1407 iph->version = 4;
1411 iph->protocol = IPPROTO_IPV6; 1408 iph->protocol = IPPROTO_IPV6;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index ace29b60813c..dc495ae2ead0 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -903,7 +903,10 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
903 if (th->rst) 903 if (th->rst)
904 return; 904 return;
905 905
906 if (!ipv6_unicast_destination(skb)) 906 /* If sk not NULL, it means we did a successful lookup and incoming
907 * route had to be correct. prequeue might have dropped our dst.
908 */
909 if (!sk && !ipv6_unicast_destination(skb))
907 return; 910 return;
908 911
909#ifdef CONFIG_TCP_MD5SIG 912#ifdef CONFIG_TCP_MD5SIG