svn commit: r196504 - head/sys/net

Marko Zec zec at icir.org
Mon Aug 24 10:29:56 UTC 2009


On Monday 24 August 2009 12:14:09 Marko Zec wrote:
> Author: zec
> Date: Mon Aug 24 10:14:09 2009
> New Revision: 196504
> URL: http://svn.freebsd.org/changeset/base/196504
>
> Log:
>   When moving ifnets from one vnet to another, and the ifnet
>   has ifaddresses of AF_LINK type which thus have an embedded
>   if_index "backpointer", we must update that if_index backpointer
>   to reflect the new if_index that our ifnet just got assigned.
>
>   This change affects only options VIMAGE builds.
>
>   Submitted by:	bz
>   Reviewed by:	bz
>   Approved by:	re (rwatson), julian (mentor)

Missing:

MFC after:	3 days

> Modified:
>   head/sys/net/if.c
>
> Modified: head/sys/net/if.c
> ===========================================================================
>=== --- head/sys/net/if.c	Mon Aug 24 10:09:30 2009	(r196503)
> +++ head/sys/net/if.c	Mon Aug 24 10:14:09 2009	(r196504)
> @@ -589,6 +589,21 @@ if_attach_internal(struct ifnet *ifp, in
>  		/* Reliably crash if used uninitialized. */
>  		ifp->if_broadcastaddr = NULL;
>  	}
> +#ifdef VIMAGE
> +	else {
> +		/*
> +		 * Update the interface index in the link layer address
> +		 * of the interface.
> +		 */
> +		for (ifa = ifp->if_addr; ifa != NULL;
> +		    ifa = TAILQ_NEXT(ifa, ifa_link)) {
> +			if (ifa->ifa_addr->sa_family == AF_LINK) {
> +				sdl = (struct sockaddr_dl *)ifa->ifa_addr;
> +				sdl->sdl_index = ifp->if_index;
> +			}
> +		}
> +	}
> +#endif
>
>  	IFNET_WLOCK();
>  	TAILQ_INSERT_TAIL(&V_ifnet, ifp, if_link);




More information about the svn-src-head mailing list