netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Jianguo Wu <wujianguo106@163.com>
Cc: netdev <netdev@vger.kernel.org>,
	"edumazet@google.com >> Eric Dumazet" <edumazet@google.com>,
	davem@davemloft.net, daniel@iogearbox.net,
	Florian Westphal <fw@strlen.de>
Subject: Re: [PATCH net-next] ipvlan: Make skb->skb_iif track skb->dev for l3s mode
Date: Thu, 9 Mar 2023 12:10:26 +0100	[thread overview]
Message-ID: <ZAm+ovPoEFfESOQI@nanopsycho> (raw)
In-Reply-To: <29865b1f-6db7-c07a-de89-949d3721ea30@163.com>

Thu, Mar 09, 2023 at 03:03:36AM CET, wujianguo106@163.com wrote:
>From: Jianguo Wu <wujianguo@chinatelecom.cn>
>
>For l3s mode, skb->dev is set to ipvlan interface in ipvlan_nf_input():
>  skb->dev = addr->master->dev
>but, skb->skb_iif remain unchanged, this will cause socket lookup failed
>if a target socket is bound to a interface, like the following example:
>
>  ip link add ipvlan0 link eth0 type ipvlan mode l3s
>  ip addr add dev ipvlan0 192.168.124.111/24
>  ip link set ipvlan0 up
>
>  ping -c 1 -I ipvlan0 8.8.8.8
>  100% packet loss
>
>This is because there is no match sk in __raw_v4_lookup() as sk->sk_bound_dev_if != dif(skb->skb_iif).
>Fix this by make skb->skb_iif track skb->dev in ipvlan_nf_input().
>
>Fixes: c675e06a98a4 ("ipvlan: decouple l3s mode dependencies from other modes").
>
>Signed-off-by: Jianguo Wu <wujianguo@chinatelecom.cn>
>---
> drivers/net/ipvlan/ipvlan_l3s.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/drivers/net/ipvlan/ipvlan_l3s.c b/drivers/net/ipvlan/ipvlan_l3s.c
>index 943d26cbf39f..71712ea25403 100644
>--- a/drivers/net/ipvlan/ipvlan_l3s.c
>+++ b/drivers/net/ipvlan/ipvlan_l3s.c
>@@ -101,6 +101,7 @@ static unsigned int ipvlan_nf_input(void *priv, struct sk_buff *skb,
> 		goto out;
>
> 	skb->dev = addr->master->dev;
>+	skb->skb_iif = skb->dev->ifindex;

I think we should have a macro to replace skb->dev which would handle
this too. It's on multiple places.

Anyway, this patch looks fine to me.

Reviewed-by: Jiri Pirko <jiri@nvidia.com>



> 	len = skb->len + ETH_HLEN;
> 	ipvlan_count_rx(addr->master, len, true, false);
> out:
>-- 
>1.8.3.1
>

  reply	other threads:[~2023-03-09 11:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09  2:03 [PATCH net-next] ipvlan: Make skb->skb_iif track skb->dev for l3s mode Jianguo Wu
2023-03-09 11:10 ` Jiri Pirko [this message]
2023-03-11  5:30 ` patchwork-bot+netdevbpf

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=ZAm+ovPoEFfESOQI@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=netdev@vger.kernel.org \
    --cc=wujianguo106@163.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;
as well as URLs for NNTP newsgroup(s).