From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>
Cc: Kuniyuki Iwashima <kuniyu@amazon.com>,
Kuniyuki Iwashima <kuni1840@gmail.com>, <netdev@vger.kernel.org>
Subject: [PATCH v1 net-next 2/6] fib: rules: Pass net to fib_nl2rule() instead of skb.
Date: Thu, 6 Feb 2025 17:46:25 +0900 [thread overview]
Message-ID: <20250206084629.16602-3-kuniyu@amazon.com> (raw)
In-Reply-To: <20250206084629.16602-1-kuniyu@amazon.com>
skb is not used in fib_nl2rule() other than sock_net(skb->sk),
which is already available in callers, fib_nl_newrule() and
fib_nl_delrule().
Let's pass net directly to fib_nl2rule().
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
net/core/fib_rules.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 02dfb841ab29..87f731199538 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -512,14 +512,13 @@ static int fib_nl2rule_l3mdev(struct nlattr *nla, struct fib_rule *nlrule,
}
#endif
-static int fib_nl2rule(struct sk_buff *skb, struct nlmsghdr *nlh,
+static int fib_nl2rule(struct net *net, struct nlmsghdr *nlh,
struct netlink_ext_ack *extack,
struct fib_rules_ops *ops,
struct nlattr *tb[],
struct fib_rule **rule,
bool *user_priority)
{
- struct net *net = sock_net(skb->sk);
struct fib_rule_hdr *frh = nlmsg_data(nlh);
struct fib_rule *nlrule = NULL;
int err = -EINVAL;
@@ -798,7 +797,7 @@ int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh,
goto errout;
}
- err = fib_nl2rule(skb, nlh, extack, ops, tb, &rule, &user_priority);
+ err = fib_nl2rule(net, nlh, extack, ops, tb, &rule, &user_priority);
if (err)
goto errout;
@@ -906,7 +905,7 @@ int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr *nlh,
goto errout;
}
- err = fib_nl2rule(skb, nlh, extack, ops, tb, &nlrule, &user_priority);
+ err = fib_nl2rule(net, nlh, extack, ops, tb, &nlrule, &user_priority);
if (err)
goto errout;
--
2.39.5 (Apple Git-154)
next prev parent reply other threads:[~2025-02-06 8:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-06 8:46 [PATCH v1 net-next 0/6] fib: rules: Convert RTM_NEWRULE and RTM_DELRULE to per-netns RTNL Kuniyuki Iwashima
2025-02-06 8:46 ` [PATCH v1 net-next 1/6] fib: rules: Don't check net in rule_exists() and rule_find() Kuniyuki Iwashima
2025-02-06 8:46 ` Kuniyuki Iwashima [this message]
2025-02-06 8:46 ` [PATCH v1 net-next 3/6] fib: rules: Split fib_nl2rule() Kuniyuki Iwashima
2025-02-06 8:46 ` [PATCH v1 net-next 4/6] fib: rules: Convert RTM_NEWRULE to per-netns RTNL Kuniyuki Iwashima
2025-02-06 8:46 ` [PATCH v1 net-next 5/6] fib: rules: Add error_free label in fib_nl_delrule() Kuniyuki Iwashima
2025-02-06 8:46 ` [PATCH v1 net-next 6/6] fib: rules: Convert RTM_DELRULE to per-netns RTNL Kuniyuki Iwashima
2025-02-06 9:41 ` Eric Dumazet
2025-02-06 9:52 ` Kuniyuki Iwashima
2025-02-06 11:22 ` Ido Schimmel
2025-02-07 4:12 ` Kuniyuki Iwashima
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=20250206084629.16602-3-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.com \
--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 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).