Hi,

divert-to currently only works with sockets listening on a specific
address, but not any (0.0.0.0 / ::).

For example, if you do "pass in ... divert-to 127.0.0.1 port 1234",
the userland proxy currently has bind its socket to 127.0.0.1, and not
0.0.0.0.  The attached diff attempts to fix it and also allows the
"zero address".

OK?

Reyk

Index: sys/netinet/in_pcb.c
===================================================================
RCS file: /cvs/src/sys/netinet/in_pcb.c,v
retrieving revision 1.139
diff -u -p -u -p -r1.139 in_pcb.c
--- sys/netinet/in_pcb.c        1 Jun 2013 13:25:40 -0000       1.139
+++ sys/netinet/in_pcb.c        19 Jun 2013 17:53:50 -0000
@@ -1004,7 +1004,8 @@ in_pcblookup_listen(struct inpcbtable *t
 
                if ((divert = pf_find_divert(m)) == NULL)
                        return (NULL);
-               key1 = key2 = &divert->addr.v4;
+               key1 = &divert->addr.v4;
+               key2 = &zeroin_addr;
                lport = divert->port;
        } else
 #endif

Reply via email to