From owner-freebsd-net@FreeBSD.ORG Sat May 3 10:17:22 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E45C1065672 for ; Sat, 3 May 2008 10:17:22 +0000 (UTC) (envelope-from edwin@mavetju.org) Received: from mail5out.barnet.com.au (mail5.barnet.com.au [202.83.178.78]) by mx1.freebsd.org (Postfix) with ESMTP id 706A88FC27 for ; Sat, 3 May 2008 10:17:21 +0000 (UTC) (envelope-from edwin@mavetju.org) Received: by mail5out.barnet.com.au (Postfix, from userid 1001) id 8402A2218A78; Sat, 3 May 2008 20:00:44 +1000 (EST) X-Viruscan-Id: <481C37CC0001637998C548@BarNet> Received: from mail5auth.barnet.com.au (mail5.barnet.com.au [202.83.178.78]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mail5auth.barnet.com.au", Issuer "*.barnet.com.au" (verified OK)) by mail5.barnet.com.au (Postfix) with ESMTP id 2B7E821B2BCE for ; Sat, 3 May 2008 20:00:44 +1000 (EST) Received: from k7.mavetju (k7.mavetju.org [10.251.1.18]) by mail5auth.barnet.com.au (Postfix) with ESMTP id B753D2218A69 for ; Sat, 3 May 2008 20:00:43 +1000 (EST) Received: by k7.mavetju (Postfix, from userid 1001) id 64F7B314; Sat, 3 May 2008 20:00:43 +1000 (EST) Date: Sat, 3 May 2008 20:00:43 +1000 From: Edwin Groothuis To: freebsd-net@freebsd.org Message-ID: <20080503100043.GA68835@k7.mavetju> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i Subject: IPPROTO_DIVERT and PF_INET6 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 May 2008 10:17:22 -0000 Greetings, Before somebody shoots me down on it: I know that ipfw_divert() is not suitable for IPv6 packets. So, to the point. This code: struct sockaddr_in6 addr6; struct in6_addr ip6_any = IN6ADDR_ANY_INIT; sin = socket(PF_INET6, SOCK_RAW, IPPROTO_DIVERT); if (sin == -1) errx(1, "Unable to create sin socket."); if (sin > fdmax) fdmax = sin; addr6.sin6_family = AF_INET6; addr6.sin6_addr = ip6_any; addr6.sin6_port = htons(8669); if (bind(sin, (struct sockaddr *) &addr6, sizeof(addr6)) == -1) errx(1, "Unable to bind incoming divert socket: %s", strerror(errno)); compiles and run fine, but it gives me this in the lsof output: nat6to4d 67887 root 3u IPv6 0xc8b05000 0t0 HOPOPTS *:* HOPOPTS is "0" according to /etc/protocols. Making everything IPv4, it gives this: nat6to4d 67899 root 3u IPv4 0xc865421c 0t0 DIVERT *:8669 which is what I expected. So why doesn't this get displayed for the IPv6 sockets? Edwin -- Edwin Groothuis | Personal website: http://www.mavetju.org edwin@mavetju.org | Weblog: http://www.mavetju.org/weblog/