net: UDP repair mode for retrieving the send queue of corked UDP socket
Subsystems (3)
PATCH 1/1 net: UDP repair mode for retrieving the send queue of corked UDP socket
Hello everyone!
In this year's edition of GSoC, there is a project idea for CRIU to add support for checkpoint/restore of cork-ed UDP sockets. But to add it, the kernel API needs to be extended.
This is what this patch does. It adds UDP "repair mode" for UDP sockets in a similar approach to the TCP "repair mode", but only the send queue is necessary to be retrieved. So the patch extends the recv and setsockopt syscalls. Using UDP_REPAIR option in setsockopt, caller can set the socket in repair mode. If it is setted, the recv/recvfrom/recvmsg will receive the write queue and the destination of the data. As in the TCP mode, to change the repair mode requires the CAP_NET_ADMIN capability and to receive data the caller is obliged to use the MSG_PEEK flag.
Best regards,
Lese Doru
--- include/linux/udp.h | 3 + include/uapi/linux/udp.h | 1 net/ipv4/udp.c | 59 +++++++++++++++++++++++++++++++++++++ net/ipv6/udp.c | 45 ++++++++++++++++++++++++++++ 4 files changed, 107 insertions(+), 1 deletion(-)
include/linux/udp.h +2 -1
@@ -51,7 +51,8 @@ struct udp_sock {* different encapsulation layer set * this */ - gro_enabled:1 ;/* Can accept GRO packets */ + gro_enabled:1 ,/* Can accept GRO packets */ + repair:1;/* Receive the send queue *//* * Following member retains the information to create a UDP header * when the socket is uncorked.
include/uapi/linux/udp.h +1 -0
@@ -29,6 +29,7 @@ struct udphdr {/* UDP socket options */ #define UDP_CORK 1/* Never send partially complete segments */ +#define UDP_REPAIR 19/* Receive the send queue */ #define UDP_ENCAP 100/* Set the socket to accept encapsulated packets */ #define UDP_NO_CHECK6_TX 101/* Disable sending checksum for UDP6X */ #define UDP_NO_CHECK6_RX 102/* Disable accpeting checksum for UDP6 */
net/ipv4/udp.c +59 -0
103 lines not on this page · raw message
net/ipv6/udp.c +45 -0
70 lines not on this page · raw message
David Miller
maintainerFrom: Leşe Doru Călin <[email protected]>
Date: Wed, 8 Apr 2020 23:59:54 +0300
Quoted 13 lines
Hello everyone!
In this year's edition of GSoC, there is a project idea for CRIU to add support for checkpoint/restore of cork-ed UDP sockets. But to add it, the kernel API needs to be extended.
This is what this patch does. It adds UDP "repair mode" for UDP sockets in a similar approach to the TCP "repair mode", but only the send queue is necessary to be retrieved. So the patch extends the recv and setsockopt syscalls. UsingUDP_REPAIRoption in setsockopt, caller can set the socket in repair mode. If it is setted, the recv/recvfrom/recvmsg will receive the write queue and the destination of the data. As in the TCP mode, to change the repair mode requires theCAP_NET_ADMINcapability and to receive data the caller is obliged to use theMSG_PEEKflag.
Quoted 4 lines
Best regards,
Lese DoruSigned-off-by Lese Doru Calin <[email protected]>
Why do I feel like I've seen this patch several times before?
Quoted 16 lines · David Miller
From: Lese Doru Calin <[email protected]>
Date: Wed, 8 Apr 2020 23:59:54 +0300Quoted 13 lines
Hello everyone!
In this year's edition of GSoC, there is a project idea for CRIU to add support for checkpoint/restore of cork-ed UDP sockets. But to add it, the kernel API needs to be extended.
This is what this patch does. It adds UDP "repair mode" for UDP sockets in a similar approach to the TCP "repair mode", but only the send queue is necessary to be retrieved. So the patch extends the recv and setsockopt syscalls. UsingUDP_REPAIRoption in setsockopt, caller can set the socket in repair mode. If it is setted, the recv/recvfrom/recvmsg will receive the write queue and the destination of the data. As in the TCP mode, to change the repair mode requires theCAP_NET_ADMINcapability and to receive data the caller is obliged to use theMSG_PEEKflag.
Quoted 6 lines
Quoted 4 lines
Best regards,
Lese DoruSigned-off-by Lese Doru Calin <[email protected]>Why do I feel like I've seen this patch several times before?
Maybe others contestants in GSoC already sended a patch for this. This is the my first time when try.
David Miller
maintainerFrom: Leşe Doru Călin <[email protected]>
Date: Wed, 8 Apr 2020 23:59:54 +0300
net/ipv4/udp.c struct sk_buff *__skb_recv_udp(struct sock *sk, unsigned int flags, · line 1726
Quoted 4 lines
net/ipv4/udp.c +4
-0+static int udp_peek_sndq (struct sock *sk,struct msghdr *msg,int off,int len) +{ +struct sk_buff *skb; +int copied =0 , err =0 , copy;
Please use reverse christmas tree (longest to shortest) ordering for local variables.
net/ipv6/udp.c struct sock *udp6_lib_lookup(struct net *net, const struct in6_addr *saddr, __be · line 256
Quoted 4 lines
net/ipv6/udp.c +4
-0+static int udp6_peek_sndq (struct sock *sk,struct msghdr *msg,int off,int len) +{ +struct sk_buff *skb; +int copied =0 , err =0 , copy;
Likewise.
Thank you.
Quoted 11 lines · David Miller
From: Lese Doru Calin <[email protected]>
Date: Wed, 8 Apr 2020 23:59:54 +0300Review
Quoted 4 lines
(quoted diff) +4
-0+static int udp_peek_sndq(struct sock *sk, struct msghdr *msg, int off, int len) +{ + struct sk_buff *skb; + int copied = 0, err = 0, copy;Please use reverse christmas tree (longest to shortest) ordering for local variables.
Quoted 8 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+static int udp6_peek_sndq(struct sock *sk, struct msghdr *msg, int off, int len) +{ + struct sk_buff *skb; + int copied = 0, err = 0, copy;Likewise.
Thank you.
I changed it accordingly. I hope it is ok.
Best regards,
Lese Doru
--- include/linux/udp.h | 3 +- include/uapi/linux/udp.h | 1 net/ipv4/udp.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++ net/ipv6/udp.c | 45 +++++++++++++++++++++++++++++++++++ 4 files changed, 108 insertions(+), 1 deletion(-)
include/linux/udp.h +2 -1
@@ -51,7 +51,8 @@ struct udp_sock {* different encapsulation layer set * this */ - gro_enabled:1 ;/* Can accept GRO packets */ + gro_enabled:1 ,/* Can accept GRO packets */ + repair:1;/* Receive the send queue *//* * Following member retains the information to create a UDP header * when the socket is uncorked.
include/uapi/linux/udp.h +1 -0
@@ -29,6 +29,7 @@ struct udphdr {/* UDP socket options */ #define UDP_CORK 1/* Never send partially complete segments */ +#define UDP_REPAIR 19/* Receive the send queue */ #define UDP_ENCAP 100/* Set the socket to accept encapsulated packets */ #define UDP_NO_CHECK6_TX 101/* Disable sending checksum for UDP6X */ #define UDP_NO_CHECK6_RX 102/* Disable accpeting checksum for UDP6 */
net/ipv4/udp.c +60 -0
104 lines not on this page · raw message
net/ipv6/udp.c +45 -0
70 lines not on this page · raw message
David Miller
maintainerFrom: Leşe Doru Călin <[email protected]>
Date: Mon, 13 Apr 2020 23:09:27 +0300
Quoted 19 lines · David Miller
Quoted 18 lines
From: Lese Doru Calin <[email protected]>
Date: Wed, 8 Apr 2020 23:59:54 +0300net/ipv4/udp.c struct sk_buff *__skb_recv_udp(struct sock *sk, unsigned int flags,
Quoted 4 lines
net/ipv4/udp.c +4
-0+static int udp_peek_sndq (struct sock *sk,struct msghdr *msg,int off,int len) +{ +struct sk_buff *skb; +int copied =0 , err =0 , copy;Please use reverse christmas tree (longest to shortest) ordering for local variables.
net/ipv6/udp.c struct sock *udp6_lib_lookup(struct net *net, const struct in6_addr *saddr, __be
Quoted 4 lines
net/ipv6/udp.c +4
-0+static int udp6_peek_sndq (struct sock *sk,struct msghdr *msg,int off,int len) +{ +struct sk_buff *skb; +int copied =0 , err =0 , copy;Likewise.
Quoted 3 lines
Quoted 1 line
Thank you.
I changed it accordingly. I hope it is ok.
You have to make a fresh patch posting when you fix feedback given to you, and add appropriate version specifications to your Subject line such as "[PATCH v2]" etc.