From owner-freebsd-net@FreeBSD.ORG Mon May 5 19:18:32 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 A8152106567F for ; Mon, 5 May 2008 19:18:32 +0000 (UTC) (envelope-from Jinmei_Tatuya@isc.org) Received: from mon.jinmei.org (mon.jinmei.org [IPv6:2001:4f8:3:36::162]) by mx1.freebsd.org (Postfix) with ESMTP id 99E6F8FC14 for ; Mon, 5 May 2008 19:18:32 +0000 (UTC) (envelope-from Jinmei_Tatuya@isc.org) Received: from jmb.jinmei.org (unknown [IPv6:2001:4f8:3:bb:217:f2ff:fee0:a91f]) by mon.jinmei.org (Postfix) with ESMTP id 32B3133C2E; Mon, 5 May 2008 12:18:32 -0700 (PDT) Date: Mon, 05 May 2008 12:18:32 -0700 Message-ID: From: JINMEI Tatuya / =?ISO-2022-JP?B?GyRCP0BMQEMjOkgbKEI=?= To: Edwin Groothuis In-Reply-To: <20080503100043.GA68835@k7.mavetju> References: <20080503100043.GA68835@k7.mavetju> User-Agent: Wanderlust/2.14.0 (Africa) Emacs/22.1 Mule/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: freebsd-net@freebsd.org Subject: Re: 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: Mon, 05 May 2008 19:18:32 -0000 At Sat, 3 May 2008 20:00:43 +1000, Edwin Groothuis wrote: > Before somebody shoots me down on it: I know that ipfw_divert() is > not suitable for IPv6 packets. [snip] > which is what I expected. So why doesn't this get displayed for the > IPv6 sockets? I don't know much about IPDIVERT, but it seems to me this is simply because the IPv6 stack (sys/netinet6) doesn't support divert sockets. So opening an AF_INET6 socket with the protocol being IPPROTO_DIVERT (which is "unknown") sin = socket(PF_INET6, SOCK_RAW, IPPROTO_DIVERT); matches a wildcard protosw /* raw wildcard */ { .pr_type = SOCK_RAW, .pr_domain = &inet6domain, .pr_flags = PR_ATOMIC|PR_ADDR, .pr_input = rip6_input, .pr_output = rip6_output, .pr_ctloutput = rip6_ctloutput, .pr_usrreqs = &rip6_usrreqs }, whose pr_protocol is implicitly set to 0, which is (accidentally) interpreted by lsof as "HOPOPTS". This should provide a direct answer to you question of "why"? But I suspect the underlying question is why divert sockets aren't supported for IPv6. I don't know why. --- JINMEI, Tatuya Internet Systems Consortium, Inc.