Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+309 -254
+4
net/mptcp/mib.c
··· 25 25 SNMP_MIB_ITEM("MPJoinSynAckHMacFailure", MPTCP_MIB_JOINSYNACKMAC), 26 26 SNMP_MIB_ITEM("MPJoinAckRx", MPTCP_MIB_JOINACKRX), 27 27 SNMP_MIB_ITEM("MPJoinAckHMacFailure", MPTCP_MIB_JOINACKMAC), 28 + SNMP_MIB_ITEM("MPJoinSynTx", MPTCP_MIB_JOINSYNTX), 29 + SNMP_MIB_ITEM("MPJoinSynTxCreatSkErr", MPTCP_MIB_JOINSYNTXCREATSKERR), 30 + SNMP_MIB_ITEM("MPJoinSynTxBindErr", MPTCP_MIB_JOINSYNTXBINDERR), 31 + SNMP_MIB_ITEM("MPJoinSynTxConnectErr", MPTCP_MIB_JOINSYNTXCONNECTERR), 28 32 SNMP_MIB_ITEM("DSSNotMatching", MPTCP_MIB_DSSNOMATCH), 29 33 SNMP_MIB_ITEM("InfiniteMapTx", MPTCP_MIB_INFINITEMAPTX), 30 34 SNMP_MIB_ITEM("InfiniteMapRx", MPTCP_MIB_INFINITEMAPRX),
+4
net/mptcp/mib.h
··· 20 20 MPTCP_MIB_JOINSYNACKMAC, /* HMAC was wrong on SYN/ACK + MP_JOIN */ 21 21 MPTCP_MIB_JOINACKRX, /* Received an ACK + MP_JOIN */ 22 22 MPTCP_MIB_JOINACKMAC, /* HMAC was wrong on ACK + MP_JOIN */ 23 + MPTCP_MIB_JOINSYNTX, /* Sending a SYN + MP_JOIN */ 24 + MPTCP_MIB_JOINSYNTXCREATSKERR, /* Not able to create a socket when sending a SYN + MP_JOIN */ 25 + MPTCP_MIB_JOINSYNTXBINDERR, /* Not able to bind() the address when sending a SYN + MP_JOIN */ 26 + MPTCP_MIB_JOINSYNTXCONNECTERR, /* Not able to connect() when sending a SYN + MP_JOIN */ 23 27 MPTCP_MIB_DSSNOMATCH, /* Received a new mapping that did not match the previous one */ 24 28 MPTCP_MIB_INFINITEMAPTX, /* Sent an infinite mapping */ 25 29 MPTCP_MIB_INFINITEMAPRX, /* Received an infinite mapping */
-11
net/mptcp/pm.c
··· 430 430 return mptcp_pm_nl_is_backup(msk, &skc_local); 431 431 } 432 432 433 - int mptcp_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, unsigned int id, 434 - u8 *flags, int *ifindex) 435 - { 436 - *flags = 0; 437 - *ifindex = 0; 438 - 439 - if (mptcp_pm_is_userspace(msk)) 440 - return mptcp_userspace_pm_get_flags_and_ifindex_by_id(msk, id, flags, ifindex); 441 - return mptcp_pm_nl_get_flags_and_ifindex_by_id(msk, id, flags, ifindex); 442 - } 443 - 444 433 int mptcp_pm_get_addr(struct sk_buff *skb, struct genl_info *info) 445 434 { 446 435 if (info->attrs[MPTCP_PM_ATTR_TOKEN])
+30 -48
net/mptcp/pm_netlink.c
··· 149 149 static bool 150 150 select_local_address(const struct pm_nl_pernet *pernet, 151 151 const struct mptcp_sock *msk, 152 - struct mptcp_pm_addr_entry *new_entry) 152 + struct mptcp_pm_local *new_local) 153 153 { 154 154 struct mptcp_pm_addr_entry *entry; 155 155 bool found = false; ··· 164 164 if (!test_bit(entry->addr.id, msk->pm.id_avail_bitmap)) 165 165 continue; 166 166 167 - *new_entry = *entry; 167 + new_local->addr = entry->addr; 168 + new_local->flags = entry->flags; 169 + new_local->ifindex = entry->ifindex; 168 170 found = true; 169 171 break; 170 172 } ··· 177 175 178 176 static bool 179 177 select_signal_address(struct pm_nl_pernet *pernet, const struct mptcp_sock *msk, 180 - struct mptcp_pm_addr_entry *new_entry) 178 + struct mptcp_pm_local *new_local) 181 179 { 182 180 struct mptcp_pm_addr_entry *entry; 183 181 bool found = false; ··· 195 193 if (!(entry->flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) 196 194 continue; 197 195 198 - *new_entry = *entry; 196 + new_local->addr = entry->addr; 197 + new_local->flags = entry->flags; 198 + new_local->ifindex = entry->ifindex; 199 199 found = true; 200 200 break; 201 201 } ··· 528 524 static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) 529 525 { 530 526 struct sock *sk = (struct sock *)msk; 531 - struct mptcp_pm_addr_entry local; 532 527 unsigned int add_addr_signal_max; 533 528 bool signal_and_subflow = false; 534 529 unsigned int local_addr_max; 535 530 struct pm_nl_pernet *pernet; 531 + struct mptcp_pm_local local; 536 532 unsigned int subflows_max; 537 533 538 534 pernet = pm_nl_get_pernet(sock_net(sk)); ··· 633 629 634 630 spin_unlock_bh(&msk->pm.lock); 635 631 for (i = 0; i < nr; i++) 636 - __mptcp_subflow_connect(sk, &local.addr, &addrs[i]); 632 + __mptcp_subflow_connect(sk, &local, &addrs[i]); 637 633 spin_lock_bh(&msk->pm.lock); 638 634 } 639 635 mptcp_pm_nl_check_work_pending(msk); ··· 654 650 */ 655 651 static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk, 656 652 struct mptcp_addr_info *remote, 657 - struct mptcp_addr_info *addrs) 653 + struct mptcp_pm_local *locals) 658 654 { 659 655 struct sock *sk = (struct sock *)msk; 660 656 struct mptcp_pm_addr_entry *entry; ··· 677 673 continue; 678 674 679 675 if (msk->pm.subflows < subflows_max) { 680 - msk->pm.subflows++; 681 - addrs[i] = entry->addr; 676 + locals[i].addr = entry->addr; 677 + locals[i].flags = entry->flags; 678 + locals[i].ifindex = entry->ifindex; 682 679 683 680 /* Special case for ID0: set the correct ID */ 684 - if (mptcp_addresses_equal(&entry->addr, &mpc_addr, entry->addr.port)) 685 - addrs[i].id = 0; 681 + if (mptcp_addresses_equal(&locals[i].addr, &mpc_addr, locals[i].addr.port)) 682 + locals[i].addr.id = 0; 686 683 684 + msk->pm.subflows++; 687 685 i++; 688 686 } 689 687 } ··· 695 689 * 'IPADDRANY' local address 696 690 */ 697 691 if (!i) { 698 - struct mptcp_addr_info local; 699 - 700 - memset(&local, 0, sizeof(local)); 701 - local.family = 692 + memset(&locals[i], 0, sizeof(locals[i])); 693 + locals[i].addr.family = 702 694 #if IS_ENABLED(CONFIG_MPTCP_IPV6) 703 695 remote->family == AF_INET6 && 704 696 ipv6_addr_v4mapped(&remote->addr6) ? AF_INET : 705 697 #endif 706 698 remote->family; 707 699 708 - if (!mptcp_pm_addr_families_match(sk, &local, remote)) 700 + if (!mptcp_pm_addr_families_match(sk, &locals[i].addr, remote)) 709 701 return 0; 710 702 711 703 msk->pm.subflows++; 712 - addrs[i++] = local; 704 + i++; 713 705 } 714 706 715 707 return i; ··· 715 711 716 712 static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) 717 713 { 718 - struct mptcp_addr_info addrs[MPTCP_PM_ADDR_MAX]; 714 + struct mptcp_pm_local locals[MPTCP_PM_ADDR_MAX]; 719 715 struct sock *sk = (struct sock *)msk; 720 716 unsigned int add_addr_accept_max; 721 717 struct mptcp_addr_info remote; ··· 744 740 /* connect to the specified remote address, using whatever 745 741 * local address the routing configuration will pick. 746 742 */ 747 - nr = fill_local_addresses_vec(msk, &remote, addrs); 743 + nr = fill_local_addresses_vec(msk, &remote, locals); 748 744 if (nr == 0) 749 745 return; 750 746 751 747 spin_unlock_bh(&msk->pm.lock); 752 748 for (i = 0; i < nr; i++) 753 - if (__mptcp_subflow_connect(sk, &addrs[i], &remote) == 0) 749 + if (__mptcp_subflow_connect(sk, &locals[i], &remote) == 0) 754 750 sf_created = true; 755 751 spin_lock_bh(&msk->pm.lock); 756 752 ··· 1437 1433 return ret; 1438 1434 } 1439 1435 1440 - int mptcp_pm_nl_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, unsigned int id, 1441 - u8 *flags, int *ifindex) 1442 - { 1443 - struct mptcp_pm_addr_entry *entry; 1444 - struct sock *sk = (struct sock *)msk; 1445 - struct net *net = sock_net(sk); 1446 - 1447 - /* No entries with ID 0 */ 1448 - if (id == 0) 1449 - return 0; 1450 - 1451 - rcu_read_lock(); 1452 - entry = __lookup_addr_by_id(pm_nl_get_pernet(net), id); 1453 - if (entry) { 1454 - *flags = entry->flags; 1455 - *ifindex = entry->ifindex; 1456 - } 1457 - rcu_read_unlock(); 1458 - 1459 - return 0; 1460 - } 1461 - 1462 1436 static bool remove_anno_list_by_saddr(struct mptcp_sock *msk, 1463 1437 const struct mptcp_addr_info *addr) 1464 1438 { ··· 1654 1672 } 1655 1673 1656 1674 /* Called from the in-kernel PM only */ 1657 - static void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk, 1658 - struct list_head *rm_list) 1675 + static void mptcp_pm_flush_addrs_and_subflows(struct mptcp_sock *msk, 1676 + struct list_head *rm_list) 1659 1677 { 1660 1678 struct mptcp_rm_list alist = { .nr = 0 }, slist = { .nr = 0 }; 1661 1679 struct mptcp_pm_addr_entry *entry; ··· 1683 1701 spin_unlock_bh(&msk->pm.lock); 1684 1702 } 1685 1703 1686 - static void mptcp_nl_remove_addrs_list(struct net *net, 1687 - struct list_head *rm_list) 1704 + static void mptcp_nl_flush_addrs_list(struct net *net, 1705 + struct list_head *rm_list) 1688 1706 { 1689 1707 long s_slot = 0, s_num = 0; 1690 1708 struct mptcp_sock *msk; ··· 1697 1715 1698 1716 if (!mptcp_pm_is_userspace(msk)) { 1699 1717 lock_sock(sk); 1700 - mptcp_pm_remove_addrs_and_subflows(msk, rm_list); 1718 + mptcp_pm_flush_addrs_and_subflows(msk, rm_list); 1701 1719 release_sock(sk); 1702 1720 } 1703 1721 ··· 1738 1756 pernet->next_id = 1; 1739 1757 bitmap_zero(pernet->id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); 1740 1758 spin_unlock_bh(&pernet->lock); 1741 - mptcp_nl_remove_addrs_list(sock_net(skb->sk), &free_list); 1759 + mptcp_nl_flush_addrs_list(sock_net(skb->sk), &free_list); 1742 1760 synchronize_rcu(); 1743 1761 __flush_addrs(&free_list); 1744 1762 return 0;
+13 -27
net/mptcp/pm_userspace.c
··· 119 119 return NULL; 120 120 } 121 121 122 - int mptcp_userspace_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, 123 - unsigned int id, 124 - u8 *flags, int *ifindex) 125 - { 126 - struct mptcp_pm_addr_entry *match; 127 - 128 - spin_lock_bh(&msk->pm.lock); 129 - match = mptcp_userspace_pm_lookup_addr_by_id(msk, id); 130 - spin_unlock_bh(&msk->pm.lock); 131 - if (match) { 132 - *flags = match->flags; 133 - *ifindex = match->ifindex; 134 - } 135 - 136 - return 0; 137 - } 138 - 139 122 int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, 140 123 struct mptcp_addr_info *skc) 141 124 { ··· 335 352 struct nlattr *raddr = info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE]; 336 353 struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN]; 337 354 struct nlattr *laddr = info->attrs[MPTCP_PM_ATTR_ADDR]; 338 - struct mptcp_pm_addr_entry local = { 0 }; 355 + struct mptcp_pm_addr_entry entry = { 0 }; 339 356 struct mptcp_addr_info addr_r; 357 + struct mptcp_pm_local local; 340 358 struct mptcp_sock *msk; 341 359 int err = -EINVAL; 342 360 struct sock *sk; ··· 363 379 goto create_err; 364 380 } 365 381 366 - err = mptcp_pm_parse_entry(laddr, info, true, &local); 382 + err = mptcp_pm_parse_entry(laddr, info, true, &entry); 367 383 if (err < 0) { 368 384 NL_SET_ERR_MSG_ATTR(info->extack, laddr, "error parsing local addr"); 369 385 goto create_err; 370 386 } 371 387 372 - if (local.flags & MPTCP_PM_ADDR_FLAG_SIGNAL) { 388 + if (entry.flags & MPTCP_PM_ADDR_FLAG_SIGNAL) { 373 389 GENL_SET_ERR_MSG(info, "invalid addr flags"); 374 390 err = -EINVAL; 375 391 goto create_err; 376 392 } 377 - local.flags |= MPTCP_PM_ADDR_FLAG_SUBFLOW; 393 + entry.flags |= MPTCP_PM_ADDR_FLAG_SUBFLOW; 378 394 379 395 err = mptcp_pm_parse_addr(raddr, info, &addr_r); 380 396 if (err < 0) { ··· 382 398 goto create_err; 383 399 } 384 400 385 - if (!mptcp_pm_addr_families_match(sk, &local.addr, &addr_r)) { 401 + if (!mptcp_pm_addr_families_match(sk, &entry.addr, &addr_r)) { 386 402 GENL_SET_ERR_MSG(info, "families mismatch"); 387 403 err = -EINVAL; 388 404 goto create_err; 389 405 } 390 406 391 - err = mptcp_userspace_pm_append_new_local_addr(msk, &local, false); 407 + err = mptcp_userspace_pm_append_new_local_addr(msk, &entry, false); 392 408 if (err < 0) { 393 409 GENL_SET_ERR_MSG(info, "did not match address and id"); 394 410 goto create_err; 395 411 } 396 412 413 + local.addr = entry.addr; 414 + local.flags = entry.flags; 415 + local.ifindex = entry.ifindex; 416 + 397 417 lock_sock(sk); 398 - 399 - err = __mptcp_subflow_connect(sk, &local.addr, &addr_r); 400 - 418 + err = __mptcp_subflow_connect(sk, &local, &addr_r); 401 419 release_sock(sk); 402 420 403 421 spin_lock_bh(&msk->pm.lock); 404 422 if (err) 405 - mptcp_userspace_pm_delete_local_addr(msk, &local); 423 + mptcp_userspace_pm_delete_local_addr(msk, &entry); 406 424 else 407 425 msk->pm.subflows++; 408 426 spin_unlock_bh(&msk->pm.lock);
+7 -9
net/mptcp/protocol.h
··· 236 236 struct mptcp_rm_list rm_list_rx; 237 237 }; 238 238 239 + struct mptcp_pm_local { 240 + struct mptcp_addr_info addr; 241 + u8 flags; 242 + int ifindex; 243 + }; 244 + 239 245 struct mptcp_pm_addr_entry { 240 246 struct list_head list; 241 247 struct mptcp_addr_info addr; ··· 725 719 void mptcp_local_address(const struct sock_common *skc, struct mptcp_addr_info *addr); 726 720 727 721 /* called with sk socket lock held */ 728 - int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, 722 + int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_pm_local *local, 729 723 const struct mptcp_addr_info *remote); 730 724 int mptcp_subflow_create_socket(struct sock *sk, unsigned short family, 731 725 struct socket **new_sock); ··· 1020 1014 struct mptcp_pm_add_entry * 1021 1015 mptcp_lookup_anno_list_by_saddr(const struct mptcp_sock *msk, 1022 1016 const struct mptcp_addr_info *addr); 1023 - int mptcp_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, 1024 - unsigned int id, 1025 - u8 *flags, int *ifindex); 1026 - int mptcp_pm_nl_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, unsigned int id, 1027 - u8 *flags, int *ifindex); 1028 - int mptcp_userspace_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, 1029 - unsigned int id, 1030 - u8 *flags, int *ifindex); 1031 1017 int mptcp_pm_set_flags(struct sk_buff *skb, struct genl_info *info); 1032 1018 int mptcp_pm_nl_set_flags(struct sk_buff *skb, struct genl_info *info); 1033 1019 int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info);
+36 -14
net/mptcp/subflow.c
··· 1565 1565 #endif 1566 1566 } 1567 1567 1568 - int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, 1568 + int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_pm_local *local, 1569 1569 const struct mptcp_addr_info *remote) 1570 1570 { 1571 1571 struct mptcp_sock *msk = mptcp_sk(sk); 1572 1572 struct mptcp_subflow_context *subflow; 1573 + int local_id = local->addr.id; 1573 1574 struct sockaddr_storage addr; 1574 1575 int remote_id = remote->id; 1575 - int local_id = loc->id; 1576 1576 int err = -ENOTCONN; 1577 1577 struct socket *sf; 1578 1578 struct sock *ssk; 1579 1579 u32 remote_token; 1580 1580 int addrlen; 1581 - int ifindex; 1582 - u8 flags; 1583 1581 1582 + /* The userspace PM sent the request too early? */ 1584 1583 if (!mptcp_is_fully_established(sk)) 1585 1584 goto err_out; 1586 1585 1587 - err = mptcp_subflow_create_socket(sk, loc->family, &sf); 1588 - if (err) 1586 + err = mptcp_subflow_create_socket(sk, local->addr.family, &sf); 1587 + if (err) { 1588 + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXCREATSKERR); 1589 + pr_debug("msk=%p local=%d remote=%d create sock error: %d\n", 1590 + msk, local_id, remote_id, err); 1589 1591 goto err_out; 1592 + } 1590 1593 1591 1594 ssk = sf->sk; 1592 1595 subflow = mptcp_subflow_ctx(ssk); ··· 1597 1594 get_random_bytes(&subflow->local_nonce, sizeof(u32)); 1598 1595 } while (!subflow->local_nonce); 1599 1596 1600 - if (local_id) 1597 + /* if 'IPADDRANY', the ID will be set later, after the routing */ 1598 + if (local->addr.family == AF_INET) { 1599 + if (!local->addr.addr.s_addr) 1600 + local_id = -1; 1601 + #if IS_ENABLED(CONFIG_MPTCP_IPV6) 1602 + } else if (sk->sk_family == AF_INET6) { 1603 + if (ipv6_addr_any(&local->addr.addr6)) 1604 + local_id = -1; 1605 + #endif 1606 + } 1607 + 1608 + if (local_id >= 0) 1601 1609 subflow_set_local_id(subflow, local_id); 1602 1610 1603 - mptcp_pm_get_flags_and_ifindex_by_id(msk, local_id, 1604 - &flags, &ifindex); 1605 1611 subflow->remote_key_valid = 1; 1606 1612 subflow->remote_key = READ_ONCE(msk->remote_key); 1607 1613 subflow->local_key = READ_ONCE(msk->local_key); 1608 1614 subflow->token = msk->token; 1609 - mptcp_info2sockaddr(loc, &addr, ssk->sk_family); 1615 + mptcp_info2sockaddr(&local->addr, &addr, ssk->sk_family); 1610 1616 1611 1617 addrlen = sizeof(struct sockaddr_in); 1612 1618 #if IS_ENABLED(CONFIG_MPTCP_IPV6) 1613 1619 if (addr.ss_family == AF_INET6) 1614 1620 addrlen = sizeof(struct sockaddr_in6); 1615 1621 #endif 1616 - ssk->sk_bound_dev_if = ifindex; 1622 + ssk->sk_bound_dev_if = local->ifindex; 1617 1623 err = kernel_bind(sf, (struct sockaddr *)&addr, addrlen); 1618 - if (err) 1624 + if (err) { 1625 + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXBINDERR); 1626 + pr_debug("msk=%p local=%d remote=%d bind error: %d\n", 1627 + msk, local_id, remote_id, err); 1619 1628 goto failed; 1629 + } 1620 1630 1621 1631 mptcp_crypto_key_sha(subflow->remote_key, &remote_token, NULL); 1622 1632 pr_debug("msk=%p remote_token=%u local_id=%d remote_id=%d\n", msk, ··· 1637 1621 subflow->remote_token = remote_token; 1638 1622 WRITE_ONCE(subflow->remote_id, remote_id); 1639 1623 subflow->request_join = 1; 1640 - subflow->request_bkup = !!(flags & MPTCP_PM_ADDR_FLAG_BACKUP); 1624 + subflow->request_bkup = !!(local->flags & MPTCP_PM_ADDR_FLAG_BACKUP); 1641 1625 subflow->subflow_id = msk->subflow_id++; 1642 1626 mptcp_info2sockaddr(remote, &addr, ssk->sk_family); 1643 1627 1644 1628 sock_hold(ssk); 1645 1629 list_add_tail(&subflow->node, &msk->conn_list); 1646 1630 err = kernel_connect(sf, (struct sockaddr *)&addr, addrlen, O_NONBLOCK); 1647 - if (err && err != -EINPROGRESS) 1631 + if (err && err != -EINPROGRESS) { 1632 + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXCONNECTERR); 1633 + pr_debug("msk=%p local=%d remote=%d connect error: %d\n", 1634 + msk, local_id, remote_id, err); 1648 1635 goto failed_unlink; 1636 + } 1637 + 1638 + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTX); 1649 1639 1650 1640 /* discard the subflow socket */ 1651 1641 mptcp_sock_graft(ssk, sk->sk_socket);
+213 -137
tools/testing/selftests/net/mptcp/mptcp_join.sh
··· 61 61 unset fastclose 62 62 unset fullmesh 63 63 unset speed 64 + unset join_csum_ns1 65 + unset join_csum_ns2 66 + unset join_fail_nr 67 + unset join_rst_nr 68 + unset join_infi_nr 69 + unset join_corrupted_pkts 70 + unset join_syn_tx 71 + unset join_create_err 72 + unset join_bind_err 73 + unset join_connect_err 64 74 65 75 # generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) == 0x30) || 66 76 # (ip6 && (ip6[74] & 0xf0) == 0x30)'" ··· 204 194 print_skip() 205 195 { 206 196 mptcp_lib_pr_skip "${@}" 197 + } 198 + 199 + # $1: check name; $2: rc 200 + print_results() 201 + { 202 + local check="${1}" 203 + local rc=${2} 204 + 205 + print_check "${check}" 206 + if [ ${rc} = ${KSFT_PASS} ]; then 207 + print_ok 208 + elif [ ${rc} = ${KSFT_SKIP} ]; then 209 + print_skip 210 + else 211 + fail_test "see above" 212 + fi 207 213 } 208 214 209 215 # [ $1: fail msg ] ··· 363 337 local ns1_enable=$1 364 338 local ns2_enable=$2 365 339 366 - reset "checksum test ${1} ${2}" || return 1 340 + reset "checksum test ${ns1_enable} ${ns2_enable}" || return 1 367 341 368 342 ip netns exec $ns1 sysctl -q net.mptcp.checksum_enabled=$ns1_enable 369 343 ip netns exec $ns2 sysctl -q net.mptcp.checksum_enabled=$ns2_enable ··· 865 839 local cestab=$2 866 840 local count 867 841 868 - print_check "cestab $cestab" 842 + print_check "currently established: $cestab" 869 843 count=$(mptcp_lib_get_counter ${ns} "MPTcpExtMPCurrEstab") 870 844 if [ -z "$count" ]; then 871 845 print_skip ··· 1141 1115 csum_ns2=${csum_ns2:1} 1142 1116 fi 1143 1117 1144 - print_check "sum" 1118 + print_check "checksum server" 1145 1119 count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtDataCsumErr") 1146 1120 if [ -n "$count" ] && [ "$count" != "$csum_ns1" ]; then 1147 1121 extra_msg+=" ns1=$count" ··· 1154 1128 else 1155 1129 print_ok 1156 1130 fi 1157 - print_check "csum" 1131 + 1132 + print_check "checksum client" 1158 1133 count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtDataCsumErr") 1159 1134 if [ -n "$count" ] && [ "$count" != "$csum_ns2" ]; then 1160 1135 extra_msg+=" ns2=$count" ··· 1180 1153 local count 1181 1154 local ns_tx=$ns1 1182 1155 local ns_rx=$ns2 1156 + local tx="server" 1157 + local rx="client" 1183 1158 local extra_msg="" 1184 1159 local allow_tx_lost=0 1185 1160 local allow_rx_lost=0 ··· 1189 1160 if [[ $ns_invert = "invert" ]]; then 1190 1161 ns_tx=$ns2 1191 1162 ns_rx=$ns1 1192 - extra_msg="invert" 1163 + tx="client" 1164 + rx="server" 1193 1165 fi 1194 1166 1195 1167 if [[ "${fail_tx}" = "-"* ]]; then ··· 1202 1172 fail_rx=${fail_rx:1} 1203 1173 fi 1204 1174 1205 - print_check "ftx" 1175 + print_check "fail tx ${tx}" 1206 1176 count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPFailTx") 1207 1177 if [ -n "$count" ] && [ "$count" != "$fail_tx" ]; then 1208 - extra_msg+=",tx=$count" 1178 + extra_msg+=" tx=$count" 1209 1179 fi 1210 1180 if [ -z "$count" ]; then 1211 1181 print_skip ··· 1216 1186 print_ok 1217 1187 fi 1218 1188 1219 - print_check "failrx" 1189 + print_check "fail rx ${rx}" 1220 1190 count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPFailRx") 1221 1191 if [ -n "$count" ] && [ "$count" != "$fail_rx" ]; then 1222 - extra_msg+=",rx=$count" 1192 + extra_msg+=" rx=$count" 1223 1193 fi 1224 1194 if [ -z "$count" ]; then 1225 1195 print_skip ··· 1241 1211 local count 1242 1212 local ns_tx=$ns2 1243 1213 local ns_rx=$ns1 1244 - local extra_msg="" 1214 + local tx="client" 1215 + local rx="server" 1245 1216 1246 1217 if [[ $ns_invert = "invert" ]]; then 1247 1218 ns_tx=$ns1 1248 1219 ns_rx=$ns2 1249 - extra_msg="invert" 1220 + tx="server" 1221 + rx="client" 1250 1222 fi 1251 1223 1252 - print_check "ctx" 1224 + print_check "fast close tx ${tx}" 1253 1225 count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPFastcloseTx") 1254 1226 if [ -z "$count" ]; then 1255 1227 print_skip 1256 1228 elif [ "$count" != "$fclose_tx" ]; then 1257 - extra_msg+=",tx=$count" 1258 1229 fail_test "got $count MP_FASTCLOSE[s] TX expected $fclose_tx" 1259 1230 else 1260 1231 print_ok 1261 1232 fi 1262 1233 1263 - print_check "fclzrx" 1234 + print_check "fast close rx ${rx}" 1264 1235 count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPFastcloseRx") 1265 1236 if [ -z "$count" ]; then 1266 1237 print_skip 1267 1238 elif [ "$count" != "$fclose_rx" ]; then 1268 - extra_msg+=",rx=$count" 1269 1239 fail_test "got $count MP_FASTCLOSE[s] RX expected $fclose_rx" 1270 1240 else 1271 1241 print_ok 1272 1242 fi 1273 - 1274 - print_info "$extra_msg" 1275 1243 } 1276 1244 1277 1245 chk_rst_nr() ··· 1280 1252 local count 1281 1253 local ns_tx=$ns1 1282 1254 local ns_rx=$ns2 1283 - local extra_msg="" 1255 + local tx="server" 1256 + local rx="client" 1284 1257 1285 1258 if [[ $ns_invert = "invert" ]]; then 1286 1259 ns_tx=$ns2 1287 1260 ns_rx=$ns1 1288 - extra_msg="invert" 1261 + tx="client" 1262 + rx="server" 1289 1263 fi 1290 1264 1291 - print_check "rtx" 1265 + print_check "reset tx ${tx}" 1292 1266 count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPRstTx") 1293 1267 if [ -z "$count" ]; then 1294 1268 print_skip ··· 1302 1272 print_ok 1303 1273 fi 1304 1274 1305 - print_check "rstrx" 1275 + print_check "reset rx ${rx}" 1306 1276 count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPRstRx") 1307 1277 if [ -z "$count" ]; then 1308 1278 print_skip ··· 1313 1283 else 1314 1284 print_ok 1315 1285 fi 1316 - 1317 - print_info "$extra_msg" 1318 1286 } 1319 1287 1320 1288 chk_infi_nr() ··· 1321 1293 local infi_rx=$2 1322 1294 local count 1323 1295 1324 - print_check "itx" 1296 + print_check "infi tx client" 1325 1297 count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtInfiniteMapTx") 1326 1298 if [ -z "$count" ]; then 1327 1299 print_skip ··· 1331 1303 print_ok 1332 1304 fi 1333 1305 1334 - print_check "infirx" 1306 + print_check "infi rx server" 1335 1307 count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtInfiniteMapRx") 1336 1308 if [ -z "$count" ]; then 1337 1309 print_skip ··· 1342 1314 fi 1343 1315 } 1344 1316 1317 + chk_join_tx_nr() 1318 + { 1319 + local syn_tx=${join_syn_tx:-0} 1320 + local create=${join_create_err:-0} 1321 + local bind=${join_bind_err:-0} 1322 + local connect=${join_connect_err:-0} 1323 + local rc=${KSFT_PASS} 1324 + local count 1325 + 1326 + count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTx") 1327 + if [ -z "$count" ]; then 1328 + rc=${KSFT_SKIP} 1329 + elif [ "$count" != "$syn_tx" ]; then 1330 + rc=${KSFT_FAIL} 1331 + print_check "syn tx" 1332 + fail_test "got $count JOIN[s] syn tx expected $syn_tx" 1333 + fi 1334 + 1335 + count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTxCreatSkErr") 1336 + if [ -z "$count" ]; then 1337 + rc=${KSFT_SKIP} 1338 + elif [ "$count" != "$create" ]; then 1339 + rc=${KSFT_FAIL} 1340 + print_check "syn tx create socket error" 1341 + fail_test "got $count JOIN[s] syn tx create socket error expected $create" 1342 + fi 1343 + 1344 + count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTxBindErr") 1345 + if [ -z "$count" ]; then 1346 + rc=${KSFT_SKIP} 1347 + elif [ "$count" != "$bind" ]; then 1348 + rc=${KSFT_FAIL} 1349 + print_check "syn tx bind error" 1350 + fail_test "got $count JOIN[s] syn tx bind error expected $bind" 1351 + fi 1352 + 1353 + count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTxConnectErr") 1354 + if [ -z "$count" ]; then 1355 + rc=${KSFT_SKIP} 1356 + elif [ "$count" != "$connect" ]; then 1357 + rc=${KSFT_FAIL} 1358 + print_check "syn tx connect error" 1359 + fail_test "got $count JOIN[s] syn tx connect error expected $connect" 1360 + fi 1361 + 1362 + print_results "join Tx" ${rc} 1363 + } 1364 + 1345 1365 chk_join_nr() 1346 1366 { 1347 1367 local syn_nr=$1 1348 1368 local syn_ack_nr=$2 1349 1369 local ack_nr=$3 1350 - local csum_ns1=${4:-0} 1351 - local csum_ns2=${5:-0} 1352 - local fail_nr=${6:-0} 1353 - local rst_nr=${7:-0} 1354 - local infi_nr=${8:-0} 1355 - local corrupted_pkts=${9:-0} 1370 + local csum_ns1=${join_csum_ns1:-0} 1371 + local csum_ns2=${join_csum_ns2:-0} 1372 + local fail_nr=${join_fail_nr:-0} 1373 + local rst_nr=${join_rst_nr:-0} 1374 + local infi_nr=${join_infi_nr:-0} 1375 + local corrupted_pkts=${join_corrupted_pkts:-0} 1376 + local rc=${KSFT_PASS} 1356 1377 local count 1357 1378 local with_cookie 1358 1379 ··· 1409 1332 print_info "${corrupted_pkts} corrupted pkts" 1410 1333 fi 1411 1334 1412 - print_check "syn" 1413 1335 count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinSynRx") 1414 1336 if [ -z "$count" ]; then 1415 - print_skip 1337 + rc=${KSFT_SKIP} 1416 1338 elif [ "$count" != "$syn_nr" ]; then 1417 - fail_test "got $count JOIN[s] syn expected $syn_nr" 1418 - else 1419 - print_ok 1339 + rc=${KSFT_FAIL} 1340 + print_check "syn rx" 1341 + fail_test "got $count JOIN[s] syn rx expected $syn_nr" 1420 1342 fi 1421 1343 1422 - print_check "synack" 1423 1344 with_cookie=$(ip netns exec $ns2 sysctl -n net.ipv4.tcp_syncookies) 1424 1345 count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynAckRx") 1425 1346 if [ -z "$count" ]; then 1426 - print_skip 1347 + rc=${KSFT_SKIP} 1427 1348 elif [ "$count" != "$syn_ack_nr" ]; then 1428 1349 # simult connections exceeding the limit with cookie enabled could go up to 1429 1350 # synack validation as the conn limit can be enforced reliably only after 1430 1351 # the subflow creation 1431 - if [ "$with_cookie" = 2 ] && [ "$count" -gt "$syn_ack_nr" ] && [ "$count" -le "$syn_nr" ]; then 1432 - print_ok 1433 - else 1434 - fail_test "got $count JOIN[s] synack expected $syn_ack_nr" 1352 + if [ "$with_cookie" != 2 ] || [ "$count" -le "$syn_ack_nr" ] || [ "$count" -gt "$syn_nr" ]; then 1353 + rc=${KSFT_FAIL} 1354 + print_check "synack rx" 1355 + fail_test "got $count JOIN[s] synack rx expected $syn_ack_nr" 1435 1356 fi 1436 - else 1437 - print_ok 1438 1357 fi 1439 1358 1440 - print_check "ack" 1441 1359 count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinAckRx") 1442 1360 if [ -z "$count" ]; then 1443 - print_skip 1361 + rc=${KSFT_SKIP} 1444 1362 elif [ "$count" != "$ack_nr" ]; then 1445 - fail_test "got $count JOIN[s] ack expected $ack_nr" 1446 - else 1447 - print_ok 1363 + rc=${KSFT_FAIL} 1364 + print_check "ack rx" 1365 + fail_test "got $count JOIN[s] ack rx expected $ack_nr" 1448 1366 fi 1367 + 1368 + print_results "join Rx" ${rc} 1369 + 1370 + join_syn_tx="${join_syn_tx:-${syn_nr}}" \ 1371 + chk_join_tx_nr 1372 + 1449 1373 if $validate_checksum; then 1450 1374 chk_csum_nr $csum_ns1 $csum_ns2 1451 1375 chk_fail_nr $fail_nr $fail_nr ··· 1507 1429 local mis_ack_nr=0 1508 1430 local ns_tx=$ns1 1509 1431 local ns_rx=$ns2 1510 - local extra_msg="" 1432 + local tx="" 1433 + local rx="" 1511 1434 local count 1512 1435 local timeout 1513 1436 1514 1437 if [[ $ns_invert = "invert" ]]; then 1515 1438 ns_tx=$ns2 1516 1439 ns_rx=$ns1 1517 - extra_msg="invert" 1440 + tx=" client" 1441 + rx=" server" 1518 1442 fi 1519 1443 1520 1444 timeout=$(ip netns exec ${ns_tx} sysctl -n net.mptcp.add_addr_timeout) 1521 1445 1522 - print_check "add" 1446 + print_check "add addr rx${rx}" 1523 1447 count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtAddAddr") 1524 1448 if [ -z "$count" ]; then 1525 1449 print_skip ··· 1533 1453 print_ok 1534 1454 fi 1535 1455 1536 - print_check "echo" 1456 + print_check "add addr echo rx${tx}" 1537 1457 count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtEchoAdd") 1538 1458 if [ -z "$count" ]; then 1539 1459 print_skip ··· 1544 1464 fi 1545 1465 1546 1466 if [ $port_nr -gt 0 ]; then 1547 - print_check "pt" 1467 + print_check "add addr rx with port${rx}" 1548 1468 count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtPortAdd") 1549 1469 if [ -z "$count" ]; then 1550 1470 print_skip ··· 1554 1474 print_ok 1555 1475 fi 1556 1476 1557 - print_check "syn" 1477 + print_check "syn rx port${tx}" 1558 1478 count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPJoinPortSynRx") 1559 1479 if [ -z "$count" ]; then 1560 1480 print_skip ··· 1565 1485 print_ok 1566 1486 fi 1567 1487 1568 - print_check "synack" 1488 + print_check "synack rx port${rx}" 1569 1489 count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPJoinPortSynAckRx") 1570 1490 if [ -z "$count" ]; then 1571 1491 print_skip ··· 1576 1496 print_ok 1577 1497 fi 1578 1498 1579 - print_check "ack" 1499 + print_check "ack rx port${tx}" 1580 1500 count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPJoinPortAckRx") 1581 1501 if [ -z "$count" ]; then 1582 1502 print_skip ··· 1587 1507 print_ok 1588 1508 fi 1589 1509 1590 - print_check "syn" 1510 + print_check "syn rx port mismatch${tx}" 1591 1511 count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMismatchPortSynRx") 1592 1512 if [ -z "$count" ]; then 1593 1513 print_skip ··· 1598 1518 print_ok 1599 1519 fi 1600 1520 1601 - print_check "ack" 1521 + print_check "ack rx port mismatch${tx}" 1602 1522 count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMismatchPortAckRx") 1603 1523 if [ -z "$count" ]; then 1604 1524 print_skip ··· 1609 1529 print_ok 1610 1530 fi 1611 1531 fi 1612 - 1613 - print_info "$extra_msg" 1614 1532 } 1615 1533 1616 1534 chk_add_tx_nr() ··· 1620 1542 1621 1543 timeout=$(ip netns exec $ns1 sysctl -n net.mptcp.add_addr_timeout) 1622 1544 1623 - print_check "add TX" 1545 + print_check "add addr tx" 1624 1546 count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtAddAddrTx") 1625 1547 if [ -z "$count" ]; then 1626 1548 print_skip ··· 1632 1554 print_ok 1633 1555 fi 1634 1556 1635 - print_check "echo TX" 1557 + print_check "add addr echo tx" 1636 1558 count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtEchoAddTx") 1637 1559 if [ -z "$count" ]; then 1638 1560 print_skip ··· 1652 1574 local count 1653 1575 local addr_ns=$ns1 1654 1576 local subflow_ns=$ns2 1577 + local addr="server" 1578 + local subflow="client" 1655 1579 local extra_msg="" 1656 1580 1657 1581 shift 2 ··· 1663 1583 shift 1664 1584 done 1665 1585 1666 - if [ -z $invert ]; then 1667 - addr_ns=$ns1 1668 - subflow_ns=$ns2 1669 - elif [ $invert = "true" ]; then 1586 + if [ "$invert" = "true" ]; then 1670 1587 addr_ns=$ns2 1671 1588 subflow_ns=$ns1 1672 - extra_msg="invert" 1589 + addr="client" 1590 + subflow="server" 1673 1591 fi 1674 1592 1675 - print_check "rm" 1593 + print_check "rm addr rx ${addr}" 1676 1594 count=$(mptcp_lib_get_counter ${addr_ns} "MPTcpExtRmAddr") 1677 1595 if [ -z "$count" ]; then 1678 1596 print_skip ··· 1680 1602 print_ok 1681 1603 fi 1682 1604 1683 - print_check "rmsf" 1605 + print_check "rm subflow ${subflow}" 1684 1606 count=$(mptcp_lib_get_counter ${subflow_ns} "MPTcpExtRmSubflow") 1685 1607 if [ -z "$count" ]; then 1686 1608 print_skip ··· 1694 1616 count=$((count + cnt)) 1695 1617 if [ "$count" != "$rm_subflow_nr" ]; then 1696 1618 suffix="$count in [$rm_subflow_nr:$((rm_subflow_nr*2))]" 1697 - extra_msg+=" simult" 1619 + extra_msg="simult" 1698 1620 fi 1699 1621 if [ $count -ge "$rm_subflow_nr" ] && \ 1700 1622 [ "$count" -le "$((rm_subflow_nr *2 ))" ]; then ··· 1715 1637 { 1716 1638 local rm_addr_tx_nr=$1 1717 1639 1718 - print_check "rm TX" 1640 + print_check "rm addr tx client" 1719 1641 count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtRmAddrTx") 1720 1642 if [ -z "$count" ]; then 1721 1643 print_skip ··· 1734 1656 local mpj_syn_ack=$4 1735 1657 local count 1736 1658 1737 - print_check "ptx" 1659 + print_check "mp_prio tx server" 1738 1660 count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPPrioTx") 1739 1661 if [ -z "$count" ]; then 1740 1662 print_skip ··· 1744 1666 print_ok 1745 1667 fi 1746 1668 1747 - print_check "prx" 1669 + print_check "mp_prio rx client" 1748 1670 count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPPrioRx") 1749 1671 if [ -z "$count" ]; then 1750 1672 print_skip ··· 1987 1909 pm_nl_set_limits $ns1 0 1 1988 1910 pm_nl_set_limits $ns2 0 1 1989 1911 pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow 1912 + pm_nl_add_endpoint $ns2 10.0.12.2 flags subflow 1990 1913 speed=slow \ 1991 1914 run_tests $ns1 $ns2 10.0.1.1 1992 - chk_join_nr 0 0 0 1915 + join_bind_err=1 \ 1916 + chk_join_nr 0 0 0 1993 1917 fi 1994 1918 1995 1919 # multiple subflows, with subflow creation error ··· 2003 1923 pm_nl_add_endpoint $ns2 10.0.2.2 flags subflow 2004 1924 speed=slow \ 2005 1925 run_tests $ns1 $ns2 10.0.1.1 2006 - chk_join_nr 1 1 1 1926 + join_syn_tx=2 \ 1927 + chk_join_nr 1 1 1 2007 1928 fi 2008 1929 2009 1930 # multiple subflows, with subflow timeout on MPJ ··· 2016 1935 pm_nl_add_endpoint $ns2 10.0.2.2 flags subflow 2017 1936 speed=slow \ 2018 1937 run_tests $ns1 $ns2 10.0.1.1 2019 - chk_join_nr 1 1 1 1938 + join_syn_tx=2 \ 1939 + chk_join_nr 1 1 1 2020 1940 fi 2021 1941 2022 1942 # multiple subflows, check that the endpoint corresponding to ··· 2038 1956 2039 1957 # additional subflow could be created only if the PM select 2040 1958 # the later endpoint, skipping the already used one 2041 - chk_join_nr 1 1 1 1959 + join_syn_tx=2 \ 1960 + chk_join_nr 1 1 1 2042 1961 fi 2043 1962 } 2044 1963 ··· 2125 2042 pm_nl_add_endpoint $ns1 10.0.14.1 flags signal 2126 2043 pm_nl_set_limits $ns2 3 3 2127 2044 run_tests $ns1 $ns2 10.0.1.1 2128 - chk_join_nr 1 1 1 2045 + join_syn_tx=3 \ 2046 + chk_join_nr 1 1 1 2129 2047 chk_add_nr 3 3 2130 2048 fi 2131 2049 ··· 2294 2210 pm_nl_set_limits $ns2 2 2 2295 2211 speed=10 \ 2296 2212 run_tests $ns1 $ns2 10.0.1.1 2297 - chk_join_nr 1 1 1 2213 + join_syn_tx=2 \ 2214 + chk_join_nr 1 1 1 2298 2215 chk_add_nr 8 0 2299 2216 fi 2300 2217 } ··· 2395 2310 pm_nl_set_limits $ns2 2 2 2396 2311 addr_nr_ns1=-3 speed=10 \ 2397 2312 run_tests $ns1 $ns2 10.0.1.1 2398 - chk_join_nr 1 1 1 2313 + join_syn_tx=2 join_connect_err=1 \ 2314 + chk_join_nr 1 1 1 2399 2315 chk_add_nr 3 3 2400 2316 chk_rm_nr 3 1 invert 2401 2317 chk_rst_nr 0 0 ··· 2461 2375 pm_nl_set_limits $ns2 3 3 2462 2376 addr_nr_ns1=-8 speed=slow \ 2463 2377 run_tests $ns1 $ns2 10.0.1.1 2464 - chk_join_nr 1 1 1 2378 + join_syn_tx=3 \ 2379 + chk_join_nr 1 1 1 2465 2380 chk_add_nr 3 3 2466 2381 chk_rm_nr 3 1 invert 2467 2382 chk_rst_nr 0 0 ··· 3032 2945 3033 2946 checksum_tests() 3034 2947 { 3035 - # checksum test 0 0 3036 - if reset_with_checksum 0 0; then 3037 - pm_nl_set_limits $ns1 0 1 3038 - pm_nl_set_limits $ns2 0 1 3039 - run_tests $ns1 $ns2 10.0.1.1 3040 - chk_join_nr 0 0 0 3041 - fi 3042 - 3043 - # checksum test 1 1 3044 - if reset_with_checksum 1 1; then 3045 - pm_nl_set_limits $ns1 0 1 3046 - pm_nl_set_limits $ns2 0 1 3047 - run_tests $ns1 $ns2 10.0.1.1 3048 - chk_join_nr 0 0 0 3049 - fi 3050 - 3051 - # checksum test 0 1 3052 - if reset_with_checksum 0 1; then 3053 - pm_nl_set_limits $ns1 0 1 3054 - pm_nl_set_limits $ns2 0 1 3055 - run_tests $ns1 $ns2 10.0.1.1 3056 - chk_join_nr 0 0 0 3057 - fi 3058 - 3059 - # checksum test 1 0 3060 - if reset_with_checksum 1 0; then 3061 - pm_nl_set_limits $ns1 0 1 3062 - pm_nl_set_limits $ns2 0 1 3063 - run_tests $ns1 $ns2 10.0.1.1 3064 - chk_join_nr 0 0 0 3065 - fi 2948 + local checksum_enable 2949 + for checksum_enable in "0 0" "1 1" "0 1" "1 0"; do 2950 + # checksum test 0 0, 1 1, 0 1, 1 0 2951 + if reset_with_checksum ${checksum_enable}; then 2952 + pm_nl_set_limits $ns1 0 1 2953 + pm_nl_set_limits $ns2 0 1 2954 + run_tests $ns1 $ns2 10.0.1.1 2955 + chk_join_nr 0 0 0 2956 + fi 2957 + done 3066 2958 } 3067 2959 3068 2960 deny_join_id0_tests() ··· 3230 3164 MPTCP_LIB_SUBTEST_FLAKY=1 3231 3165 test_linkfail=1024 fastclose=server \ 3232 3166 run_tests $ns1 $ns2 10.0.1.1 3233 - chk_join_nr 0 0 0 0 0 0 1 3167 + join_rst_nr=1 \ 3168 + chk_join_nr 0 0 0 3234 3169 chk_fclose_nr 1 1 invert 3235 3170 chk_rst_nr 1 1 3236 3171 fi ··· 3250 3183 MPTCP_LIB_SUBTEST_FLAKY=1 3251 3184 test_linkfail=128 \ 3252 3185 run_tests $ns1 $ns2 10.0.1.1 3253 - chk_join_nr 0 0 0 +1 +0 1 0 1 "$(pedit_action_pkts)" 3186 + join_csum_ns1=+1 join_csum_ns2=+0 \ 3187 + join_fail_nr=1 join_rst_nr=0 join_infi_nr=1 \ 3188 + join_corrupted_pkts="$(pedit_action_pkts)" \ 3189 + chk_join_nr 0 0 0 3254 3190 chk_fail_nr 1 -1 invert 3255 3191 fi 3256 3192 ··· 3266 3196 pm_nl_add_endpoint $ns2 10.0.2.2 dev ns2eth2 flags subflow 3267 3197 test_linkfail=1024 \ 3268 3198 run_tests $ns1 $ns2 10.0.1.1 3269 - chk_join_nr 1 1 1 1 0 1 1 0 "$(pedit_action_pkts)" 3199 + join_csum_ns1=1 join_csum_ns2=0 \ 3200 + join_fail_nr=1 join_rst_nr=1 join_infi_nr=0 \ 3201 + join_corrupted_pkts="$(pedit_action_pkts)" \ 3202 + chk_join_nr 1 1 1 3270 3203 fi 3271 3204 } 3272 3205 ··· 3521 3448 continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then 3522 3449 set_userspace_pm $ns1 3523 3450 pm_nl_set_limits $ns2 2 2 3524 - speed=5 \ 3525 - run_tests $ns1 $ns2 10.0.1.1 & 3451 + { speed=5 \ 3452 + run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null 3526 3453 local tests_pid=$! 3527 3454 wait_mpj $ns1 3528 3455 userspace_pm_add_addr $ns1 10.0.2.1 10 ··· 3554 3481 continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then 3555 3482 set_userspace_pm $ns2 3556 3483 pm_nl_set_limits $ns1 0 1 3557 - speed=5 \ 3558 - run_tests $ns1 $ns2 10.0.1.1 & 3484 + { speed=5 \ 3485 + run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null 3559 3486 local tests_pid=$! 3560 3487 wait_mpj $ns2 3561 3488 userspace_pm_add_sf $ns2 10.0.3.2 20 ··· 3582 3509 continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then 3583 3510 set_userspace_pm $ns2 3584 3511 pm_nl_set_limits $ns1 0 1 3585 - speed=5 \ 3586 - run_tests $ns1 $ns2 10.0.1.1 & 3512 + { speed=5 \ 3513 + run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null 3587 3514 local tests_pid=$! 3588 3515 wait_mpj $ns2 3589 3516 chk_mptcp_info subflows 0 subflows 0 ··· 3603 3530 continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then 3604 3531 set_userspace_pm $ns2 3605 3532 pm_nl_set_limits $ns1 0 1 3606 - speed=5 \ 3607 - run_tests $ns1 $ns2 10.0.1.1 & 3533 + { speed=5 \ 3534 + run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null 3608 3535 local tests_pid=$! 3609 3536 wait_mpj $ns2 3610 3537 userspace_pm_add_sf $ns2 10.0.3.2 20 ··· 3627 3554 continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then 3628 3555 set_userspace_pm $ns1 3629 3556 pm_nl_set_limits $ns2 1 1 3630 - speed=5 \ 3631 - run_tests $ns1 $ns2 10.0.1.1 & 3557 + { speed=5 \ 3558 + run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null 3632 3559 local tests_pid=$! 3633 3560 wait_mpj $ns1 3634 3561 userspace_pm_add_addr $ns1 10.0.2.1 10 ··· 3658 3585 pm_nl_set_limits $ns1 2 2 3659 3586 pm_nl_set_limits $ns2 2 2 3660 3587 pm_nl_add_endpoint $ns1 10.0.2.1 flags signal 3661 - speed=slow \ 3662 - run_tests $ns1 $ns2 10.0.1.1 & 3588 + { speed=slow \ 3589 + run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null 3663 3590 local tests_pid=$! 3664 3591 3665 3592 wait_mpj $ns1 ··· 3685 3612 pm_nl_set_limits $ns2 0 3 3686 3613 pm_nl_add_endpoint $ns2 10.0.1.2 id 1 dev ns2eth1 flags subflow 3687 3614 pm_nl_add_endpoint $ns2 10.0.2.2 id 2 dev ns2eth2 flags subflow 3688 - test_linkfail=4 speed=5 \ 3689 - run_tests $ns1 $ns2 10.0.1.1 & 3615 + { test_linkfail=4 speed=5 \ 3616 + run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null 3690 3617 local tests_pid=$! 3691 3618 3692 3619 wait_mpj $ns2 ··· 3748 3675 chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 6 3749 3676 chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_CLOSED 5 # one has been closed before estab 3750 3677 3751 - chk_join_nr 6 6 6 3678 + join_syn_tx=7 \ 3679 + chk_join_nr 6 6 6 3752 3680 chk_rm_nr 4 4 3753 3681 fi 3754 3682 ··· 3762 3688 # broadcast IP: no packet for this address will be received on ns1 3763 3689 pm_nl_add_endpoint $ns1 224.0.0.1 id 2 flags signal 3764 3690 pm_nl_add_endpoint $ns1 10.0.1.1 id 42 flags signal 3765 - test_linkfail=4 speed=5 \ 3766 - run_tests $ns1 $ns2 10.0.1.1 & 3691 + { test_linkfail=4 speed=5 \ 3692 + run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null 3767 3693 local tests_pid=$! 3768 3694 3769 3695 wait_mpj $ns2 ··· 3821 3747 chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 5 3822 3748 chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_CLOSED 3 3823 3749 3824 - chk_join_nr 5 5 5 3750 + join_connect_err=1 \ 3751 + chk_join_nr 5 5 5 3825 3752 chk_add_nr 6 6 3826 3753 chk_rm_nr 4 3 invert 3827 3754 fi ··· 3835 3760 # broadcast IP: no packet for this address will be received on ns1 3836 3761 pm_nl_add_endpoint $ns1 224.0.0.1 id 2 flags signal 3837 3762 pm_nl_add_endpoint $ns2 10.0.3.2 id 3 flags subflow 3838 - test_linkfail=4 speed=20 \ 3839 - run_tests $ns1 $ns2 10.0.1.1 & 3763 + { test_linkfail=4 speed=20 \ 3764 + run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null 3840 3765 local tests_pid=$! 3841 3766 3842 3767 wait_attempt_fail $ns2 ··· 3853 3778 wait_mpj $ns2 3854 3779 mptcp_lib_kill_wait $tests_pid 3855 3780 3856 - chk_join_nr 2 2 2 3781 + join_syn_tx=3 join_connect_err=1 \ 3782 + chk_join_nr 2 2 2 3857 3783 chk_add_nr 2 2 3858 3784 chk_rm_nr 1 0 invert 3859 3785 fi
+2 -8
tools/testing/selftests/net/mptcp/pm_nl_ctl.c
··· 19 19 20 20 #include "linux/mptcp.h" 21 21 22 - #ifndef MPTCP_PM_NAME 23 - #define MPTCP_PM_NAME "mptcp_pm" 24 - #endif 25 - #ifndef MPTCP_PM_EVENTS 26 - #define MPTCP_PM_EVENTS "mptcp_pm_events" 27 - #endif 28 22 #ifndef IPPROTO_MPTCP 29 23 #define IPPROTO_MPTCP 262 30 24 #endif ··· 110 116 111 117 if (setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, 112 118 &event_group, sizeof(event_group)) < 0) 113 - error(1, errno, "could not join the " MPTCP_PM_EVENTS " mcast group"); 119 + error(1, errno, "could not join the " MPTCP_PM_EV_GRP_NAME " mcast group"); 114 120 115 121 do { 116 122 FD_ZERO(&rfds); ··· 282 288 if (grp->rta_type == CTRL_ATTR_MCAST_GRP_ID) 283 289 *events_mcast_grp = *(__u32 *)RTA_DATA(grp); 284 290 else if (grp->rta_type == CTRL_ATTR_MCAST_GRP_NAME && 285 - !strcmp(RTA_DATA(grp), MPTCP_PM_EVENTS)) 291 + !strcmp(RTA_DATA(grp), MPTCP_PM_EV_GRP_NAME)) 286 292 got_events_grp = 1; 287 293 288 294 grp = RTA_NEXT(grp, grp_len);