Commit 1232e93b authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'mptcp-mib-counters-for-mpj-tx-misc-improvements'

Matthieu Baerts says:

====================
mptcp: MIB counters for MPJ TX + misc improvements

Recently, a few issues have been discovered around the creation of
additional subflows. Without these counters, it was difficult to point
out the reason why some subflows were not created as expected.

In patch 3, all error paths from __mptcp_subflow_connect() are covered,
except the one related to the 'fully established mode', because it can
only happen with the userspace PM, which will propagate the error to the
userspace in this case (ENOTCONN).

These new counters are also verified in the MPTCP Join selftest in patch
6.

While at it, a few other patches are improving the MPTCP path-manager
code ...

 - Patch 1: 'flush' related helpers are renamed to avoid confusions
 - Patch 2: directly pass known ID and flags to create a new subflow,
            i/o getting them later by iterating over all endpoints again

... and the MPJoin selftests:

 - Patch 4: reduce the number of positional parameters
 - Patch 5: only one line for the 'join' checks, instead of 3
 - Patch 7: more explicit check names, instead of sometimes too cryptic
            ones: rtx, ptx, ftx, ctx, fclzrx, sum
 - Patch 8: specify client/server instead of 'invert' for some checks
            not suggesting one specific direction
 - Patch 9: mute errors of mptcp_connect when ran in the background
 - Patch 10: simplify checksum_tests by using a for-loop
 - Patch 11: remove 'define' re-definitions
====================

Link: https://patch.msgid.link/20240902-net-next-mptcp-mib-mpjtx-misc-v1-0-d3e0f3773b90@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 8ecf2afb 38dc0708
...@@ -25,6 +25,10 @@ static const struct snmp_mib mptcp_snmp_list[] = { ...@@ -25,6 +25,10 @@ static const struct snmp_mib mptcp_snmp_list[] = {
SNMP_MIB_ITEM("MPJoinSynAckHMacFailure", MPTCP_MIB_JOINSYNACKMAC), SNMP_MIB_ITEM("MPJoinSynAckHMacFailure", MPTCP_MIB_JOINSYNACKMAC),
SNMP_MIB_ITEM("MPJoinAckRx", MPTCP_MIB_JOINACKRX), SNMP_MIB_ITEM("MPJoinAckRx", MPTCP_MIB_JOINACKRX),
SNMP_MIB_ITEM("MPJoinAckHMacFailure", MPTCP_MIB_JOINACKMAC), SNMP_MIB_ITEM("MPJoinAckHMacFailure", MPTCP_MIB_JOINACKMAC),
SNMP_MIB_ITEM("MPJoinSynTx", MPTCP_MIB_JOINSYNTX),
SNMP_MIB_ITEM("MPJoinSynTxCreatSkErr", MPTCP_MIB_JOINSYNTXCREATSKERR),
SNMP_MIB_ITEM("MPJoinSynTxBindErr", MPTCP_MIB_JOINSYNTXBINDERR),
SNMP_MIB_ITEM("MPJoinSynTxConnectErr", MPTCP_MIB_JOINSYNTXCONNECTERR),
SNMP_MIB_ITEM("DSSNotMatching", MPTCP_MIB_DSSNOMATCH), SNMP_MIB_ITEM("DSSNotMatching", MPTCP_MIB_DSSNOMATCH),
SNMP_MIB_ITEM("InfiniteMapTx", MPTCP_MIB_INFINITEMAPTX), SNMP_MIB_ITEM("InfiniteMapTx", MPTCP_MIB_INFINITEMAPTX),
SNMP_MIB_ITEM("InfiniteMapRx", MPTCP_MIB_INFINITEMAPRX), SNMP_MIB_ITEM("InfiniteMapRx", MPTCP_MIB_INFINITEMAPRX),
......
...@@ -20,6 +20,10 @@ enum linux_mptcp_mib_field { ...@@ -20,6 +20,10 @@ enum linux_mptcp_mib_field {
MPTCP_MIB_JOINSYNACKMAC, /* HMAC was wrong on SYN/ACK + MP_JOIN */ MPTCP_MIB_JOINSYNACKMAC, /* HMAC was wrong on SYN/ACK + MP_JOIN */
MPTCP_MIB_JOINACKRX, /* Received an ACK + MP_JOIN */ MPTCP_MIB_JOINACKRX, /* Received an ACK + MP_JOIN */
MPTCP_MIB_JOINACKMAC, /* HMAC was wrong on ACK + MP_JOIN */ MPTCP_MIB_JOINACKMAC, /* HMAC was wrong on ACK + MP_JOIN */
MPTCP_MIB_JOINSYNTX, /* Sending a SYN + MP_JOIN */
MPTCP_MIB_JOINSYNTXCREATSKERR, /* Not able to create a socket when sending a SYN + MP_JOIN */
MPTCP_MIB_JOINSYNTXBINDERR, /* Not able to bind() the address when sending a SYN + MP_JOIN */
MPTCP_MIB_JOINSYNTXCONNECTERR, /* Not able to connect() when sending a SYN + MP_JOIN */
MPTCP_MIB_DSSNOMATCH, /* Received a new mapping that did not match the previous one */ MPTCP_MIB_DSSNOMATCH, /* Received a new mapping that did not match the previous one */
MPTCP_MIB_INFINITEMAPTX, /* Sent an infinite mapping */ MPTCP_MIB_INFINITEMAPTX, /* Sent an infinite mapping */
MPTCP_MIB_INFINITEMAPRX, /* Received an infinite mapping */ MPTCP_MIB_INFINITEMAPRX, /* Received an infinite mapping */
......
...@@ -430,17 +430,6 @@ bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc) ...@@ -430,17 +430,6 @@ bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc)
return mptcp_pm_nl_is_backup(msk, &skc_local); return mptcp_pm_nl_is_backup(msk, &skc_local);
} }
int mptcp_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, unsigned int id,
u8 *flags, int *ifindex)
{
*flags = 0;
*ifindex = 0;
if (mptcp_pm_is_userspace(msk))
return mptcp_userspace_pm_get_flags_and_ifindex_by_id(msk, id, flags, ifindex);
return mptcp_pm_nl_get_flags_and_ifindex_by_id(msk, id, flags, ifindex);
}
int mptcp_pm_get_addr(struct sk_buff *skb, struct genl_info *info) int mptcp_pm_get_addr(struct sk_buff *skb, struct genl_info *info)
{ {
if (info->attrs[MPTCP_PM_ATTR_TOKEN]) if (info->attrs[MPTCP_PM_ATTR_TOKEN])
......
...@@ -149,7 +149,7 @@ static bool lookup_subflow_by_daddr(const struct list_head *list, ...@@ -149,7 +149,7 @@ static bool lookup_subflow_by_daddr(const struct list_head *list,
static bool static bool
select_local_address(const struct pm_nl_pernet *pernet, select_local_address(const struct pm_nl_pernet *pernet,
const struct mptcp_sock *msk, const struct mptcp_sock *msk,
struct mptcp_pm_addr_entry *new_entry) struct mptcp_pm_local *new_local)
{ {
struct mptcp_pm_addr_entry *entry; struct mptcp_pm_addr_entry *entry;
bool found = false; bool found = false;
...@@ -164,7 +164,9 @@ select_local_address(const struct pm_nl_pernet *pernet, ...@@ -164,7 +164,9 @@ select_local_address(const struct pm_nl_pernet *pernet,
if (!test_bit(entry->addr.id, msk->pm.id_avail_bitmap)) if (!test_bit(entry->addr.id, msk->pm.id_avail_bitmap))
continue; continue;
*new_entry = *entry; new_local->addr = entry->addr;
new_local->flags = entry->flags;
new_local->ifindex = entry->ifindex;
found = true; found = true;
break; break;
} }
...@@ -175,7 +177,7 @@ select_local_address(const struct pm_nl_pernet *pernet, ...@@ -175,7 +177,7 @@ select_local_address(const struct pm_nl_pernet *pernet,
static bool static bool
select_signal_address(struct pm_nl_pernet *pernet, const struct mptcp_sock *msk, select_signal_address(struct pm_nl_pernet *pernet, const struct mptcp_sock *msk,
struct mptcp_pm_addr_entry *new_entry) struct mptcp_pm_local *new_local)
{ {
struct mptcp_pm_addr_entry *entry; struct mptcp_pm_addr_entry *entry;
bool found = false; bool found = false;
...@@ -193,7 +195,9 @@ select_signal_address(struct pm_nl_pernet *pernet, const struct mptcp_sock *msk, ...@@ -193,7 +195,9 @@ select_signal_address(struct pm_nl_pernet *pernet, const struct mptcp_sock *msk,
if (!(entry->flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) if (!(entry->flags & MPTCP_PM_ADDR_FLAG_SIGNAL))
continue; continue;
*new_entry = *entry; new_local->addr = entry->addr;
new_local->flags = entry->flags;
new_local->ifindex = entry->ifindex;
found = true; found = true;
break; break;
} }
...@@ -524,11 +528,11 @@ __lookup_addr(struct pm_nl_pernet *pernet, const struct mptcp_addr_info *info) ...@@ -524,11 +528,11 @@ __lookup_addr(struct pm_nl_pernet *pernet, const struct mptcp_addr_info *info)
static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
{ {
struct sock *sk = (struct sock *)msk; struct sock *sk = (struct sock *)msk;
struct mptcp_pm_addr_entry local;
unsigned int add_addr_signal_max; unsigned int add_addr_signal_max;
bool signal_and_subflow = false; bool signal_and_subflow = false;
unsigned int local_addr_max; unsigned int local_addr_max;
struct pm_nl_pernet *pernet; struct pm_nl_pernet *pernet;
struct mptcp_pm_local local;
unsigned int subflows_max; unsigned int subflows_max;
pernet = pm_nl_get_pernet(sock_net(sk)); pernet = pm_nl_get_pernet(sock_net(sk));
...@@ -629,7 +633,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) ...@@ -629,7 +633,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
spin_unlock_bh(&msk->pm.lock); spin_unlock_bh(&msk->pm.lock);
for (i = 0; i < nr; i++) for (i = 0; i < nr; i++)
__mptcp_subflow_connect(sk, &local.addr, &addrs[i]); __mptcp_subflow_connect(sk, &local, &addrs[i]);
spin_lock_bh(&msk->pm.lock); spin_lock_bh(&msk->pm.lock);
} }
mptcp_pm_nl_check_work_pending(msk); mptcp_pm_nl_check_work_pending(msk);
...@@ -650,7 +654,7 @@ static void mptcp_pm_nl_subflow_established(struct mptcp_sock *msk) ...@@ -650,7 +654,7 @@ static void mptcp_pm_nl_subflow_established(struct mptcp_sock *msk)
*/ */
static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk, static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk,
struct mptcp_addr_info *remote, struct mptcp_addr_info *remote,
struct mptcp_addr_info *addrs) struct mptcp_pm_local *locals)
{ {
struct sock *sk = (struct sock *)msk; struct sock *sk = (struct sock *)msk;
struct mptcp_pm_addr_entry *entry; struct mptcp_pm_addr_entry *entry;
...@@ -673,13 +677,15 @@ static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk, ...@@ -673,13 +677,15 @@ static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk,
continue; continue;
if (msk->pm.subflows < subflows_max) { if (msk->pm.subflows < subflows_max) {
msk->pm.subflows++; locals[i].addr = entry->addr;
addrs[i] = entry->addr; locals[i].flags = entry->flags;
locals[i].ifindex = entry->ifindex;
/* Special case for ID0: set the correct ID */ /* Special case for ID0: set the correct ID */
if (mptcp_addresses_equal(&entry->addr, &mpc_addr, entry->addr.port)) if (mptcp_addresses_equal(&locals[i].addr, &mpc_addr, locals[i].addr.port))
addrs[i].id = 0; locals[i].addr.id = 0;
msk->pm.subflows++;
i++; i++;
} }
} }
...@@ -689,21 +695,19 @@ static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk, ...@@ -689,21 +695,19 @@ static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk,
* 'IPADDRANY' local address * 'IPADDRANY' local address
*/ */
if (!i) { if (!i) {
struct mptcp_addr_info local; memset(&locals[i], 0, sizeof(locals[i]));
locals[i].addr.family =
memset(&local, 0, sizeof(local));
local.family =
#if IS_ENABLED(CONFIG_MPTCP_IPV6) #if IS_ENABLED(CONFIG_MPTCP_IPV6)
remote->family == AF_INET6 && remote->family == AF_INET6 &&
ipv6_addr_v4mapped(&remote->addr6) ? AF_INET : ipv6_addr_v4mapped(&remote->addr6) ? AF_INET :
#endif #endif
remote->family; remote->family;
if (!mptcp_pm_addr_families_match(sk, &local, remote)) if (!mptcp_pm_addr_families_match(sk, &locals[i].addr, remote))
return 0; return 0;
msk->pm.subflows++; msk->pm.subflows++;
addrs[i++] = local; i++;
} }
return i; return i;
...@@ -711,7 +715,7 @@ static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk, ...@@ -711,7 +715,7 @@ static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk,
static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
{ {
struct mptcp_addr_info addrs[MPTCP_PM_ADDR_MAX]; struct mptcp_pm_local locals[MPTCP_PM_ADDR_MAX];
struct sock *sk = (struct sock *)msk; struct sock *sk = (struct sock *)msk;
unsigned int add_addr_accept_max; unsigned int add_addr_accept_max;
struct mptcp_addr_info remote; struct mptcp_addr_info remote;
...@@ -740,13 +744,13 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) ...@@ -740,13 +744,13 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
/* connect to the specified remote address, using whatever /* connect to the specified remote address, using whatever
* local address the routing configuration will pick. * local address the routing configuration will pick.
*/ */
nr = fill_local_addresses_vec(msk, &remote, addrs); nr = fill_local_addresses_vec(msk, &remote, locals);
if (nr == 0) if (nr == 0)
return; return;
spin_unlock_bh(&msk->pm.lock); spin_unlock_bh(&msk->pm.lock);
for (i = 0; i < nr; i++) for (i = 0; i < nr; i++)
if (__mptcp_subflow_connect(sk, &addrs[i], &remote) == 0) if (__mptcp_subflow_connect(sk, &locals[i], &remote) == 0)
sf_created = true; sf_created = true;
spin_lock_bh(&msk->pm.lock); spin_lock_bh(&msk->pm.lock);
...@@ -1433,28 +1437,6 @@ int mptcp_pm_nl_add_addr_doit(struct sk_buff *skb, struct genl_info *info) ...@@ -1433,28 +1437,6 @@ int mptcp_pm_nl_add_addr_doit(struct sk_buff *skb, struct genl_info *info)
return ret; return ret;
} }
int mptcp_pm_nl_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, unsigned int id,
u8 *flags, int *ifindex)
{
struct mptcp_pm_addr_entry *entry;
struct sock *sk = (struct sock *)msk;
struct net *net = sock_net(sk);
/* No entries with ID 0 */
if (id == 0)
return 0;
rcu_read_lock();
entry = __lookup_addr_by_id(pm_nl_get_pernet(net), id);
if (entry) {
*flags = entry->flags;
*ifindex = entry->ifindex;
}
rcu_read_unlock();
return 0;
}
static bool remove_anno_list_by_saddr(struct mptcp_sock *msk, static bool remove_anno_list_by_saddr(struct mptcp_sock *msk,
const struct mptcp_addr_info *addr) const struct mptcp_addr_info *addr)
{ {
...@@ -1672,7 +1654,7 @@ void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list) ...@@ -1672,7 +1654,7 @@ void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list)
} }
/* Called from the in-kernel PM only */ /* Called from the in-kernel PM only */
static void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk, static void mptcp_pm_flush_addrs_and_subflows(struct mptcp_sock *msk,
struct list_head *rm_list) struct list_head *rm_list)
{ {
struct mptcp_rm_list alist = { .nr = 0 }, slist = { .nr = 0 }; struct mptcp_rm_list alist = { .nr = 0 }, slist = { .nr = 0 };
...@@ -1701,7 +1683,7 @@ static void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk, ...@@ -1701,7 +1683,7 @@ static void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk,
spin_unlock_bh(&msk->pm.lock); spin_unlock_bh(&msk->pm.lock);
} }
static void mptcp_nl_remove_addrs_list(struct net *net, static void mptcp_nl_flush_addrs_list(struct net *net,
struct list_head *rm_list) struct list_head *rm_list)
{ {
long s_slot = 0, s_num = 0; long s_slot = 0, s_num = 0;
...@@ -1715,7 +1697,7 @@ static void mptcp_nl_remove_addrs_list(struct net *net, ...@@ -1715,7 +1697,7 @@ static void mptcp_nl_remove_addrs_list(struct net *net,
if (!mptcp_pm_is_userspace(msk)) { if (!mptcp_pm_is_userspace(msk)) {
lock_sock(sk); lock_sock(sk);
mptcp_pm_remove_addrs_and_subflows(msk, rm_list); mptcp_pm_flush_addrs_and_subflows(msk, rm_list);
release_sock(sk); release_sock(sk);
} }
...@@ -1756,7 +1738,7 @@ int mptcp_pm_nl_flush_addrs_doit(struct sk_buff *skb, struct genl_info *info) ...@@ -1756,7 +1738,7 @@ int mptcp_pm_nl_flush_addrs_doit(struct sk_buff *skb, struct genl_info *info)
pernet->next_id = 1; pernet->next_id = 1;
bitmap_zero(pernet->id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); bitmap_zero(pernet->id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1);
spin_unlock_bh(&pernet->lock); spin_unlock_bh(&pernet->lock);
mptcp_nl_remove_addrs_list(sock_net(skb->sk), &free_list); mptcp_nl_flush_addrs_list(sock_net(skb->sk), &free_list);
synchronize_rcu(); synchronize_rcu();
__flush_addrs(&free_list); __flush_addrs(&free_list);
return 0; return 0;
......
...@@ -119,23 +119,6 @@ mptcp_userspace_pm_lookup_addr_by_id(struct mptcp_sock *msk, unsigned int id) ...@@ -119,23 +119,6 @@ mptcp_userspace_pm_lookup_addr_by_id(struct mptcp_sock *msk, unsigned int id)
return NULL; return NULL;
} }
int mptcp_userspace_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk,
unsigned int id,
u8 *flags, int *ifindex)
{
struct mptcp_pm_addr_entry *match;
spin_lock_bh(&msk->pm.lock);
match = mptcp_userspace_pm_lookup_addr_by_id(msk, id);
spin_unlock_bh(&msk->pm.lock);
if (match) {
*flags = match->flags;
*ifindex = match->ifindex;
}
return 0;
}
int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk,
struct mptcp_addr_info *skc) struct mptcp_addr_info *skc)
{ {
...@@ -352,8 +335,9 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) ...@@ -352,8 +335,9 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info)
struct nlattr *raddr = info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE]; struct nlattr *raddr = info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE];
struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN]; struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN];
struct nlattr *laddr = info->attrs[MPTCP_PM_ATTR_ADDR]; struct nlattr *laddr = info->attrs[MPTCP_PM_ATTR_ADDR];
struct mptcp_pm_addr_entry local = { 0 }; struct mptcp_pm_addr_entry entry = { 0 };
struct mptcp_addr_info addr_r; struct mptcp_addr_info addr_r;
struct mptcp_pm_local local;
struct mptcp_sock *msk; struct mptcp_sock *msk;
int err = -EINVAL; int err = -EINVAL;
struct sock *sk; struct sock *sk;
...@@ -379,18 +363,18 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) ...@@ -379,18 +363,18 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info)
goto create_err; goto create_err;
} }
err = mptcp_pm_parse_entry(laddr, info, true, &local); err = mptcp_pm_parse_entry(laddr, info, true, &entry);
if (err < 0) { if (err < 0) {
NL_SET_ERR_MSG_ATTR(info->extack, laddr, "error parsing local addr"); NL_SET_ERR_MSG_ATTR(info->extack, laddr, "error parsing local addr");
goto create_err; goto create_err;
} }
if (local.flags & MPTCP_PM_ADDR_FLAG_SIGNAL) { if (entry.flags & MPTCP_PM_ADDR_FLAG_SIGNAL) {
GENL_SET_ERR_MSG(info, "invalid addr flags"); GENL_SET_ERR_MSG(info, "invalid addr flags");
err = -EINVAL; err = -EINVAL;
goto create_err; goto create_err;
} }
local.flags |= MPTCP_PM_ADDR_FLAG_SUBFLOW; entry.flags |= MPTCP_PM_ADDR_FLAG_SUBFLOW;
err = mptcp_pm_parse_addr(raddr, info, &addr_r); err = mptcp_pm_parse_addr(raddr, info, &addr_r);
if (err < 0) { if (err < 0) {
...@@ -398,27 +382,29 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) ...@@ -398,27 +382,29 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info)
goto create_err; goto create_err;
} }
if (!mptcp_pm_addr_families_match(sk, &local.addr, &addr_r)) { if (!mptcp_pm_addr_families_match(sk, &entry.addr, &addr_r)) {
GENL_SET_ERR_MSG(info, "families mismatch"); GENL_SET_ERR_MSG(info, "families mismatch");
err = -EINVAL; err = -EINVAL;
goto create_err; goto create_err;
} }
err = mptcp_userspace_pm_append_new_local_addr(msk, &local, false); err = mptcp_userspace_pm_append_new_local_addr(msk, &entry, false);
if (err < 0) { if (err < 0) {
GENL_SET_ERR_MSG(info, "did not match address and id"); GENL_SET_ERR_MSG(info, "did not match address and id");
goto create_err; goto create_err;
} }
lock_sock(sk); local.addr = entry.addr;
local.flags = entry.flags;
err = __mptcp_subflow_connect(sk, &local.addr, &addr_r); local.ifindex = entry.ifindex;
lock_sock(sk);
err = __mptcp_subflow_connect(sk, &local, &addr_r);
release_sock(sk); release_sock(sk);
spin_lock_bh(&msk->pm.lock); spin_lock_bh(&msk->pm.lock);
if (err) if (err)
mptcp_userspace_pm_delete_local_addr(msk, &local); mptcp_userspace_pm_delete_local_addr(msk, &entry);
else else
msk->pm.subflows++; msk->pm.subflows++;
spin_unlock_bh(&msk->pm.lock); spin_unlock_bh(&msk->pm.lock);
......
...@@ -236,6 +236,12 @@ struct mptcp_pm_data { ...@@ -236,6 +236,12 @@ struct mptcp_pm_data {
struct mptcp_rm_list rm_list_rx; struct mptcp_rm_list rm_list_rx;
}; };
struct mptcp_pm_local {
struct mptcp_addr_info addr;
u8 flags;
int ifindex;
};
struct mptcp_pm_addr_entry { struct mptcp_pm_addr_entry {
struct list_head list; struct list_head list;
struct mptcp_addr_info addr; struct mptcp_addr_info addr;
...@@ -719,7 +725,7 @@ bool mptcp_addresses_equal(const struct mptcp_addr_info *a, ...@@ -719,7 +725,7 @@ bool mptcp_addresses_equal(const struct mptcp_addr_info *a,
void mptcp_local_address(const struct sock_common *skc, struct mptcp_addr_info *addr); void mptcp_local_address(const struct sock_common *skc, struct mptcp_addr_info *addr);
/* called with sk socket lock held */ /* called with sk socket lock held */
int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_pm_local *local,
const struct mptcp_addr_info *remote); const struct mptcp_addr_info *remote);
int mptcp_subflow_create_socket(struct sock *sk, unsigned short family, int mptcp_subflow_create_socket(struct sock *sk, unsigned short family,
struct socket **new_sock); struct socket **new_sock);
...@@ -1014,14 +1020,6 @@ mptcp_pm_del_add_timer(struct mptcp_sock *msk, ...@@ -1014,14 +1020,6 @@ mptcp_pm_del_add_timer(struct mptcp_sock *msk,
struct mptcp_pm_add_entry * struct mptcp_pm_add_entry *
mptcp_lookup_anno_list_by_saddr(const struct mptcp_sock *msk, mptcp_lookup_anno_list_by_saddr(const struct mptcp_sock *msk,
const struct mptcp_addr_info *addr); const struct mptcp_addr_info *addr);
int mptcp_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk,
unsigned int id,
u8 *flags, int *ifindex);
int mptcp_pm_nl_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, unsigned int id,
u8 *flags, int *ifindex);
int mptcp_userspace_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk,
unsigned int id,
u8 *flags, int *ifindex);
int mptcp_pm_set_flags(struct sk_buff *skb, struct genl_info *info); int mptcp_pm_set_flags(struct sk_buff *skb, struct genl_info *info);
int mptcp_pm_nl_set_flags(struct sk_buff *skb, struct genl_info *info); int mptcp_pm_nl_set_flags(struct sk_buff *skb, struct genl_info *info);
int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info); int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info);
......
...@@ -1565,28 +1565,31 @@ void mptcp_info2sockaddr(const struct mptcp_addr_info *info, ...@@ -1565,28 +1565,31 @@ void mptcp_info2sockaddr(const struct mptcp_addr_info *info,
#endif #endif
} }
int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_pm_local *local,
const struct mptcp_addr_info *remote) const struct mptcp_addr_info *remote)
{ {
struct mptcp_sock *msk = mptcp_sk(sk); struct mptcp_sock *msk = mptcp_sk(sk);
struct mptcp_subflow_context *subflow; struct mptcp_subflow_context *subflow;
int local_id = local->addr.id;
struct sockaddr_storage addr; struct sockaddr_storage addr;
int remote_id = remote->id; int remote_id = remote->id;
int local_id = loc->id;
int err = -ENOTCONN; int err = -ENOTCONN;
struct socket *sf; struct socket *sf;
struct sock *ssk; struct sock *ssk;
u32 remote_token; u32 remote_token;
int addrlen; int addrlen;
int ifindex;
u8 flags;
/* The userspace PM sent the request too early? */
if (!mptcp_is_fully_established(sk)) if (!mptcp_is_fully_established(sk))
goto err_out; goto err_out;
err = mptcp_subflow_create_socket(sk, loc->family, &sf); err = mptcp_subflow_create_socket(sk, local->addr.family, &sf);
if (err) if (err) {
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXCREATSKERR);
pr_debug("msk=%p local=%d remote=%d create sock error: %d\n",
msk, local_id, remote_id, err);
goto err_out; goto err_out;
}
ssk = sf->sk; ssk = sf->sk;
subflow = mptcp_subflow_ctx(ssk); subflow = mptcp_subflow_ctx(ssk);
...@@ -1594,26 +1597,39 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, ...@@ -1594,26 +1597,39 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
get_random_bytes(&subflow->local_nonce, sizeof(u32)); get_random_bytes(&subflow->local_nonce, sizeof(u32));
} while (!subflow->local_nonce); } while (!subflow->local_nonce);
if (local_id) /* if 'IPADDRANY', the ID will be set later, after the routing */
if (local->addr.family == AF_INET) {
if (!local->addr.addr.s_addr)
local_id = -1;
#if IS_ENABLED(CONFIG_MPTCP_IPV6)
} else if (sk->sk_family == AF_INET6) {
if (ipv6_addr_any(&local->addr.addr6))
local_id = -1;
#endif
}
if (local_id >= 0)
subflow_set_local_id(subflow, local_id); subflow_set_local_id(subflow, local_id);
mptcp_pm_get_flags_and_ifindex_by_id(msk, local_id,
&flags, &ifindex);
subflow->remote_key_valid = 1; subflow->remote_key_valid = 1;
subflow->remote_key = READ_ONCE(msk->remote_key); subflow->remote_key = READ_ONCE(msk->remote_key);
subflow->local_key = READ_ONCE(msk->local_key); subflow->local_key = READ_ONCE(msk->local_key);
subflow->token = msk->token; subflow->token = msk->token;
mptcp_info2sockaddr(loc, &addr, ssk->sk_family); mptcp_info2sockaddr(&local->addr, &addr, ssk->sk_family);
addrlen = sizeof(struct sockaddr_in); addrlen = sizeof(struct sockaddr_in);
#if IS_ENABLED(CONFIG_MPTCP_IPV6) #if IS_ENABLED(CONFIG_MPTCP_IPV6)
if (addr.ss_family == AF_INET6) if (addr.ss_family == AF_INET6)
addrlen = sizeof(struct sockaddr_in6); addrlen = sizeof(struct sockaddr_in6);
#endif #endif
ssk->sk_bound_dev_if = ifindex; ssk->sk_bound_dev_if = local->ifindex;
err = kernel_bind(sf, (struct sockaddr *)&addr, addrlen); err = kernel_bind(sf, (struct sockaddr *)&addr, addrlen);
if (err) if (err) {
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXBINDERR);
pr_debug("msk=%p local=%d remote=%d bind error: %d\n",
msk, local_id, remote_id, err);
goto failed; goto failed;
}
mptcp_crypto_key_sha(subflow->remote_key, &remote_token, NULL); mptcp_crypto_key_sha(subflow->remote_key, &remote_token, NULL);
pr_debug("msk=%p remote_token=%u local_id=%d remote_id=%d\n", msk, pr_debug("msk=%p remote_token=%u local_id=%d remote_id=%d\n", msk,
...@@ -1621,15 +1637,21 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, ...@@ -1621,15 +1637,21 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
subflow->remote_token = remote_token; subflow->remote_token = remote_token;
WRITE_ONCE(subflow->remote_id, remote_id); WRITE_ONCE(subflow->remote_id, remote_id);
subflow->request_join = 1; subflow->request_join = 1;
subflow->request_bkup = !!(flags & MPTCP_PM_ADDR_FLAG_BACKUP); subflow->request_bkup = !!(local->flags & MPTCP_PM_ADDR_FLAG_BACKUP);
subflow->subflow_id = msk->subflow_id++; subflow->subflow_id = msk->subflow_id++;
mptcp_info2sockaddr(remote, &addr, ssk->sk_family); mptcp_info2sockaddr(remote, &addr, ssk->sk_family);
sock_hold(ssk); sock_hold(ssk);
list_add_tail(&subflow->node, &msk->conn_list); list_add_tail(&subflow->node, &msk->conn_list);
err = kernel_connect(sf, (struct sockaddr *)&addr, addrlen, O_NONBLOCK); err = kernel_connect(sf, (struct sockaddr *)&addr, addrlen, O_NONBLOCK);
if (err && err != -EINPROGRESS) if (err && err != -EINPROGRESS) {
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXCONNECTERR);
pr_debug("msk=%p local=%d remote=%d connect error: %d\n",
msk, local_id, remote_id, err);
goto failed_unlink; goto failed_unlink;
}
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTX);
/* discard the subflow socket */ /* discard the subflow socket */
mptcp_sock_graft(ssk, sk->sk_socket); mptcp_sock_graft(ssk, sk->sk_socket);
......
...@@ -61,6 +61,16 @@ unset sflags ...@@ -61,6 +61,16 @@ unset sflags
unset fastclose unset fastclose
unset fullmesh unset fullmesh
unset speed unset speed
unset join_csum_ns1
unset join_csum_ns2
unset join_fail_nr
unset join_rst_nr
unset join_infi_nr
unset join_corrupted_pkts
unset join_syn_tx
unset join_create_err
unset join_bind_err
unset join_connect_err
# generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) == 0x30) || # generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) == 0x30) ||
# (ip6 && (ip6[74] & 0xf0) == 0x30)'" # (ip6 && (ip6[74] & 0xf0) == 0x30)'"
...@@ -196,6 +206,22 @@ print_skip() ...@@ -196,6 +206,22 @@ print_skip()
mptcp_lib_pr_skip "${@}" mptcp_lib_pr_skip "${@}"
} }
# $1: check name; $2: rc
print_results()
{
local check="${1}"
local rc=${2}
print_check "${check}"
if [ ${rc} = ${KSFT_PASS} ]; then
print_ok
elif [ ${rc} = ${KSFT_SKIP} ]; then
print_skip
else
fail_test "see above"
fi
}
# [ $1: fail msg ] # [ $1: fail msg ]
mark_as_skipped() mark_as_skipped()
{ {
...@@ -337,7 +363,7 @@ reset_with_checksum() ...@@ -337,7 +363,7 @@ reset_with_checksum()
local ns1_enable=$1 local ns1_enable=$1
local ns2_enable=$2 local ns2_enable=$2
reset "checksum test ${1} ${2}" || return 1 reset "checksum test ${ns1_enable} ${ns2_enable}" || return 1
ip netns exec $ns1 sysctl -q net.mptcp.checksum_enabled=$ns1_enable ip netns exec $ns1 sysctl -q net.mptcp.checksum_enabled=$ns1_enable
ip netns exec $ns2 sysctl -q net.mptcp.checksum_enabled=$ns2_enable ip netns exec $ns2 sysctl -q net.mptcp.checksum_enabled=$ns2_enable
...@@ -839,7 +865,7 @@ chk_cestab_nr() ...@@ -839,7 +865,7 @@ chk_cestab_nr()
local cestab=$2 local cestab=$2
local count local count
print_check "cestab $cestab" print_check "currently established: $cestab"
count=$(mptcp_lib_get_counter ${ns} "MPTcpExtMPCurrEstab") count=$(mptcp_lib_get_counter ${ns} "MPTcpExtMPCurrEstab")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1115,7 +1141,7 @@ chk_csum_nr() ...@@ -1115,7 +1141,7 @@ chk_csum_nr()
csum_ns2=${csum_ns2:1} csum_ns2=${csum_ns2:1}
fi fi
print_check "sum" print_check "checksum server"
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtDataCsumErr") count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtDataCsumErr")
if [ -n "$count" ] && [ "$count" != "$csum_ns1" ]; then if [ -n "$count" ] && [ "$count" != "$csum_ns1" ]; then
extra_msg+=" ns1=$count" extra_msg+=" ns1=$count"
...@@ -1128,7 +1154,8 @@ chk_csum_nr() ...@@ -1128,7 +1154,8 @@ chk_csum_nr()
else else
print_ok print_ok
fi fi
print_check "csum"
print_check "checksum client"
count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtDataCsumErr") count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtDataCsumErr")
if [ -n "$count" ] && [ "$count" != "$csum_ns2" ]; then if [ -n "$count" ] && [ "$count" != "$csum_ns2" ]; then
extra_msg+=" ns2=$count" extra_msg+=" ns2=$count"
...@@ -1153,6 +1180,8 @@ chk_fail_nr() ...@@ -1153,6 +1180,8 @@ chk_fail_nr()
local count local count
local ns_tx=$ns1 local ns_tx=$ns1
local ns_rx=$ns2 local ns_rx=$ns2
local tx="server"
local rx="client"
local extra_msg="" local extra_msg=""
local allow_tx_lost=0 local allow_tx_lost=0
local allow_rx_lost=0 local allow_rx_lost=0
...@@ -1160,7 +1189,8 @@ chk_fail_nr() ...@@ -1160,7 +1189,8 @@ chk_fail_nr()
if [[ $ns_invert = "invert" ]]; then if [[ $ns_invert = "invert" ]]; then
ns_tx=$ns2 ns_tx=$ns2
ns_rx=$ns1 ns_rx=$ns1
extra_msg="invert" tx="client"
rx="server"
fi fi
if [[ "${fail_tx}" = "-"* ]]; then if [[ "${fail_tx}" = "-"* ]]; then
...@@ -1172,10 +1202,10 @@ chk_fail_nr() ...@@ -1172,10 +1202,10 @@ chk_fail_nr()
fail_rx=${fail_rx:1} fail_rx=${fail_rx:1}
fi fi
print_check "ftx" print_check "fail tx ${tx}"
count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPFailTx") count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPFailTx")
if [ -n "$count" ] && [ "$count" != "$fail_tx" ]; then if [ -n "$count" ] && [ "$count" != "$fail_tx" ]; then
extra_msg+=",tx=$count" extra_msg+=" tx=$count"
fi fi
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1186,10 +1216,10 @@ chk_fail_nr() ...@@ -1186,10 +1216,10 @@ chk_fail_nr()
print_ok print_ok
fi fi
print_check "failrx" print_check "fail rx ${rx}"
count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPFailRx") count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPFailRx")
if [ -n "$count" ] && [ "$count" != "$fail_rx" ]; then if [ -n "$count" ] && [ "$count" != "$fail_rx" ]; then
extra_msg+=",rx=$count" extra_msg+=" rx=$count"
fi fi
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1211,37 +1241,35 @@ chk_fclose_nr() ...@@ -1211,37 +1241,35 @@ chk_fclose_nr()
local count local count
local ns_tx=$ns2 local ns_tx=$ns2
local ns_rx=$ns1 local ns_rx=$ns1
local extra_msg="" local tx="client"
local rx="server"
if [[ $ns_invert = "invert" ]]; then if [[ $ns_invert = "invert" ]]; then
ns_tx=$ns1 ns_tx=$ns1
ns_rx=$ns2 ns_rx=$ns2
extra_msg="invert" tx="server"
rx="client"
fi fi
print_check "ctx" print_check "fast close tx ${tx}"
count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPFastcloseTx") count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPFastcloseTx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
elif [ "$count" != "$fclose_tx" ]; then elif [ "$count" != "$fclose_tx" ]; then
extra_msg+=",tx=$count"
fail_test "got $count MP_FASTCLOSE[s] TX expected $fclose_tx" fail_test "got $count MP_FASTCLOSE[s] TX expected $fclose_tx"
else else
print_ok print_ok
fi fi
print_check "fclzrx" print_check "fast close rx ${rx}"
count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPFastcloseRx") count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPFastcloseRx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
elif [ "$count" != "$fclose_rx" ]; then elif [ "$count" != "$fclose_rx" ]; then
extra_msg+=",rx=$count"
fail_test "got $count MP_FASTCLOSE[s] RX expected $fclose_rx" fail_test "got $count MP_FASTCLOSE[s] RX expected $fclose_rx"
else else
print_ok print_ok
fi fi
print_info "$extra_msg"
} }
chk_rst_nr() chk_rst_nr()
...@@ -1252,15 +1280,17 @@ chk_rst_nr() ...@@ -1252,15 +1280,17 @@ chk_rst_nr()
local count local count
local ns_tx=$ns1 local ns_tx=$ns1
local ns_rx=$ns2 local ns_rx=$ns2
local extra_msg="" local tx="server"
local rx="client"
if [[ $ns_invert = "invert" ]]; then if [[ $ns_invert = "invert" ]]; then
ns_tx=$ns2 ns_tx=$ns2
ns_rx=$ns1 ns_rx=$ns1
extra_msg="invert" tx="client"
rx="server"
fi fi
print_check "rtx" print_check "reset tx ${tx}"
count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPRstTx") count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPRstTx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1272,7 +1302,7 @@ chk_rst_nr() ...@@ -1272,7 +1302,7 @@ chk_rst_nr()
print_ok print_ok
fi fi
print_check "rstrx" print_check "reset rx ${rx}"
count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPRstRx") count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPRstRx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1283,8 +1313,6 @@ chk_rst_nr() ...@@ -1283,8 +1313,6 @@ chk_rst_nr()
else else
print_ok print_ok
fi fi
print_info "$extra_msg"
} }
chk_infi_nr() chk_infi_nr()
...@@ -1293,7 +1321,7 @@ chk_infi_nr() ...@@ -1293,7 +1321,7 @@ chk_infi_nr()
local infi_rx=$2 local infi_rx=$2
local count local count
print_check "itx" print_check "infi tx client"
count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtInfiniteMapTx") count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtInfiniteMapTx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1303,7 +1331,7 @@ chk_infi_nr() ...@@ -1303,7 +1331,7 @@ chk_infi_nr()
print_ok print_ok
fi fi
print_check "infirx" print_check "infi rx server"
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtInfiniteMapRx") count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtInfiniteMapRx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1314,17 +1342,66 @@ chk_infi_nr() ...@@ -1314,17 +1342,66 @@ chk_infi_nr()
fi fi
} }
chk_join_tx_nr()
{
local syn_tx=${join_syn_tx:-0}
local create=${join_create_err:-0}
local bind=${join_bind_err:-0}
local connect=${join_connect_err:-0}
local rc=${KSFT_PASS}
local count
count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTx")
if [ -z "$count" ]; then
rc=${KSFT_SKIP}
elif [ "$count" != "$syn_tx" ]; then
rc=${KSFT_FAIL}
print_check "syn tx"
fail_test "got $count JOIN[s] syn tx expected $syn_tx"
fi
count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTxCreatSkErr")
if [ -z "$count" ]; then
rc=${KSFT_SKIP}
elif [ "$count" != "$create" ]; then
rc=${KSFT_FAIL}
print_check "syn tx create socket error"
fail_test "got $count JOIN[s] syn tx create socket error expected $create"
fi
count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTxBindErr")
if [ -z "$count" ]; then
rc=${KSFT_SKIP}
elif [ "$count" != "$bind" ]; then
rc=${KSFT_FAIL}
print_check "syn tx bind error"
fail_test "got $count JOIN[s] syn tx bind error expected $bind"
fi
count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTxConnectErr")
if [ -z "$count" ]; then
rc=${KSFT_SKIP}
elif [ "$count" != "$connect" ]; then
rc=${KSFT_FAIL}
print_check "syn tx connect error"
fail_test "got $count JOIN[s] syn tx connect error expected $connect"
fi
print_results "join Tx" ${rc}
}
chk_join_nr() chk_join_nr()
{ {
local syn_nr=$1 local syn_nr=$1
local syn_ack_nr=$2 local syn_ack_nr=$2
local ack_nr=$3 local ack_nr=$3
local csum_ns1=${4:-0} local csum_ns1=${join_csum_ns1:-0}
local csum_ns2=${5:-0} local csum_ns2=${join_csum_ns2:-0}
local fail_nr=${6:-0} local fail_nr=${join_fail_nr:-0}
local rst_nr=${7:-0} local rst_nr=${join_rst_nr:-0}
local infi_nr=${8:-0} local infi_nr=${join_infi_nr:-0}
local corrupted_pkts=${9:-0} local corrupted_pkts=${join_corrupted_pkts:-0}
local rc=${KSFT_PASS}
local count local count
local with_cookie local with_cookie
...@@ -1332,43 +1409,44 @@ chk_join_nr() ...@@ -1332,43 +1409,44 @@ chk_join_nr()
print_info "${corrupted_pkts} corrupted pkts" print_info "${corrupted_pkts} corrupted pkts"
fi fi
print_check "syn"
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinSynRx") count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinSynRx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip rc=${KSFT_SKIP}
elif [ "$count" != "$syn_nr" ]; then elif [ "$count" != "$syn_nr" ]; then
fail_test "got $count JOIN[s] syn expected $syn_nr" rc=${KSFT_FAIL}
else print_check "syn rx"
print_ok fail_test "got $count JOIN[s] syn rx expected $syn_nr"
fi fi
print_check "synack"
with_cookie=$(ip netns exec $ns2 sysctl -n net.ipv4.tcp_syncookies) with_cookie=$(ip netns exec $ns2 sysctl -n net.ipv4.tcp_syncookies)
count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynAckRx") count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynAckRx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip rc=${KSFT_SKIP}
elif [ "$count" != "$syn_ack_nr" ]; then elif [ "$count" != "$syn_ack_nr" ]; then
# simult connections exceeding the limit with cookie enabled could go up to # simult connections exceeding the limit with cookie enabled could go up to
# synack validation as the conn limit can be enforced reliably only after # synack validation as the conn limit can be enforced reliably only after
# the subflow creation # the subflow creation
if [ "$with_cookie" = 2 ] && [ "$count" -gt "$syn_ack_nr" ] && [ "$count" -le "$syn_nr" ]; then if [ "$with_cookie" != 2 ] || [ "$count" -le "$syn_ack_nr" ] || [ "$count" -gt "$syn_nr" ]; then
print_ok rc=${KSFT_FAIL}
else print_check "synack rx"
fail_test "got $count JOIN[s] synack expected $syn_ack_nr" fail_test "got $count JOIN[s] synack rx expected $syn_ack_nr"
fi fi
else
print_ok
fi fi
print_check "ack"
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinAckRx") count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinAckRx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip rc=${KSFT_SKIP}
elif [ "$count" != "$ack_nr" ]; then elif [ "$count" != "$ack_nr" ]; then
fail_test "got $count JOIN[s] ack expected $ack_nr" rc=${KSFT_FAIL}
else print_check "ack rx"
print_ok fail_test "got $count JOIN[s] ack rx expected $ack_nr"
fi fi
print_results "join Rx" ${rc}
join_syn_tx="${join_syn_tx:-${syn_nr}}" \
chk_join_tx_nr
if $validate_checksum; then if $validate_checksum; then
chk_csum_nr $csum_ns1 $csum_ns2 chk_csum_nr $csum_ns1 $csum_ns2
chk_fail_nr $fail_nr $fail_nr chk_fail_nr $fail_nr $fail_nr
...@@ -1429,19 +1507,21 @@ chk_add_nr() ...@@ -1429,19 +1507,21 @@ chk_add_nr()
local mis_ack_nr=0 local mis_ack_nr=0
local ns_tx=$ns1 local ns_tx=$ns1
local ns_rx=$ns2 local ns_rx=$ns2
local extra_msg="" local tx=""
local rx=""
local count local count
local timeout local timeout
if [[ $ns_invert = "invert" ]]; then if [[ $ns_invert = "invert" ]]; then
ns_tx=$ns2 ns_tx=$ns2
ns_rx=$ns1 ns_rx=$ns1
extra_msg="invert" tx=" client"
rx=" server"
fi fi
timeout=$(ip netns exec ${ns_tx} sysctl -n net.mptcp.add_addr_timeout) timeout=$(ip netns exec ${ns_tx} sysctl -n net.mptcp.add_addr_timeout)
print_check "add" print_check "add addr rx${rx}"
count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtAddAddr") count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtAddAddr")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1453,7 +1533,7 @@ chk_add_nr() ...@@ -1453,7 +1533,7 @@ chk_add_nr()
print_ok print_ok
fi fi
print_check "echo" print_check "add addr echo rx${tx}"
count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtEchoAdd") count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtEchoAdd")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1464,7 +1544,7 @@ chk_add_nr() ...@@ -1464,7 +1544,7 @@ chk_add_nr()
fi fi
if [ $port_nr -gt 0 ]; then if [ $port_nr -gt 0 ]; then
print_check "pt" print_check "add addr rx with port${rx}"
count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtPortAdd") count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtPortAdd")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1474,7 +1554,7 @@ chk_add_nr() ...@@ -1474,7 +1554,7 @@ chk_add_nr()
print_ok print_ok
fi fi
print_check "syn" print_check "syn rx port${tx}"
count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPJoinPortSynRx") count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPJoinPortSynRx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1485,7 +1565,7 @@ chk_add_nr() ...@@ -1485,7 +1565,7 @@ chk_add_nr()
print_ok print_ok
fi fi
print_check "synack" print_check "synack rx port${rx}"
count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPJoinPortSynAckRx") count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPJoinPortSynAckRx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1496,7 +1576,7 @@ chk_add_nr() ...@@ -1496,7 +1576,7 @@ chk_add_nr()
print_ok print_ok
fi fi
print_check "ack" print_check "ack rx port${tx}"
count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPJoinPortAckRx") count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPJoinPortAckRx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1507,7 +1587,7 @@ chk_add_nr() ...@@ -1507,7 +1587,7 @@ chk_add_nr()
print_ok print_ok
fi fi
print_check "syn" print_check "syn rx port mismatch${tx}"
count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMismatchPortSynRx") count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMismatchPortSynRx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1518,7 +1598,7 @@ chk_add_nr() ...@@ -1518,7 +1598,7 @@ chk_add_nr()
print_ok print_ok
fi fi
print_check "ack" print_check "ack rx port mismatch${tx}"
count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMismatchPortAckRx") count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMismatchPortAckRx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1529,8 +1609,6 @@ chk_add_nr() ...@@ -1529,8 +1609,6 @@ chk_add_nr()
print_ok print_ok
fi fi
fi fi
print_info "$extra_msg"
} }
chk_add_tx_nr() chk_add_tx_nr()
...@@ -1542,7 +1620,7 @@ chk_add_tx_nr() ...@@ -1542,7 +1620,7 @@ chk_add_tx_nr()
timeout=$(ip netns exec $ns1 sysctl -n net.mptcp.add_addr_timeout) timeout=$(ip netns exec $ns1 sysctl -n net.mptcp.add_addr_timeout)
print_check "add TX" print_check "add addr tx"
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtAddAddrTx") count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtAddAddrTx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1554,7 +1632,7 @@ chk_add_tx_nr() ...@@ -1554,7 +1632,7 @@ chk_add_tx_nr()
print_ok print_ok
fi fi
print_check "echo TX" print_check "add addr echo tx"
count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtEchoAddTx") count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtEchoAddTx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1574,6 +1652,8 @@ chk_rm_nr() ...@@ -1574,6 +1652,8 @@ chk_rm_nr()
local count local count
local addr_ns=$ns1 local addr_ns=$ns1
local subflow_ns=$ns2 local subflow_ns=$ns2
local addr="server"
local subflow="client"
local extra_msg="" local extra_msg=""
shift 2 shift 2
...@@ -1583,16 +1663,14 @@ chk_rm_nr() ...@@ -1583,16 +1663,14 @@ chk_rm_nr()
shift shift
done done
if [ -z $invert ]; then if [ "$invert" = "true" ]; then
addr_ns=$ns1
subflow_ns=$ns2
elif [ $invert = "true" ]; then
addr_ns=$ns2 addr_ns=$ns2
subflow_ns=$ns1 subflow_ns=$ns1
extra_msg="invert" addr="client"
subflow="server"
fi fi
print_check "rm" print_check "rm addr rx ${addr}"
count=$(mptcp_lib_get_counter ${addr_ns} "MPTcpExtRmAddr") count=$(mptcp_lib_get_counter ${addr_ns} "MPTcpExtRmAddr")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1602,7 +1680,7 @@ chk_rm_nr() ...@@ -1602,7 +1680,7 @@ chk_rm_nr()
print_ok print_ok
fi fi
print_check "rmsf" print_check "rm subflow ${subflow}"
count=$(mptcp_lib_get_counter ${subflow_ns} "MPTcpExtRmSubflow") count=$(mptcp_lib_get_counter ${subflow_ns} "MPTcpExtRmSubflow")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1616,7 +1694,7 @@ chk_rm_nr() ...@@ -1616,7 +1694,7 @@ chk_rm_nr()
count=$((count + cnt)) count=$((count + cnt))
if [ "$count" != "$rm_subflow_nr" ]; then if [ "$count" != "$rm_subflow_nr" ]; then
suffix="$count in [$rm_subflow_nr:$((rm_subflow_nr*2))]" suffix="$count in [$rm_subflow_nr:$((rm_subflow_nr*2))]"
extra_msg+=" simult" extra_msg="simult"
fi fi
if [ $count -ge "$rm_subflow_nr" ] && \ if [ $count -ge "$rm_subflow_nr" ] && \
[ "$count" -le "$((rm_subflow_nr *2 ))" ]; then [ "$count" -le "$((rm_subflow_nr *2 ))" ]; then
...@@ -1637,7 +1715,7 @@ chk_rm_tx_nr() ...@@ -1637,7 +1715,7 @@ chk_rm_tx_nr()
{ {
local rm_addr_tx_nr=$1 local rm_addr_tx_nr=$1
print_check "rm TX" print_check "rm addr tx client"
count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtRmAddrTx") count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtRmAddrTx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1656,7 +1734,7 @@ chk_prio_nr() ...@@ -1656,7 +1734,7 @@ chk_prio_nr()
local mpj_syn_ack=$4 local mpj_syn_ack=$4
local count local count
print_check "ptx" print_check "mp_prio tx server"
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPPrioTx") count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPPrioTx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1666,7 +1744,7 @@ chk_prio_nr() ...@@ -1666,7 +1744,7 @@ chk_prio_nr()
print_ok print_ok
fi fi
print_check "prx" print_check "mp_prio rx client"
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPPrioRx") count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPPrioRx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
...@@ -1909,8 +1987,10 @@ subflows_error_tests() ...@@ -1909,8 +1987,10 @@ subflows_error_tests()
pm_nl_set_limits $ns1 0 1 pm_nl_set_limits $ns1 0 1
pm_nl_set_limits $ns2 0 1 pm_nl_set_limits $ns2 0 1
pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow
pm_nl_add_endpoint $ns2 10.0.12.2 flags subflow
speed=slow \ speed=slow \
run_tests $ns1 $ns2 10.0.1.1 run_tests $ns1 $ns2 10.0.1.1
join_bind_err=1 \
chk_join_nr 0 0 0 chk_join_nr 0 0 0
fi fi
...@@ -1923,6 +2003,7 @@ subflows_error_tests() ...@@ -1923,6 +2003,7 @@ subflows_error_tests()
pm_nl_add_endpoint $ns2 10.0.2.2 flags subflow pm_nl_add_endpoint $ns2 10.0.2.2 flags subflow
speed=slow \ speed=slow \
run_tests $ns1 $ns2 10.0.1.1 run_tests $ns1 $ns2 10.0.1.1
join_syn_tx=2 \
chk_join_nr 1 1 1 chk_join_nr 1 1 1
fi fi
...@@ -1935,6 +2016,7 @@ subflows_error_tests() ...@@ -1935,6 +2016,7 @@ subflows_error_tests()
pm_nl_add_endpoint $ns2 10.0.2.2 flags subflow pm_nl_add_endpoint $ns2 10.0.2.2 flags subflow
speed=slow \ speed=slow \
run_tests $ns1 $ns2 10.0.1.1 run_tests $ns1 $ns2 10.0.1.1
join_syn_tx=2 \
chk_join_nr 1 1 1 chk_join_nr 1 1 1
fi fi
...@@ -1956,6 +2038,7 @@ subflows_error_tests() ...@@ -1956,6 +2038,7 @@ subflows_error_tests()
# additional subflow could be created only if the PM select # additional subflow could be created only if the PM select
# the later endpoint, skipping the already used one # the later endpoint, skipping the already used one
join_syn_tx=2 \
chk_join_nr 1 1 1 chk_join_nr 1 1 1
fi fi
} }
...@@ -2042,6 +2125,7 @@ signal_address_tests() ...@@ -2042,6 +2125,7 @@ signal_address_tests()
pm_nl_add_endpoint $ns1 10.0.14.1 flags signal pm_nl_add_endpoint $ns1 10.0.14.1 flags signal
pm_nl_set_limits $ns2 3 3 pm_nl_set_limits $ns2 3 3
run_tests $ns1 $ns2 10.0.1.1 run_tests $ns1 $ns2 10.0.1.1
join_syn_tx=3 \
chk_join_nr 1 1 1 chk_join_nr 1 1 1
chk_add_nr 3 3 chk_add_nr 3 3
fi fi
...@@ -2210,6 +2294,7 @@ add_addr_timeout_tests() ...@@ -2210,6 +2294,7 @@ add_addr_timeout_tests()
pm_nl_set_limits $ns2 2 2 pm_nl_set_limits $ns2 2 2
speed=10 \ speed=10 \
run_tests $ns1 $ns2 10.0.1.1 run_tests $ns1 $ns2 10.0.1.1
join_syn_tx=2 \
chk_join_nr 1 1 1 chk_join_nr 1 1 1
chk_add_nr 8 0 chk_add_nr 8 0
fi fi
...@@ -2310,6 +2395,7 @@ remove_tests() ...@@ -2310,6 +2395,7 @@ remove_tests()
pm_nl_set_limits $ns2 2 2 pm_nl_set_limits $ns2 2 2
addr_nr_ns1=-3 speed=10 \ addr_nr_ns1=-3 speed=10 \
run_tests $ns1 $ns2 10.0.1.1 run_tests $ns1 $ns2 10.0.1.1
join_syn_tx=2 join_connect_err=1 \
chk_join_nr 1 1 1 chk_join_nr 1 1 1
chk_add_nr 3 3 chk_add_nr 3 3
chk_rm_nr 3 1 invert chk_rm_nr 3 1 invert
...@@ -2375,6 +2461,7 @@ remove_tests() ...@@ -2375,6 +2461,7 @@ remove_tests()
pm_nl_set_limits $ns2 3 3 pm_nl_set_limits $ns2 3 3
addr_nr_ns1=-8 speed=slow \ addr_nr_ns1=-8 speed=slow \
run_tests $ns1 $ns2 10.0.1.1 run_tests $ns1 $ns2 10.0.1.1
join_syn_tx=3 \
chk_join_nr 1 1 1 chk_join_nr 1 1 1
chk_add_nr 3 3 chk_add_nr 3 3
chk_rm_nr 3 1 invert chk_rm_nr 3 1 invert
...@@ -2945,37 +3032,16 @@ syncookies_tests() ...@@ -2945,37 +3032,16 @@ syncookies_tests()
checksum_tests() checksum_tests()
{ {
# checksum test 0 0 local checksum_enable
if reset_with_checksum 0 0; then for checksum_enable in "0 0" "1 1" "0 1" "1 0"; do
pm_nl_set_limits $ns1 0 1 # checksum test 0 0, 1 1, 0 1, 1 0
pm_nl_set_limits $ns2 0 1 if reset_with_checksum ${checksum_enable}; then
run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 0 0 0
fi
# checksum test 1 1
if reset_with_checksum 1 1; then
pm_nl_set_limits $ns1 0 1
pm_nl_set_limits $ns2 0 1
run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 0 0 0
fi
# checksum test 0 1
if reset_with_checksum 0 1; then
pm_nl_set_limits $ns1 0 1
pm_nl_set_limits $ns2 0 1
run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 0 0 0
fi
# checksum test 1 0
if reset_with_checksum 1 0; then
pm_nl_set_limits $ns1 0 1 pm_nl_set_limits $ns1 0 1
pm_nl_set_limits $ns2 0 1 pm_nl_set_limits $ns2 0 1
run_tests $ns1 $ns2 10.0.1.1 run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 0 0 0 chk_join_nr 0 0 0
fi fi
done
} }
deny_join_id0_tests() deny_join_id0_tests()
...@@ -3164,7 +3230,8 @@ fastclose_tests() ...@@ -3164,7 +3230,8 @@ fastclose_tests()
MPTCP_LIB_SUBTEST_FLAKY=1 MPTCP_LIB_SUBTEST_FLAKY=1
test_linkfail=1024 fastclose=server \ test_linkfail=1024 fastclose=server \
run_tests $ns1 $ns2 10.0.1.1 run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 0 0 0 0 0 0 1 join_rst_nr=1 \
chk_join_nr 0 0 0
chk_fclose_nr 1 1 invert chk_fclose_nr 1 1 invert
chk_rst_nr 1 1 chk_rst_nr 1 1
fi fi
...@@ -3183,7 +3250,10 @@ fail_tests() ...@@ -3183,7 +3250,10 @@ fail_tests()
MPTCP_LIB_SUBTEST_FLAKY=1 MPTCP_LIB_SUBTEST_FLAKY=1
test_linkfail=128 \ test_linkfail=128 \
run_tests $ns1 $ns2 10.0.1.1 run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 0 0 0 +1 +0 1 0 1 "$(pedit_action_pkts)" join_csum_ns1=+1 join_csum_ns2=+0 \
join_fail_nr=1 join_rst_nr=0 join_infi_nr=1 \
join_corrupted_pkts="$(pedit_action_pkts)" \
chk_join_nr 0 0 0
chk_fail_nr 1 -1 invert chk_fail_nr 1 -1 invert
fi fi
...@@ -3196,7 +3266,10 @@ fail_tests() ...@@ -3196,7 +3266,10 @@ fail_tests()
pm_nl_add_endpoint $ns2 10.0.2.2 dev ns2eth2 flags subflow pm_nl_add_endpoint $ns2 10.0.2.2 dev ns2eth2 flags subflow
test_linkfail=1024 \ test_linkfail=1024 \
run_tests $ns1 $ns2 10.0.1.1 run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 1 1 1 1 0 1 1 0 "$(pedit_action_pkts)" join_csum_ns1=1 join_csum_ns2=0 \
join_fail_nr=1 join_rst_nr=1 join_infi_nr=0 \
join_corrupted_pkts="$(pedit_action_pkts)" \
chk_join_nr 1 1 1
fi fi
} }
...@@ -3448,8 +3521,8 @@ userspace_tests() ...@@ -3448,8 +3521,8 @@ userspace_tests()
continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
set_userspace_pm $ns1 set_userspace_pm $ns1
pm_nl_set_limits $ns2 2 2 pm_nl_set_limits $ns2 2 2
speed=5 \ { speed=5 \
run_tests $ns1 $ns2 10.0.1.1 & run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null
local tests_pid=$! local tests_pid=$!
wait_mpj $ns1 wait_mpj $ns1
userspace_pm_add_addr $ns1 10.0.2.1 10 userspace_pm_add_addr $ns1 10.0.2.1 10
...@@ -3481,8 +3554,8 @@ userspace_tests() ...@@ -3481,8 +3554,8 @@ userspace_tests()
continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
set_userspace_pm $ns2 set_userspace_pm $ns2
pm_nl_set_limits $ns1 0 1 pm_nl_set_limits $ns1 0 1
speed=5 \ { speed=5 \
run_tests $ns1 $ns2 10.0.1.1 & run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null
local tests_pid=$! local tests_pid=$!
wait_mpj $ns2 wait_mpj $ns2
userspace_pm_add_sf $ns2 10.0.3.2 20 userspace_pm_add_sf $ns2 10.0.3.2 20
...@@ -3509,8 +3582,8 @@ userspace_tests() ...@@ -3509,8 +3582,8 @@ userspace_tests()
continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
set_userspace_pm $ns2 set_userspace_pm $ns2
pm_nl_set_limits $ns1 0 1 pm_nl_set_limits $ns1 0 1
speed=5 \ { speed=5 \
run_tests $ns1 $ns2 10.0.1.1 & run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null
local tests_pid=$! local tests_pid=$!
wait_mpj $ns2 wait_mpj $ns2
chk_mptcp_info subflows 0 subflows 0 chk_mptcp_info subflows 0 subflows 0
...@@ -3530,8 +3603,8 @@ userspace_tests() ...@@ -3530,8 +3603,8 @@ userspace_tests()
continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
set_userspace_pm $ns2 set_userspace_pm $ns2
pm_nl_set_limits $ns1 0 1 pm_nl_set_limits $ns1 0 1
speed=5 \ { speed=5 \
run_tests $ns1 $ns2 10.0.1.1 & run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null
local tests_pid=$! local tests_pid=$!
wait_mpj $ns2 wait_mpj $ns2
userspace_pm_add_sf $ns2 10.0.3.2 20 userspace_pm_add_sf $ns2 10.0.3.2 20
...@@ -3554,8 +3627,8 @@ userspace_tests() ...@@ -3554,8 +3627,8 @@ userspace_tests()
continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
set_userspace_pm $ns1 set_userspace_pm $ns1
pm_nl_set_limits $ns2 1 1 pm_nl_set_limits $ns2 1 1
speed=5 \ { speed=5 \
run_tests $ns1 $ns2 10.0.1.1 & run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null
local tests_pid=$! local tests_pid=$!
wait_mpj $ns1 wait_mpj $ns1
userspace_pm_add_addr $ns1 10.0.2.1 10 userspace_pm_add_addr $ns1 10.0.2.1 10
...@@ -3585,8 +3658,8 @@ endpoint_tests() ...@@ -3585,8 +3658,8 @@ endpoint_tests()
pm_nl_set_limits $ns1 2 2 pm_nl_set_limits $ns1 2 2
pm_nl_set_limits $ns2 2 2 pm_nl_set_limits $ns2 2 2
pm_nl_add_endpoint $ns1 10.0.2.1 flags signal pm_nl_add_endpoint $ns1 10.0.2.1 flags signal
speed=slow \ { speed=slow \
run_tests $ns1 $ns2 10.0.1.1 & run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null
local tests_pid=$! local tests_pid=$!
wait_mpj $ns1 wait_mpj $ns1
...@@ -3612,8 +3685,8 @@ endpoint_tests() ...@@ -3612,8 +3685,8 @@ endpoint_tests()
pm_nl_set_limits $ns2 0 3 pm_nl_set_limits $ns2 0 3
pm_nl_add_endpoint $ns2 10.0.1.2 id 1 dev ns2eth1 flags subflow pm_nl_add_endpoint $ns2 10.0.1.2 id 1 dev ns2eth1 flags subflow
pm_nl_add_endpoint $ns2 10.0.2.2 id 2 dev ns2eth2 flags subflow pm_nl_add_endpoint $ns2 10.0.2.2 id 2 dev ns2eth2 flags subflow
test_linkfail=4 speed=5 \ { test_linkfail=4 speed=5 \
run_tests $ns1 $ns2 10.0.1.1 & run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null
local tests_pid=$! local tests_pid=$!
wait_mpj $ns2 wait_mpj $ns2
...@@ -3675,6 +3748,7 @@ endpoint_tests() ...@@ -3675,6 +3748,7 @@ endpoint_tests()
chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 6 chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 6
chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_CLOSED 5 # one has been closed before estab chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_CLOSED 5 # one has been closed before estab
join_syn_tx=7 \
chk_join_nr 6 6 6 chk_join_nr 6 6 6
chk_rm_nr 4 4 chk_rm_nr 4 4
fi fi
...@@ -3688,8 +3762,8 @@ endpoint_tests() ...@@ -3688,8 +3762,8 @@ endpoint_tests()
# broadcast IP: no packet for this address will be received on ns1 # broadcast IP: no packet for this address will be received on ns1
pm_nl_add_endpoint $ns1 224.0.0.1 id 2 flags signal pm_nl_add_endpoint $ns1 224.0.0.1 id 2 flags signal
pm_nl_add_endpoint $ns1 10.0.1.1 id 42 flags signal pm_nl_add_endpoint $ns1 10.0.1.1 id 42 flags signal
test_linkfail=4 speed=5 \ { test_linkfail=4 speed=5 \
run_tests $ns1 $ns2 10.0.1.1 & run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null
local tests_pid=$! local tests_pid=$!
wait_mpj $ns2 wait_mpj $ns2
...@@ -3747,6 +3821,7 @@ endpoint_tests() ...@@ -3747,6 +3821,7 @@ endpoint_tests()
chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 5 chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 5
chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_CLOSED 3 chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_CLOSED 3
join_connect_err=1 \
chk_join_nr 5 5 5 chk_join_nr 5 5 5
chk_add_nr 6 6 chk_add_nr 6 6
chk_rm_nr 4 3 invert chk_rm_nr 4 3 invert
...@@ -3760,8 +3835,8 @@ endpoint_tests() ...@@ -3760,8 +3835,8 @@ endpoint_tests()
# broadcast IP: no packet for this address will be received on ns1 # broadcast IP: no packet for this address will be received on ns1
pm_nl_add_endpoint $ns1 224.0.0.1 id 2 flags signal pm_nl_add_endpoint $ns1 224.0.0.1 id 2 flags signal
pm_nl_add_endpoint $ns2 10.0.3.2 id 3 flags subflow pm_nl_add_endpoint $ns2 10.0.3.2 id 3 flags subflow
test_linkfail=4 speed=20 \ { test_linkfail=4 speed=20 \
run_tests $ns1 $ns2 10.0.1.1 & run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null
local tests_pid=$! local tests_pid=$!
wait_attempt_fail $ns2 wait_attempt_fail $ns2
...@@ -3778,6 +3853,7 @@ endpoint_tests() ...@@ -3778,6 +3853,7 @@ endpoint_tests()
wait_mpj $ns2 wait_mpj $ns2
mptcp_lib_kill_wait $tests_pid mptcp_lib_kill_wait $tests_pid
join_syn_tx=3 join_connect_err=1 \
chk_join_nr 2 2 2 chk_join_nr 2 2 2
chk_add_nr 2 2 chk_add_nr 2 2
chk_rm_nr 1 0 invert chk_rm_nr 1 0 invert
......
...@@ -19,12 +19,6 @@ ...@@ -19,12 +19,6 @@
#include "linux/mptcp.h" #include "linux/mptcp.h"
#ifndef MPTCP_PM_NAME
#define MPTCP_PM_NAME "mptcp_pm"
#endif
#ifndef MPTCP_PM_EVENTS
#define MPTCP_PM_EVENTS "mptcp_pm_events"
#endif
#ifndef IPPROTO_MPTCP #ifndef IPPROTO_MPTCP
#define IPPROTO_MPTCP 262 #define IPPROTO_MPTCP 262
#endif #endif
...@@ -116,7 +110,7 @@ static int capture_events(int fd, int event_group) ...@@ -116,7 +110,7 @@ static int capture_events(int fd, int event_group)
if (setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, if (setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP,
&event_group, sizeof(event_group)) < 0) &event_group, sizeof(event_group)) < 0)
error(1, errno, "could not join the " MPTCP_PM_EVENTS " mcast group"); error(1, errno, "could not join the " MPTCP_PM_EV_GRP_NAME " mcast group");
do { do {
FD_ZERO(&rfds); FD_ZERO(&rfds);
...@@ -288,7 +282,7 @@ static int genl_parse_getfamily(struct nlmsghdr *nlh, int *pm_family, ...@@ -288,7 +282,7 @@ static int genl_parse_getfamily(struct nlmsghdr *nlh, int *pm_family,
if (grp->rta_type == CTRL_ATTR_MCAST_GRP_ID) if (grp->rta_type == CTRL_ATTR_MCAST_GRP_ID)
*events_mcast_grp = *(__u32 *)RTA_DATA(grp); *events_mcast_grp = *(__u32 *)RTA_DATA(grp);
else if (grp->rta_type == CTRL_ATTR_MCAST_GRP_NAME && else if (grp->rta_type == CTRL_ATTR_MCAST_GRP_NAME &&
!strcmp(RTA_DATA(grp), MPTCP_PM_EVENTS)) !strcmp(RTA_DATA(grp), MPTCP_PM_EV_GRP_NAME))
got_events_grp = 1; got_events_grp = 1;
grp = RTA_NEXT(grp, grp_len); grp = RTA_NEXT(grp, grp_len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment