Skip to contentSkip to conversation

mptcp: guide the user to avoid mistakes

PATCH Superseded Matthieu Baerts (NGI0) 2 participants 10 messages Jun 5, 2024 – Jun 21, 2024 Networking MPTCP

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Matthieu Baerts (NGI0)

author maintainer
#0 lore raw

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.

Adding missing info for the 'dev' parameter, and clarifying 'signal' and 'subflow' flags in the manual is a first step. But because people might surprisingly not (fully) read the manual, printing warnings to stderr if the 'signal' and 'subflow' flags are wrongly used is a second step to prevent frustration, and bug reports.

---
Matthieu Baerts (NGI0) (4):
man: mptcp: document 'dev IFNAME'
man: mptcp: clarify 'signal' and 'subflow' flags
mptcp: warn if 'signal' and 'subflow' flags are set
mptcp: warn if 'signal' or 'subflow' flag is not set

 ip/ipmptcp.c        | 18 ++++++++++++++++++
 man/man8/ip-mptcp.8 | 14 ++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)

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

Best regards,

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

PATCH 1/4 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.43.0
author maintainer
#2 lore raw

PATCH 2/4 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.43.0
author maintainer
#3 lore raw

PATCH 3/4 mptcp: warn if 'signal' and 'subflow' flags are set

In reply to Matthieu Baerts (NGI0)

Setting both the 'signal' and 'subflow' flags is very likely a mistake from the user, and would bring unexpected behaviours as mentioned in some bug reports on the MPTCP project.

It is then important to guide the users by printing a warning on stderr. Users can ignore this message if they have an atypical environment where the initiator of a connection might accept the creation of additional subflows from the other peer.

---
 ip/ipmptcp.c | 9 +++++++++
 1 file changed, 9 insertions(+)
ip/ipmptcp.c +9 -0
index 9847f95b..0f09cf75 100644
@@ -179,6 +179,15 @@ static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n, int cmd)
 	if (adding && port && !(flags & MPTCP_PM_ADDR_FLAG_SIGNAL))
 		invarg("flags must have signal when using port", "port");
 
+	if (adding && (flags & MPTCP_PM_ADDR_FLAG_SIGNAL) &&
+	              (flags & MPTCP_PM_ADDR_FLAG_SUBFLOW))
+		fprintf(stderr,
+		    "Warning: Setting both the 'signal' and 'subflow' flags is usually a mistake:\n"
+		    "         'signal' is used to announce additional addresses, typically for the\n"
+		    "         server side, while 'subflow' is used to create new paths, typically\n"
+		    "         for the client side. It is not typical to both initiate, and accept\n"
+		    "         new connections with the same peer. Continuing as requested.\n");
+
 	if (setting && id_set && port)
 		invarg("port can't be used with id", "port");
 
Signature · 1 line
2.43.0
maintainer
#4 lore raw

Re: [PATCH mptcp-iproute 3/4] mptcp: warn if 'signal' and 'subflow' flags are set

Quoted 21 lines · On Wed, 5 Jun 2024, Matthieu Baerts (NGI0) wrote:

Setting both the 'signal' and 'subflow' flags is very likely a mistake from the user, and would bring unexpected behaviours as mentioned in some bug reports on the MPTCP project.

It is then important to guide the users by printing a warning on stderr. Users can ignore this message if they have an atypical environment where the initiator of a connection might accept the creation of additional subflows from the other peer.

---
ip/ipmptcp.c | 9 +++++++++

1 file changed, 9 insertions(+)
ip/ipmptcp.c +0 -0
index 9847f95b..0f09cf75 100644
@@ -179,6 +179,15 @@ static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n, int cmd)
 	if (adding && port && !(flags & MPTCP_PM_ADDR_FLAG_SIGNAL))
 		invarg("flags must have signal when using port", "port");

ip/ipmptcp.c static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n, int cmd) · line 190

Quoted 10 lines
ip/ipmptcp.c +9 -0
 
+	if (adding && (flags & MPTCP_PM_ADDR_FLAG_SIGNAL) &&
+	              (flags & MPTCP_PM_ADDR_FLAG_SUBFLOW))
+		fprintf(stderr,
+		    "Warning: Setting both the 'signal' and 'subflow' flags is usually a mistake:\n"
+		    "         'signal' is used to announce additional addresses, typically for the\n"
+		    "         server side, while 'subflow' is used to create new paths, typically\n"
+		    "         for the client side. It is not typical to both initiate, and accept\n"
+		    "         new connections with the same peer. Continuing as requested.\n");
+

Hi Matthieu -

For this patch and the next one, I think it would be better to update the man page with information about typical usage rather than printing this error message. Seems like the ip tool doesn't have other informational run-time messages like this (especially ones this long), and there's no '-q' flag to silence them for non-typical cases.

- Mat

Quoted 9 lines
ip/ipmptcp.c +0 -0
 	if (setting && id_set && port)
 		invarg("port can't be used with id", "port");
 
Signature · 2 lines
-- 
2.43.0
author maintainer
#5 lore raw

Re: [PATCH mptcp-iproute 3/4] mptcp: warn if 'signal' and 'subflow' flags are set

Hi Mat,

Quoted 25 lines · Mat Martineau
Quoted 23 lines · On Wed, 5 Jun 2024, Matthieu Baerts (NGI0) wrote:

Setting both the 'signal' and 'subflow' flags is very likely a mistake from the user, and would bring unexpected behaviours as mentioned in some bug reports on the MPTCP project.

It is then important to guide the users by printing a warning on stderr. Users can ignore this message if they have an atypical environment where the initiator of a connection might accept the creation of additional subflows from the other peer.

---
ip/ipmptcp.c | 9 +++++++++

1 file changed, 9 insertions(+)
ip/ipmptcp.c +0 -0
index 9847f95b..0f09cf75 100644
@@ -179,6 +179,15 @@ static int mptcp_parse_opt(int argc, char **argv,
 struct nlmsghdr *n, int cmd)
     if (adding && port && !(flags & MPTCP_PM_ADDR_FLAG_SIGNAL))
         invarg("flags must have signal when using port", "port");
 
Quoted 16 lines
Quoted 6 lines
ip/ipmptcp.c +4 -0
+    if (adding && (flags & MPTCP_PM_ADDR_FLAG_SIGNAL) &&
+                  (flags & MPTCP_PM_ADDR_FLAG_SUBFLOW))
+        fprintf(stderr,
+            "Warning: Setting both the 'signal' and 'subflow' flags

is usually a mistake:\n"
+            "         'signal' is used to announce additional

Quoted 8 lines

addresses, typically for the\n"
+            "         server side, while 'subflow' is used to create new paths, typically\n"
+            "         for the client side. It is not typical to both initiate, and accept\n"
+            "         new connections with the same peer. Continuing as requested.\n");
+

Hi Matthieu -

Thank you for the review!

Quoted 5 lines

For this patch and the next one, I think it would be better to update the man page with information about typical usage rather than printing this error message. Seems like the ip tool doesn't have other informational run-time messages like this (especially ones this long), and there's no '-q' flag to silence them for non-typical cases.

That was my first intension, but I think only adding such info in the man page will not prevent frustrations, and bug reports. I mean: that supposes people are (fully and carefully) reading the man pages, and not just 'ip mptcp help' :)

I thought it was OK to let people ignoring this message, because the action will still be done. But what about adding a new option 'nowarning' option then?

ip mptcp endpoint add (...) [ nowarning ]

If people know what they are doing, they can add this not to have the warning, while not fully ignoring what is printing to stderr.

If not, I'm not sure people will notice what they are doing is very likely wrong.

Cheers,
Matt

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

Re: [PATCH mptcp-iproute 3/4] mptcp: warn if 'signal' and 'subflow' flags are set

Quoted 52 lines · Matthieu Baerts

Hi Mat,

Quoted 25 lines · Mat Martineau
Quoted 23 lines · On Wed, 5 Jun 2024, Matthieu Baerts (NGI0) wrote:

Setting both the 'signal' and 'subflow' flags is very likely a mistake from the user, and would bring unexpected behaviours as mentioned in some bug reports on the MPTCP project.

It is then important to guide the users by printing a warning on stderr. Users can ignore this message if they have an atypical environment where the initiator of a connection might accept the creation of additional subflows from the other peer.

---
ip/ipmptcp.c | 9 +++++++++

1 file changed, 9 insertions(+)
ip/ipmptcp.c +0 -0
index 9847f95b..0f09cf75 100644
@@ -179,6 +179,15 @@ static int mptcp_parse_opt(int argc, char **argv,
 struct nlmsghdr *n, int cmd)
     if (adding && port && !(flags & MPTCP_PM_ADDR_FLAG_SIGNAL))
         invarg("flags must have signal when using port", "port");
 
Quoted 16 lines
Quoted 6 lines
ip/ipmptcp.c +4 -0
+    if (adding && (flags & MPTCP_PM_ADDR_FLAG_SIGNAL) &&
+                  (flags & MPTCP_PM_ADDR_FLAG_SUBFLOW))
+        fprintf(stderr,
+            "Warning: Setting both the 'signal' and 'subflow' flags

is usually a mistake:\n"
+            "         'signal' is used to announce additional

Quoted 8 lines

addresses, typically for the\n"
+            "         server side, while 'subflow' is used to create new paths, typically\n"
+            "         for the client side. It is not typical to both initiate, and accept\n"
+            "         new connections with the same peer. Continuing as requested.\n");
+

Hi Matthieu -

Thank you for the review!

Quoted 5 lines

For this patch and the next one, I think it would be better to update the man page with information about typical usage rather than printing this error message. Seems like the ip tool doesn't have other informational run-time messages like this (especially ones this long), and there's no '-q' flag to silence them for non-typical cases.

Quoted 4 lines

That was my first intension, but I think only adding such info in the man page will not prevent frustrations, and bug reports. I mean: that supposes people are (fully and carefully) reading the man pages, and not just 'ip mptcp help' :)

Hi Matthieu -

Ok, maybe info could be added at runtime (like you suggest below) and also in the man page?

Quoted 10 lines

I thought it was OK to let people ignoring this message, because the action will still be done. But what about adding a new option 'nowarning' option then?

ip mptcp endpoint add (...) [ nowarning ]

If people know what they are doing, they can add this not to have the warning, while not fully ignoring what is printing to stderr.

My main concern is to have a way to silence it, so "nowarning" fine with me. Then it would be up to the iproute maintainers :)

Quoted 2 lines

If not, I'm not sure people will notice what they are doing is very likely wrong.

It is definely helpful information for new users to get them on the right track faster, and also avoid extra support load.

- Mat

author maintainer
#7 lore raw

Re: [PATCH mptcp-iproute 3/4] mptcp: warn if 'signal' and 'subflow' flags are set

Hi Mat,

Thank you for your reply!

Quoted 61 lines · Mat Martineau
Quoted 54 lines · Matthieu Baerts

Hi Mat,

Quoted 27 lines · Mat Martineau
Quoted 25 lines · On Wed, 5 Jun 2024, Matthieu Baerts (NGI0) wrote:

Setting both the 'signal' and 'subflow' flags is very likely a mistake from the user, and would bring unexpected behaviours as mentioned in some bug reports on the MPTCP project.

It is then important to guide the users by printing a warning on stderr.
Users can ignore this message if they have an atypical environment where
the initiator of a connection might accept the creation of additional subflows from the other peer.

---
ip/ipmptcp.c | 9 +++++++++

1 file changed, 9 insertions(+)
ip/ipmptcp.c +0 -0
index 9847f95b..0f09cf75 100644
@@ -179,6 +179,15 @@ static int mptcp_parse_opt(int argc, char **argv,
 struct nlmsghdr *n, int cmd)
     if (adding && port && !(flags & MPTCP_PM_ADDR_FLAG_SIGNAL))
         invarg("flags must have signal when using port", "port");
 
Quoted 16 lines
Quoted 6 lines
ip/ipmptcp.c +4 -0
+    if (adding && (flags & MPTCP_PM_ADDR_FLAG_SIGNAL) &&
+                  (flags & MPTCP_PM_ADDR_FLAG_SUBFLOW))
+        fprintf(stderr,
+            "Warning: Setting both the 'signal' and 'subflow' flags

is usually a mistake:\n"
+            "         'signal' is used to announce additional

Quoted 8 lines

addresses, typically for the\n"
+            "         server side, while 'subflow' is used to create new paths, typically\n"
+            "         for the client side. It is not typical to both initiate, and accept\n"
+            "         new connections with the same peer. Continuing as requested.\n");
+

Hi Matthieu -

Thank you for the review!

Quoted 5 lines

For this patch and the next one, I think it would be better to update the man page with information about typical usage rather than printing this error message. Seems like the ip tool doesn't have other informational run-time messages like this (especially ones this long), and there's no '-q' flag to silence them for non-typical cases.

Quoted 4 lines

That was my first intension, but I think only adding such info in the man page will not prevent frustrations, and bug reports. I mean: that supposes people are (fully and carefully) reading the man pages, and not just 'ip mptcp help' :)

Quoted 4 lines

Hi Matthieu -

Ok, maybe info could be added at runtime (like you suggest below) and also in the man page?

Yes, we can add info on both sides.

Quoted 4 lines
Quoted 4 lines

I thought it was OK to let people ignoring this message, because the action will still be done. But what about adding a new option 'nowarning' option then?

Quoted 8 lines
Quoted 5 lines

 ip mptcp endpoint add (...) [ nowarning ]

If people know what they are doing, they can add this not to have the warning, while not fully ignoring what is printing to stderr.

My main concern is to have a way to silence it, so "nowarning" fine with me. Then it would be up to the iproute maintainers :)

I looked at the code of the in-kernel PM (but I may have missed cases):
it looks like when both 'signal' and 'subflow' are set, the 'subflow' flag is somehow ignored. So does it make sense to allow them together?

For the 'patch 4/4', I don't see what would be the use case, except if only 'backup' is set. We can update that.

Maybe we should (also) modify the kernel, not to allow cases that don't make sense?

I added a topic -- with more details -- for the next meeting [1].

[1] https://annuel2.framapad.org/p/mptcp_upstreaming_20240612

Quoted 5 lines
Quoted 2 lines

If not, I'm not sure people will notice what they are doing is very likely wrong.

It is definely helpful information for new users to get them on the right track faster, and also avoid extra support load.

Exactly :)

Cheers,
Matt

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

Re: [PATCH mptcp-iproute 3/4] mptcp: warn if 'signal' and 'subflow' flags are set

Hi Mat,

Quoted 93 lines · Matthieu Baerts

Hi Mat,

Thank you for your reply!

Quoted 61 lines · Mat Martineau
Quoted 54 lines · Matthieu Baerts

Hi Mat,

Quoted 27 lines · Mat Martineau
Quoted 25 lines · On Wed, 5 Jun 2024, Matthieu Baerts (NGI0) wrote:

Setting both the 'signal' and 'subflow' flags is very likely a mistake from the user, and would bring unexpected behaviours as mentioned in some bug reports on the MPTCP project.

It is then important to guide the users by printing a warning on stderr.
Users can ignore this message if they have an atypical environment where
the initiator of a connection might accept the creation of additional subflows from the other peer.

---
ip/ipmptcp.c | 9 +++++++++

1 file changed, 9 insertions(+)
ip/ipmptcp.c +0 -0
index 9847f95b..0f09cf75 100644
@@ -179,6 +179,15 @@ static int mptcp_parse_opt(int argc, char **argv,
 struct nlmsghdr *n, int cmd)
     if (adding && port && !(flags & MPTCP_PM_ADDR_FLAG_SIGNAL))
         invarg("flags must have signal when using port", "port");
 
Quoted 16 lines
Quoted 6 lines
ip/ipmptcp.c +4 -0
+    if (adding && (flags & MPTCP_PM_ADDR_FLAG_SIGNAL) &&
+                  (flags & MPTCP_PM_ADDR_FLAG_SUBFLOW))
+        fprintf(stderr,
+            "Warning: Setting both the 'signal' and 'subflow' flags

is usually a mistake:\n"
+            "         'signal' is used to announce additional

Quoted 8 lines

addresses, typically for the\n"
+            "         server side, while 'subflow' is used to create new paths, typically\n"
+            "         for the client side. It is not typical to both initiate, and accept\n"
+            "         new connections with the same peer. Continuing as requested.\n");
+

Hi Matthieu -

Thank you for the review!

Quoted 5 lines

For this patch and the next one, I think it would be better to update the man page with information about typical usage rather than printing this error message. Seems like the ip tool doesn't have other informational run-time messages like this (especially ones this long), and there's no '-q' flag to silence them for non-typical cases.

Quoted 4 lines

That was my first intension, but I think only adding such info in the man page will not prevent frustrations, and bug reports. I mean: that supposes people are (fully and carefully) reading the man pages, and not just 'ip mptcp help' :)

Quoted 4 lines

Hi Matthieu -

Ok, maybe info could be added at runtime (like you suggest below) and also in the man page?

Yes, we can add info on both sides.

Quoted 4 lines
Quoted 4 lines

I thought it was OK to let people ignoring this message, because the action will still be done. But what about adding a new option 'nowarning' option then?

Quoted 8 lines
Quoted 5 lines

 ip mptcp endpoint add (...) [ nowarning ]

If people know what they are doing, they can add this not to have the warning, while not fully ignoring what is printing to stderr.

My main concern is to have a way to silence it, so "nowarning" fine with me. Then it would be up to the iproute maintainers :)

I looked at the code of the in-kernel PM (but I may have missed cases):
it looks like when both 'signal' and 'subflow' are set, the 'subflow' flag is somehow ignored. So does it make sense to allow them together?

For the 'patch 4/4', I don't see what would be the use case, except if only 'backup' is set. We can update that.

Quoted 6 lines

Maybe we should (also) modify the kernel, not to allow cases that don't make sense?

I added a topic -- with more details -- for the next meeting [1].

[1] https://annuel2.framapad.org/p/mptcp_upstreaming_20240612

After the discussion we had, and the series I just sent [1], do you think we still need the last two patches adding warnings? Is it enough with the man update?

There is still the case where people might not set any flags, but it looks like an issue on their side, a bit like adding an IP without the netmask, and having issues because of that.

All these patches still apply on the latest 'main' branch from the iproute2 repo.

[1]
https://lore.kernel.org/r/[email protected]

Cheers,
Matt

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

PATCH 4/4 mptcp: warn if 'signal' or 'subflow' flag is not set

In reply to Matthieu Baerts (NGI0)

Similar to the previous commit, not setting either the 'signal' or 'subflow' flag is usually a mistake from the user. This would bring unexpected behaviours as mentioned in some bug reports on the MPTCP project.

It is then important to guide the users by printing a warning on stderr. Users can ignore this message if they have an atypical environment where it is required to reserve an ID for some obscure reasons.

---
 ip/ipmptcp.c | 9 +++++++++
 1 file changed, 9 insertions(+)
ip/ipmptcp.c +9 -0
index 0f09cf75..d40a50d5 100644
@@ -188,6 +188,15 @@ static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n, int cmd)
 		    "         for the client side. It is not typical to both initiate, and accept\n"
 		    "         new connections with the same peer. Continuing as requested.\n");
 
+	if (adding && !(flags & (MPTCP_PM_ADDR_FLAG_SIGNAL |
+	                         MPTCP_PM_ADDR_FLAG_SUBFLOW)))
+		fprintf(stderr,
+		    "Warning: Not setting either the 'signal' or 'subflow' flag is usually a mistake:\n"
+		    "         'signal' is used to announce additional addresses, typically for the\n"
+		    "         server side, while 'subflow' is used to create new paths, typically\n"
+		    "         for the client side. Not setting either of these flags will reserve\n"
+		    "         the endpoint ID, but that's it. Continuing as requested.\n");
+
 	if (setting && id_set && port)
 		invarg("port can't be used with id", "port");
 
Signature · 1 line
2.43.0