Skip to contentSkip to conversation

Change IPPROTO_MPTCP

PATCH In review Mat Martineau 3 participants 6 messages Jun 12, 2019 – Jun 25, 2019

Subsystems (3)
lore
Share & tools
lore

Mat Martineau

author
#0 lore raw

cover Change IPPROTO_MPTCP

Instead of using 99 for IPPROTO_MPTCP (which IANA defines as "any private encryption scheme"), use 262 (0x100 | IPPROTO_TCP). The MPTCP self tests continue to run successfully with these changes.

Earlier in development we used 262 for IPPROTO_SUBFLOW as it would get truncated to 0x06 (IPPROTO_TCP) in the IP header. Now that IPPROTO_SUBFLOW has been removed in favor of using ULP, 262 is freed up for MPTCP.

Note that this does change the value of IPPROTO_MAX, and in reviewing the occurrences of that around the kernel most uses look fine. net/sunrpc/xprtrdma/svc_rdma_recvfrom.c has one instance of IPPROTO_MAX where its meaning is not immediately obvious.

Mat Martineau (2):
squash-to: Define IPPROTO_MPTCP
squash-to: add basic kselftest program

 include/uapi/linux/in.h                           | 4 ++--
 tools/include/uapi/linux/in.h                     | 2 ++
 tools/testing/selftests/net/mptcp/mptcp_connect.c | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
2.22.0
author
#1 lore raw

PATCH 1/2 squash-to: Define IPPROTO_MPTCP

Signed-off-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>
---
 include/uapi/linux/in.h       | 4 ++--
 tools/include/uapi/linux/in.h | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)
include/uapi/linux/in.h +2 -2
index 649d8cd41b80..44df6dc1ff1d 100644
@@ -64,8 +64,6 @@ enum {
 #define IPPROTO_BEETPH		IPPROTO_BEETPH
   IPPROTO_ENCAP = 98,		/* Encapsulation Header			*/
 #define IPPROTO_ENCAP		IPPROTO_ENCAP
-  IPPROTO_MPTCP = 99,		/* Multipath TCP connection 		*/
-#define IPPROTO_MPTCP		IPPROTO_MPTCP
   IPPROTO_PIM = 103,		/* Protocol Independent Multicast	*/
 #define IPPROTO_PIM		IPPROTO_PIM
   IPPROTO_COMP = 108,		/* Compression Header Protocol		*/
@@ -78,6 +76,8 @@ enum {
 #define IPPROTO_MPLS		IPPROTO_MPLS
   IPPROTO_RAW = 255,		/* Raw IP packets			*/
 #define IPPROTO_RAW		IPPROTO_RAW
+  IPPROTO_MPTCP = 262,		/* Multipath TCP connection 		*/
+#define IPPROTO_MPTCP		IPPROTO_MPTCP
   IPPROTO_MAX
 };
 #endif
tools/include/uapi/linux/in.h +2 -0
index e7ad9d350a28..44df6dc1ff1d 100644
@@ -76,6 +76,8 @@ enum {
 #define IPPROTO_MPLS		IPPROTO_MPLS
   IPPROTO_RAW = 255,		/* Raw IP packets			*/
 #define IPPROTO_RAW		IPPROTO_RAW
+  IPPROTO_MPTCP = 262,		/* Multipath TCP connection 		*/
+#define IPPROTO_MPTCP		IPPROTO_MPTCP
   IPPROTO_MAX
 };
 #endif
Signature · 1 line
2.22.0
#2 lore raw

Re: [MPTCP] [PATCH 1/2] squash-to: Define IPPROTO_MPTCP

Maybe I am concerned about the wrong thing but when looking at sockopt levels defined in include/linux/socket.h,
there is an entry of the same value 262 assigned to X25:

/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */ #define SOL_IP 0
/* #define SOL_ICMP 1 No-no-no! Due to Linux :-) we cannot use SOL_ICMP=1 */ #define SOL_TCP 6
#define SOL_UDP 17
...
#define SOL_X25 262
...

I don't know if it has any issue or implication though.

Hoang

Quoted 49 lines · Mat Martineau
Signed-off-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>
---
 include/uapi/linux/in.h       | 4 ++--
 tools/include/uapi/linux/in.h | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)
include/uapi/linux/in.h +2 -2
index 649d8cd41b80..44df6dc1ff1d 100644
@@ -64,8 +64,6 @@ enum {
 #define IPPROTO_BEETPH         IPPROTO_BEETPH
   IPPROTO_ENCAP = 98,          /* Encapsulation Header                 */
 #define IPPROTO_ENCAP          IPPROTO_ENCAP
-  IPPROTO_MPTCP = 99,          /* Multipath TCP connection             */
-#define IPPROTO_MPTCP          IPPROTO_MPTCP
   IPPROTO_PIM = 103,           /* Protocol Independent Multicast       */
 #define IPPROTO_PIM            IPPROTO_PIM
   IPPROTO_COMP = 108,          /* Compression Header Protocol          */
@@ -78,6 +76,8 @@ enum {
 #define IPPROTO_MPLS           IPPROTO_MPLS
   IPPROTO_RAW = 255,           /* Raw IP packets                       */
 #define IPPROTO_RAW            IPPROTO_RAW
+  IPPROTO_MPTCP = 262,         /* Multipath TCP connection             */
+#define IPPROTO_MPTCP          IPPROTO_MPTCP
   IPPROTO_MAX
 };
 #endif
tools/include/uapi/linux/in.h +2 -1
index e7ad9d350a28..44df6dc1ff1d 100644
@@ -76,6 +76,8 @@ enum {
 #define IPPROTO_MPLS           IPPROTO_MPLS
   IPPROTO_RAW = 255,           /* Raw IP packets                       */
 #define IPPROTO_RAW            IPPROTO_RAW
+  IPPROTO_MPTCP = 262,         /* Multipath TCP connection             */
+#define IPPROTO_MPTCP          IPPROTO_MPTCP
   IPPROTO_MAX
 };
 #endif
--

2.22.0

_______________________________________________
mptcp mailing list
mptcp(a)lists.01.org
https://lists.01.org/mailman/listinfo/mptcp

author
#3 lore raw

Re: [MPTCP] [PATCH 1/2] squash-to: Define IPPROTO_MPTCP

Quoted 13 lines · Viet-Hoang Tran

Maybe I am concerned about the wrong thing but when looking at sockopt levels defined in include/linux/socket.h,there is an entry of the same value 262 assigned to X25:

/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */ #define SOL_IP 0
/* #define SOL_ICMP 1 No-no-no! Due to Linux :-) we cannot use SOL_ICMP=1 */ #define SOL_TCP 6
#define SOL_UDP 17
...
#define SOL_X25 262
...

Quoted 1 line

I don't know if it has any issue or implication though.

Hello Hoang -

Thanks for noticing this. We'll probably define SOL_MPTCP at some point, so there's also the question of matching values for SOL_MPTCP and IPPROTO_MPTCP.

Other than changing sock->sk_protocol to 16 bits (which I posted on Friday), it seems like the main effect of choosing a larger integer for IPPROTO_MPTCP is increasing IPPROTO_MAX. That, in turn, increases a handful of array sizes:

- inet_diag_table
- xfrm4_state_afinfo (two arrays for type maps)
- xfrm6_state_afinfo (two arrays for type maps)

Maybe that's not a big deal, they're already fairly sparse arrays that trade space for speed.

At least it's easy to change for now!

Mat

Quoted 41 lines · Mat Martineau
      Signed-off-by: Mat Martineau <mathew.j.martineau(a)linux.intel.com>
      ---
       include/uapi/linux/in.h       | 4 ++--
       tools/include/uapi/linux/in.h | 2 ++
       2 files changed, 4 insertions(+), 2 deletions(-)

      diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h
      index 649d8cd41b80..44df6dc1ff1d 100644
      --- a/include/uapi/linux/in.h
      +++ b/include/uapi/linux/in.h
      @@ -64,8 +64,6 @@ enum {
       #define IPPROTO_BEETPH         IPPROTO_BEETPH
         IPPROTO_ENCAP = 98,          /* Encapsulation Header                 */
       #define IPPROTO_ENCAP          IPPROTO_ENCAP
      -  IPPROTO_MPTCP = 99,          /* Multipath TCP connection             */
      -#define IPPROTO_MPTCP          IPPROTO_MPTCP
         IPPROTO_PIM = 103,           /* Protocol Independent Multicast       */
       #define IPPROTO_PIM            IPPROTO_PIM
         IPPROTO_COMP = 108,          /* Compression Header Protocol          */
      @@ -78,6 +76,8 @@ enum {
       #define IPPROTO_MPLS           IPPROTO_MPLS
         IPPROTO_RAW = 255,           /* Raw IP packets                       */
       #define IPPROTO_RAW            IPPROTO_RAW
      +  IPPROTO_MPTCP = 262,         /* Multipath TCP connection             */
      +#define IPPROTO_MPTCP          IPPROTO_MPTCP
         IPPROTO_MAX
       };
       #endif
      diff --git a/tools/include/uapi/linux/in.h b/tools/include/uapi/linux/in.h
      index e7ad9d350a28..44df6dc1ff1d 100644
      --- a/tools/include/uapi/linux/in.h
      +++ b/tools/include/uapi/linux/in.h
      @@ -76,6 +76,8 @@ enum {
       #define IPPROTO_MPLS           IPPROTO_MPLS
         IPPROTO_RAW = 255,           /* Raw IP packets                       */
       #define IPPROTO_RAW            IPPROTO_RAW
      +  IPPROTO_MPTCP = 262,         /* Multipath TCP connection             */
      +#define IPPROTO_MPTCP          IPPROTO_MPTCP
         IPPROTO_MAX
       };
Quoted 11 lines
       #endif
      --
      2.22.0

      _______________________________________________
      mptcp mailing list
      mptcp(a)lists.01.org
      https://lists.01.org/mailman/listinfo/mptcp

--
Mat Martineau
Intel

author
#4 lore raw

PATCH 2/2 squash-to: add basic kselftest program

In reply to Mat Martineau
Signed-off-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>
---
 tools/testing/selftests/net/mptcp/mptcp_connect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/mptcp/mptcp_connect.c +1 -1
index 360b698e5ddd..fb60a5615093 100644
@@ -23,7 +23,7 @@
 extern int optind;
 
 #ifndef IPPROTO_MPTCP
-#define IPPROTO_MPTCP 99
+#define IPPROTO_MPTCP 262
 #endif
 
 static bool listen_mode;
Signature · 1 line
2.22.0
#5 lore raw
In reply to Mat Martineau

Hi Mat,

Quoted 9 lines · Mat Martineau

Instead of using 99 for IPPROTO_MPTCP (which IANA defines as "any private encryption scheme"), use 262 (0x100 | IPPROTO_TCP). The MPTCP self tests continue to run successfully with these changes.

Earlier in development we used 262 for IPPROTO_SUBFLOW as it would get truncated to 0x06 (IPPROTO_TCP) in the IP header. Now that IPPROTO_SUBFLOW has been removed in favor of using ULP, 262 is freed up for MPTCP.

Quoted 8 lines

Note that this does change the value of IPPROTO_MAX, and in reviewing the occurrences of that around the kernel most uses look fine. net/sunrpc/xprtrdma/svc_rdma_recvfrom.c has one instance of IPPROTO_MAX where its meaning is not immediately obvious.

Mat Martineau (2):
squash-to: Define IPPROTO_MPTCP
squash-to: add basic kselftest program

Thank you for the patch.

- b2727bb697b3: "squash" of the first patch in "tcp: Define IPPROTO_MPTCP"
- signed-off was already there
- e993d4b99859: "squash" of the second patch in "mptcp: add basic kselftest program"
- no conflict
- d44c2b144d8a..532214a3e83e: result

Cheers,
Matt

Signature · 5 lines
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium