aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/arcnet/com20020-pci.c3
-rw-r--r--drivers/net/dsa/mv88e6131.c3
-rw-r--r--drivers/net/ethernet/amd/xgbe/xgbe-drv.c11
-rw-r--r--drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c57
-rw-r--r--drivers/net/vxlan.c2
-rw-r--r--include/net/addrconf.h3
-rw-r--r--include/net/ipv6.h2
-rw-r--r--net/bridge/br_fdb.c12
-rw-r--r--net/core/dev.c4
-rw-r--r--net/core/flow.c2
-rw-r--r--net/core/pktgen.c16
-rw-r--r--net/core/rtnetlink.c18
-rw-r--r--net/dsa/dsa.c2
-rw-r--r--net/dsa/slave.c13
-rw-r--r--net/ipv4/tcp_fastopen.c13
-rw-r--r--net/ipv6/addrconf.c36
-rw-r--r--net/ipv6/ndisc.c4
-rw-r--r--net/ipv6/output_core.c5
18 files changed, 129 insertions, 77 deletions
diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c
index 6c99ff0b0bdd..945f532078e9 100644
--- a/drivers/net/arcnet/com20020-pci.c
+++ b/drivers/net/arcnet/com20020-pci.c
@@ -78,6 +78,9 @@ static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
78 78
79 priv = devm_kzalloc(&pdev->dev, sizeof(struct com20020_priv), 79 priv = devm_kzalloc(&pdev->dev, sizeof(struct com20020_priv),
80 GFP_KERNEL); 80 GFP_KERNEL);
81 if (!priv)
82 return -ENOMEM;
83
81 ci = (struct com20020_pci_card_info *)id->driver_data; 84 ci = (struct com20020_pci_card_info *)id->driver_data;
82 priv->ci = ci; 85 priv->ci = ci;
83 86
diff --git a/drivers/net/dsa/mv88e6131.c b/drivers/net/dsa/mv88e6131.c
index 1230f52aa70e..2540ef0142af 100644
--- a/drivers/net/dsa/mv88e6131.c
+++ b/drivers/net/dsa/mv88e6131.c
@@ -139,7 +139,8 @@ static int mv88e6131_setup_global(struct dsa_switch *ds)
139 int nexthop; 139 int nexthop;
140 140
141 nexthop = 0x1f; 141 nexthop = 0x1f;
142 if (i != ds->index && i < ds->dst->pd->nr_chips) 142 if (ds->pd->rtable &&
143 i != ds->index && i < ds->dst->pd->nr_chips)
143 nexthop = ds->pd->rtable[i] & 0x1f; 144 nexthop = ds->pd->rtable[i] & 0x1f;
144 145
145 REG_WRITE(REG_GLOBAL2, 0x06, 0x8000 | (i << 8) | nexthop); 146 REG_WRITE(REG_GLOBAL2, 0x06, 0x8000 | (i << 8) | nexthop);
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
index d41f9f468688..b93d4404d975 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
@@ -342,12 +342,13 @@ static irqreturn_t xgbe_isr(int irq, void *data)
342 dma_ch_isr = XGMAC_DMA_IOREAD(channel, DMA_CH_SR); 342 dma_ch_isr = XGMAC_DMA_IOREAD(channel, DMA_CH_SR);
343 DBGPR(" DMA_CH%u_ISR = %08x\n", i, dma_ch_isr); 343 DBGPR(" DMA_CH%u_ISR = %08x\n", i, dma_ch_isr);
344 344
345 /* If we get a TI or RI interrupt that means per channel DMA 345 /* The TI or RI interrupt bits may still be set even if using
346 * interrupts are not enabled, so we use the private data napi 346 * per channel DMA interrupts. Check to be sure those are not
347 * structure, not the per channel napi structure 347 * enabled before using the private data napi structure.
348 */ 348 */
349 if (XGMAC_GET_BITS(dma_ch_isr, DMA_CH_SR, TI) || 349 if (!pdata->per_channel_irq &&
350 XGMAC_GET_BITS(dma_ch_isr, DMA_CH_SR, RI)) { 350 (XGMAC_GET_BITS(dma_ch_isr, DMA_CH_SR, TI) ||
351 XGMAC_GET_BITS(dma_ch_isr, DMA_CH_SR, RI))) {
351 if (napi_schedule_prep(&pdata->napi)) { 352 if (napi_schedule_prep(&pdata->napi)) {
352 /* Disable Tx and Rx interrupts */ 353 /* Disable Tx and Rx interrupts */
353 xgbe_disable_rx_tx_ints(pdata); 354 xgbe_disable_rx_tx_ints(pdata);
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
index 11288d4fc85f..c8a01ee4d25e 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
@@ -364,6 +364,26 @@ static int sxgbe_init_rx_buffers(struct net_device *dev,
364 364
365 return 0; 365 return 0;
366} 366}
367
368/**
369 * sxgbe_free_rx_buffers - free what sxgbe_init_rx_buffers() allocated
370 * @dev: net device structure
371 * @rx_ring: ring to be freed
372 * @rx_rsize: ring size
373 * Description: this function initializes the DMA RX descriptor
374 */
375static void sxgbe_free_rx_buffers(struct net_device *dev,
376 struct sxgbe_rx_norm_desc *p, int i,
377 unsigned int dma_buf_sz,
378 struct sxgbe_rx_queue *rx_ring)
379{
380 struct sxgbe_priv_data *priv = netdev_priv(dev);
381
382 kfree_skb(rx_ring->rx_skbuff[i]);
383 dma_unmap_single(priv->device, rx_ring->rx_skbuff_dma[i],
384 dma_buf_sz, DMA_FROM_DEVICE);
385}
386
367/** 387/**
368 * init_tx_ring - init the TX descriptor ring 388 * init_tx_ring - init the TX descriptor ring
369 * @dev: net device structure 389 * @dev: net device structure
@@ -456,7 +476,7 @@ static int init_rx_ring(struct net_device *dev, u8 queue_no,
456 /* RX ring is not allcoated */ 476 /* RX ring is not allcoated */
457 if (rx_ring == NULL) { 477 if (rx_ring == NULL) {
458 netdev_err(dev, "No memory for RX queue\n"); 478 netdev_err(dev, "No memory for RX queue\n");
459 goto error; 479 return -ENOMEM;
460 } 480 }
461 481
462 /* assign queue number */ 482 /* assign queue number */
@@ -468,23 +488,21 @@ static int init_rx_ring(struct net_device *dev, u8 queue_no,
468 &rx_ring->dma_rx_phy, GFP_KERNEL); 488 &rx_ring->dma_rx_phy, GFP_KERNEL);
469 489
470 if (rx_ring->dma_rx == NULL) 490 if (rx_ring->dma_rx == NULL)
471 goto error; 491 return -ENOMEM;
472 492
473 /* allocate memory for RX skbuff array */ 493 /* allocate memory for RX skbuff array */
474 rx_ring->rx_skbuff_dma = kmalloc_array(rx_rsize, 494 rx_ring->rx_skbuff_dma = kmalloc_array(rx_rsize,
475 sizeof(dma_addr_t), GFP_KERNEL); 495 sizeof(dma_addr_t), GFP_KERNEL);
476 if (!rx_ring->rx_skbuff_dma) { 496 if (!rx_ring->rx_skbuff_dma) {
477 dma_free_coherent(priv->device, 497 ret = -ENOMEM;
478 rx_rsize * sizeof(struct sxgbe_rx_norm_desc), 498 goto err_free_dma_rx;
479 rx_ring->dma_rx, rx_ring->dma_rx_phy);
480 goto error;
481 } 499 }
482 500
483 rx_ring->rx_skbuff = kmalloc_array(rx_rsize, 501 rx_ring->rx_skbuff = kmalloc_array(rx_rsize,
484 sizeof(struct sk_buff *), GFP_KERNEL); 502 sizeof(struct sk_buff *), GFP_KERNEL);
485 if (!rx_ring->rx_skbuff) { 503 if (!rx_ring->rx_skbuff) {
486 kfree(rx_ring->rx_skbuff_dma); 504 ret = -ENOMEM;
487 goto error; 505 goto err_free_skbuff_dma;
488 } 506 }
489 507
490 /* initialise the buffers */ 508 /* initialise the buffers */
@@ -494,7 +512,7 @@ static int init_rx_ring(struct net_device *dev, u8 queue_no,
494 ret = sxgbe_init_rx_buffers(dev, p, desc_index, 512 ret = sxgbe_init_rx_buffers(dev, p, desc_index,
495 bfsize, rx_ring); 513 bfsize, rx_ring);
496 if (ret) 514 if (ret)
497 goto err_init_rx_buffers; 515 goto err_free_rx_buffers;
498 } 516 }
499 517
500 /* initalise counters */ 518 /* initalise counters */
@@ -504,11 +522,22 @@ static int init_rx_ring(struct net_device *dev, u8 queue_no,
504 522
505 return 0; 523 return 0;
506 524
507err_init_rx_buffers: 525err_free_rx_buffers:
508 while (--desc_index >= 0) 526 while (--desc_index >= 0) {
509 free_rx_ring(priv->device, rx_ring, desc_index); 527 struct sxgbe_rx_norm_desc *p;
510error: 528
511 return -ENOMEM; 529 p = rx_ring->dma_rx + desc_index;
530 sxgbe_free_rx_buffers(dev, p, desc_index, bfsize, rx_ring);
531 }
532 kfree(rx_ring->rx_skbuff);
533err_free_skbuff_dma:
534 kfree(rx_ring->rx_skbuff_dma);
535err_free_dma_rx:
536 dma_free_coherent(priv->device,
537 rx_rsize * sizeof(struct sxgbe_rx_norm_desc),
538 rx_ring->dma_rx, rx_ring->dma_rx_phy);
539
540 return ret;
512} 541}
513/** 542/**
514 * free_tx_ring - free the TX descriptor ring 543 * free_tx_ring - free the TX descriptor ring
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index e6ed3e66964d..0e57e862c399 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1009,7 +1009,7 @@ static bool vxlan_snoop(struct net_device *dev,
1009 if (net_ratelimit()) 1009 if (net_ratelimit())
1010 netdev_info(dev, 1010 netdev_info(dev,
1011 "%pM migrated from %pIS to %pIS\n", 1011 "%pM migrated from %pIS to %pIS\n",
1012 src_mac, &rdst->remote_ip, &src_ip); 1012 src_mac, &rdst->remote_ip.sa, &src_ip->sa);
1013 1013
1014 rdst->remote_ip = *src_ip; 1014 rdst->remote_ip = *src_ip;
1015 f->updated = jiffies; 1015 f->updated = jiffies;
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index d13573bb879e..80456f72d70a 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -62,6 +62,9 @@ int addrconf_set_dstaddr(struct net *net, void __user *arg);
62 62
63int ipv6_chk_addr(struct net *net, const struct in6_addr *addr, 63int ipv6_chk_addr(struct net *net, const struct in6_addr *addr,
64 const struct net_device *dev, int strict); 64 const struct net_device *dev, int strict);
65int ipv6_chk_addr_and_flags(struct net *net, const struct in6_addr *addr,
66 const struct net_device *dev, int strict,
67 u32 banned_flags);
65 68
66#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) 69#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
67int ipv6_chk_home_addr(struct net *net, const struct in6_addr *addr); 70int ipv6_chk_home_addr(struct net *net, const struct in6_addr *addr);
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 8ae7c9edbd3c..4c9fe224d73b 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -671,8 +671,6 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add
671 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); 671 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr));
672} 672}
673 673
674u32 __ipv6_select_ident(u32 hashrnd, struct in6_addr *dst,
675 struct in6_addr *src);
676void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt); 674void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt);
677void ipv6_proxy_select_ident(struct sk_buff *skb); 675void ipv6_proxy_select_ident(struct sk_buff *skb);
678 676
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 08bf04bdac58..e0670d7054f9 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -846,10 +846,9 @@ int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
846 /* VID was specified, so use it. */ 846 /* VID was specified, so use it. */
847 err = __br_fdb_add(ndm, p, addr, nlh_flags, vid); 847 err = __br_fdb_add(ndm, p, addr, nlh_flags, vid);
848 } else { 848 } else {
849 if (!pv || bitmap_empty(pv->vlan_bitmap, VLAN_N_VID)) { 849 err = __br_fdb_add(ndm, p, addr, nlh_flags, 0);
850 err = __br_fdb_add(ndm, p, addr, nlh_flags, 0); 850 if (err || !pv)
851 goto out; 851 goto out;
852 }
853 852
854 /* We have vlans configured on this port and user didn't 853 /* We have vlans configured on this port and user didn't
855 * specify a VLAN. To be nice, add/update entry for every 854 * specify a VLAN. To be nice, add/update entry for every
@@ -917,16 +916,15 @@ int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[],
917 916
918 err = __br_fdb_delete(p, addr, vid); 917 err = __br_fdb_delete(p, addr, vid);
919 } else { 918 } else {
920 if (!pv || bitmap_empty(pv->vlan_bitmap, VLAN_N_VID)) { 919 err = -ENOENT;
921 err = __br_fdb_delete(p, addr, 0); 920 err &= __br_fdb_delete(p, addr, 0);
921 if (!pv)
922 goto out; 922 goto out;
923 }
924 923
925 /* We have vlans configured on this port and user didn't 924 /* We have vlans configured on this port and user didn't
926 * specify a VLAN. To be nice, add/update entry for every 925 * specify a VLAN. To be nice, add/update entry for every
927 * vlan on this port. 926 * vlan on this port.
928 */ 927 */
929 err = -ENOENT;
930 for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) { 928 for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) {
931 err &= __br_fdb_delete(p, addr, vid); 929 err &= __br_fdb_delete(p, addr, vid);
932 } 930 }
diff --git a/net/core/dev.c b/net/core/dev.c
index 8be38675e1a8..d030575532a2 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -7129,11 +7129,11 @@ static int dev_cpu_callback(struct notifier_block *nfb,
7129 7129
7130 /* Process offline CPU's input_pkt_queue */ 7130 /* Process offline CPU's input_pkt_queue */
7131 while ((skb = __skb_dequeue(&oldsd->process_queue))) { 7131 while ((skb = __skb_dequeue(&oldsd->process_queue))) {
7132 netif_rx_internal(skb); 7132 netif_rx_ni(skb);
7133 input_queue_head_incr(oldsd); 7133 input_queue_head_incr(oldsd);
7134 } 7134 }
7135 while ((skb = skb_dequeue(&oldsd->input_pkt_queue))) { 7135 while ((skb = skb_dequeue(&oldsd->input_pkt_queue))) {
7136 netif_rx_internal(skb); 7136 netif_rx_ni(skb);
7137 input_queue_head_incr(oldsd); 7137 input_queue_head_incr(oldsd);
7138 } 7138 }
7139 7139
diff --git a/net/core/flow.c b/net/core/flow.c
index a0348fde1fdf..1033725be40b 100644
--- a/net/core/flow.c
+++ b/net/core/flow.c
@@ -379,7 +379,7 @@ done:
379static void flow_cache_flush_task(struct work_struct *work) 379static void flow_cache_flush_task(struct work_struct *work)
380{ 380{
381 struct netns_xfrm *xfrm = container_of(work, struct netns_xfrm, 381 struct netns_xfrm *xfrm = container_of(work, struct netns_xfrm,
382 flow_cache_gc_work); 382 flow_cache_flush_work);
383 struct net *net = container_of(xfrm, struct net, xfrm); 383 struct net *net = container_of(xfrm, struct net, xfrm);
384 384
385 flow_cache_flush(net); 385 flow_cache_flush(net);
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index da934fc3faa8..9fa25b0ea145 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2842,25 +2842,25 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
2842 skb->dev = odev; 2842 skb->dev = odev;
2843 skb->pkt_type = PACKET_HOST; 2843 skb->pkt_type = PACKET_HOST;
2844 2844
2845 pktgen_finalize_skb(pkt_dev, skb, datalen);
2846
2845 if (!(pkt_dev->flags & F_UDPCSUM)) { 2847 if (!(pkt_dev->flags & F_UDPCSUM)) {
2846 skb->ip_summed = CHECKSUM_NONE; 2848 skb->ip_summed = CHECKSUM_NONE;
2847 } else if (odev->features & NETIF_F_V4_CSUM) { 2849 } else if (odev->features & NETIF_F_V4_CSUM) {
2848 skb->ip_summed = CHECKSUM_PARTIAL; 2850 skb->ip_summed = CHECKSUM_PARTIAL;
2849 skb->csum = 0; 2851 skb->csum = 0;
2850 udp4_hwcsum(skb, udph->source, udph->dest); 2852 udp4_hwcsum(skb, iph->saddr, iph->daddr);
2851 } else { 2853 } else {
2852 __wsum csum = udp_csum(skb); 2854 __wsum csum = skb_checksum(skb, skb_transport_offset(skb), datalen + 8, 0);
2853 2855
2854 /* add protocol-dependent pseudo-header */ 2856 /* add protocol-dependent pseudo-header */
2855 udph->check = csum_tcpudp_magic(udph->source, udph->dest, 2857 udph->check = csum_tcpudp_magic(iph->saddr, iph->daddr,
2856 datalen + 8, IPPROTO_UDP, csum); 2858 datalen + 8, IPPROTO_UDP, csum);
2857 2859
2858 if (udph->check == 0) 2860 if (udph->check == 0)
2859 udph->check = CSUM_MANGLED_0; 2861 udph->check = CSUM_MANGLED_0;
2860 } 2862 }
2861 2863
2862 pktgen_finalize_skb(pkt_dev, skb, datalen);
2863
2864#ifdef CONFIG_XFRM 2864#ifdef CONFIG_XFRM
2865 if (!process_ipsec(pkt_dev, skb, protocol)) 2865 if (!process_ipsec(pkt_dev, skb, protocol))
2866 return NULL; 2866 return NULL;
@@ -2976,6 +2976,8 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
2976 skb->dev = odev; 2976 skb->dev = odev;
2977 skb->pkt_type = PACKET_HOST; 2977 skb->pkt_type = PACKET_HOST;
2978 2978
2979 pktgen_finalize_skb(pkt_dev, skb, datalen);
2980
2979 if (!(pkt_dev->flags & F_UDPCSUM)) { 2981 if (!(pkt_dev->flags & F_UDPCSUM)) {
2980 skb->ip_summed = CHECKSUM_NONE; 2982 skb->ip_summed = CHECKSUM_NONE;
2981 } else if (odev->features & NETIF_F_V6_CSUM) { 2983 } else if (odev->features & NETIF_F_V6_CSUM) {
@@ -2984,7 +2986,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
2984 skb->csum_offset = offsetof(struct udphdr, check); 2986 skb->csum_offset = offsetof(struct udphdr, check);
2985 udph->check = ~csum_ipv6_magic(&iph->saddr, &iph->daddr, udplen, IPPROTO_UDP, 0); 2987 udph->check = ~csum_ipv6_magic(&iph->saddr, &iph->daddr, udplen, IPPROTO_UDP, 0);
2986 } else { 2988 } else {
2987 __wsum csum = udp_csum(skb); 2989 __wsum csum = skb_checksum(skb, skb_transport_offset(skb), udplen, 0);
2988 2990
2989 /* add protocol-dependent pseudo-header */ 2991 /* add protocol-dependent pseudo-header */
2990 udph->check = csum_ipv6_magic(&iph->saddr, &iph->daddr, udplen, IPPROTO_UDP, csum); 2992 udph->check = csum_ipv6_magic(&iph->saddr, &iph->daddr, udplen, IPPROTO_UDP, csum);
@@ -2993,8 +2995,6 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
2993 udph->check = CSUM_MANGLED_0; 2995 udph->check = CSUM_MANGLED_0;
2994 } 2996 }
2995 2997
2996 pktgen_finalize_skb(pkt_dev, skb, datalen);
2997
2998 return skb; 2998 return skb;
2999} 2999}
3000 3000
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 5dad4f782f03..5be499b6a2d2 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1263,18 +1263,12 @@ static const struct nla_policy ifla_vfinfo_policy[IFLA_VF_INFO_MAX+1] = {
1263}; 1263};
1264 1264
1265static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = { 1265static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = {
1266 [IFLA_VF_MAC] = { .type = NLA_BINARY, 1266 [IFLA_VF_MAC] = { .len = sizeof(struct ifla_vf_mac) },
1267 .len = sizeof(struct ifla_vf_mac) }, 1267 [IFLA_VF_VLAN] = { .len = sizeof(struct ifla_vf_vlan) },
1268 [IFLA_VF_VLAN] = { .type = NLA_BINARY, 1268 [IFLA_VF_TX_RATE] = { .len = sizeof(struct ifla_vf_tx_rate) },
1269 .len = sizeof(struct ifla_vf_vlan) }, 1269 [IFLA_VF_SPOOFCHK] = { .len = sizeof(struct ifla_vf_spoofchk) },
1270 [IFLA_VF_TX_RATE] = { .type = NLA_BINARY, 1270 [IFLA_VF_RATE] = { .len = sizeof(struct ifla_vf_rate) },
1271 .len = sizeof(struct ifla_vf_tx_rate) }, 1271 [IFLA_VF_LINK_STATE] = { .len = sizeof(struct ifla_vf_link_state) },
1272 [IFLA_VF_SPOOFCHK] = { .type = NLA_BINARY,
1273 .len = sizeof(struct ifla_vf_spoofchk) },
1274 [IFLA_VF_RATE] = { .type = NLA_BINARY,
1275 .len = sizeof(struct ifla_vf_rate) },
1276 [IFLA_VF_LINK_STATE] = { .type = NLA_BINARY,
1277 .len = sizeof(struct ifla_vf_link_state) },
1278}; 1272};
1279 1273
1280static const struct nla_policy ifla_port_policy[IFLA_PORT_MAX+1] = { 1274static const struct nla_policy ifla_port_policy[IFLA_PORT_MAX+1] = {
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 37317149f918..2173402d87e0 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -603,7 +603,7 @@ static int dsa_of_probe(struct platform_device *pdev)
603 603
604 pdev->dev.platform_data = pd; 604 pdev->dev.platform_data = pd;
605 pd->netdev = &ethernet_dev->dev; 605 pd->netdev = &ethernet_dev->dev;
606 pd->nr_chips = of_get_child_count(np); 606 pd->nr_chips = of_get_available_child_count(np);
607 if (pd->nr_chips > DSA_MAX_SWITCHES) 607 if (pd->nr_chips > DSA_MAX_SWITCHES)
608 pd->nr_chips = DSA_MAX_SWITCHES; 608 pd->nr_chips = DSA_MAX_SWITCHES;
609 609
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 589aafd01fc5..d104ae15836f 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -676,18 +676,5 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
676 676
677 netif_carrier_off(slave_dev); 677 netif_carrier_off(slave_dev);
678 678
679 if (p->phy != NULL) {
680 if (ds->drv->get_phy_flags)
681 p->phy->dev_flags |= ds->drv->get_phy_flags(ds, port);
682
683 phy_attach(slave_dev, dev_name(&p->phy->dev),
684 PHY_INTERFACE_MODE_GMII);
685
686 p->phy->autoneg = AUTONEG_ENABLE;
687 p->phy->speed = 0;
688 p->phy->duplex = 0;
689 p->phy->advertising = p->phy->supported | ADVERTISED_Autoneg;
690 }
691
692 return slave_dev; 679 return slave_dev;
693} 680}
diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c
index 815c85e3b1e0..53db2c309572 100644
--- a/net/ipv4/tcp_fastopen.c
+++ b/net/ipv4/tcp_fastopen.c
@@ -255,6 +255,9 @@ bool tcp_try_fastopen(struct sock *sk, struct sk_buff *skb,
255 struct tcp_fastopen_cookie valid_foc = { .len = -1 }; 255 struct tcp_fastopen_cookie valid_foc = { .len = -1 };
256 bool syn_data = TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq + 1; 256 bool syn_data = TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq + 1;
257 257
258 if (foc->len == 0) /* Client requests a cookie */
259 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPFASTOPENCOOKIEREQD);
260
258 if (!((sysctl_tcp_fastopen & TFO_SERVER_ENABLE) && 261 if (!((sysctl_tcp_fastopen & TFO_SERVER_ENABLE) &&
259 (syn_data || foc->len >= 0) && 262 (syn_data || foc->len >= 0) &&
260 tcp_fastopen_queue_check(sk))) { 263 tcp_fastopen_queue_check(sk))) {
@@ -265,7 +268,8 @@ bool tcp_try_fastopen(struct sock *sk, struct sk_buff *skb,
265 if (syn_data && (sysctl_tcp_fastopen & TFO_SERVER_COOKIE_NOT_REQD)) 268 if (syn_data && (sysctl_tcp_fastopen & TFO_SERVER_COOKIE_NOT_REQD))
266 goto fastopen; 269 goto fastopen;
267 270
268 if (tcp_fastopen_cookie_gen(req, skb, &valid_foc) && 271 if (foc->len >= 0 && /* Client presents or requests a cookie */
272 tcp_fastopen_cookie_gen(req, skb, &valid_foc) &&
269 foc->len == TCP_FASTOPEN_COOKIE_SIZE && 273 foc->len == TCP_FASTOPEN_COOKIE_SIZE &&
270 foc->len == valid_foc.len && 274 foc->len == valid_foc.len &&
271 !memcmp(foc->val, valid_foc.val, foc->len)) { 275 !memcmp(foc->val, valid_foc.val, foc->len)) {
@@ -284,11 +288,10 @@ fastopen:
284 LINUX_MIB_TCPFASTOPENPASSIVE); 288 LINUX_MIB_TCPFASTOPENPASSIVE);
285 return true; 289 return true;
286 } 290 }
287 } 291 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPFASTOPENPASSIVEFAIL);
292 } else if (foc->len > 0) /* Client presents an invalid cookie */
293 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPFASTOPENPASSIVEFAIL);
288 294
289 NET_INC_STATS_BH(sock_net(sk), foc->len ?
290 LINUX_MIB_TCPFASTOPENPASSIVEFAIL :
291 LINUX_MIB_TCPFASTOPENCOOKIEREQD);
292 *foc = valid_foc; 295 *foc = valid_foc;
293 return false; 296 return false;
294} 297}
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 8623118cb2bb..98e4a63d72bb 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1522,15 +1522,30 @@ static int ipv6_count_addresses(struct inet6_dev *idev)
1522int ipv6_chk_addr(struct net *net, const struct in6_addr *addr, 1522int ipv6_chk_addr(struct net *net, const struct in6_addr *addr,
1523 const struct net_device *dev, int strict) 1523 const struct net_device *dev, int strict)
1524{ 1524{
1525 return ipv6_chk_addr_and_flags(net, addr, dev, strict, IFA_F_TENTATIVE);
1526}
1527EXPORT_SYMBOL(ipv6_chk_addr);
1528
1529int ipv6_chk_addr_and_flags(struct net *net, const struct in6_addr *addr,
1530 const struct net_device *dev, int strict,
1531 u32 banned_flags)
1532{
1525 struct inet6_ifaddr *ifp; 1533 struct inet6_ifaddr *ifp;
1526 unsigned int hash = inet6_addr_hash(addr); 1534 unsigned int hash = inet6_addr_hash(addr);
1535 u32 ifp_flags;
1527 1536
1528 rcu_read_lock_bh(); 1537 rcu_read_lock_bh();
1529 hlist_for_each_entry_rcu(ifp, &inet6_addr_lst[hash], addr_lst) { 1538 hlist_for_each_entry_rcu(ifp, &inet6_addr_lst[hash], addr_lst) {
1530 if (!net_eq(dev_net(ifp->idev->dev), net)) 1539 if (!net_eq(dev_net(ifp->idev->dev), net))
1531 continue; 1540 continue;
1541 /* Decouple optimistic from tentative for evaluation here.
1542 * Ban optimistic addresses explicitly, when required.
1543 */
1544 ifp_flags = (ifp->flags&IFA_F_OPTIMISTIC)
1545 ? (ifp->flags&~IFA_F_TENTATIVE)
1546 : ifp->flags;
1532 if (ipv6_addr_equal(&ifp->addr, addr) && 1547 if (ipv6_addr_equal(&ifp->addr, addr) &&
1533 !(ifp->flags&IFA_F_TENTATIVE) && 1548 !(ifp_flags&banned_flags) &&
1534 (dev == NULL || ifp->idev->dev == dev || 1549 (dev == NULL || ifp->idev->dev == dev ||
1535 !(ifp->scope&(IFA_LINK|IFA_HOST) || strict))) { 1550 !(ifp->scope&(IFA_LINK|IFA_HOST) || strict))) {
1536 rcu_read_unlock_bh(); 1551 rcu_read_unlock_bh();
@@ -1541,7 +1556,7 @@ int ipv6_chk_addr(struct net *net, const struct in6_addr *addr,
1541 rcu_read_unlock_bh(); 1556 rcu_read_unlock_bh();
1542 return 0; 1557 return 0;
1543} 1558}
1544EXPORT_SYMBOL(ipv6_chk_addr); 1559EXPORT_SYMBOL(ipv6_chk_addr_and_flags);
1545 1560
1546static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr, 1561static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
1547 struct net_device *dev) 1562 struct net_device *dev)
@@ -4579,6 +4594,22 @@ static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token)
4579 return 0; 4594 return 0;
4580} 4595}
4581 4596
4597static const struct nla_policy inet6_af_policy[IFLA_INET6_MAX + 1] = {
4598 [IFLA_INET6_ADDR_GEN_MODE] = { .type = NLA_U8 },
4599 [IFLA_INET6_TOKEN] = { .len = sizeof(struct in6_addr) },
4600};
4601
4602static int inet6_validate_link_af(const struct net_device *dev,
4603 const struct nlattr *nla)
4604{
4605 struct nlattr *tb[IFLA_INET6_MAX + 1];
4606
4607 if (dev && !__in6_dev_get(dev))
4608 return -EAFNOSUPPORT;
4609
4610 return nla_parse_nested(tb, IFLA_INET6_MAX, nla, inet6_af_policy);
4611}
4612
4582static int inet6_set_link_af(struct net_device *dev, const struct nlattr *nla) 4613static int inet6_set_link_af(struct net_device *dev, const struct nlattr *nla)
4583{ 4614{
4584 int err = -EINVAL; 4615 int err = -EINVAL;
@@ -5409,6 +5440,7 @@ static struct rtnl_af_ops inet6_ops __read_mostly = {
5409 .family = AF_INET6, 5440 .family = AF_INET6,
5410 .fill_link_af = inet6_fill_link_af, 5441 .fill_link_af = inet6_fill_link_af,
5411 .get_link_af_size = inet6_get_link_af_size, 5442 .get_link_af_size = inet6_get_link_af_size,
5443 .validate_link_af = inet6_validate_link_af,
5412 .set_link_af = inet6_set_link_af, 5444 .set_link_af = inet6_set_link_af,
5413}; 5445};
5414 5446
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 8a9d7c19e247..471ed24aabae 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -655,7 +655,9 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
655 struct in6_addr *target = (struct in6_addr *)&neigh->primary_key; 655 struct in6_addr *target = (struct in6_addr *)&neigh->primary_key;
656 int probes = atomic_read(&neigh->probes); 656 int probes = atomic_read(&neigh->probes);
657 657
658 if (skb && ipv6_chk_addr(dev_net(dev), &ipv6_hdr(skb)->saddr, dev, 1)) 658 if (skb && ipv6_chk_addr_and_flags(dev_net(dev), &ipv6_hdr(skb)->saddr,
659 dev, 1,
660 IFA_F_TENTATIVE|IFA_F_OPTIMISTIC))
659 saddr = &ipv6_hdr(skb)->saddr; 661 saddr = &ipv6_hdr(skb)->saddr;
660 probes -= NEIGH_VAR(neigh->parms, UCAST_PROBES); 662 probes -= NEIGH_VAR(neigh->parms, UCAST_PROBES);
661 if (probes < 0) { 663 if (probes < 0) {
diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c
index 54520a0bd5e3..74581f706c4d 100644
--- a/net/ipv6/output_core.c
+++ b/net/ipv6/output_core.c
@@ -9,7 +9,8 @@
9#include <net/addrconf.h> 9#include <net/addrconf.h>
10#include <net/secure_seq.h> 10#include <net/secure_seq.h>
11 11
12u32 __ipv6_select_ident(u32 hashrnd, struct in6_addr *dst, struct in6_addr *src) 12static u32 __ipv6_select_ident(u32 hashrnd, struct in6_addr *dst,
13 struct in6_addr *src)
13{ 14{
14 u32 hash, id; 15 u32 hash, id;
15 16
@@ -54,7 +55,7 @@ void ipv6_proxy_select_ident(struct sk_buff *skb)
54 55
55 id = __ipv6_select_ident(ip6_proxy_idents_hashrnd, 56 id = __ipv6_select_ident(ip6_proxy_idents_hashrnd,
56 &addrs[1], &addrs[0]); 57 &addrs[1], &addrs[0]);
57 skb_shinfo(skb)->ip6_frag_id = id; 58 skb_shinfo(skb)->ip6_frag_id = htonl(id);
58} 59}
59EXPORT_SYMBOL_GPL(ipv6_proxy_select_ident); 60EXPORT_SYMBOL_GPL(ipv6_proxy_select_ident);
60 61