On Sun, Oct 11, 2020 at 3:46 PM Xie He <xie.he.0...@gmail.com> wrote: > > On Sun, Oct 11, 2020 at 12:11 PM Cong Wang <xiyou.wangc...@gmail.com> wrote: > > > > @@ -626,8 +626,7 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb, > > > > if (dev->header_ops) { > > /* Need space for new headers */ > > - if (skb_cow_head(skb, dev->needed_headroom - > > - (tunnel->hlen + sizeof(struct > > iphdr)))) > > + if (skb_cow_head(skb, dev->hard_header_len)) > > goto free_skb; > > > > tnl_params = (const struct iphdr *)skb->data; > > As I understand, the skb_cow functions are for ensuring enough header > space before skb->data. (Right?) However, at this stage our skb->data > is already at the outer IP header, I think we don't need to request > additional header space before the outer IP header.
Good point, I thought skb_headroom() == dev->hard_header_len, but skb->data already points to the tunnel header like you said, so we should pass 0 to skb_cow_head() here. Thanks.