Skip to content

Commit 243aad8

Browse files
fableddavem330
authored andcommitted
ip_gre: include route header_len in max_headroom calculation
Taking route's header_len into account, and updating gre device needed_headroom will give better hints on upper bound of required headroom. This is useful if the gre traffic is xfrm'ed. Signed-off-by: Timo Teras <timo.teras@iki.fi> Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 9bf35c8 commit 243aad8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/ipv4/ip_gre.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,11 +810,13 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
810810
tunnel->err_count = 0;
811811
}
812812

813-
max_headroom = LL_RESERVED_SPACE(tdev) + gre_hlen;
813+
max_headroom = LL_RESERVED_SPACE(tdev) + gre_hlen + rt->u.dst.header_len;
814814

815815
if (skb_headroom(skb) < max_headroom || skb_shared(skb)||
816816
(skb_cloned(skb) && !skb_clone_writable(skb, 0))) {
817817
struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom);
818+
if (max_headroom > dev->needed_headroom)
819+
dev->needed_headroom = max_headroom;
818820
if (!new_skb) {
819821
ip_rt_put(rt);
820822
txq->tx_dropped++;

0 commit comments

Comments
 (0)