[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cf5ef569-1742-a22f-ec7d-f987287e12fb@6wind.com>
Date: Thu, 13 Feb 2020 17:33:01 +0100
From: Nicolas Dichtel <nicolas.dichtel@...nd.com>
To: William Dauchy <w.dauchy@...teo.com>, netdev@...r.kernel.org
Subject: Re: [PATCH v4 net] net, ip6_tunnel: enhance tunnel locate with link
check
Le 13/02/2020 à 16:35, William Dauchy a écrit :
[snip]
> @@ -1420,9 +1441,11 @@ ip6_tnl_start_xmit(struct sk_buff *skb, struct net_device *dev)
> static void ip6_tnl_link_config(struct ip6_tnl *t)
> {
> struct net_device *dev = t->dev;
> + struct net_device *tdev = NULL;
> struct __ip6_tnl_parm *p = &t->parms;
> struct flowi6 *fl6 = &t->fl.u.ip6;
> int t_hlen;
> + int mtu;
>
> memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr));
> memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr));
> @@ -1457,22 +1480,24 @@ static void ip6_tnl_link_config(struct ip6_tnl *t)
> struct rt6_info *rt = rt6_lookup(t->net,
> &p->raddr, &p->laddr,
> p->link, NULL, strict);
> + if (!IS_ERR(rt)) {
Why IS_ERR()? rt6_lookup() returns a valid pointer or NULL.
> + tdev = rt->dst.dev;
> + ip6_rt_put(rt);
> + } else if (t->parms.link) {
> + tdev = __dev_get_by_index(t->net, t->parms.link);
p->link to be consistent with the rest of the function.
> + }
>
> - if (!rt)
> - return;
> -
> - if (rt->dst.dev) {
But rt->dst.dev can be NULL.
> - dev->hard_header_len = rt->dst.dev->hard_header_len +
> - t_hlen;
> + if (tdev) {
> + dev->hard_header_len = tdev->hard_header_len + t_hlen;
> + mtu = min(tdev->mtu, IP_MAX_MTU);
IP6_MAX_MTU?
>
> - dev->mtu = rt->dst.dev->mtu - t_hlen;
> + dev->mtu = mtu - t_hlen;
> if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT))
> dev->mtu -= 8;
>
> if (dev->mtu < IPV6_MIN_MTU)
> dev->mtu = IPV6_MIN_MTU;
> }
> - ip6_rt_put(rt);
> }
> }
>
>
Powered by blists - more mailing lists