diff options
| author | Geliang Tang <[email protected]> | 2025-02-07 13:59:33 +0000 |
|---|---|---|
| committer | Paolo Abeni <[email protected]> | 2025-02-11 11:46:38 +0000 |
| commit | c7f25f7987c060b43b926c7c03c8ef8f0054a182 (patch) | |
| tree | f65a533f26cc71d8842d45729d23d286a56d53e4 /net/mptcp/pm.c | |
| parent | mptcp: pm: change rem type of set_flags (diff) | |
| download | kernel-c7f25f7987c060b43b926c7c03c8ef8f0054a182.tar.gz kernel-c7f25f7987c060b43b926c7c03c8ef8f0054a182.zip | |
mptcp: pm: add local parameter for set_flags
This patch updates the interfaces set_flags to reduce repetitive
code, adds a new parameter 'local' for them.
The local address is parsed in public helper mptcp_pm_nl_set_flags_doit(),
then pass it to mptcp_pm_nl_set_flags() and mptcp_userspace_pm_set_flags().
Signed-off-by: Geliang Tang <[email protected]>
Reviewed-by: Matthieu Baerts (NGI0) <[email protected]>
Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>
Diffstat (limited to 'net/mptcp/pm.c')
| -rw-r--r-- | net/mptcp/pm.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index c213f06bc702..b1f36dc1a091 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -506,9 +506,21 @@ int mptcp_pm_nl_get_addr_dumpit(struct sk_buff *msg, static int mptcp_pm_set_flags(struct genl_info *info) { + struct mptcp_pm_addr_entry loc = { .addr = { .family = AF_UNSPEC }, }; + struct nlattr *attr_loc; + int ret = -EINVAL; + + if (GENL_REQ_ATTR_CHECK(info, MPTCP_PM_ATTR_ADDR)) + return ret; + + attr_loc = info->attrs[MPTCP_PM_ATTR_ADDR]; + ret = mptcp_pm_parse_entry(attr_loc, info, false, &loc); + if (ret < 0) + return ret; + if (info->attrs[MPTCP_PM_ATTR_TOKEN]) - return mptcp_userspace_pm_set_flags(info); - return mptcp_pm_nl_set_flags(info); + return mptcp_userspace_pm_set_flags(&loc, info); + return mptcp_pm_nl_set_flags(&loc, info); } int mptcp_pm_nl_set_flags_doit(struct sk_buff *skb, struct genl_info *info) |
