HEADSUP: internal network interface changes

Brooks Davis brooks at one-eyed-alien.net
Thu Jun 9 15:40:20 GMT 2005


On Thu, Jun 09, 2005 at 10:25:30AM +0200, Maxim Sobolev wrote:
> Hi,
> 
> I've noticed that in some cases you have removed bcopy()
> into arpcom.ac_enaddr completely, while in some others
> have modified it to use IFP2AC(). I wonder if it's a mistake
> or if there is some logic behind that.

Good catch, these are bugs.  I'll do another sweep.  The problems is
that I did the inital sweep based on some macros and not quite
everything was converted.

> Also, it looks like in cdce(4) driver you are referencing
> if_softc before it's been assigned by if_alloc():
> 
> @@ -282,9 +283,13 @@
>  		}
>  	}
>  
> -	bcopy(eaddr, (char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN);
> +	bcopy(eaddr, (char *)&GET_ARPCOM(sc)->ac_enaddr, ETHER_ADDR_LEN);
>  
> -	ifp = GET_IFP(sc);
> +	ifp = GET_IFP(sc) = if_alloc(IFT_ETHER);
> +	if (ifp == NULL) {
> +		printf("%s: can not if_alloc()\n", USBDEVNAME(sc->cdce_dev));
> +		USB_ATTACH_ERROR_RETURN;
> +	}
>  	ifp->if_softc = sc;
>  	if_initname(ifp, "cdce", sc->cdce_unit);
>  	ifp->if_mtu = ETHERMTU;
> @@ -323,6 +328,7 @@
> 
> GET_ARPCOM(sc) basically dereferences sc->cdce_ifp, which isn't
> initialized before if_alloc() on the next line.

Yup, I got tripped up becuase this doesn't use the macro I introduced.

Thanks for the review!

-- Brooks

-- 
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20050609/67d66db3/attachment.bin


More information about the freebsd-net mailing list