Subject: CVS commit: syssrc
To: None <source-changes@netbsd.org>
From: Jason R Thorpe <thorpej@netbsd.org>
List: source-changes
Date: 01/17/2001 02:30:53
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).


To generate a diff of this commit:
cvs rdiff -r1.5 -r1.6 syssrc/sys/arch/alpha/a12/if_xb.c
cvs rdiff -r1.13 -r1.14 syssrc/sys/dev/ic/hd64570.c
cvs rdiff -r1.80 -r1.81 syssrc/sys/net/if.c
cvs rdiff -r1.62 -r1.63 syssrc/sys/net/if.h
cvs rdiff -r1.33 -r1.34 syssrc/sys/net/if_arcsubr.c
cvs rdiff -r1.26 -r1.27 syssrc/sys/net/if_atmsubr.c
cvs rdiff -r1.74 -r1.75 syssrc/sys/net/if_ethersubr.c
cvs rdiff -r1.14 -r1.15 syssrc/sys/net/if_faith.c \
    syssrc/sys/net/if_tokensubr.c
cvs rdiff -r1.37 -r1.38 syssrc/sys/net/if_fddisubr.c
cvs rdiff -r1.19 -r1.20 syssrc/sys/net/if_gif.c syssrc/sys/net/if_spppsubr.c
cvs rdiff -r1.15 -r1.16 syssrc/sys/net/if_gre.c
cvs rdiff -r1.9 -r1.10 syssrc/sys/net/if_hippisubr.c
cvs rdiff -r1.6 -r1.7 syssrc/sys/net/if_ieee1394subr.c
cvs rdiff -r1.34 -r1.35 syssrc/sys/net/if_loop.c syssrc/sys/net/if_strip.c
cvs rdiff -r1.66 -r1.67 syssrc/sys/net/if_ppp.c
cvs rdiff -r1.71 -r1.72 syssrc/sys/net/if_sl.c
cvs rdiff -r1.7 -r1.8 syssrc/sys/net/if_stf.c
cvs rdiff -r1.41 -r1.42 syssrc/sys/net/if_tun.c
cvs rdiff -r1.13 -r1.14 syssrc/sys/netinet/ip_ipip.c
cvs rdiff -r1.1 -r1.2 syssrc/sys/netisdn/i4b_ipr.c \
    syssrc/sys/netisdn/i4b_isppp.c
cvs rdiff -r1.29 -r1.30 syssrc/sys/netiso/if_eon.c
cvs rdiff -r1.26 -r1.27 syssrc/sys/netns/ns_ip.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.