mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-03-01 12:35:01 +07:00
vxlan: set needed headroom correctly
vxlan_setup is called when allocating the net_device, i.e. way before vxlan_newlink (or vxlan_dev_configure) is called. This means vxlan->default_dst is actually unset in vxlan_setup and the condition that sets needed_headroom always takes the else branch. Set the needed_headrom at the point when we have the information about the address family available. Fixes:e4c7ed4153
("vxlan: add ipv6 support") Fixes:2853af6a2e
("vxlan: use dev->needed_headroom instead of dev->hard_header_len") CC: Cong Wang <cwang@twopensource.com> Signed-off-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c38f6ac74c
commit
9dc2ad1008
@ -2392,10 +2392,6 @@ static void vxlan_setup(struct net_device *dev)
|
|||||||
|
|
||||||
eth_hw_addr_random(dev);
|
eth_hw_addr_random(dev);
|
||||||
ether_setup(dev);
|
ether_setup(dev);
|
||||||
if (vxlan->default_dst.remote_ip.sa.sa_family == AF_INET6)
|
|
||||||
dev->needed_headroom = ETH_HLEN + VXLAN6_HEADROOM;
|
|
||||||
else
|
|
||||||
dev->needed_headroom = ETH_HLEN + VXLAN_HEADROOM;
|
|
||||||
|
|
||||||
dev->netdev_ops = &vxlan_netdev_ops;
|
dev->netdev_ops = &vxlan_netdev_ops;
|
||||||
dev->destructor = free_netdev;
|
dev->destructor = free_netdev;
|
||||||
@ -2670,8 +2666,12 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,
|
|||||||
|
|
||||||
dev->needed_headroom = lowerdev->hard_header_len +
|
dev->needed_headroom = lowerdev->hard_header_len +
|
||||||
(use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM);
|
(use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM);
|
||||||
} else if (use_ipv6)
|
} else if (use_ipv6) {
|
||||||
vxlan->flags |= VXLAN_F_IPV6;
|
vxlan->flags |= VXLAN_F_IPV6;
|
||||||
|
dev->needed_headroom = ETH_HLEN + VXLAN6_HEADROOM;
|
||||||
|
} else {
|
||||||
|
dev->needed_headroom = ETH_HLEN + VXLAN_HEADROOM;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(&vxlan->cfg, conf, sizeof(*conf));
|
memcpy(&vxlan->cfg, conf, sizeof(*conf));
|
||||||
if (!vxlan->cfg.dst_port)
|
if (!vxlan->cfg.dst_port)
|
||||||
|
Loading…
Reference in New Issue
Block a user