Anyone play with divert sockets lately?
Ian FREISLICH
if at hetzner.co.za
Mon Sep 25 23:38:39 PDT 2006
Randall Stewart wrote:
> Hi all:
>
> Due to something I need to do at I had to bring
> up a couple of daemon's that use DIVERT sockets.
> So I grabbed my two test machines.. one runs
> 6.1 the other 7.0...
>
> I had not updated in a while... (the 7.0 machine).
> So anyway, I got everything configured.. started
> my router with the proper VRF's.. setup the
> tunnels ...
>
> the 6.1 machine came up fine..
>
> The 7.0 could not write into the tunnel... it
> is sending to addr.sin_addr.s_addr = 0 and getting
> error EACCESS back..
>
> So I cvsup to current as of today.. rebuild..
>
> and I get a bunch of:
>
> error's from the divert code.. and then a
> crash in kern_exec/kern_proc.c
I'm using divert sockets extensively for some tunnel/vpn software
I wrote _way_ back. It's running fine on -CURRENT (Tue Sep 19
08:33:01 SAST 2006), 4.11-STABLE, and just about everything in
between. I've not had to change the code substantially to make it
work on newer BSDs. All our VoIP goes through this piece of code:
memset(&from, '\0', sizeof from);
from.sin_addr.s_addr = INADDR_ANY;
from.sin_port = config.tuns[config.tun].fw_rule;
while (tot + ntohs(hdr->length) <= (p - buf + in)) {
out = sendto(config.tuns[config.tun].div_fd, buf + tot,
ntohs(hdr->length), 0, (struct sockaddr *)&from,
sizeof(addr));
...
So, I'm not sure where you're going wrong.
Ian
--
Ian Freislich
More information about the freebsd-current
mailing list