Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Jun 2005 13:08:51 +0100
From:      Bruce M Simpson <bms@spc.org>
To:        Matthew Luckie <mjl@luckie.org.nz>
Cc:        freebsd-net@freebsd.org
Subject:   Re: bpf writes on tun device
Message-ID:  <20050606120851.GD734@empiric.icir.org>
In-Reply-To: <20050606081637.GA73886@lycra.luckie.org.nz>
References:  <4295A6CA.8080409@luckie.org.nz> <20050606081637.GA73886@lycra.luckie.org.nz>

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050606120851.GD734>