lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <20230424071541.GA10583@unreal> Date: Mon, 24 Apr 2023 10:15:41 +0300 From: Leon Romanovsky <leon@...nel.org> To: Cong Wang <xiyou.wangcong@...il.com> Cc: netdev@...r.kernel.org, Cong Wang <cong.wang@...edance.com>, Palash Oswal <oswalpalash@...il.com>, Kuniyuki Iwashima <kuniyu@...zon.com>, Eric Dumazet <edumazet@...gle.com> Subject: Re: [Patch net] sit: update dev->needed_headroom in ipip6_tunnel_bind_dev() On Sun, Apr 23, 2023 at 05:34:14PM -0700, Cong Wang wrote: > From: Cong Wang <cong.wang@...edance.com> > > 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(). > > Note, this is targeting for -net and -table, so I'd keep the fix > small. We can refactor and reuse ip_tunnel_bind_dev() for -net-next. I suggest to put these two lines under --- trailer. There is a little value of this information in git history. > > Fixes: 32b8a8e59c9c ("sit: add IPv4 over IPv4 support") > Reported-by: Palash Oswal <oswalpalash@...il.com> > Link: https://lore.kernel.org/netdev/CAGyP=7fDcSPKu6nttbGwt7RXzE3uyYxLjCSE97J64pRxJP8jPA@mail.gmail.com/ > Cc: Kuniyuki Iwashima <kuniyu@...zon.com> > Cc: Eric Dumazet <edumazet@...gle.com> > Signed-off-by: Cong Wang <cong.wang@...edance.com> > --- > net/ipv6/sit.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c > index 70d81bba5093..3a8f04ba4947 100644 > --- a/net/ipv6/sit.c > +++ b/net/ipv6/sit.c > @@ -1096,11 +1096,12 @@ static netdev_tx_t sit_tunnel_xmit(struct sk_buff *skb, > static void ipip6_tunnel_bind_dev(struct net_device *dev) > { > struct net_device *tdev = NULL; > - struct ip_tunnel *tunnel; > + struct ip_tunnel *tunnel = netdev_priv(dev); > const struct iphdr *iph; > struct flowi4 fl4; > + int t_hlen = tunnel->hlen + sizeof(struct iphdr); > + int hlen = LL_MAX_HEADER; Please continue to use reversed Christmas tree in declaration of variables. Thanks > > - tunnel = netdev_priv(dev); > iph = &tunnel->parms.iph; > > if (iph->daddr) { > @@ -1123,14 +1124,15 @@ static void ipip6_tunnel_bind_dev(struct net_device *dev) > tdev = __dev_get_by_index(tunnel->net, tunnel->parms.link); > > if (tdev && !netif_is_l3_master(tdev)) { > - int t_hlen = tunnel->hlen + sizeof(struct iphdr); > int mtu; > > mtu = tdev->mtu - t_hlen; > if (mtu < IPV6_MIN_MTU) > mtu = IPV6_MIN_MTU; > WRITE_ONCE(dev->mtu, mtu); > + hlen = tdev->hard_header_len + tdev->needed_headroom; > } > + dev->needed_headroom = t_hlen + hlen; > } > > static void ipip6_tunnel_update(struct ip_tunnel *t, struct ip_tunnel_parm *p, > -- > 2.34.1 >
Powered by blists - more mailing lists