bpf writes on tun device

Bruce M Simpson bms at spc.org
Mon Jun 6 12:08:56 GMT 2005


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


More information about the freebsd-net mailing list