Skip to contentSkip to conversation

mptcp: guide the user to avoid mistakes

PATCH Superseded Matthieu Baerts (NGI0) 2 participants 10 messages Jul 23, 2024 – Jul 26, 2024 Networking MPTCP

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Matthieu Baerts (NGI0)

author maintainer
#0 lore raw

v2 cover mptcp: guide the user to avoid mistakes

According to some bug reports we had in the past, setting the MPTCP endpoints might be confusing, and the wrong flags might be set.

This series adds missing info for the 'dev' parameter in the manual, but also clarify a few other parameters.

While at it, a better error message is reported when 'id 0' is used to 'add' or 'change' an endpoint.

---
Changes in v2:
- Drop the patches adding the warnings (Mat).
- Add patches 3 to 7.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Matthieu Baerts (NGI0) (7):
man: mptcp: document 'dev IFNAME'
man: mptcp: clarify 'signal' and 'subflow' flags
man: mptcp: 'port' has to be used with 'signal'
man: mptcp: 'backup' flag also affects outgoing data
man: mptcp: 'fullmesh' has to be used with 'subflow'
man: mptcp: clarify the 'ID' parameter
ip: mptcp: 'id 0' is only for 'del'

 ip/ipmptcp.c        |  2 ++
 man/man8/ip-mptcp.8 | 39 ++++++++++++++++++++++++++++++++-------
 2 files changed, 34 insertions(+), 7 deletions(-)

---
base-commit: 554ea3649dd15b19202d7e9791310c3bbb910b34
change-id: 20240605-mptcp-user-feedback-0676915250cb

Best regards,

Signature · 1 line
Matthieu Baerts (NGI0) <[email protected]>
author maintainer
#1 lore raw

PATCH v2 1/7 man: mptcp: document 'dev IFNAME'

It was missing, while it is a very important option.

Indeed, without it, the kernel might not pick the right interface to send packets for additional subflows. Mention that in the man page.

---
 man/man8/ip-mptcp.8 | 8 ++++++++
 1 file changed, 8 insertions(+)
man/man8/ip-mptcp.8 +8 -0
index 6c708957..89fcb64f 100644
@@ -135,6 +135,14 @@ established MPTCP sockets will be accepted on the specified port, regardless
 the original listener port accepting the first MPTCP subflow and/or
 this peer being actually on the client side.
 
+.TP
+.IR IFNAME
+is the network interface name attached to the endpoint. It is important to
+specify this device name linked to the address to make sure the system knows how
+to route packets from the specified IP address to the correct network interface.
+Without this, it might be required to add IP rules and routes to have the
+expected behavior.
+
 .TP
 .IR ID
 is a unique numeric identifier for the given endpoint
Signature · 1 line
2.45.2
author maintainer
#2 lore raw

PATCH v2 2/7 man: mptcp: clarify 'signal' and 'subflow' flags

In reply to Matthieu Baerts (NGI0)

According to some bug reports on the MPTCP project, these options might be a bit confusing for some.

Mentioning that the 'signal' flag is typically for a server, and the 'subflow' one is typically for a client should help the user knowing in which context which flag should be picked.

---
 man/man8/ip-mptcp.8 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
man/man8/ip-mptcp.8 +4 -2
index 89fcb64f..2b693564 100644
@@ -150,7 +150,8 @@ is a unique numeric identifier for the given endpoint
 .TP
 .BR signal
 The endpoint will be announced/signaled to each peer via an MPTCP ADD_ADDR
-sub-option. Upon reception of an ADD_ADDR sub-option, the peer can try to
+sub-option. Typically, a server would be responsible for this. Upon reception of
+an ADD_ADDR sub-option, the other peer, typically the client side, can try to
 create additional subflows, see
 .BR ADD_ADDR_ACCEPTED_NR.
 
@@ -158,7 +159,8 @@ create additional subflows, see
 .BR subflow
 If additional subflow creation is allowed by the MPTCP limits, the MPTCP
 path manager will try to create an additional subflow using this endpoint
-as the source address after the MPTCP connection is established.
+as the source address after the MPTCP connection is established. A client would
+typically do this.
 
 .TP
 .BR backup
Signature · 1 line
2.45.2
author maintainer
#3 lore raw

PATCH v2 3/7 man: mptcp: 'port' has to be used with 'signal'

In reply to Matthieu Baerts (NGI0)

That's what is enforced by the kernel: the 'port' is used to create a new listening socket on that port, not to create a new subflow from/to that port. It then requires the 'signal' flag.

---
 man/man8/ip-mptcp.8 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
man/man8/ip-mptcp.8 +4 -1
index 2b693564..11df43ce 100644
@@ -133,7 +133,10 @@ is 0.
 When a port number is specified, incoming MPTCP subflows for already
 established MPTCP sockets will be accepted on the specified port, regardless
 the original listener port accepting the first MPTCP subflow and/or
-this peer being actually on the client side.
+this peer being actually on the client side. This option has to be used in
+combination with the
+.BR signal
+flag.
 
 .TP
 .IR IFNAME
Signature · 1 line
2.45.2
author maintainer
#4 lore raw

PATCH v2 4/7 man: mptcp: 'backup' flag also affects outgoing data

In reply to Matthieu Baerts (NGI0)

That's the behaviour with the default packet scheduler.

In some early design, the default scheduler was supposed to take into account only the received backup flags, but it ended up not being the case, and setting the flag would also affect outgoing data.

---
 man/man8/ip-mptcp.8 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
man/man8/ip-mptcp.8 +3 -2
index 11df43ce..4d4c879b 100644
@@ -172,8 +172,9 @@ If this is a
 endpoint, the subflows created using this endpoint will have the backup
 flag set during the connection process. This flag instructs the peer to
 only send data on a given subflow when all non-backup subflows are
-unavailable. This does not affect outgoing data, where subflow priority
-is determined by the backup/non-backup flag received from the peer
+unavailable. This does also affect outgoing data when the default packets
+scheduler is used. With it, the subflow priority is determined by the
+backup/non-backup flag sent to or received from the peer.
 
 .TP
 .BR fullmesh
Signature · 1 line
2.45.2
maintainer
#5 lore raw

Re: [PATCH mptcp-iproute v2 4/7] man: mptcp: 'backup' flag also affects outgoing data

Quoted 16 lines · On Tue, 23 Jul 2024, Matthieu Baerts (NGI0) wrote:

That's the behaviour with the default packet scheduler.

In some early design, the default scheduler was supposed to take into account only the received backup flags, but it ended up not being the case, and setting the flag would also affect outgoing data.

---
man/man8/ip-mptcp.8 | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)
man/man8/ip-mptcp.8 +0 -0
index 11df43ce..4d4c879b 100644
@@ -172,8 +172,9 @@ If this is a
Quoted 1 line

endpoint, the subflows created using this endpoint will have the backup

Hi Matthieu -

I think we should clarify this text some more.

Quoted 1 line

flag set during the connection process. This flag instructs the peer to

Changing it to "remote peer" on the above line will help clarify the part about the packet scheduler below.

man/man8/ip-mptcp.8 If this is a · line 177

Quoted 7 lines

only send data on a given subflow when all non-backup subflows are

man/man8/ip-mptcp.8 +3 -2
-unavailable. This does not affect outgoing data, where subflow priority
-is determined by the backup/non-backup flag received from the peer
+unavailable. This does also affect outgoing data when the default packets
+scheduler is used. With it, the subflow priority is determined by the
+backup/non-backup flag sent to or received from the peer.

How about: "When using the default packet scheduler with a 'backup' endpoint, outgoing data from the local peer is also affected: packets will only be sent from this endpoint when all non-backup subflows are unavailable."

The other patches all look good to me.

- Mat

author maintainer
#6 lore raw

Re: [PATCH mptcp-iproute v2 4/7] man: mptcp: 'backup' flag also affects outgoing data

Hi Mat,

Quoted 22 lines · Mat Martineau
Quoted 16 lines · On Tue, 23 Jul 2024, Matthieu Baerts (NGI0) wrote:

That's the behaviour with the default packet scheduler.

In some early design, the default scheduler was supposed to take into account only the received backup flags, but it ended up not being the case, and setting the flag would also affect outgoing data.

---
man/man8/ip-mptcp.8 | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)
man/man8/ip-mptcp.8 +0 -0
index 11df43ce..4d4c879b 100644
@@ -172,8 +172,9 @@ If this is a
Quoted 1 line

endpoint, the subflows created using this endpoint will have the backup

Hi Matthieu -

Quoted 1 line

I think we should clarify this text some more.

Good idea!

Quoted 4 lines
Quoted 1 line

flag set during the connection process. This flag instructs the peer to

Changing it to "remote peer" on the above line will help clarify the part about the packet scheduler below.

Indeed!

Quoted 5 lines
Quoted 5 lines

only send data on a given subflow when all non-backup subflows are

man/man8/ip-mptcp.8 +1 -2
-unavailable. This does not affect outgoing data, where subflow priority
-is determined by the backup/non-backup flag received from the peer
+unavailable. This does also affect outgoing data when the default

packets

Quoted 8 lines

man/man8/ip-mptcp.8 If this is a · line 177

Quoted 3 lines
man/man8/ip-mptcp.8 +2 -0
+scheduler is used. With it, the subflow priority is determined by the
+backup/non-backup flag sent to or received from the peer.

How about: "When using the default packet scheduler with a 'backup' endpoint, outgoing data from the local peer is also affected: packets will only be sent from this endpoint when all non-backup subflows are unavailable."

Clearer indeed, thanks!

Quoted 1 line

The other patches all look good to me.

I just send a v3. I guess that's OK for you if I add your Acked-by, and send it to netdev?

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
author maintainer
#7 lore raw

PATCH v2 5/7 man: mptcp: 'fullmesh' has to be used with 'subflow'

In reply to Matthieu Baerts (NGI0)

'fullmesh' affects the subflow creation, it has to be used with the 'subflow' flag. That's what is enforced on the kernel side.

---
 man/man8/ip-mptcp.8 | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
man/man8/ip-mptcp.8 +8 -1
index 4d4c879b..7eeeeef2 100644
@@ -189,7 +189,14 @@ this will behave the same as a plain
 .BR subflow
 endpoint. When the peer does announce addresses, each received ADD_ADDR
 sub-option will trigger creation of an additional subflow to generate a
-full mesh topology.
+full mesh topology. This
+.BR fullmesh
+flag should always be used in combination with the
+.BR subflow
+one to be useful, except for the address used by the initial subflow,
+where
+.BR subflow
+is then optional.
 
 .TP
 .BR implicit
Signature · 1 line
2.45.2
author maintainer
#8 lore raw

PATCH v2 6/7 man: mptcp: clarify the 'ID' parameter

In reply to Matthieu Baerts (NGI0)

Explain the range (u8), and the special case for ID 0.

The endpoints here are for all the connections, while the ID 0 is a special case per connection, depending on the source address used by the initial subflow. This ID 0 can then not be used for the global endpoints.

---
 man/man8/ip-mptcp.8 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
man/man8/ip-mptcp.8 +5 -1
index 7eeeeef2..9c2e4ea6 100644
@@ -148,7 +148,11 @@ expected behavior.
 
 .TP
 .IR ID
-is a unique numeric identifier for the given endpoint
+is a unique numeric identifier, between 0 and 255, for the given endpoint. It is
+not possible to add endpoints with ID 0, because this special ID is reserved for
+the initial subflow. For rules linked to the initial subflow, the path-manager
+will look at endpoints matching the same address, and port if set, ignoring the
+ID.
 
 .TP
 .BR signal
Signature · 1 line
2.45.2
author maintainer
#9 lore raw

PATCH v2 7/7 ip: mptcp: 'id 0' is only for 'del'

In reply to Matthieu Baerts (NGI0)

Adding an endpoint with 'id 0' is not allowed. In this case, the kernel will ignore this 'id 0' and set another one.

Similarly, because there are no endpoints with this 'id 0', changing an attribute for such endpoint will not be possible.

To avoid some confusions, it sounds better to clearly report an error that the ID cannot be 0 in these cases.

---
 ip/ipmptcp.c | 2 ++
 1 file changed, 2 insertions(+)
ip/ipmptcp.c +2 -0
index 9847f95b..118bac4a 100644
@@ -174,6 +174,8 @@ static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n, int cmd)
 			invarg("invalid for non-zero id address\n", "ADDRESS");
 		else if (!id && !addr_set)
 			invarg("address is needed for deleting id 0 address\n", "ID");
+	} else if (id_set && !deling && !id) {
+		invarg("cannot be 0\n", "ID");
 	}
 
 	if (adding && port && !(flags & MPTCP_PM_ADDR_FLAG_SIGNAL))
Signature · 1 line
2.45.2