Skip to content

Commit c88f8d5

Browse files
Cong Wangdavem330
authored andcommitted
sit: update dev->needed_headroom in ipip6_tunnel_bind_dev()
When a tunnel device is bound with the underlying device, its dev->needed_headroom needs to be updated properly. IPv4 tunnels already do the same in ip_tunnel_bind_dev(). Otherwise we may not have enough header room for skb, especially after commit b17f709 ("gue: TX support for using remote checksum offload option"). Fixes: 32b8a8e ("sit: add IPv4 over IPv4 support") Reported-by: Palash Oswal <[email protected]> Link: https://lore.kernel.org/netdev/CAGyP=7fDcSPKu6nttbGwt7RXzE3uyYxLjCSE97J64pRxJP8jPA@mail.gmail.com/ Cc: Kuniyuki Iwashima <[email protected]> Cc: Eric Dumazet <[email protected]> Signed-off-by: Cong Wang <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Reviewed-by: Kuniyuki Iwashima <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent da94a77 commit c88f8d5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

net/ipv6/sit.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,12 +1095,13 @@ static netdev_tx_t sit_tunnel_xmit(struct sk_buff *skb,
10951095

10961096
static void ipip6_tunnel_bind_dev(struct net_device *dev)
10971097
{
1098+
struct ip_tunnel *tunnel = netdev_priv(dev);
1099+
int t_hlen = tunnel->hlen + sizeof(struct iphdr);
10981100
struct net_device *tdev = NULL;
1099-
struct ip_tunnel *tunnel;
1101+
int hlen = LL_MAX_HEADER;
11001102
const struct iphdr *iph;
11011103
struct flowi4 fl4;
11021104

1103-
tunnel = netdev_priv(dev);
11041105
iph = &tunnel->parms.iph;
11051106

11061107
if (iph->daddr) {
@@ -1123,14 +1124,15 @@ static void ipip6_tunnel_bind_dev(struct net_device *dev)
11231124
tdev = __dev_get_by_index(tunnel->net, tunnel->parms.link);
11241125

11251126
if (tdev && !netif_is_l3_master(tdev)) {
1126-
int t_hlen = tunnel->hlen + sizeof(struct iphdr);
11271127
int mtu;
11281128

11291129
mtu = tdev->mtu - t_hlen;
11301130
if (mtu < IPV6_MIN_MTU)
11311131
mtu = IPV6_MIN_MTU;
11321132
WRITE_ONCE(dev->mtu, mtu);
1133+
hlen = tdev->hard_header_len + tdev->needed_headroom;
11331134
}
1135+
dev->needed_headroom = t_hlen + hlen;
11341136
}
11351137

11361138
static void ipip6_tunnel_update(struct ip_tunnel *t, struct ip_tunnel_parm *p,

0 commit comments

Comments
 (0)