From: David Ahern <dsahern@gmail.com>
To: Stephen Suryaputra <ssuryaextr@gmail.com>,
netdev@vger.kernel.org, Ido Schimmel <idosch@mellanox.com>
Cc: dsahern@gmail.com
Subject: Re: [PATCH net] ipv6: When forwarding count rx stats on the orig netdev
Date: Thu, 14 Oct 2021 20:15:34 -0600 [thread overview]
Message-ID: <1a83de45-936e-483c-0176-c877d8548d70@gmail.com> (raw)
In-Reply-To: <20211014130845.410602-1-ssuryaextr@gmail.com>
[ added Ido for the forwarding tests ]
On 10/14/21 7:08 AM, Stephen Suryaputra wrote:
> Commit bdb7cc643fc9 ("ipv6: Count interface receive statistics on the
> ingress netdev") does not work when ip6_forward() executes on the skbs
> with vrf-enslaved netdev. Use IP6CB(skb)->iif to get to the right one.
>
> Add a selftest script to verify.
>
> Fixes: bdb7cc643fc9 ("ipv6: Count interface receive statistics on the ingress netdev")
> Signed-off-by: Stephen Suryaputra <ssuryaextr@gmail.com>
> ---
> net/ipv6/ip6_output.c | 3 +-
> .../testing/selftests/net/forwarding/Makefile | 1 +
> .../net/forwarding/forwarding.config.sample | 2 +
> .../net/forwarding/ip6_forward_instats_vrf.sh | 172 ++++++++++++++++++
> tools/testing/selftests/net/forwarding/lib.sh | 8 +
> 5 files changed, 185 insertions(+), 1 deletion(-)
> create mode 100755 tools/testing/selftests/net/forwarding/ip6_forward_instats_vrf.sh
>
> diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
> index 12f985f43bcc..2f044a49afa8 100644
> --- a/net/ipv6/ip6_output.c
> +++ b/net/ipv6/ip6_output.c
> @@ -464,13 +464,14 @@ static bool ip6_pkt_too_big(const struct sk_buff *skb, unsigned int mtu)
>
> int ip6_forward(struct sk_buff *skb)
> {
> - struct inet6_dev *idev = __in6_dev_get_safely(skb->dev);
> struct dst_entry *dst = skb_dst(skb);
> struct ipv6hdr *hdr = ipv6_hdr(skb);
> struct inet6_skb_parm *opt = IP6CB(skb);
> struct net *net = dev_net(dst->dev);
> + struct inet6_dev *idev;
> u32 mtu;
>
> + idev = __in6_dev_get_safely(dev_get_by_index_rcu(net, IP6CB(skb)->iif));
> if (net->ipv6.devconf_all->forwarding == 0)
> goto error;
>
This seems fine to me, but IPv4 and IPv6 should work the same.
next prev parent reply other threads:[~2021-10-15 2:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-14 13:08 [PATCH net] ipv6: When forwarding count rx stats on the orig netdev Stephen Suryaputra
2021-10-15 2:15 ` David Ahern [this message]
2021-10-15 2:22 ` Stephen Suryaputra
2021-10-15 2:27 ` David Ahern
2021-10-15 20:01 ` Jakub Kicinski
2021-10-15 21:28 ` David Ahern
2021-10-15 23:29 ` Jakub Kicinski
2021-10-18 13:24 ` Stephen Suryaputra
2021-10-18 14:00 ` Jakub Kicinski
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=1a83de45-936e-483c-0176-c877d8548d70@gmail.com \
--to=dsahern@gmail.com \
--cc=idosch@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=ssuryaextr@gmail.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).