[Patch net v2] ip_gre: set dev->hard_header_len and dev->needed_headroom properly

2020-10-11 Thread Cong Wang
GRE tunnel has its own header_ops, ipgre_header_ops, and sets it conditionally. When it is set, it assumes the outer IP header is already created before ipgre_xmit(). This is not true when we send packets through a raw packet socket, where L2 headers are supposed to be constructed by user. Packet

Re: [Patch net v2] ip_gre: set dev->hard_header_len and dev->needed_headroom properly

2020-10-11 Thread Xie He
On Sun, Oct 11, 2020 at 12:11 PM Cong Wang wrote: > > GRE tunnel has its own header_ops, ipgre_header_ops, and sets it > conditionally. When it is set, it assumes the outer IP header is > already created before ipgre_xmit(). > > This is not true when we send packets through a raw packet socket, >

Re: [Patch net v2] ip_gre: set dev->hard_header_len and dev->needed_headroom properly

2020-10-11 Thread Willem de Bruijn
On Sun, Oct 11, 2020 at 3:11 PM Cong Wang wrote: > > GRE tunnel has its own header_ops, ipgre_header_ops, and sets it > conditionally. When it is set, it assumes the outer IP header is > already created before ipgre_xmit(). > > This is not true when we send packets through a raw packet socket, > w

Re: [Patch net v2] ip_gre: set dev->hard_header_len and dev->needed_headroom properly

2020-10-11 Thread Willem de Bruijn
On Sun, Oct 11, 2020 at 4:42 PM Xie He wrote: > > On Sun, Oct 11, 2020 at 12:11 PM Cong Wang wrote: > > > > GRE tunnel has its own header_ops, ipgre_header_ops, and sets it > > conditionally. When it is set, it assumes the outer IP header is > > already created before ipgre_xmit(). > > > > This i

Re: [Patch net v2] ip_gre: set dev->hard_header_len and dev->needed_headroom properly

2020-10-11 Thread Willem de Bruijn
On Sun, Oct 11, 2020 at 5:00 PM Willem de Bruijn wrote: > > On Sun, Oct 11, 2020 at 3:11 PM Cong Wang wrote: > > > > GRE tunnel has its own header_ops, ipgre_header_ops, and sets it > > conditionally. When it is set, it assumes the outer IP header is > > already created before ipgre_xmit(). > > >

Re: [Patch net v2] ip_gre: set dev->hard_header_len and dev->needed_headroom properly

2020-10-11 Thread Xie He
On Sun, Oct 11, 2020 at 2:07 PM Willem de Bruijn wrote: > > On Sun, Oct 11, 2020 at 4:42 PM Xie He wrote: > > > > Hi, thanks for attempting to fix this tunnel. Are we still considering > > removing header_ops->create? > > > > As said in my email sent previously today, I want to remove > > header_

Re: [Patch net v2] ip_gre: set dev->hard_header_len and dev->needed_headroom properly

2020-10-11 Thread Xie He
On Sun, Oct 11, 2020 at 2:01 PM Willem de Bruijn wrote: > > There is agreement that hard_header_len should be the length of link > layer headers visible to the upper layers, needed_headroom the > additional room required for headers that are not exposed, i.e., those > pushed inside ndo_start_xmit.

Re: [Patch net v2] ip_gre: set dev->hard_header_len and dev->needed_headroom properly

2020-10-11 Thread Xie He
On Sun, Oct 11, 2020 at 12:11 PM Cong Wang 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 - > -

Re: [Patch net v2] ip_gre: set dev->hard_header_len and dev->needed_headroom properly

2020-10-12 Thread Cong Wang
On Sun, Oct 11, 2020 at 3:46 PM Xie He wrote: > > On Sun, Oct 11, 2020 at 12:11 PM Cong Wang 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 (sk

Re: [Patch net v2] ip_gre: set dev->hard_header_len and dev->needed_headroom properly

2020-10-14 Thread Xie He
On Sun, Oct 11, 2020 at 2:01 PM Willem de Bruijn wrote: > > There is agreement that hard_header_len should be the length of link > layer headers visible to the upper layers, needed_headroom the > additional room required for headers that are not exposed, i.e., those > pushed inside ndo_start_xmit.

Re: [Patch net v2] ip_gre: set dev->hard_header_len and dev->needed_headroom properly

2020-10-14 Thread Willem de Bruijn
On Wed, Oct 14, 2020 at 4:52 AM Xie He wrote: > > On Sun, Oct 11, 2020 at 2:01 PM Willem de Bruijn > wrote: > > > > There is agreement that hard_header_len should be the length of link > > layer headers visible to the upper layers, needed_headroom the > > additional room required for headers that

Re: [Patch net v2] ip_gre: set dev->hard_header_len and dev->needed_headroom properly

2020-10-14 Thread Xie He
On Wed, Oct 14, 2020 at 8:12 AM Willem de Bruijn wrote: > > On Wed, Oct 14, 2020 at 4:52 AM Xie He wrote: > > > > On Sun, Oct 11, 2020 at 2:01 PM Willem de Bruijn > > wrote: > > > > > > There is agreement that hard_header_len should be the length of link > > > layer headers visible to the upper

Re: [Patch net v2] ip_gre: set dev->hard_header_len and dev->needed_headroom properly

2020-10-14 Thread Willem de Bruijn
On Wed, Oct 14, 2020 at 3:48 PM Xie He wrote: > > On Wed, Oct 14, 2020 at 8:12 AM Willem de Bruijn > wrote: > > > > On Wed, Oct 14, 2020 at 4:52 AM Xie He wrote: > > > > > > On Sun, Oct 11, 2020 at 2:01 PM Willem de Bruijn > > > wrote: > > > > > > > > There is agreement that hard_header_len sho

Re: [Patch net v2] ip_gre: set dev->hard_header_len and dev->needed_headroom properly

2020-10-14 Thread Xie He
On Wed, Oct 14, 2020 at 1:19 PM Willem de Bruijn wrote: > > On Wed, Oct 14, 2020 at 3:48 PM Xie He wrote: > > > > I thought we agreed that ideally GRE devices would not have > > header_ops. Currently GRE devices (in normal situations) indeed do not > > use header_ops (and use ARHPHRD_IPGRE as dev

Re: [Patch net v2] ip_gre: set dev->hard_header_len and dev->needed_headroom properly

2020-10-14 Thread Xie He
On Wed, Oct 14, 2020 at 6:38 PM Xie He wrote: > > On Wed, Oct 14, 2020 at 1:19 PM Willem de Bruijn > wrote: > > > > On Wed, Oct 14, 2020 at 3:48 PM Xie He wrote: > > > > > > I thought we agreed that ideally GRE devices would not have > > > header_ops. Currently GRE devices (in normal situations)

Re: [Patch net v2] ip_gre: set dev->hard_header_len and dev->needed_headroom properly

2020-10-15 Thread Willem de Bruijn
On Wed, Oct 14, 2020 at 10:25 PM Xie He wrote: > > On Wed, Oct 14, 2020 at 6:38 PM Xie He wrote: > > > > On Wed, Oct 14, 2020 at 1:19 PM Willem de Bruijn > > wrote: > > > > > > On Wed, Oct 14, 2020 at 3:48 PM Xie He wrote: > > > > > > > > I thought we agreed that ideally GRE devices would not h

Re: [Patch net v2] ip_gre: set dev->hard_header_len and dev->needed_headroom properly

2020-10-15 Thread Xie He
On Thu, Oct 15, 2020 at 6:42 AM Willem de Bruijn wrote: > > On Wed, Oct 14, 2020 at 10:25 PM Xie He wrote: > > > > Actually I think dev->type can be seen from user space. For example, > > when you type "ip link", it will display the link type for you. So I > > think it is useful to keep different

Re: [Patch net v2] ip_gre: set dev->hard_header_len and dev->needed_headroom properly

2020-10-15 Thread Willem de Bruijn
On Thu, Oct 15, 2020 at 3:19 PM Xie He wrote: > > On Thu, Oct 15, 2020 at 6:42 AM Willem de Bruijn > wrote: > > > > On Wed, Oct 14, 2020 at 10:25 PM Xie He wrote: > > > > > > Actually I think dev->type can be seen from user space. For example, > > > when you type "ip link", it will display the l