From owner-freebsd-current@FreeBSD.ORG Tue Sep 26 06:38:39 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 74E3816A407 for ; Tue, 26 Sep 2006 06:38:39 +0000 (UTC) (envelope-from if@hetzner.co.za) Received: from hetzner.co.za (office.cpt2.host-h.net [196.7.147.230]) by mx1.FreeBSD.org (Postfix) with ESMTP id EF63943D77 for ; Tue, 26 Sep 2006 06:38:38 +0000 (GMT) (envelope-from if@hetzner.co.za) Received: from localhost ([127.0.0.1]) by hetzner.co.za with esmtp (Exim 4.62 (FreeBSD)) (envelope-from ) id 1GS6aP-0007pm-Fy; Tue, 26 Sep 2006 08:38:33 +0200 To: Randall Stewart From: Ian FREISLICH In-Reply-To: Message from Randall Stewart of "Fri, 22 Sep 2006 13:54:26 -0400." <45142352.2060600@cisco.com> X-Attribution: BOFH Date: Tue, 26 Sep 2006 08:38:33 +0200 Message-Id: Cc: freebsd-current@freebsd.org Subject: Re: Anyone play with divert sockets lately? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Sep 2006 06:38:39 -0000 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