Subject: Re: IPv6 capable tun
To: Michael Richardson <mcr@sandelman.ottawa.on.ca>
From: None <itojun@iijlab.net>
List: tech-net
Date: 01/11/2001 15:11:12
>    > 	for IFF_MULTICAST, I believe we need to have proper multicast group
>    > 	management code in tunioctl().
>  What do we need to do?
>  Just keep track of which multicast groups are on? Or do you think that
>these things should be passed to the application?

	sorry this was not correct.  maybe i was dreaming.

>    > 	another issue - there's no compatibility between *BSD, regarding to
>    > 	packet encoding on character device side...
>  What do you mean? What do you other BSDs do?

	openbsd: when we read/write character device side, we always see
		u_int32_t address family at the top, in network byteorder.
http://www.openbsd.org/cgi-bin/cvsweb/src/sys/net/if_tun.c?r1=1.2&r2=1.3

	freebsd[23]: no indicaiton of af (= IPv4 only)
	freebsd4: in TUN_LMODE, attaches sockaddr at the head.  if TUN_IFHEAD,
		attach address family in network byteorder.  otherwise,
		no indication of af (= IPv4 only)

		TUN_LMODE: 
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/net/if_tun.c.diff?r1=1.52&r2=1.53
		TUN_IFHEAD:
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/net/if_tun.c.diff?r1=1.69&r2=1.70


	netbsd: in TUN_PREPADDR, attaches sockaddr at the head.
		otherwise, no indication of af (= IPv4 only).


	af#, u_int32_t	sockaddr	none
	(network order)
	---		---		---
net	no		yes		yes
free	yes		yes		yes
open	yes		no		no

	so if you would like to implement some program that is portable across
	three of them, you need to implement at least two modes of operation.

itojun