[MPTCP][PATCH mptcp-next] Squash to "mptcp: use WRITE_ONCE/READ_ONCE for the pernet *_max"
by Geliang Tang
As Jakub suggested, drop all the READ_ONCEs in the original patch.
And the commit message needs to be updated too:
-
Subject: mptcp: use WRITE_ONCE for the pernet *_max
This patch uses WRITE_ONCE() for all the pernet add_addr_signal_max,
add_addr_accept_max, local_addr_max and subflows_max fields in struct
pm_nl_pernet to avoid concurrency issues.
-
Signed-off-by: Geliang Tang <geliangtang(a)gmail.com>
---
net/mptcp/pm_netlink.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index 7d6081d9a1db..c429bd82313e 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -616,11 +616,11 @@ static int mptcp_pm_nl_append_new_local_addr(struct pm_nl_pernet *pernet,
pernet->next_id = entry->addr.id;
if (entry->addr.flags & MPTCP_PM_ADDR_FLAG_SIGNAL) {
- addr_max = READ_ONCE(pernet->add_addr_signal_max);
+ addr_max = pernet->add_addr_signal_max;
WRITE_ONCE(pernet->add_addr_signal_max, addr_max + 1);
}
if (entry->addr.flags & MPTCP_PM_ADDR_FLAG_SUBFLOW) {
- addr_max = READ_ONCE(pernet->local_addr_max);
+ addr_max = pernet->local_addr_max;
WRITE_ONCE(pernet->local_addr_max, addr_max + 1);
}
@@ -932,11 +932,11 @@ static int mptcp_nl_cmd_del_addr(struct sk_buff *skb, struct genl_info *info)
return -EINVAL;
}
if (entry->addr.flags & MPTCP_PM_ADDR_FLAG_SIGNAL) {
- addr_max = READ_ONCE(pernet->add_addr_signal_max);
+ addr_max = pernet->add_addr_signal_max;
WRITE_ONCE(pernet->add_addr_signal_max, addr_max - 1);
}
if (entry->addr.flags & MPTCP_PM_ADDR_FLAG_SUBFLOW) {
- addr_max = READ_ONCE(pernet->local_addr_max);
+ addr_max = pernet->local_addr_max;
WRITE_ONCE(pernet->local_addr_max, addr_max - 1);
}
@@ -1140,12 +1140,12 @@ mptcp_nl_cmd_set_limits(struct sk_buff *skb, struct genl_info *info)
int ret;
spin_lock_bh(&pernet->lock);
- rcv_addrs = READ_ONCE(pernet->add_addr_accept_max);
+ rcv_addrs = pernet->add_addr_accept_max;
ret = parse_limit(info, MPTCP_PM_ATTR_RCV_ADD_ADDRS, &rcv_addrs);
if (ret)
goto unlock;
- subflows = READ_ONCE(pernet->subflows_max);
+ subflows = pernet->subflows_max;
ret = parse_limit(info, MPTCP_PM_ATTR_SUBFLOWS, &subflows);
if (ret)
goto unlock;
--
2.29.2
1 year, 3 months
[PATCH net-next v3] mptcp: fix length of MP_PRIO suboption
by Davide Caratti
With version 0 of the protocol it was legal to encode the 'Subflow Id' in
the MP_PRIO suboption, to specify which subflow would change its 'Backup'
flag. This has been removed from v1 specification: thus, according to RFC
8684 §3.3.8, the resulting 'Length' for MP_PRIO changed from 4 to 3 byte.
Current Linux generates / parses MP_PRIO according to the old spec, using
'Length' equal to 4, and hardcoding 1 as 'Subflow Id'; RFC compliance can
improve if we change 'Length' in other to become 3, leaving a 'Nop' after
the MP_PRIO suboption. In this way the kernel will emit and accept *only*
MP_PRIO suboptions that are compliant to version 1 of the MPTCP protocol.
unpatched 5.11-rc kernel:
[root@bottarga ~]# tcpdump -tnnr unpatched.pcap | grep prio
reading from file unpatched.pcap, link-type LINUX_SLL (Linux cooked v1)
dropped privs to tcpdump
IP 10.0.3.2.48433 > 10.0.1.1.10006: Flags [.], ack 1, win 502, options [nop,nop,TS val 4032325513 ecr 1876514270,mptcp prio non-backup id 1,mptcp dss ack 14084896651682217737], length 0
patched 5.11-rc kernel:
[root@bottarga ~]# tcpdump -tnnr patched.pcap | grep prio
reading from file patched.pcap, link-type LINUX_SLL (Linux cooked v1)
dropped privs to tcpdump
IP 10.0.3.2.49735 > 10.0.1.1.10006: Flags [.], ack 1, win 502, options [nop,nop,TS val 1276737699 ecr 2686399734,mptcp prio non-backup,nop,mptcp dss ack 18433038869082491686], length 0
Changes since v2:
- when accounting for option space, don't increment 'TCPOLEN_MPTCP_PRIO'
and use 'TCPOLEN_MPTCP_PRIO_ALIGN' instead, thanks to Matthieu Baerts.
Changes since v1:
- refactor patch to avoid using 'TCPOLEN_MPTCP_PRIO' with its old value,
thanks to Geliang Tang.
Fixes: 067065422fcd ("mptcp: add the outgoing MP_PRIO support")
Signed-off-by: Davide Caratti <dcaratti(a)redhat.com>
---
net/mptcp/options.c | 5 +++--
net/mptcp/protocol.h | 3 ++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 775f0576592e..bb874c5d663a 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -699,10 +699,11 @@ static bool mptcp_established_options_mp_prio(struct sock *sk,
if (!subflow->send_mp_prio)
return false;
- if (remaining < TCPOLEN_MPTCP_PRIO)
+ /* account for the trailing 'nop' option */
+ if (remaining < TCPOLEN_MPTCP_PRIO_ALIGN)
return false;
- *size = TCPOLEN_MPTCP_PRIO;
+ *size = TCPOLEN_MPTCP_PRIO_ALIGN;
opts->suboptions |= OPTION_MPTCP_PRIO;
opts->backup = subflow->request_bkup;
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 447ce4631b43..d31edbae8da8 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -61,7 +61,8 @@
#define TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT 24
#define TCPOLEN_MPTCP_PORT_LEN 4
#define TCPOLEN_MPTCP_RM_ADDR_BASE 4
-#define TCPOLEN_MPTCP_PRIO 4
+#define TCPOLEN_MPTCP_PRIO 3
+#define TCPOLEN_MPTCP_PRIO_ALIGN 4
#define TCPOLEN_MPTCP_FASTCLOSE 12
/* MPTCP MP_JOIN flags */
--
2.29.2
1 year, 3 months
[PATCH net-next 00/16] mptcp: ADD_ADDR enhancements
by Mat Martineau
This patch series from the MPTCP tree contains enhancements and
associated tests for the ADD_ADDR ("add address") MPTCP option. This
option allows already-connected MPTCP peers to share additional IP
addresses with each other, which can then be used to create additional
subflows within those MPTCP connections.
Patches 1 & 2 remove duplicated data in the per-connection path manager
structure.
Patches 3-6 initiate additional subflows when an address is added using
the netlink path manager interface and improve ADD_ADDR signaling
reliability, subject to configured limits. Self tests are also updated.
Patches 7-15 add new support for optional port numbers in ADD_ADDR. This
includes creating an additional in-kernel TCP listening socket for the
requested port number, validating the port number when processing
incoming subflow connections, including the port number in netlink
interfaces, and adding some new MIBs. New self test cases are added for
subflows connecting with alternate port numbers.
Patch 16 refactors the self test script containing the ADD_ADDR test
cases, allowing developers to quickly run a subset of the tests.
Geliang Tang (16):
mptcp: use WRITE_ONCE/READ_ONCE for the pernet *_max
mptcp: drop *_max fields in mptcp_pm_data
mptcp: create subflow or signal addr for newly added address
mptcp: send ack for every add_addr
selftests: mptcp: use minus values for removing address numbers
selftests: mptcp: add testcases for newly added addresses
mptcp: create the listening socket for new port
mptcp: drop unused skb in subflow_token_join_request
mptcp: add a new helper subflow_req_create_thmac
mptcp: add port number check for MP_JOIN
mptcp: enable use_port when invoke addresses_equal
mptcp: deal with MPTCP_PM_ADDR_ATTR_PORT in PM netlink
selftests: mptcp: add port argument for pm_nl_ctl
mptcp: add the mibs for ADD_ADDR with port
selftests: mptcp: add testcases for ADD_ADDR with port
selftests: mptcp: add command line arguments for mptcp_join.sh
net/mptcp/mib.c | 6 +
net/mptcp/mib.h | 6 +
net/mptcp/mptcp_diag.c | 6 +-
net/mptcp/options.c | 4 +
net/mptcp/pm.c | 12 +-
net/mptcp/pm_netlink.c | 295 ++++-
net/mptcp/protocol.c | 2 +-
net/mptcp/protocol.h | 12 +-
net/mptcp/subflow.c | 79 +-
.../testing/selftests/net/mptcp/mptcp_join.sh | 1095 +++++++++++------
tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 24 +-
11 files changed, 1084 insertions(+), 457 deletions(-)
base-commit: 32e31b78272ba0905c751a0f6ff6ab4c275a780e
--
2.30.0
1 year, 3 months
[MPTCP][PATCH mptcp-next 0/8] RM_ADDR: remove a list of addrs
by Geliang Tang
This patchset added the removing a list of addresses support for
RM_ADDR. It addressed issue #140.
tag: export/20210129T064739
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/140
Geliang Tang (8):
mptcp: remove multi addrs on outgoing path
mptcp: remove multi addrs on incoming path
mptcp: add removing multi addrs support in PM
mptcp: add removing multi addrs support in netlink
mptcp: implement mptcp_nl_remove_addrs_and_subflows
mptcp: remove a list of addrs when flushing
mptcp: update the netlink event for rm_addr
selftests: mptcp: add testcases for removing addrs
include/net/mptcp.h | 2 +-
include/uapi/linux/mptcp.h | 1 +
net/mptcp/options.c | 53 +++--
net/mptcp/pm.c | 26 +--
net/mptcp/pm_netlink.c | 182 ++++++++++++++----
net/mptcp/protocol.h | 23 ++-
.../testing/selftests/net/mptcp/mptcp_join.sh | 23 +++
7 files changed, 235 insertions(+), 75 deletions(-)
--
2.29.2
1 year, 3 months
[MPTCP][RFC mptcp-next 0/6] add trace events
by Geliang Tang
This patchset addressed issues 131, replace some/most pr_debug with trace
events.
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/131
Geliang Tang (6):
mptcp: add tracepoints for data operations
mptcp: add echo field in mptcp_out_options
mptcp: add tracepoints for options operations
mptcp: add mptcpi_local_addr_* in mptcp_info
mptcp: add tracepoints for PM operations
mptcp: add tracepoints for subflow operations
include/net/mptcp.h | 1 +
include/trace/events/mptcp.h | 408 +++++++++++++++++++++++++++++++++++
include/uapi/linux/mptcp.h | 4 +-
net/mptcp/mptcp_diag.c | 4 +-
net/mptcp/options.c | 11 +-
net/mptcp/pm.c | 3 +
net/mptcp/pm_netlink.c | 6 +-
net/mptcp/protocol.c | 5 +
net/mptcp/protocol.h | 1 +
net/mptcp/subflow.c | 6 +
10 files changed, 445 insertions(+), 4 deletions(-)
create mode 100644 include/trace/events/mptcp.h
--
2.29.2
1 year, 3 months
[Weekly meetings] MoM - 28th of January 2021
by Matthieu Baerts
Hello everyone,
Today, we just had our 133rd meeting with Mat and Ossama (Intel),
Christoph (Apple), Paolo, Davide and Florian (RedHat) and myself (Tessares).
Thanks again for this new good meeting!
Here are the minutes of the meeting:
Accepted patches:
- The list of accepted patches can be seen on PatchWork:
https://patchwork.ozlabs.org/project/mptcp/list/?state=3
netdev (if mptcp ML is in cc) (Mat Martineau (commits from Geliang
and Matthieu)):
1431345 [net-next,5/5] selftests: increase timeout to 10 min
1431343 [net-next,4/5] selftests: mptcp: add IPv4-mapped IPv6 testcases
1431340 [net-next,3/5] mptcp: pm nl: reduce variable scope
1431341 [net-next,2/5] mptcp: pm nl: support IPv4 mapped in v6 addresses
1431344 [net-next,1/5] mptcp: support MPJoin with IPv4 mapped in v6 sk
our repo (by: Florian Westphal, Geliang Tang):
1430293 [v3,mptcp-next] mptcp: send ack for every add_addr:
- changing a bit the behaviour, normal.
1429292 [v2,mptcp-next,5/5] mptcp: add netlink event support
1429320 [v2,mptcp-next,4/5] genetlink: add CAP_NET_ADMIN test for
multicast b...
1429291 [v2,mptcp-next,3/5] mptcp: avoid lock_fast usage in accept path
1429290 [v2,mptcp-next,2/5] mptcp: pass subflow socket to a few helpers
1429289 [v2,mptcp-next,1/5] mptcp: split __mptcp_close_ssk helper:
- *Ossama and Mat* are validating it.
Pending patches:
- The list of pending patches can be seen on PatchWork:
https://patchwork.ozlabs.org/project/mptcp/list/?state=*
netdev (if mptcp ML is in cc) (by: /):
/
our repo (by: Davide Caratti, Florian Westphal, Geliang Tang):
1370700: RFC: [RFC,2/4] tcp: move selected mptcp helpers to tcp.h/mptcp.h
1370702: RFC: [RFC,4/4] tcp: parse tcp options contained in reset packets
1375893: RFC: [RFC,mptpcp-next] mptcp: add ooo prune support
1395128: RFC: [1/5] tcp: make two mptcp helpers available to tcp stack
1395131: RFC: [3/5] mptcp: add mptcp reset option support
1395133: RFC: [5/5] mptcp: send fastclose if userspace closes socket
with unread data
1426554: Changes Requested: [PATCHi,iproute2] mptcp: add support for
event monitoring:
- Depending on the kernel patches that are being validated by
Ossama and Mat
1431688: New: [RFC,mptcp-next,1/6] mptcp: add tracepoints for data
operations
1431689: New: [RFC,mptcp-next,2/6] mptcp: add echo field in
mptcp_out_options
1431690: New: [RFC,mptcp-next,3/6] mptcp: add tracepoints for options
operations
1431691: New: [RFC,mptcp-next,4/6] mptcp: add mptcpi_local_addr_* in
mptcp_info
1431692: New: [RFC,mptcp-next,5/6] mptcp: add tracepoints for PM operations
1431693: New: [RFC,mptcp-next,6/6] mptcp: add tracepoints for subflow
operations:
- Tracepoints have been added, we need to double check if they are
at the right place with the right args as it is difficult to modify
- Waiting for review (it might take some time to review it because
of what is said at the previous line)
1432790: Changes Requested: [net-next,v2] net: mptcp: fix length of
MP_PRIO sub-option:
- for net-next only
- small idea of modification sent
- v3 will be sent later
Issues on Github:
https://github.com/multipath-tcp/mptcp_net-next/issues/
Recently opened (latest from last week: 141)
146 DATA_FIN is not retransmitted on timeout [bug]:
- Could be reproduced with packetdrill
145 EADDRINUSE even if SO_REUSEADDR is set [bug]:
- With the data-fin state machine, we have an issue there
- Paolo is trying to reproduce the issue with Packetdrill to
avoid regression
143 Packetdrill: ADD_ADDR for v6 only socket should only contain v6
addresses [enhancement] [packetdrill]:
- For the moment, some tests are executed in v4 and v4-mapped
only (suffixed with "v4.pkt")
- because they are not compatible with v6 only: Packetdrill
expect to see a v4 address in the ADD_ADDR
142 packetdrill: support injecting ADD_ADDR echo bit [enhancement]
[packetdrill] @dcaratti:
- There are some TODO in the packetdrill scripts: we cannot
inject ADD_ADDR with echo bit for the moment
- Davide is looking at that
Bugs (opened, flagged as "bug" and assigned)
/
Bugs (opened and flagged as "bug" and not assigned)
146 DATA_FIN is not retransmitted on timeout [bug]:
- assigned to *Mat*
145 EADDRINUSE even if SO_REUSEADDR is set [bug]:
- assigned to *Paolo*
137 selftests: simult_flows.sh: unbalanced bwidth tests are unstable
[bug]:
- still unstable from time to time
136 [syzkaller] WARNING in sk_stream_kill_queues [bug] [syzkaller]:
- KFENCE enabled? → seems not
- *@Christoph* could you retry with the patch even if KFence is
not enabled
135 [syzkaller] WARNING in __mptcp_destroy_sock [bug] [syzkaller]
130 [syzkaller] WARNING in mptcp_token_destroy_request [bug]
[syzkaller]:
- Not happening anymore
- TODO: can be closed → done
125 [syzkaller] KASAN: wild-memory-access Write in
subflow_req_destructor [bug] [syzkaller]
120 [interop] netnext is dropping packets, causing MPTCP-level
retransmissions on mptcp.org [bug]
119 [syzkaller] memory leak in __get_filter [bug] [syzkaller]
112 sporadic failure of mptcp_join.sh selftest 13 [bug]:
- *@Davide* may you retry now that we have "mptcp: send ack for
every add_addr" in our tree?
- Probably we can close this one!
- TODO: assign ticket to Davide → Done
110 [syzkaller] memory leak in __ip_mc_join_group [bug] [syzkaller]
107 Review use of WARN_ON() / WARN_ON_ONCE() [bug]
65 clearing properly the status in listen() [bug]
56 msk connection state set without msk lock [bug]
In Progress (opened and assigned)
142 packetdrill: support injecting ADD_ADDR echo bit [enhancement]
[packetdrill] @dcaratti
140 RM_ADDR: remove a list of addresses [enhancement] @geliangtang
134 Checksum support [enhancement] @geliangtang
131 replace some/most pr_debug with trace events [enhancement]
@geliangtang
96 Python: add support for IPPROTO_MPTCP [enhancement] @matttbe
76 [gs]etsockopt per subflow: BPF [enhancement] @matttbe
60 PM: netlink: events per connection [enhancement] @fw-strlen
54 ADD_ADDR: ports support [enhancement] @geliangtang
51 MP_PRIO support [enhancement] @geliangtang
Recently closed (since last week)
144 Packetdrill: ADD_ADDR are now sent sooner [bug] [packetdrill]
@matttbe:
- Due to "mptcp: send ack for every add_addr" but that's normal
139 selftests: mptcp_join.sh: ADD_ADDR timeout issue [bug] @geliangtang:
- Thanks to "mptcp: send ack for every add_addr"
94 Packetdrill: after a received DATA_FIN, no new packets can be
treated [bug] [packetdrill] @dcaratti
- Not able to repro
FYI: Current Roadmap:
- Bugs: https://github.com/multipath-tcp/mptcp_net-next/projects/2
- Current merge window (5.12):
https://github.com/multipath-tcp/mptcp_net-next/projects/7
- For later: https://github.com/multipath-tcp/mptcp_net-next/projects/4
Patches to send to netdev:
- net:
- /
- net-next:
- All patches related to ADD_ADDR (including accepting MP_JOIN
on another port)
- *@Mat* is going to send them
Extra tests:
- news about Syzkaller? (Christoph):
- Status has been updated on Github
- Will look at them again and close the obsolete ones
- news about interop with mptcp.org? (Christoph):
- /
- news about Intel's kbuild? (Mat):
- code building fine but automation problems there, not our fault
- packetdrill (Davide):
- *Davide* is working on issue 51: adding MP_PRIO support in
packetdrill
- covscan:
- reporting a possible division by 0 on the code that has been
fixed
- probably a false positive because it is not a simple "if !=
0" just before but in the path, we make sure it doesn't come with that.
- CI (Matth):
- Working on having the tests on GH Actions
Benchmarking:
- net-next, TCP vs MPTCP
- much better! ~10% gap compared to plain TCP
- we scale quite well with multiple subflows, quite linearly
without CPU bounded
- with CPU bounded (without zero copy stuff, etc.), adding multiple
subflows improve perf a bit because the load is spread on multiple
subflows → better than plain TCP!
→ was on baremetal, with loopback and different peers and a couple
of NICs (== 2)
→ Nice work team! (kudos to *Paolo* for the optimizations and the
very few refactoring changes!)
- With VM: on virtio xmit/receive is much more costly with MPTCP
- reducing the lock might help even more! But doesn't seem urgent.
- could be good to have perf regression tests
mptcpd:
- New version 0.6 released by Ossama!
- ChangeLog:
- Mptcpd now supports versions of the Embedded Linux Library
(ELL) greater than 0.33.
- Plugins should use the new MPTCPD_PLUGIN_DEFINE()
preprocessor macro instead of L_PLUGIN_DEFINE().
- A pointer to the mptcpd path manager object, i.e. struct
mptcpd *pm, is now passed to the plugin init and exit functions. This
allows plugins to potentially perform mptcpd path manager related
operations during initialization and finalization.
- Support for the MPTCP netlink path manager in the upstream
Linux kernel is now available. A new set of path management command
functions corresponding to those available in the kernel netlink path
management API has been added to the <mptcpd/path_manager.h> header. The
new functions allow plugins to retrieve IP address information, flush
addresses, and modify MPTCP resource limits.
- The mptcpd_pm_add_addr() (formerly mptcpd_pm_send_addr()) and
mptcpd_pm_remove_addr() function parameters have been modified in order
to support both the upstream and multipath-tcp.org kernels.
- Mptcpd path management command functions declared in
<mptcpd/path_manager.h> now return zero on success and -1 or an errno on
failure instead of a bool.
- A MPTCP address ID manager mptcpd_idm interface was
introduced that mptcpd plugins may leverage to map an IP address to a
MPTCP address ID, as well as to track used and unused IDs. The interface
is defined in the new <mptcpd/id_manager.h> header.
- A new address advertising plugin, addr_adv, has been added.
It simply triggers a MPTCP ADD_ADDR when a new IP address is detected by
the mptcpd network monitor. Similarly, a MPTCP REMOVE_ADDR is triggered
when an IP address is no longer available.
- MPTCP netlink command error message logging was improved to
be more descriptive when possible.
- Not supporting Netlink events from the upstream kernel (export
branch only)
- 0.5.1 will be part of Fedora 34!
- Hopefully, the update to 0.6.0 would be easier
- Interaction with Network Manager?:
- Should be technically possible, ideally with DBus, but not
planned now
Next meeting:
- We propose to have the next meeting on Thursday, the 4th of February.
- Usual UTC time: 16:00 UTC (8am PST, 5pm CET, Midnight CST)
- Still open to everyone!
- https://annuel2.framapad.org/p/mptcp_upstreaming_20210204
Feel free to comment on these points and propose new ones for the next
meeting!
Talk to you on Thursday,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
1 year, 3 months
[PATCH net-next v2] net: mptcp: fix length of MP_PRIO sub-option
by Davide Caratti
With version 0 of the protocol it was legal to encode the 'Subflow Id' in
the MP_PRIO suboption, to specify which subflow would change its 'Backup'
flag. This has been removed from v1 specification: thus, according to RFC
8684 §3.3.8, the resulting 'Length' for MP_PRIO changed from 4 to 3 byte.
Current Linux generates / parses MP_PRIO according to the old spec, using
'Length' equal to 4, and hardcoding 1 as 'Subflow Id'; RFC compliance can
improve if we change 'Length' in other to become 3, leaving a 'Nop' after
the MP_PRIO suboption. In this way the kernel will emit and accept *only*
MP_PRIO suboptions that are compliant to version 1 of the MPTCP protocol.
unpatched 5.11-rc kernel:
[root@bottarga ~]# tcpdump -tnnr unpatched.pcap | grep prio
reading from file unpatched.pcap, link-type LINUX_SLL (Linux cooked v1)
dropped privs to tcpdump
IP 10.0.3.2.48433 > 10.0.1.1.10006: Flags [.], ack 1, win 502, options [nop,nop,TS val 4032325513 ecr 1876514270,mptcp prio non-backup id 1,mptcp dss ack 14084896651682217737], length 0
patched 5.11-rc kernel:
[root@bottarga ~]# tcpdump -tnnr patched.pcap | grep prio
reading from file patched.pcap, link-type LINUX_SLL (Linux cooked v1)
dropped privs to tcpdump
IP 10.0.3.2.49735 > 10.0.1.1.10006: Flags [.], ack 1, win 502, options [nop,nop,TS val 1276737699 ecr 2686399734,mptcp prio non-backup,nop,mptcp dss ack 18433038869082491686], length 0
Changes since v1:
- refactor patch to avoid using 'TCPOLEN_MPTCP_PRIO' with its old value,
thanks to Geliang Tang.
Fixes: 067065422fcd ("mptcp: add the outgoing MP_PRIO support")
Signed-off-by: Davide Caratti <dcaratti(a)redhat.com>
---
net/mptcp/options.c | 5 +++--
net/mptcp/protocol.h | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 775f0576592e..6e088c583992 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -699,10 +699,11 @@ static bool mptcp_established_options_mp_prio(struct sock *sk,
if (!subflow->send_mp_prio)
return false;
- if (remaining < TCPOLEN_MPTCP_PRIO)
+ /* account for the trailing 'nop' option */
+ if (remaining < TCPOLEN_MPTCP_PRIO + 1)
return false;
- *size = TCPOLEN_MPTCP_PRIO;
+ *size = TCPOLEN_MPTCP_PRIO + 1;
opts->suboptions |= OPTION_MPTCP_PRIO;
opts->backup = subflow->request_bkup;
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 447ce4631b43..c61f5731eccd 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -61,7 +61,7 @@
#define TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT 24
#define TCPOLEN_MPTCP_PORT_LEN 4
#define TCPOLEN_MPTCP_RM_ADDR_BASE 4
-#define TCPOLEN_MPTCP_PRIO 4
+#define TCPOLEN_MPTCP_PRIO 3
#define TCPOLEN_MPTCP_FASTCLOSE 12
/* MPTCP MP_JOIN flags */
--
2.29.2
1 year, 3 months
[PATCH net] net: mptcp: fix length of MP_PRIO sub-option
by Davide Caratti
With version 0 of the protocol it was legal to encode the 'Subflow Id' in
the MP_PRIO suboption, to specify which subflow would change its 'Backup'
flag. This has been removed from v1 specification: thus, according to RFC
8684 §3.3.8, the resulting 'Length' of MP_PRIO changed from 4 to 3 bytes.
Current Linux generates / parses MP_PRIO according to the old spec, using
'Length' equal to 4, and hardcoding 1 as 'Subflow Id'; RFC compliance can
improve if we change 'Length' in other to become 3, leaving a 'Nop' after
the MP_PRIO suboption. In this way the kernel will emit and accept *only*
MP_PRIO suboptions that are compliant to version 1 of the MPTCP protocol.
unpatched kernel:
$ tcpdump --number -tnnr unpatched.pcap | grep prio
reading from file unpatched.pcap, link-type LINUX_SLL (Linux cooked v1), snapshot length 65535
76 IP 10.0.1.1.10006 > 10.0.1.2.53982: Flags [.], ack 301, win 256, options [nop,nop,TS val 600859890 ecr 1213685745,mptcp prio non-backup id 1,mptcp dss ack 13257926699604102366], length 0
77 IP 10.0.3.2.40019 > 10.0.1.1.10006: Flags [.], ack 1, win 256, options [nop,nop,TS val 2488720994 ecr 3187547357,mptcp prio non-backup id 1,mptcp dss ack 4016099686801387019], length 0
patched kernel:
$ tcpdump --number -tnnr patched.pcap | grep prio
reading from file patched.pcap, link-type LINUX_SLL (Linux cooked v1), snapshot length 65535
77 IP 10.0.1.1.10006 > 10.0.1.2.44058: Flags [.], ack 301, win 509, options [nop,nop,TS val 1313569662 ecr 1198445302,mptcp prio non-backup,nop,mptcp dss ack 14169869632263667042], length 0
78 IP 10.0.3.2.42645 > 10.0.1.1.10006: Flags [.], ack 1, win 502, options [nop,nop,TS val 4000297703 ecr 2471781012,mptcp prio non-backup,nop,mptcp dss ack 5132559192566117977], length 0
Fixes: 40453a5c61f4 ("mptcp: add the incoming MP_PRIO support")
Fixes: 067065422fcd ("mptcp: add the outgoing MP_PRIO support")
Signed-off-by: Davide Caratti <dcaratti(a)redhat.com>
---
net/mptcp/options.c | 4 ++--
net/mptcp/protocol.h | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 775f0576592e..bb9230dda9fe 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -283,7 +283,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
break;
case MPTCPOPT_MP_PRIO:
- if (opsize != TCPOLEN_MPTCP_PRIO)
+ if (opsize != TCPOLEN_MPTCP_PRIO_NOID)
break;
mp_opt->mp_prio = 1;
@@ -1224,7 +1224,7 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
subflow->send_mp_prio = 0;
*ptr++ = mptcp_option(MPTCPOPT_MP_PRIO,
- TCPOLEN_MPTCP_PRIO,
+ TCPOLEN_MPTCP_PRIO_NOID,
opts->backup, TCPOPT_NOP);
}
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 447ce4631b43..7e18bbfe8f43 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -62,6 +62,7 @@
#define TCPOLEN_MPTCP_PORT_LEN 4
#define TCPOLEN_MPTCP_RM_ADDR_BASE 4
#define TCPOLEN_MPTCP_PRIO 4
+#define TCPOLEN_MPTCP_PRIO_NOID 3
#define TCPOLEN_MPTCP_FASTCLOSE 12
/* MPTCP MP_JOIN flags */
--
2.29.2
1 year, 3 months
[PATCH net-next 0/5] MPTCP: IPv4-mapped IPv6 addressing for subflows
by Mat Martineau
This patch series from the MPTCP tree adds support for IPv4-mapped IPv6
addressing that was missing when multiple subflows were first
implemented.
Patches 1 and 2 handle the conversion and comparison of the mapped
addresses.
Patch 3 contains a minor refactor in the path manager's handling of
addresses.
Patches 4 and 5 add selftests for the new functionality and adjust the
selftest timeout.
Geliang Tang (1):
selftests: mptcp: add IPv4-mapped IPv6 testcases
Matthieu Baerts (4):
mptcp: support MPJoin with IPv4 mapped in v6 sk
mptcp: pm nl: support IPv4 mapped in v6 addresses
mptcp: pm nl: reduce variable scope
selftests: increase timeout to 10 min
net/mptcp/pm_netlink.c | 39 +++++++---
net/mptcp/subflow.c | 24 ++++--
.../testing/selftests/net/mptcp/mptcp_join.sh | 75 +++++++++++++++++++
tools/testing/selftests/net/mptcp/settings | 2 +-
4 files changed, 120 insertions(+), 20 deletions(-)
base-commit: a61e4b60761fa7fa2cfde6682760763537ce5549
--
2.30.0
1 year, 3 months