Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
mptcp:netlink: fix sf creation without SADDR attr
Browse files Browse the repository at this point in the history
If MPTCP_ATTR_SADDR[46] was not set, in any case we were returning with
an error. A condition/goto was missing.

Fixes: 4ea5dee (mptcp: new netlink-based path manager)
Github-Fixes: #338 (netlink path manager: always fail when no source address specified)
Reported-by: Matthieu Coudron <[email protected]>
Signed-off-by: Matthieu Baerts <[email protected]>
Signed-off-by: Christoph Paasch <[email protected]>
(cherry picked from commit 74eff65)
Signed-off-by: Christoph Paasch <[email protected]>
  • Loading branch information
matttbe authored and cpaasch committed Jun 3, 2019
1 parent ea0df99 commit 1c6f694
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions net/mptcp/mptcp_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -870,17 +870,22 @@ mptcp_nl_genl_create(struct sk_buff *skb, struct genl_info *info)
}

if (!info->attrs[MPTCP_ATTR_SADDR4]) {
bool found = false;

mptcp_for_each_bit_set(priv->loc4_bits, i) {
if (priv->locaddr4[i].loc4_id == loc_id) {
loc.addr = priv->locaddr4[i].addr;
loc.low_prio =
priv->locaddr4[i].low_prio;
loc.if_idx =
priv->locaddr4[i].if_idx;
found = true;
break;
}
}
goto create_failed;

if (!found)
goto create_failed;
} else {
loc.addr.s_addr =
nla_get_u32(info->attrs[MPTCP_ATTR_SADDR4]);
Expand Down Expand Up @@ -914,17 +919,23 @@ mptcp_nl_genl_create(struct sk_buff *skb, struct genl_info *info)
}

if (!info->attrs[MPTCP_ATTR_SADDR6]) {
bool found = false;

mptcp_for_each_bit_set(priv->loc6_bits, i) {
if (priv->locaddr6[i].loc6_id == loc_id) {
loc.addr = priv->locaddr6[i].addr;
loc.low_prio =
priv->locaddr6[i].low_prio;
loc.if_idx =
priv->locaddr6[i].if_idx;

found = true;
break;
}
}
goto create_failed;

if (!found)
goto create_failed;
} else {
loc.addr = *(struct in6_addr *)
nla_data(info->attrs[MPTCP_ATTR_SADDR6]);
Expand Down

0 comments on commit 1c6f694

Please sign in to comment.