Subject: sockaddr_dl trouble
To: None <thorpej@netbsd.org>
From: None <itojun@iijlab.net>
List: tech-net
Date: 01/17/2001 18:12:34
>Module Name:	syssrc
>Committed By:	thorpej
>Date:		Wed Jan 17 00:30:53 UTC 2001
>
>Modified Files:
>	syssrc/sys/arch/alpha/a12: if_xb.c
>	syssrc/sys/dev/ic: hd64570.c
>	syssrc/sys/net: if.c if.h if_arcsubr.c if_atmsubr.c if_ethersubr.c
>	    if_faith.c if_fddisubr.c if_gif.c if_gre.c if_hippisubr.c
>	    if_ieee1394subr.c if_loop.c if_ppp.c if_sl.c if_spppsubr.c if_stf.c
>	    if_strip.c if_tokensubr.c if_tun.c
>	syssrc/sys/netinet: ip_ipip.c
>	syssrc/sys/netisdn: i4b_ipr.c i4b_isppp.c
>	syssrc/sys/netiso: if_eon.c
>	syssrc/sys/netns: ns_ip.c
>
>Log Message:
>Fix a rather annoying problem where the sockaddr_dl which holds
>the link level name for the interface (ifp->if_sadl) is allocated
>before ifp->if_addrlen is initialized, which could lead to allocating
>too little space for the link level address.
>
>Do this by splitting allocation of the link level name out of
>if_attach() and into if_alloc_sadl(), which is normally called
>by functions like ether_ifattach().  Network interfaces which
>don't have a link-specific attach routine must call if_alloc_sadl()
>themselves (example: gif).
>
>Link level names are freed by if_free_sadl(), which can be called
>from e.g. ether_ifdetach().  Drivers never need call if_free_sadl()
>themselves as if_detach() will do it if it is not already done.
>
>While here, add the ability to pass an AF_LINK address to
>SIOCSIFADDR in ether_ioctl() (this is what caused me to notice
>the problem that the above fixes).

	after this change,
	- ifconfig -a nor netstat -in do not present MAC address
	- IPv6 code cannot find sockaddr_dl, and initializes interface
	  identifier from MD5(hostname)
	it needs to be fixed.

itojun