From owner-freebsd-net@FreeBSD.ORG Mon Jun 6 12:08:56 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8F1AA16A420 for ; Mon, 6 Jun 2005 12:08:56 +0000 (GMT) (envelope-from bms@spc.org) Received: from arginine.spc.org (arginine.spc.org [83.167.185.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1DCD443D5E for ; Mon, 6 Jun 2005 12:08:56 +0000 (GMT) (envelope-from bms@spc.org) Received: from localhost (localhost [127.0.0.1]) by arginine.spc.org (Postfix) with ESMTP id D159765371; Mon, 6 Jun 2005 13:06:55 +0100 (BST) Received: from arginine.spc.org ([127.0.0.1]) by localhost (arginine.spc.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 94191-03-2; Mon, 6 Jun 2005 13:06:55 +0100 (BST) Received: from empiric.dek.spc.org (host81-134-123-217.in-addr.btopenworld.com [81.134.123.217]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by arginine.spc.org (Postfix) with ESMTP id 52C1E65319; Mon, 6 Jun 2005 13:06:54 +0100 (BST) Received: by empiric.dek.spc.org (Postfix, from userid 1001) id ACF336266; Mon, 6 Jun 2005 13:08:51 +0100 (BST) Date: Mon, 6 Jun 2005 13:08:51 +0100 From: Bruce M Simpson To: Matthew Luckie Message-ID: <20050606120851.GD734@empiric.icir.org> Mail-Followup-To: Matthew Luckie , freebsd-net@freebsd.org References: <4295A6CA.8080409@luckie.org.nz> <20050606081637.GA73886@lycra.luckie.org.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050606081637.GA73886@lycra.luckie.org.nz> Cc: freebsd-net@freebsd.org Subject: Re: bpf writes on tun device 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, 06 Jun 2005 12:08:56 -0000 On Mon, Jun 06, 2005 at 08:16:38PM +1200, Matthew Luckie wrote: > If I was to pursue this, would someone on this list consider committing the > work to current? ... > + case DLT_NULL: > + sockp->sa_family = AF_UNSPEC; > + if(strcmp(ifp->if_name, "tun") == 0) > + hlen = sizeof(int); > + else > + hlen = 0; > + break; Maybe this won't work if an instance of tun is renamed? I'd compare "tun" with ifp->if_dname (driver name) to be on the safe side. Because tun instances allow their if_type to be set, one cannot use if_type as the sole key for determining if the ifnet is of type 'tun'; this would be ambiguous, as tun instances may have their if_type set by an ioctl. Another way of dealing with this would be to ask the tcpdump.org guys to define a DLT type for tun interfaces, rather than special-casing it for DLT_NULL. Regards, BMS