Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Sep 2006 08:38:33 +0200
From:      Ian FREISLICH <if@hetzner.co.za>
To:        Randall Stewart <rrs@cisco.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: Anyone play with divert sockets lately? 
Message-ID:  <E1GS6aP-0007pm-Fy@hetzner.co.za>
In-Reply-To: Message from Randall Stewart <rrs@cisco.com>  of "Fri, 22 Sep 2006 13:54:26 -0400." <45142352.2060600@cisco.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1GS6aP-0007pm-Fy>