Skip to content

Commit 5e45296

Browse files
matttbeintel-lab-lkp
authored andcommitted
mptcp: pm: userspace: flags: clearer msg if no remote addr
Since its introduction in commit 892f396 ("mptcp: netlink: issue MP_PRIO signals from userspace PMs"), it was mandatory to specify the remote address, because of the 'if (rem->addr.family == AF_UNSPEC)' check done later one. In theory, this attribute can be optional, but it sounds better to be precise to avoid sending the MP_PRIO on the wrong subflow, e.g. if there are multiple subflows attached to the same local ID. This can be relaxed later on if there is a need to act on multiple subflows with one command. For the moment, the check to see if attr_rem is NULL can be removed, because mptcp_pm_parse_entry() will do this check as well, no need to do that differently here. While at it, move the parsing after the check linked to the local attribute. Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
1 parent 49101ac commit 5e45296

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

net/mptcp/pm_userspace.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -601,19 +601,17 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info)
601601
if (ret < 0)
602602
goto set_flags_err;
603603

604-
if (attr_rem) {
605-
ret = mptcp_pm_parse_entry(attr_rem, info, false, &rem);
606-
if (ret < 0)
607-
goto set_flags_err;
608-
}
609-
610604
if (loc.addr.family == AF_UNSPEC) {
611605
NL_SET_ERR_MSG_ATTR(info->extack, attr,
612606
"invalid local address family");
613607
ret = -EINVAL;
614608
goto set_flags_err;
615609
}
616610

611+
ret = mptcp_pm_parse_entry(attr_rem, info, false, &rem);
612+
if (ret < 0)
613+
goto set_flags_err;
614+
617615
if (rem.addr.family == AF_UNSPEC) {
618616
NL_SET_ERR_MSG_ATTR(info->extack, attr_rem,
619617
"invalid remote address family");

0 commit comments

Comments
 (0)