All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hangbin Liu <hangbin.liu@linux.dev>
To: Justin Iurman <justin.iurman@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	andrea.mayer@uniroma2.it
Subject: Re: [PATCH net 1/2] ioam6: drop the packet if no outer source address is available
Date: Mon, 16 Nov 2026 13:47:09 +0800	[thread overview]
Message-ID: <avqYw4zlIvpnKMNo@fedora> (raw)
In-Reply-To: <20261115000047.14669-2-justin.iurman@gmail.com>

On Sun, Nov 15, 2026 at 01:00:46AM +0100, Justin Iurman wrote:
> When no tunnel source is configured, ioam6_do_encap() ignores the
> return value of ipv6_dev_get_saddr(). On failure, the outer header
> keeps the source address copied from the inner header, so the packet
> is sent with an address that may not belong to this node.
> 
> Drop the packet instead.
> 
> Fixes: 8cb3bf8bff3c ("ipv6: ioam: Add support for the ip6ip6 encapsulation")
> Signed-off-by: Justin Iurman <justin.iurman@gmail.com>
> ---
>  net/ipv6/ioam6_iptunnel.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/net/ipv6/ioam6_iptunnel.c b/net/ipv6/ioam6_iptunnel.c
> index cfb2c41634a0..4990ae1ee78c 100644
> --- a/net/ipv6/ioam6_iptunnel.c
> +++ b/net/ipv6/ioam6_iptunnel.c
> @@ -324,11 +324,14 @@ static int ioam6_do_encap(struct net *net, struct sk_buff *skb,
>  	hdr->payload_len = cpu_to_be16(skb->len - sizeof(*hdr));
>  	hdr->daddr = *tundst;
>  
> -	if (has_tunsrc)
> +	if (has_tunsrc) {
>  		memcpy(&hdr->saddr, tunsrc, sizeof(*tunsrc));
> -	else
> -		ipv6_dev_get_saddr(net, dst_dev(dst), &hdr->daddr,
> -				   IPV6_PREFER_SRC_PUBLIC, &hdr->saddr);
> +	} else {
> +		err = ipv6_dev_get_saddr(net, dst_dev(dst), &hdr->daddr,
> +					 IPV6_PREFER_SRC_PUBLIC, &hdr->saddr);
> +		if (unlikely(err))
> +			return err;
> +	}
>  
>  	skb_postpush_rcsum(skb, hdr, len);
>  
> -- 
> 2.34.1
> 

Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>

  reply	other threads:[~2026-11-16  5:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-15  0:00 [PATCH net 0/2] ipv6: drop encapsulated packets when no source address is available Justin Iurman
2026-11-15  0:00 ` [PATCH net 1/2] ioam6: drop the packet if no outer " Justin Iurman
2026-11-16  5:47   ` Hangbin Liu [this message]
2026-11-15  0:00 ` [PATCH net 2/2] seg6: " Justin Iurman
2026-11-16  3:41   ` netdev-bot+sashiko
2026-11-18  2:12   ` Andrea Mayer
2026-11-15 20:08 ` [PATCH net 0/2] ipv6: drop encapsulated packets when no " netdev-bot+sinfo
2026-11-15 23:44   ` Justin Iurman

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=avqYw4zlIvpnKMNo@fedora \
    --to=hangbin.liu@linux.dev \
    --cc=andrea.mayer@uniroma2.it \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=justin.iurman@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.