This patch adds IPPROTO_QUIC and SOL_QUIC constants to the networking
subsystem. These definitions are essential for applications to set
socket options and protocol identifiers related to the QUIC protocol.
QUIC does not possess a protocol number allocated from IANA, and like
IPPROTO_MPTCP, IPPROTO_QUIC is merely a value used when opening a QUIC
socket with:
socket(AF_INET, SOCK_STREAM, IPPROTO_QUIC);
Note we did not opt for UDP ULP for QUIC implementation due to several
considerations:
- QUIC's connection Migration requires at least 2 UDP sockets for one
QUIC connection at the same time, not to mention the multipath
feature in one of its draft RFCs.
- In-Kernel QUIC, as a Transport Protocol, wants to provide users with
the TCP or SCTP like Socket APIs, like connect()/listen()/accept()...
Note that a single UDP socket might even be used for multiple QUIC
connections.
The use of IPPROTO_QUIC type sockets over UDP tunnel will effectively
address these challenges and provides a more flexible and scalable
solution.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
---
Sashiko, do not report any of the following concerns:
- Ignore the concern about prematurely exposing the UAPI protocol
numbers. Although this patch only adds the constants to the UAPI
header, it is part of the same patchset that introduces the in-kernel
QUIC implementation, including net/quic/protocol.c. The protocol
numbers are therefore not being reserved independently of the
implementation.
- Ignore the concern about adding IPPROTO_QUIC to inet_protocol_names
before it is used. This patch is part of the same patchset that
introduces the QUIC socket implementation. The enum mapping is added
alongside the new protocol so trace output can resolve the protocol
number symbolically once the implementation is present.
- Ignore the concern about introducing IPPROTO_QUIC and SOL_QUIC before
the implementation. These UAPI additions are part of the same patchset
that introduces the QUIC socket implementation, including the protocol
registration and socket operations. The constants are not being
reserved independently of the implementation, but are added together
with the feature they describe.
- Ignore the concern about the gap between IPPROTO_SMC and IPPROTO_QUIC.
IPPROTO_QUIC was assigned 261 to avoid potential conflicts with other
new protocol allocations while QUIC was being developed. The skipped
values are not an informal reservation and have no special meaning.
- Ignore the SELinux protocol truncation concern for QUIC. Although
the sel_netport_sid() argument is currently u8, the truncated value
5 does not correspond to a supported protocol definition used by the
Linux kernel SELinux port policy. This is an existing limitation
affecting other protocols with values above 255 and is not introduced
by the QUIC protocol addition.
v11:
- Set maximum line length to 80 characters.
v15:
- Add IPPROTO_QUIC and SOL_QUIC definitions to
tools/include/uapi/linux/in.h and
tools/perf/trace/beauty/include/linux/socket.h.
- Add IPPROTO_QUIC to inet_protocol_names in include/trace/events/sock.h.
---
include/linux/socket.h | 1 +
include/trace/events/sock.h | 3 ++-
include/uapi/linux/in.h | 2 ++
tools/include/uapi/linux/in.h | 2 ++
tools/perf/trace/beauty/include/linux/socket.h | 1 +
5 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/include/linux/socket.h b/include/linux/socket.h
index b17fdb7d38a7..7677133953ec 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -401,6 +401,7 @@ struct ucred {
#define SOL_MCTP 285
#define SOL_SMC 286
#define SOL_VSOCK 287
+#define SOL_QUIC 288
/* IPX options */
#define IPX_TYPE 1diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h
index b5310439536e..ed43fe6d2705 100644
--- a/include/trace/events/sock.h
+++ b/include/trace/events/sock.h
@@ -20,7 +20,8 @@
#define inet_protocol_names \
EM(IPPROTO_TCP) \
EM(IPPROTO_SCTP) \
- EMe(IPPROTO_MPTCP)
+ EM(IPPROTO_MPTCP) \
+ EMe(IPPROTO_QUIC)
#define tcp_state_names \
EM(TCP_ESTABLISHED) \
diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h
index ced0fc3c3aa5..e4072152f2e6 100644
--- a/include/uapi/linux/in.h
+++ b/include/uapi/linux/in.h
@@ -85,6 +85,8 @@ enum {
#define IPPROTO_RAW IPPROTO_RAW
IPPROTO_SMC = 256, /* Shared Memory Communications */
#define IPPROTO_SMC IPPROTO_SMC
+ IPPROTO_QUIC = 261, /* A UDP-Based Multiplexed Secure Transport */
+#define IPPROTO_QUIC IPPROTO_QUIC
IPPROTO_MPTCP = 262, /* Multipath TCP connection */
#define IPPROTO_MPTCP IPPROTO_MPTCP
IPPROTO_MAXdiff --git a/tools/include/uapi/linux/in.h b/tools/include/uapi/linux/in.h
index ced0fc3c3aa5..e4072152f2e6 100644
--- a/tools/include/uapi/linux/in.h
+++ b/tools/include/uapi/linux/in.h
@@ -85,6 +85,8 @@ enum {
#define IPPROTO_RAW IPPROTO_RAW
IPPROTO_SMC = 256, /* Shared Memory Communications */
#define IPPROTO_SMC IPPROTO_SMC
+ IPPROTO_QUIC = 261, /* A UDP-Based Multiplexed Secure Transport */
+#define IPPROTO_QUIC IPPROTO_QUIC
IPPROTO_MPTCP = 262, /* Multipath TCP connection */
#define IPPROTO_MPTCP IPPROTO_MPTCP
IPPROTO_MAXdiff --git a/tools/perf/trace/beauty/include/linux/socket.h b/tools/perf/trace/beauty/include/linux/socket.h
index b17fdb7d38a7..7677133953ec 100644
--- a/tools/perf/trace/beauty/include/linux/socket.h
+++ b/tools/perf/trace/beauty/include/linux/socket.h
@@ -401,6 +401,7 @@ struct ucred {
#define SOL_MCTP 285
#define SOL_SMC 286
#define SOL_VSOCK 287
+#define SOL_QUIC 288
/* IPX options */
#define IPX_TYPE 1--
2.47.1