* [PATCHv4 net-next 0/2] net: enable udp v6 sockets receiving v4 packets with UDP GRO @ 2021-01-26 5:10 Xin Long 2021-01-26 5:10 ` [PATCHv4 net-next 1/2] udp: call udp_encap_enable for v6 sockets when enabling encap Xin Long ` (2 more replies) 0 siblings, 3 replies; 14+ messages in thread From: Xin Long @ 2021-01-26 5:10 UTC (permalink / raw) To: network dev Cc: davem, Jakub Kicinski, pabeni, Willem de Bruijn, Martin Varghese, Alexander Duyck, David Howells Currently, udp v6 socket can not process v4 packets with UDP GRO, as udp_encap_needed_key is not increased when udp_tunnel_encap_enable() is called for v6 socket. This patchset is to increase it and remove the unnecessary code in bareudp in Patch 1/2, and improve rxrpc encap_enable by calling udp_tunnel_encap_enable(). Xin Long (2): udp: call udp_encap_enable for v6 sockets when enabling encap rxrpc: call udp_tunnel_encap_enable in rxrpc_open_socket drivers/net/bareudp.c | 6 ------ include/net/udp.h | 1 + include/net/udp_tunnel.h | 3 +-- net/ipv4/udp.c | 6 ++++++ net/ipv6/udp.c | 4 +++- net/rxrpc/local_object.c | 6 +----- 6 files changed, 12 insertions(+), 14 deletions(-) -- 2.1.0 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCHv4 net-next 1/2] udp: call udp_encap_enable for v6 sockets when enabling encap 2021-01-26 5:10 [PATCHv4 net-next 0/2] net: enable udp v6 sockets receiving v4 packets with UDP GRO Xin Long @ 2021-01-26 5:10 ` Xin Long 2021-01-26 5:10 ` [PATCHv4 net-next 2/2] rxrpc: call udp_tunnel_encap_enable in rxrpc_open_socket Xin Long ` (2 more replies) 2021-02-03 4:20 ` [PATCHv4 net-next 0/2] net: enable udp v6 sockets receiving v4 packets with UDP GRO Xin Long 2021-02-03 8:00 ` David Howells 2 siblings, 3 replies; 14+ messages in thread From: Xin Long @ 2021-01-26 5:10 UTC (permalink / raw) To: network dev Cc: davem, Jakub Kicinski, pabeni, Willem de Bruijn, Martin Varghese, Alexander Duyck, David Howells When enabling encap for a ipv6 socket without udp_encap_needed_key increased, UDP GRO won't work for v4 mapped v6 address packets as sk will be NULL in udp4_gro_receive(). This patch is to enable it by increasing udp_encap_needed_key for v6 sockets in udp_tunnel_encap_enable(), and correspondingly decrease udp_encap_needed_key in udpv6_destroy_sock(). v1->v2: - add udp_encap_disable() and export it. v2->v3: - add the change for rxrpc and bareudp into one patch, as Alex suggested. v3->v4: - move rxrpc part to another patch. Signed-off-by: Xin Long <lucien.xin@gmail.com> --- drivers/net/bareudp.c | 6 ------ include/net/udp.h | 1 + include/net/udp_tunnel.h | 3 +-- net/ipv4/udp.c | 6 ++++++ net/ipv6/udp.c | 4 +++- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c index 1b8f597..7511bca 100644 --- a/drivers/net/bareudp.c +++ b/drivers/net/bareudp.c @@ -240,12 +240,6 @@ static int bareudp_socket_create(struct bareudp_dev *bareudp, __be16 port) tunnel_cfg.encap_destroy = NULL; setup_udp_tunnel_sock(bareudp->net, sock, &tunnel_cfg); - /* As the setup_udp_tunnel_sock does not call udp_encap_enable if the - * socket type is v6 an explicit call to udp_encap_enable is needed. - */ - if (sock->sk->sk_family == AF_INET6) - udp_encap_enable(); - rcu_assign_pointer(bareudp->sock, sock); return 0; } diff --git a/include/net/udp.h b/include/net/udp.h index 877832b..1e7b6cd 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -467,6 +467,7 @@ void udp_init(void); DECLARE_STATIC_KEY_FALSE(udp_encap_needed_key); void udp_encap_enable(void); +void udp_encap_disable(void); #if IS_ENABLED(CONFIG_IPV6) DECLARE_STATIC_KEY_FALSE(udpv6_encap_needed_key); void udpv6_encap_enable(void); diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h index 282d10e..afc7ce7 100644 --- a/include/net/udp_tunnel.h +++ b/include/net/udp_tunnel.h @@ -181,9 +181,8 @@ static inline void udp_tunnel_encap_enable(struct socket *sock) #if IS_ENABLED(CONFIG_IPV6) if (sock->sk->sk_family == PF_INET6) ipv6_stub->udpv6_encap_enable(); - else #endif - udp_encap_enable(); + udp_encap_enable(); } #define UDP_TUNNEL_NIC_MAX_TABLES 4 diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 69ea765..48208fb 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -596,6 +596,12 @@ void udp_encap_enable(void) } EXPORT_SYMBOL(udp_encap_enable); +void udp_encap_disable(void) +{ + static_branch_dec(&udp_encap_needed_key); +} +EXPORT_SYMBOL(udp_encap_disable); + /* Handler for tunnels with arbitrary destination ports: no socket lookup, go * through error handlers in encapsulations looking for a match. */ diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index b9f3dfd..d754292 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -1608,8 +1608,10 @@ void udpv6_destroy_sock(struct sock *sk) if (encap_destroy) encap_destroy(sk); } - if (up->encap_enabled) + if (up->encap_enabled) { static_branch_dec(&udpv6_encap_needed_key); + udp_encap_disable(); + } } inet6_destroy_sock(sk); -- 2.1.0 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCHv4 net-next 2/2] rxrpc: call udp_tunnel_encap_enable in rxrpc_open_socket 2021-01-26 5:10 ` [PATCHv4 net-next 1/2] udp: call udp_encap_enable for v6 sockets when enabling encap Xin Long @ 2021-01-26 5:10 ` Xin Long 2021-01-26 9:06 ` David Howells 2021-01-26 23:07 ` [PATCHv4 net-next 1/2] udp: call udp_encap_enable for v6 sockets when enabling encap Willem de Bruijn 2 siblings, 0 replies; 14+ messages in thread From: Xin Long @ 2021-01-26 5:10 UTC (permalink / raw) To: network dev Cc: davem, Jakub Kicinski, pabeni, Willem de Bruijn, Martin Varghese, Alexander Duyck, David Howells When doing encap_enable/increasing encap_needed_key, up->encap_enabled is not set in rxrpc_open_socket(), and it will cause encap_needed_key not being decreased in udpv6_destroy_sock(). This patch is to improve it by just calling udp_tunnel_encap_enable() where it increases both UDP and UDPv6 encap_needed_key and sets up->encap_enabled. Signed-off-by: Xin Long <lucien.xin@gmail.com> --- net/rxrpc/local_object.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c index 8c28810..93e05d2 100644 --- a/net/rxrpc/local_object.c +++ b/net/rxrpc/local_object.c @@ -135,11 +135,7 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net) udp_sk(usk)->gro_receive = NULL; udp_sk(usk)->gro_complete = NULL; - udp_encap_enable(); -#if IS_ENABLED(CONFIG_AF_RXRPC_IPV6) - if (local->srx.transport.family == AF_INET6) - udpv6_encap_enable(); -#endif + udp_tunnel_encap_enable(local->socket); usk->sk_error_report = rxrpc_error_report; /* if a local address was supplied then bind it */ -- 2.1.0 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCHv4 net-next 2/2] rxrpc: call udp_tunnel_encap_enable in rxrpc_open_socket 2021-01-26 5:10 ` [PATCHv4 net-next 1/2] udp: call udp_encap_enable for v6 sockets when enabling encap Xin Long 2021-01-26 5:10 ` [PATCHv4 net-next 2/2] rxrpc: call udp_tunnel_encap_enable in rxrpc_open_socket Xin Long @ 2021-01-26 9:06 ` David Howells 2021-01-26 23:07 ` [PATCHv4 net-next 1/2] udp: call udp_encap_enable for v6 sockets when enabling encap Willem de Bruijn 2 siblings, 0 replies; 14+ messages in thread From: David Howells @ 2021-01-26 9:06 UTC (permalink / raw) To: Xin Long Cc: dhowells, network dev, davem, Jakub Kicinski, pabeni, Willem de Bruijn, Martin Varghese, Alexander Duyck Xin Long <lucien.xin@gmail.com> wrote: > - udp_encap_enable(); > -#if IS_ENABLED(CONFIG_AF_RXRPC_IPV6) > - if (local->srx.transport.family == AF_INET6) > - udpv6_encap_enable(); > -#endif > + udp_tunnel_encap_enable(local->socket); You need this too: --- a/net/rxrpc/local_object.c +++ b/net/rxrpc/local_object.c @@ -16,6 +16,7 @@ #include <linux/hashtable.h> #include <net/sock.h> #include <net/udp.h> +#include <net/udp_tunnel.h> #include <net/af_rxrpc.h> #include "ar-internal.h" With that, it seems to work still: Acked-and-tested-by: David Howells <dhowells@redhat.com> David ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCHv4 net-next 1/2] udp: call udp_encap_enable for v6 sockets when enabling encap 2021-01-26 5:10 ` [PATCHv4 net-next 1/2] udp: call udp_encap_enable for v6 sockets when enabling encap Xin Long 2021-01-26 5:10 ` [PATCHv4 net-next 2/2] rxrpc: call udp_tunnel_encap_enable in rxrpc_open_socket Xin Long 2021-01-26 9:06 ` David Howells @ 2021-01-26 23:07 ` Willem de Bruijn 2 siblings, 0 replies; 14+ messages in thread From: Willem de Bruijn @ 2021-01-26 23:07 UTC (permalink / raw) To: Xin Long Cc: network dev, David Miller, Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Martin Varghese, Alexander Duyck, David Howells On Tue, Jan 26, 2021 at 5:59 PM Xin Long <lucien.xin@gmail.com> wrote: > > When enabling encap for a ipv6 socket without udp_encap_needed_key > increased, UDP GRO won't work for v4 mapped v6 address packets as > sk will be NULL in udp4_gro_receive(). > > This patch is to enable it by increasing udp_encap_needed_key for > v6 sockets in udp_tunnel_encap_enable(), and correspondingly > decrease udp_encap_needed_key in udpv6_destroy_sock(). > > v1->v2: > - add udp_encap_disable() and export it. > v2->v3: > - add the change for rxrpc and bareudp into one patch, as Alex > suggested. > v3->v4: > - move rxrpc part to another patch. > > Signed-off-by: Xin Long <lucien.xin@gmail.com> Acked-by: Willem de Bruijn <willemb@google.com> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCHv4 net-next 0/2] net: enable udp v6 sockets receiving v4 packets with UDP GRO 2021-01-26 5:10 [PATCHv4 net-next 0/2] net: enable udp v6 sockets receiving v4 packets with UDP GRO Xin Long 2021-01-26 5:10 ` [PATCHv4 net-next 1/2] udp: call udp_encap_enable for v6 sockets when enabling encap Xin Long @ 2021-02-03 4:20 ` Xin Long 2021-02-03 8:00 ` David Howells 2 siblings, 0 replies; 14+ messages in thread From: Xin Long @ 2021-02-03 4:20 UTC (permalink / raw) To: network dev Cc: davem, Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Martin Varghese, Alexander Duyck, David Howells Hi, Jakub, I saw the state of this patchset is still new, should I repost it? On Tue, Jan 26, 2021 at 1:10 PM Xin Long <lucien.xin@gmail.com> wrote: > > Currently, udp v6 socket can not process v4 packets with UDP GRO, as > udp_encap_needed_key is not increased when udp_tunnel_encap_enable() > is called for v6 socket. > > This patchset is to increase it and remove the unnecessary code in > bareudp in Patch 1/2, and improve rxrpc encap_enable by calling > udp_tunnel_encap_enable(). > > Xin Long (2): > udp: call udp_encap_enable for v6 sockets when enabling encap > rxrpc: call udp_tunnel_encap_enable in rxrpc_open_socket > > drivers/net/bareudp.c | 6 ------ > include/net/udp.h | 1 + > include/net/udp_tunnel.h | 3 +-- > net/ipv4/udp.c | 6 ++++++ > net/ipv6/udp.c | 4 +++- > net/rxrpc/local_object.c | 6 +----- > 6 files changed, 12 insertions(+), 14 deletions(-) > > -- > 2.1.0 > ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCHv4 net-next 0/2] net: enable udp v6 sockets receiving v4 packets with UDP GRO 2021-01-26 5:10 [PATCHv4 net-next 0/2] net: enable udp v6 sockets receiving v4 packets with UDP GRO Xin Long 2021-01-26 5:10 ` [PATCHv4 net-next 1/2] udp: call udp_encap_enable for v6 sockets when enabling encap Xin Long 2021-02-03 4:20 ` [PATCHv4 net-next 0/2] net: enable udp v6 sockets receiving v4 packets with UDP GRO Xin Long @ 2021-02-03 8:00 ` David Howells 2021-02-03 8:52 ` Xin Long 2021-02-03 9:14 ` David Howells 2 siblings, 2 replies; 14+ messages in thread From: David Howells @ 2021-02-03 8:00 UTC (permalink / raw) To: Xin Long Cc: dhowells, network dev, davem, Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Martin Varghese, Alexander Duyck Xin Long <lucien.xin@gmail.com> wrote: > I saw the state of this patchset is still new, should I repost it? It needs a fix in patch 2 (see my response to that patch). Thanks, David ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCHv4 net-next 0/2] net: enable udp v6 sockets receiving v4 packets with UDP GRO 2021-02-03 8:00 ` David Howells @ 2021-02-03 8:52 ` Xin Long 2021-02-03 9:14 ` David Howells 1 sibling, 0 replies; 14+ messages in thread From: Xin Long @ 2021-02-03 8:52 UTC (permalink / raw) To: David Howells Cc: network dev, davem, Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Martin Varghese, Alexander Duyck On Wed, Feb 3, 2021 at 4:00 PM David Howells <dhowells@redhat.com> wrote: > > Xin Long <lucien.xin@gmail.com> wrote: > > > I saw the state of this patchset is still new, should I repost it? > > It needs a fix in patch 2 (see my response to that patch). > Sorry, my mistake, I forgot to enable rxrpc when building kernel. Will repost, Thank you. BTW, I'm also thinking to use udp_sock_create(), the only problem I can see is it may not do bind() in rxrpc_open_socket(), is that true? or we can actually bind to some address when a local address is not supplied? ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCHv4 net-next 0/2] net: enable udp v6 sockets receiving v4 packets with UDP GRO 2021-02-03 8:00 ` David Howells 2021-02-03 8:52 ` Xin Long @ 2021-02-03 9:14 ` David Howells 2021-02-03 13:47 ` Xin Long ` (3 more replies) 1 sibling, 4 replies; 14+ messages in thread From: David Howells @ 2021-02-03 9:14 UTC (permalink / raw) To: Xin Long Cc: dhowells, network dev, davem, Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Martin Varghese, Alexander Duyck, vfedorenko Xin Long <lucien.xin@gmail.com> wrote: > BTW, I'm also thinking to use udp_sock_create(), the only problem I can > see is it may not do bind() in rxrpc_open_socket(), is that true? or we > can actually bind to some address when a local address is not supplied? If a local address isn't explicitly bound to the AF_RXRPC socket, binding the UDP socket to a random local port is fine. In fact, sometimes I want to explicitly bind an rxrpc server socket to a random port. See fs/afs/rxrpc.c function afs_open_socket(): /* bind the callback manager's address to make this a server socket */ memset(&srx, 0, sizeof(srx)); srx.srx_family = AF_RXRPC; srx.srx_service = CM_SERVICE; srx.transport_type = SOCK_DGRAM; srx.transport_len = sizeof(srx.transport.sin6); srx.transport.sin6.sin6_family = AF_INET6; srx.transport.sin6.sin6_port = htons(AFS_CM_PORT); ... ret = kernel_bind(socket, (struct sockaddr *) &srx, sizeof(srx)); if (ret == -EADDRINUSE) { srx.transport.sin6.sin6_port = 0; ^^^ That's hoping to get a random port bound. ret = kernel_bind(socket, (struct sockaddr *) &srx, sizeof(srx)); } if (ret < 0) goto error_2; The client cache manager server socket here is used to receive notifications back from the fileserver. There's a standard port (7001) for the service, but if that's in use, we can use any other port. The fileserver grabs the source port from incoming RPC requests - and then uses that when sending 3rd-party change notifications back. If you could arrange for a random port to be assigned in such a case (and indicated back to the caller), that would be awesome. Possibly I just don't need to actually use bind in this case. David ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCHv4 net-next 0/2] net: enable udp v6 sockets receiving v4 packets with UDP GRO 2021-02-03 9:14 ` David Howells @ 2021-02-03 13:47 ` Xin Long 2021-02-03 15:19 ` David Howells ` (2 subsequent siblings) 3 siblings, 0 replies; 14+ messages in thread From: Xin Long @ 2021-02-03 13:47 UTC (permalink / raw) To: David Howells Cc: network dev, davem, Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Martin Varghese, Alexander Duyck, vfedorenko [-- Attachment #1: Type: text/plain, Size: 2755 bytes --] On Wed, Feb 3, 2021 at 5:14 PM David Howells <dhowells@redhat.com> wrote: > > Xin Long <lucien.xin@gmail.com> wrote: > > > BTW, I'm also thinking to use udp_sock_create(), the only problem I can > > see is it may not do bind() in rxrpc_open_socket(), is that true? or we > > can actually bind to some address when a local address is not supplied? > > If a local address isn't explicitly bound to the AF_RXRPC socket, binding the > UDP socket to a random local port is fine. In fact, sometimes I want to > explicitly bind an rxrpc server socket to a random port. See fs/afs/rxrpc.c > function afs_open_socket(): > > /* bind the callback manager's address to make this a server socket */ > memset(&srx, 0, sizeof(srx)); > srx.srx_family = AF_RXRPC; > srx.srx_service = CM_SERVICE; > srx.transport_type = SOCK_DGRAM; > srx.transport_len = sizeof(srx.transport.sin6); > srx.transport.sin6.sin6_family = AF_INET6; > srx.transport.sin6.sin6_port = htons(AFS_CM_PORT); > ... > ret = kernel_bind(socket, (struct sockaddr *) &srx, sizeof(srx)); > if (ret == -EADDRINUSE) { > srx.transport.sin6.sin6_port = 0; > > ^^^ That's hoping to get a random port bound. > > ret = kernel_bind(socket, (struct sockaddr *) &srx, sizeof(srx)); > } > if (ret < 0) > goto error_2; > > The client cache manager server socket here is used to receive notifications > back from the fileserver. There's a standard port (7001) for the service, but > if that's in use, we can use any other port. The fileserver grabs the source > port from incoming RPC requests - and then uses that when sending 3rd-party > change notifications back. > > If you could arrange for a random port to be assigned in such a case (and > indicated back to the caller), that would be awesome. Possibly I just don't > need to actually use bind in this case. > The patch is attached (based on this patch): + udp_conf.family = srx->transport.family; + if (udp_conf.family == AF_INET) { + udp_conf.local_ip = srx->transport.sin.sin_addr; + udp_conf.local_udp_port = srx->transport.sin.sin_port; + } else { + udp_conf.local_ip6 = srx->transport.sin6.sin6_addr; + udp_conf.local_udp_port = srx->transport.sin6.sin6_port; + } + ret = udp_sock_create(net, &udp_conf, &local->socket); I think this will work well. When the socket is not bound, srx->transport.sin.sin(6)_addr/sin(6)_port are zero. It'll bind to a random port in udp_sock_create(). BTW: do you have any testing for this? Thanks. [-- Attachment #2: 0001-rxrpc-use-udp-tunnel-APIs-instead-of-open-code-in-rx.patch --] [-- Type: application/octet-stream, Size: 4027 bytes --] From 5748d6312ad8025f6e347a0b067b204320b1c770 Mon Sep 17 00:00:00 2001 Message-Id: <5748d6312ad8025f6e347a0b067b204320b1c770.1612359043.git.lucien.xin@gmail.com> From: Xin Long <lucien.xin@gmail.com> Date: Wed, 3 Feb 2021 08:25:28 -0500 Subject: [PATCH net-next] rxrpc: use udp tunnel APIs instead of open code in rxrpc_open_socket Signed-off-by: Xin Long <lucien.xin@gmail.com> --- net/rxrpc/local_object.c | 69 ++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 45 deletions(-) diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c index 33b49367d575..546fd237a649 100644 --- a/net/rxrpc/local_object.c +++ b/net/rxrpc/local_object.c @@ -107,54 +107,42 @@ static struct rxrpc_local *rxrpc_alloc_local(struct rxrpc_net *rxnet, */ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net) { + struct udp_tunnel_sock_cfg tuncfg = {NULL}; + struct sockaddr_rxrpc *srx = &local->srx; + struct udp_port_cfg udp_conf = {0}; struct sock *usk; int ret; _enter("%p{%d,%d}", - local, local->srx.transport_type, local->srx.transport.family); - - /* create a socket to represent the local endpoint */ - ret = sock_create_kern(net, local->srx.transport.family, - local->srx.transport_type, 0, &local->socket); + local, srx->transport_type, srx->transport.family); + + udp_conf.family = srx->transport.family; + if (udp_conf.family == AF_INET) { + udp_conf.local_ip = srx->transport.sin.sin_addr; + udp_conf.local_udp_port = srx->transport.sin.sin_port; + } else { + udp_conf.local_ip6 = srx->transport.sin6.sin6_addr; + udp_conf.local_udp_port = srx->transport.sin6.sin6_port; + } + ret = udp_sock_create(net, &udp_conf, &local->socket); if (ret < 0) { _leave(" = %d [socket]", ret); return ret; } + tuncfg.encap_type = UDP_ENCAP_RXRPC; + tuncfg.encap_rcv = rxrpc_input_packet; + tuncfg.sk_user_data = local; + setup_udp_tunnel_sock(net, local->socket, &tuncfg); + /* set the socket up */ usk = local->socket->sk; - inet_sk(usk)->mc_loop = 0; - - /* Enable CHECKSUM_UNNECESSARY to CHECKSUM_COMPLETE conversion */ - inet_inc_convert_csum(usk); - - rcu_assign_sk_user_data(usk, local); - - udp_sk(usk)->encap_type = UDP_ENCAP_RXRPC; - udp_sk(usk)->encap_rcv = rxrpc_input_packet; - udp_sk(usk)->encap_destroy = NULL; - udp_sk(usk)->gro_receive = NULL; - udp_sk(usk)->gro_complete = NULL; - - udp_tunnel_encap_enable(local->socket); usk->sk_error_report = rxrpc_error_report; - /* if a local address was supplied then bind it */ - if (local->srx.transport_len > sizeof(sa_family_t)) { - _debug("bind"); - ret = kernel_bind(local->socket, - (struct sockaddr *)&local->srx.transport, - local->srx.transport_len); - if (ret < 0) { - _debug("bind failed %d", ret); - goto error; - } - } - - switch (local->srx.transport.family) { + switch (srx->transport.family) { case AF_INET6: /* we want to receive ICMPv6 errors */ - ip6_sock_set_recverr(local->socket->sk); + ip6_sock_set_recverr(usk); /* Fall through and set IPv4 options too otherwise we don't get * errors from IPv4 packets sent through the IPv6 socket. @@ -162,13 +150,13 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net) fallthrough; case AF_INET: /* we want to receive ICMP errors */ - ip_sock_set_recverr(local->socket->sk); + ip_sock_set_recverr(usk); /* we want to set the don't fragment bit */ - ip_sock_set_mtu_discover(local->socket->sk, IP_PMTUDISC_DO); + ip_sock_set_mtu_discover(usk, IP_PMTUDISC_DO); /* We want receive timestamps. */ - sock_enable_timestamps(local->socket->sk); + sock_enable_timestamps(usk); break; default: @@ -177,15 +165,6 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net) _leave(" = 0"); return 0; - -error: - kernel_sock_shutdown(local->socket, SHUT_RDWR); - local->socket->sk->sk_user_data = NULL; - sock_release(local->socket); - local->socket = NULL; - - _leave(" = %d", ret); - return ret; } /* -- 2.18.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCHv4 net-next 0/2] net: enable udp v6 sockets receiving v4 packets with UDP GRO 2021-02-03 9:14 ` David Howells 2021-02-03 13:47 ` Xin Long @ 2021-02-03 15:19 ` David Howells 2021-02-05 0:19 ` David Howells 2021-02-05 9:14 ` David Howells 3 siblings, 0 replies; 14+ messages in thread From: David Howells @ 2021-02-03 15:19 UTC (permalink / raw) To: Xin Long Cc: dhowells, network dev, davem, Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Martin Varghese, Alexander Duyck, vfedorenko Xin Long <lucien.xin@gmail.com> wrote: > BTW: do you have any testing for this? If you're using a distro like a recent-ish Fedora or, I think, Debian, you should be able to install a kafs-client package. If that works, start the afs.mount service with systemctl and then look in /afs. You should see directories corresponding to a bunch of places that you can try accessing. I recommend you try "ls /afs/openafs.org". If you don't have that available, if you have the keyutils package installed, you can try: mount -t afs %openafs.org:root.cell /mnt then do "ls /mnt". David ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCHv4 net-next 0/2] net: enable udp v6 sockets receiving v4 packets with UDP GRO 2021-02-03 9:14 ` David Howells 2021-02-03 13:47 ` Xin Long 2021-02-03 15:19 ` David Howells @ 2021-02-05 0:19 ` David Howells 2021-02-05 9:14 ` David Howells 3 siblings, 0 replies; 14+ messages in thread From: David Howells @ 2021-02-05 0:19 UTC (permalink / raw) To: Xin Long Cc: dhowells, network dev, davem, Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Martin Varghese, Alexander Duyck, vfedorenko Xin Long <lucien.xin@gmail.com> wrote: > > If you could arrange for a random port to be assigned in such a case (and > > indicated back to the caller), that would be awesome. Possibly I just don't > > need to actually use bind in this case. > > > The patch is attached (based on this patch): Initial testing seems to show that it works. I'll poke at it some more tomorrow. David ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCHv4 net-next 0/2] net: enable udp v6 sockets receiving v4 packets with UDP GRO 2021-02-03 9:14 ` David Howells ` (2 preceding siblings ...) 2021-02-05 0:19 ` David Howells @ 2021-02-05 9:14 ` David Howells 2021-02-05 9:16 ` Xin Long 3 siblings, 1 reply; 14+ messages in thread From: David Howells @ 2021-02-05 9:14 UTC (permalink / raw) To: Xin Long Cc: dhowells, network dev, davem, Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Martin Varghese, Alexander Duyck, vfedorenko Xin Long <lucien.xin@gmail.com> wrote: > Subject: [PATCH net-next] rxrpc: use udp tunnel APIs instead of open code in > rxrpc_open_socket > > Signed-off-by: Xin Long <lucien.xin@gmail.com> You can add "Acked-by: David Howells <dhowells@redhat.com>" if you want. David ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCHv4 net-next 0/2] net: enable udp v6 sockets receiving v4 packets with UDP GRO 2021-02-05 9:14 ` David Howells @ 2021-02-05 9:16 ` Xin Long 0 siblings, 0 replies; 14+ messages in thread From: Xin Long @ 2021-02-05 9:16 UTC (permalink / raw) To: David Howells Cc: network dev, davem, Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Martin Varghese, Alexander Duyck, vfedorenko On Fri, Feb 5, 2021 at 5:14 PM David Howells <dhowells@redhat.com> wrote: > > Xin Long <lucien.xin@gmail.com> wrote: > > > Subject: [PATCH net-next] rxrpc: use udp tunnel APIs instead of open code in > > rxrpc_open_socket > > > > Signed-off-by: Xin Long <lucien.xin@gmail.com> > > You can add "Acked-by: David Howells <dhowells@redhat.com>" if you want. > OK, Thank you so much! ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2021-02-05 9:24 UTC | newest] Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-01-26 5:10 [PATCHv4 net-next 0/2] net: enable udp v6 sockets receiving v4 packets with UDP GRO Xin Long 2021-01-26 5:10 ` [PATCHv4 net-next 1/2] udp: call udp_encap_enable for v6 sockets when enabling encap Xin Long 2021-01-26 5:10 ` [PATCHv4 net-next 2/2] rxrpc: call udp_tunnel_encap_enable in rxrpc_open_socket Xin Long 2021-01-26 9:06 ` David Howells 2021-01-26 23:07 ` [PATCHv4 net-next 1/2] udp: call udp_encap_enable for v6 sockets when enabling encap Willem de Bruijn 2021-02-03 4:20 ` [PATCHv4 net-next 0/2] net: enable udp v6 sockets receiving v4 packets with UDP GRO Xin Long 2021-02-03 8:00 ` David Howells 2021-02-03 8:52 ` Xin Long 2021-02-03 9:14 ` David Howells 2021-02-03 13:47 ` Xin Long 2021-02-03 15:19 ` David Howells 2021-02-05 0:19 ` David Howells 2021-02-05 9:14 ` David Howells 2021-02-05 9:16 ` Xin Long
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.