use fast lookup in in6_pcbconnect()

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

use fast lookup in in6_pcbconnect()

Vincent Gross-5
The current use of in_pcblookup() in in6_pcbconnect() is suboptimal :
all of the addresses and ports are defined, we are only interested in
exact matches, and its v4 cousin in_pcbconnect() already uses
in_pcbhashlookup().

Ok ?

Index: sys/netinet6/in6_pcb.c
===================================================================
RCS file: /cvs/src/sys/netinet6/in6_pcb.c,v
retrieving revision 1.89
diff -u -p -r1.89 in6_pcb.c
--- sys/netinet6/in6_pcb.c      23 Mar 2016 15:50:36 -0000      1.89
+++ sys/netinet6/in6_pcb.c      23 Mar 2016 17:09:11 -0000
@@ -304,9 +304,9 @@ in6_pcbconnect(struct inpcb *inp, struct

        inp->inp_ipv6.ip6_hlim = (u_int8_t)in6_selecthlim(inp);

- if (in_pcblookup(inp->inp_table, &sin6->sin6_addr, sin6->sin6_port,
+ if (in6_pcbhashlookup(inp->inp_table, &sin6->sin6_addr, sin6->sin6_port,
            IN6_IS_ADDR_UNSPECIFIED(&inp->inp_laddr6) ? in6a : &inp->inp_laddr6,
-    inp->inp_lport, INPLOOKUP_IPV6, inp->inp_rtableid)) {
+    inp->inp_lport, inp->inp_rtableid)) {
                return (EADDRINUSE);
        }

Reply | Threaded
Open this post in threaded view
|

Re: use fast lookup in in6_pcbconnect()

Alexander Bluhm
On Wed, Mar 23, 2016 at 06:22:36PM +0100, Vincent Gross wrote:
> The current use of in_pcblookup() in in6_pcbconnect() is suboptimal :
> all of the addresses and ports are defined, we are only interested in
> exact matches, and its v4 cousin in_pcbconnect() already uses
> in_pcbhashlookup().
>
> Ok ?

OK bluhm@

>
> Index: sys/netinet6/in6_pcb.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet6/in6_pcb.c,v
> retrieving revision 1.89
> diff -u -p -r1.89 in6_pcb.c
> --- sys/netinet6/in6_pcb.c      23 Mar 2016 15:50:36 -0000      1.89
> +++ sys/netinet6/in6_pcb.c      23 Mar 2016 17:09:11 -0000
> @@ -304,9 +304,9 @@ in6_pcbconnect(struct inpcb *inp, struct
>
> inp->inp_ipv6.ip6_hlim = (u_int8_t)in6_selecthlim(inp);
>
> - if (in_pcblookup(inp->inp_table, &sin6->sin6_addr, sin6->sin6_port,
> + if (in6_pcbhashlookup(inp->inp_table, &sin6->sin6_addr, sin6->sin6_port,
>    IN6_IS_ADDR_UNSPECIFIED(&inp->inp_laddr6) ? in6a : &inp->inp_laddr6,
> -    inp->inp_lport, INPLOOKUP_IPV6, inp->inp_rtableid)) {
> +    inp->inp_lport, inp->inp_rtableid)) {
> return (EADDRINUSE);
> }