From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: Justin Iurman <justin.iurman@6wind.com>,
Andrea Mayer <andrea.mayer@uniroma2.it>
Cc: netdev@vger.kernel.org, davem@davemloft.net, dsahern@kernel.org,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org, justin.iurman@gmail.com,
stefano.salsano@uniroma2.it
Subject: Re: [PATCH net-next v2] seg6: add per-route tunnel source address
Date: Fri, 13 Mar 2026 10:47:07 +0100 [thread overview]
Message-ID: <43e16e45-5fb1-4413-bbd1-4752bbcdec7d@6wind.com> (raw)
In-Reply-To: <CAOY2Bqz8_8iT2Auw=sWob0-XUQg-sPmdAFvzRLg+KszrU6LMqA@mail.gmail.com>
Le 13/03/2026 à 09:44, Justin Iurman a écrit :
> On Fri, Mar 13, 2026 at 2:02 AM Andrea Mayer <andrea.mayer@uniroma2.it> wrote:
>>
>> On Wed, 11 Mar 2026 16:28:45 +0100
>> Justin Iurman <justin.iurman@6wind.com> wrote:
[snip]
>>> @@ -702,13 +721,21 @@ static int seg6_build_state(struct net *net, struct nlattr *nla,
>>> slwt = seg6_lwt_lwtunnel(newts);
>>>
>>> err = dst_cache_init(&slwt->cache, GFP_ATOMIC);
>>> - if (err) {
>>> - kfree(newts);
>>> - return err;
>>> - }
>>> + if (err)
>>> + goto free_lwt_state;
>>>
>>> memcpy(&slwt->tuninfo, tuninfo, tuninfo_len);
>>>
>>> + if (tb[SEG6_IPTUNNEL_SRC]) {
>>> + slwt->tunsrc = nla_get_in6_addr(tb[SEG6_IPTUNNEL_SRC]);
>>> +
>>> + if (ipv6_addr_any(&slwt->tunsrc)) {
>>> + err = -EINVAL;
>>> + NL_SET_ERR_MSG(extack, "tunsrc cannot be ::");
>>> + goto free_dst_cache;
>>> + }
>>> + }
>>> +
>>
>> build_state() only rejects ::. Multicast or loopback will be silently
>> accepted, leading to an asymmetric black hole:
>>
>> - seg6_input() path: encapsulated packet enters ip6_forward()
>> which has the "security critical" saddr check; drop on the same
>> node, packet never leaves;
>> - seg6_output() path: goes through ip6_output() which has no saddr
>> check; packet leaves, first transit drops it in ip6_rcv_core()
>> or ip6_forward().
>>
>> Either way, silent black hole.
>>
>> I think we could reject these at build_state time, matching a similar
>> logic already present in ip6_forward(), e.g.:
>>
>> if (ipv6_addr_any(&slwt->tunsrc) ||
>> ipv6_addr_is_multicast(&slwt->tunsrc) ||
>> ipv6_addr_loopback(&slwt->tunsrc)) {
>> NL_SET_ERR_MSG(extack, "invalid tunsrc address");
>> err = -EINVAL;
>> goto free_dst_cache;
>> }
>
> +1, makes sense.
>
>> Whether to also reject link-local is debatable: ip6_forward() does
>> drop it, but is there a legitimate use case where a link-local tunnel
>> source would actually be needed?!
>> I'd argue we should reject link-local addresses as well.
>> For instance, using them as a tunnel source violates scope boundaries and
>> breaks ICMPv6 error reporting.
>
> IMHO, I also think we could reasonably forbid LLs.Why rejecting LL? It's legal to use LL as a source address of a tunnel (and
forwarding packets in this tunnel). Is this forbidden with srv6?
next prev parent reply other threads:[~2026-03-13 9:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-11 15:28 [PATCH net-next v2] seg6: add per-route tunnel source address Justin Iurman
2026-03-13 2:02 ` Andrea Mayer
2026-03-13 8:44 ` Justin Iurman
2026-03-13 9:47 ` Nicolas Dichtel [this message]
2026-03-13 10:20 ` Justin Iurman
2026-03-13 10:59 ` Nicolas Dichtel
2026-03-13 14:06 ` Justin Iurman
2026-03-14 1:09 ` Andrea Mayer
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=43e16e45-5fb1-4413-bbd1-4752bbcdec7d@6wind.com \
--to=nicolas.dichtel@6wind.com \
--cc=andrea.mayer@uniroma2.it \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=justin.iurman@6wind.com \
--cc=justin.iurman@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stefano.salsano@uniroma2.it \
/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