Re: HEADSUP: internal network interface changes

From: Brooks Davis <brooks_at_one-eyed-alien.net>
Date: Thu, 9 Jun 2005 08:40:18 -0700
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():
> 
> _at__at_ -282,9 +283,13 _at__at_
>  		}
>  	}
>  
> -	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;
> _at__at_ -323,6 +328,7 _at__at_
> 
> 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

Received on Thu Jun 09 2005 - 13:40:20 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:36 UTC