From: Gabriel Goller <g.goller@proxmox.com>
To: Ido Schimmel <idosch@nvidia.com>
Cc: David Ahern <dsahern@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Roopa Prabhu <roopa@cumulusnetworks.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] ipv4: fib: treat an unbuildable encapsulation as a nexthop mismatch
Date: Mon, 21 Sep 2026 13:09:44 +0200 [thread overview]
Message-ID: <arEQHeBlqKWCu3l5@luna.proxmox.com> (raw)
In-Reply-To: <20260920090818.GA1846216@shredder>
On 20.09.2026 12:08, Ido Schimmel wrote:
> On Fri, Sep 18, 2026 at 05:28:33PM +0200, Gabriel Goller wrote:
> > fib_encap_match() builds the requested lwtunnel state and compares it
> > against the nexthop of a candidate route. When lwtunnel_build_state()
> > failed it left result at 0, which is interpreted as "the nexthop
> > matches", so fib_nh_match() continues to compare only oif and gateway.
> >
> > So if there comes along a RTM_DELROUTE which carries an encapsulation
> > the kernel rejects, it could delete a different route with a different
> > encapsulation.
>
> Did you hit this in practice? Can you share details?
Nope, found this in the code while writing
https://lore.kernel.org/netdev/arD-5t6LiBiPXAAa@luna.proxmox.com/
> Note that the modern alternative is to install nexthop objects with
> encapsulation and then associate these objects with routes.
Yep.
> > Fixes: 571e722676fe ("ipv4: support for fib route lwtunnel encap attributes")
> > Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> > ---
> > net/ipv4/fib_semantics.c | 14 +++++++-------
> > 1 file changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
> > index 50e96f86ca59..951e48ae87da 100644
> > --- a/net/ipv4/fib_semantics.c
> > +++ b/net/ipv4/fib_semantics.c
> > @@ -911,17 +911,17 @@ static int fib_encap_match(struct net *net, u16 encap_type,
> > struct netlink_ext_ack *extack)
> > {
> > struct lwtunnel_state *lwtstate;
> > - int ret, result = 0;
> > + int result;
> >
> > if (encap_type == LWTUNNEL_ENCAP_NONE)
> > return 0;
>
> This is also "unbuildable", but will match.
>
> lwtunnel_build_state() returns an error in this case, so you can just
> remove this check.
Makes sense, will send a v2 soon.
Thanks for the review!
Gabriel
> > - ret = lwtunnel_build_state(net, encap_type, encap, AF_INET,
> > - cfg, &lwtstate, extack);
> > - if (!ret) {
> > - result = lwtunnel_cmp_encap(lwtstate, nh->fib_nh_lws);
> > - lwtstate_free(lwtstate);
> > - }
> > + if (lwtunnel_build_state(net, encap_type, encap, AF_INET, cfg,
> > + &lwtstate, extack))
> > + return 1;
> > +
> > + result = lwtunnel_cmp_encap(lwtstate, nh->fib_nh_lws);
> > + lwtstate_free(lwtstate);
> >
> > return result;
> > }
next prev parent reply other threads:[~2026-09-21 11:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 15:28 Gabriel Goller
2026-09-20 9:08 ` Ido Schimmel
2026-09-21 11:09 ` Gabriel Goller [this message]
2026-09-22 16:09 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=arEQHeBlqKWCu3l5@luna.proxmox.com \
--to=g.goller@proxmox.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=roopa@cumulusnetworks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®