* ipv6 udp early demux breaks udp_l3mdev_accept=0 @ 2017-04-14 22:23 David Ahern 2017-04-15 0:38 ` Subash Abhinov Kasiviswanathan 0 siblings, 1 reply; 8+ messages in thread From: David Ahern @ 2017-04-14 22:23 UTC (permalink / raw) To: subashab; +Cc: netdev, Robert Shearman Subash: My understanding of early demux is that it should only match connected sockets (src/sport + dst/dport are all set). The ipv6 udp early demux code added in 5425077d73e0c is doing a generic socket lookup which does not require an exact match and accordingly breaks udp_l3mdev_accept=0. Please fix. David ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ipv6 udp early demux breaks udp_l3mdev_accept=0 2017-04-14 22:23 ipv6 udp early demux breaks udp_l3mdev_accept=0 David Ahern @ 2017-04-15 0:38 ` Subash Abhinov Kasiviswanathan 2017-04-15 0:42 ` David Ahern 0 siblings, 1 reply; 8+ messages in thread From: Subash Abhinov Kasiviswanathan @ 2017-04-15 0:38 UTC (permalink / raw) To: David Ahern; +Cc: netdev, Robert Shearman On 2017-04-14 16:23, David Ahern wrote: > Subash: > > My understanding of early demux is that it should only match connected > sockets (src/sport + dst/dport are all set). The ipv6 udp early demux > code added in 5425077d73e0c is doing a generic socket lookup which does > not require an exact match and accordingly breaks udp_l3mdev_accept=0. > Please fix. > > David Hi David Would it be possible to disable udp_early_demux for your case temporarily. I'll look into this. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ipv6 udp early demux breaks udp_l3mdev_accept=0 2017-04-15 0:38 ` Subash Abhinov Kasiviswanathan @ 2017-04-15 0:42 ` David Ahern 2017-04-15 13:48 ` David Miller 0 siblings, 1 reply; 8+ messages in thread From: David Ahern @ 2017-04-15 0:42 UTC (permalink / raw) To: Subash Abhinov Kasiviswanathan; +Cc: netdev, Robert Shearman On 4/14/17 6:38 PM, Subash Abhinov Kasiviswanathan wrote: > On 2017-04-14 16:23, David Ahern wrote: >> Subash: >> >> My understanding of early demux is that it should only match connected >> sockets (src/sport + dst/dport are all set). The ipv6 udp early demux >> code added in 5425077d73e0c is doing a generic socket lookup which does >> not require an exact match and accordingly breaks udp_l3mdev_accept=0. >> Please fix. >> >> David > > Hi David > > Would it be possible to disable udp_early_demux for your case temporarily. > I'll look into this. > It should be fixed for 4.12. Basically, __udp6_lib_demux_lookup needs to be more like __udp4_lib_demux_lookup ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ipv6 udp early demux breaks udp_l3mdev_accept=0 2017-04-15 0:42 ` David Ahern @ 2017-04-15 13:48 ` David Miller 2017-04-16 2:23 ` Subash Abhinov Kasiviswanathan 0 siblings, 1 reply; 8+ messages in thread From: David Miller @ 2017-04-15 13:48 UTC (permalink / raw) To: dsa; +Cc: subashab, netdev, rshearma From: David Ahern <dsa@cumulusnetworks.com> Date: Fri, 14 Apr 2017 18:42:14 -0600 > On 4/14/17 6:38 PM, Subash Abhinov Kasiviswanathan wrote: >> On 2017-04-14 16:23, David Ahern wrote: >>> Subash: >>> >>> My understanding of early demux is that it should only match connected >>> sockets (src/sport + dst/dport are all set). The ipv6 udp early demux >>> code added in 5425077d73e0c is doing a generic socket lookup which does >>> not require an exact match and accordingly breaks udp_l3mdev_accept=0. >>> Please fix. >>> >>> David >> >> Hi David >> >> Would it be possible to disable udp_early_demux for your case temporarily. >> I'll look into this. >> > > It should be fixed for 4.12. Basically, __udp6_lib_demux_lookup needs to > be more like __udp4_lib_demux_lookup Agreed. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ipv6 udp early demux breaks udp_l3mdev_accept=0 2017-04-15 13:48 ` David Miller @ 2017-04-16 2:23 ` Subash Abhinov Kasiviswanathan 2017-04-16 23:26 ` David Ahern 0 siblings, 1 reply; 8+ messages in thread From: Subash Abhinov Kasiviswanathan @ 2017-04-16 2:23 UTC (permalink / raw) To: dsa; +Cc: David Miller, netdev, rshearma >> It should be fixed for 4.12. Basically, __udp6_lib_demux_lookup needs >> to >> be more like __udp4_lib_demux_lookup Hi David Would it be possible for you to test this with udp_l3mdev_accept=0 diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index b793ed1..0e307e5 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -46,6 +46,7 @@ #include <net/tcp_states.h> #include <net/ip6_checksum.h> #include <net/xfrm.h> +#include <net/inet_hashtables.h> #include <net/inet6_hashtables.h> #include <net/busy_poll.h> #include <net/sock_reuseport.h> @@ -864,21 +865,25 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, return 0; } + static struct sock *__udp6_lib_demux_lookup(struct net *net, __be16 loc_port, const struct in6_addr *loc_addr, __be16 rmt_port, const struct in6_addr *rmt_addr, int dif) { + unsigned short hnum = ntohs(loc_port); + unsigned int hash2 = udp6_portaddr_hash(net, loc_addr, hnum); + unsigned int slot2 = hash2 & udp_table.mask; + struct udp_hslot *hslot2 = &udp_table.hash2[slot2]; + const __portpair ports = INET_COMBINED_PORTS(rmt_port, hnum); struct sock *sk; - rcu_read_lock(); - sk = __udp6_lib_lookup(net, rmt_addr, rmt_port, loc_addr, loc_port, - dif, &udp_table, NULL); - if (sk && !atomic_inc_not_zero(&sk->sk_refcnt)) - sk = NULL; - rcu_read_unlock(); - - return sk; + udp_portaddr_for_each_entry_rcu(sk, &hslot2->head) { + if (INET6_MATCH(sk, net, rmt_addr, loc_addr, ports, dif)) + return sk; + break; + } + return NULL; } static void udp_v6_early_demux(struct sk_buff *skb) ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: ipv6 udp early demux breaks udp_l3mdev_accept=0 2017-04-16 2:23 ` Subash Abhinov Kasiviswanathan @ 2017-04-16 23:26 ` David Ahern 2017-04-17 0:44 ` Subash Abhinov Kasiviswanathan 0 siblings, 1 reply; 8+ messages in thread From: David Ahern @ 2017-04-16 23:26 UTC (permalink / raw) To: Subash Abhinov Kasiviswanathan; +Cc: David Miller, netdev, rshearma On 4/15/17 8:23 PM, Subash Abhinov Kasiviswanathan wrote: >>> It should be fixed for 4.12. Basically, __udp6_lib_demux_lookup needs to >>> be more like __udp4_lib_demux_lookup > > Hi David > > Would it be possible for you to test this with udp_l3mdev_accept=0 formatting was botched so it does not apply cleanly. please send a patch file ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ipv6 udp early demux breaks udp_l3mdev_accept=0 2017-04-16 23:26 ` David Ahern @ 2017-04-17 0:44 ` Subash Abhinov Kasiviswanathan 2017-04-17 2:59 ` David Ahern 0 siblings, 1 reply; 8+ messages in thread From: Subash Abhinov Kasiviswanathan @ 2017-04-17 0:44 UTC (permalink / raw) To: dsa, davem, netdev, rshearma; +Cc: Subash Abhinov Kasiviswanathan Can you try this --- net/ipv6/udp.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index b793ed1..0e307e5 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -46,6 +46,7 @@ #include <net/tcp_states.h> #include <net/ip6_checksum.h> #include <net/xfrm.h> +#include <net/inet_hashtables.h> #include <net/inet6_hashtables.h> #include <net/busy_poll.h> #include <net/sock_reuseport.h> @@ -864,21 +865,25 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, return 0; } + static struct sock *__udp6_lib_demux_lookup(struct net *net, __be16 loc_port, const struct in6_addr *loc_addr, __be16 rmt_port, const struct in6_addr *rmt_addr, int dif) { + unsigned short hnum = ntohs(loc_port); + unsigned int hash2 = udp6_portaddr_hash(net, loc_addr, hnum); + unsigned int slot2 = hash2 & udp_table.mask; + struct udp_hslot *hslot2 = &udp_table.hash2[slot2]; + const __portpair ports = INET_COMBINED_PORTS(rmt_port, hnum); struct sock *sk; - rcu_read_lock(); - sk = __udp6_lib_lookup(net, rmt_addr, rmt_port, loc_addr, loc_port, - dif, &udp_table, NULL); - if (sk && !atomic_inc_not_zero(&sk->sk_refcnt)) - sk = NULL; - rcu_read_unlock(); - - return sk; + udp_portaddr_for_each_entry_rcu(sk, &hslot2->head) { + if (INET6_MATCH(sk, net, rmt_addr, loc_addr, ports, dif)) + return sk; + break; + } + return NULL; } static void udp_v6_early_demux(struct sk_buff *skb) -- 1.9.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: ipv6 udp early demux breaks udp_l3mdev_accept=0 2017-04-17 0:44 ` Subash Abhinov Kasiviswanathan @ 2017-04-17 2:59 ` David Ahern 0 siblings, 0 replies; 8+ messages in thread From: David Ahern @ 2017-04-17 2:59 UTC (permalink / raw) To: Subash Abhinov Kasiviswanathan, davem, netdev, rshearma On 4/16/17 6:44 PM, Subash Abhinov Kasiviswanathan wrote: > Can you try this > > --- > net/ipv6/udp.c | 21 +++++++++++++-------- > 1 file changed, 13 insertions(+), 8 deletions(-) > > diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c > index b793ed1..0e307e5 100644 > --- a/net/ipv6/udp.c > +++ b/net/ipv6/udp.c > @@ -46,6 +46,7 @@ > #include <net/tcp_states.h> > #include <net/ip6_checksum.h> > #include <net/xfrm.h> > +#include <net/inet_hashtables.h> > #include <net/inet6_hashtables.h> > #include <net/busy_poll.h> > #include <net/sock_reuseport.h> > @@ -864,21 +865,25 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, > return 0; > } > > + > static struct sock *__udp6_lib_demux_lookup(struct net *net, > __be16 loc_port, const struct in6_addr *loc_addr, > __be16 rmt_port, const struct in6_addr *rmt_addr, > int dif) > { > + unsigned short hnum = ntohs(loc_port); > + unsigned int hash2 = udp6_portaddr_hash(net, loc_addr, hnum); > + unsigned int slot2 = hash2 & udp_table.mask; > + struct udp_hslot *hslot2 = &udp_table.hash2[slot2]; > + const __portpair ports = INET_COMBINED_PORTS(rmt_port, hnum); > struct sock *sk; > > - rcu_read_lock(); > - sk = __udp6_lib_lookup(net, rmt_addr, rmt_port, loc_addr, loc_port, > - dif, &udp_table, NULL); > - if (sk && !atomic_inc_not_zero(&sk->sk_refcnt)) > - sk = NULL; > - rcu_read_unlock(); > - > - return sk; > + udp_portaddr_for_each_entry_rcu(sk, &hslot2->head) { > + if (INET6_MATCH(sk, net, rmt_addr, loc_addr, ports, dif)) > + return sk; > + break; > + } > + return NULL; > } > > static void udp_v6_early_demux(struct sk_buff *skb) > That works for me. Thanks for the fast turn around. ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-04-17 2:59 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-04-14 22:23 ipv6 udp early demux breaks udp_l3mdev_accept=0 David Ahern 2017-04-15 0:38 ` Subash Abhinov Kasiviswanathan 2017-04-15 0:42 ` David Ahern 2017-04-15 13:48 ` David Miller 2017-04-16 2:23 ` Subash Abhinov Kasiviswanathan 2017-04-16 23:26 ` David Ahern 2017-04-17 0:44 ` Subash Abhinov Kasiviswanathan 2017-04-17 2:59 ` David Ahern
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.