From: Paolo Abeni <pabeni@redhat.com>
To: Menglong Dong <menglong8.dong@gmail.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
dsahern@kernel.org, pablo@netfilter.org, kadlec@netfilter.org,
roopa@nvidia.com, razor@blackwall.org, gnault@redhat.com,
bigeasy@linutronix.de, idosch@nvidia.com, ast@kernel.org,
dongml2@chinatelecom.cn, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org,
coreteam@netfilter.org, bridge@lists.linux.dev,
bpf@vger.kernel.org
Subject: Re: [PATCH net-next v3 02/10] net: ip: make fib_validate_source() return drop reason
Date: Mon, 21 Oct 2024 12:20:32 +0200 [thread overview]
Message-ID: <71a20e24-10e8-42a8-8509-7e704aff9c5c@redhat.com> (raw)
In-Reply-To: <20241015140800.159466-3-dongml2@chinatelecom.cn>
On 10/15/24 16:07, Menglong Dong wrote:
> diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
> index 90ff815f212b..b3f7a1562140 100644
> --- a/include/net/ip_fib.h
> +++ b/include/net/ip_fib.h
> @@ -452,13 +452,16 @@ int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
> dscp_t dscp, int oif, struct net_device *dev,
> struct in_device *idev, u32 *itag);
>
> -static inline int
> +static inline enum skb_drop_reason
> fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
> dscp_t dscp, int oif, struct net_device *dev,
> struct in_device *idev, u32 *itag)
> {
> - return __fib_validate_source(skb, src, dst, dscp, oif, dev, idev,
> - itag);
> + int err = __fib_validate_source(skb, src, dst, dscp, oif, dev, idev,
> + itag);
> + if (err < 0)
> + return -err;
> + return SKB_NOT_DROPPED_YET;
> }
It looks like the code churn in patch 1 is not needed??? You could just
define here a fib_validate_source_reason() helper doing the above, and
replace fib_validate_source with the the new helper as needed. Would
that work?
> @@ -1785,9 +1785,10 @@ static int __mkroute_input(struct sk_buff *skb, const struct fib_result *res,
> return -EINVAL;
> }
>
> - err = fib_validate_source(skb, saddr, daddr, dscp, FIB_RES_OIF(*res),
> - in_dev->dev, in_dev, &itag);
> + err = __fib_validate_source(skb, saddr, daddr, dscp, FIB_RES_OIF(*res),
> + in_dev->dev, in_dev, &itag);
> if (err < 0) {
> + err = -EINVAL;
> ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr,
> saddr);
I'm sorry for not noticing this issue before, but must preserve (at
least) the -EXDEV error code from the unpatched version or RP Filter MIB
accounting in ip_rcv_finish_core() will be fooled.
Thanks,
Paolo
next prev parent reply other threads:[~2024-10-21 10:20 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-15 14:07 [PATCH net-next v3 00/10] net: ip: add drop reasons to input route Menglong Dong
2024-10-15 14:07 ` [PATCH net-next v3 01/10] net: ip: refactor fib_validate_source/__fib_validate_source Menglong Dong
2024-10-21 10:03 ` Paolo Abeni
2024-10-15 14:07 ` [PATCH net-next v3 02/10] net: ip: make fib_validate_source() return drop reason Menglong Dong
2024-10-21 10:20 ` Paolo Abeni [this message]
2024-10-21 10:36 ` Paolo Abeni
2024-10-22 8:47 ` Menglong Dong
2024-10-15 14:07 ` [PATCH net-next v3 03/10] net: ip: make ip_route_input_mc() " Menglong Dong
2024-10-15 14:07 ` [PATCH net-next v3 04/10] net: ip: make ip_mc_validate_source() " Menglong Dong
2024-10-15 14:07 ` [PATCH net-next v3 05/10] net: ip: make ip_route_input_slow() return drop reasons Menglong Dong
2024-10-21 10:52 ` Paolo Abeni
2024-10-22 8:50 ` Menglong Dong
2024-10-15 14:07 ` [PATCH net-next v3 06/10] net: ip: make ip_route_input_rcu() " Menglong Dong
2024-10-15 14:07 ` [PATCH net-next v3 07/10] net: ip: make ip_route_input_noref() " Menglong Dong
2024-10-21 10:44 ` Paolo Abeni
2024-10-21 10:49 ` Paolo Abeni
2024-10-22 8:49 ` Menglong Dong
2024-10-15 14:07 ` [PATCH net-next v3 08/10] net: ip: make ip_route_input() " Menglong Dong
2024-10-15 14:07 ` [PATCH net-next v3 09/10] net: ip: make ip_mkroute_input/__mkroute_input " Menglong Dong
2024-10-15 14:08 ` [PATCH net-next v3 10/10] net: ip: make ip_route_use_hint() " Menglong Dong
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=71a20e24-10e8-42a8-8509-7e704aff9c5c@redhat.com \
--to=pabeni@redhat.com \
--cc=ast@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=bpf@vger.kernel.org \
--cc=bridge@lists.linux.dev \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=dongml2@chinatelecom.cn \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=gnault@redhat.com \
--cc=idosch@nvidia.com \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=menglong8.dong@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=razor@blackwall.org \
--cc=roopa@nvidia.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®