Subject: Re: Allowing ether_ifattach() to fail
To: John Hawkinson <jhawk@mit.edu>
From: None <itojun@iijlab.net>
List: tech-net
Date: 05/24/2000 12:43:00
>As part of addressing kern/9548 ("fxp0 can get all 1's mac address"),,
>I'd like to allow ether_ifattach() to fail (and return failure). It
>would do this in the case of invalid MAC addresses (like
>multicast/broadcast addresses, that seem to have a high potential to
>pop up in the case of buggy drivers/flakey hardware).
>
>Since this requires touching a lot of the tree (ether_ifattach() is
>called from every network driver), I thought I should send a probe
>here first, since modifications might be signficant (see below).
>
>Careful examination of a bunch of drivers shows that they don't deal
>very well with the case of *_attach() failing. For instance there are
>a wide variety of failure conditions (7?) where fxp_attach() might
>not call if_attach(); but fxp_detach() unconditionally calls
>if_detach().
this is common problem to pcmcia drivers. some of pcmcia devices
copes with this situation by having flag in sc->sc_flags to indicate
which resource was allocated on attach, and which wasn't (this is
what you have suggested). sys/dev/pcmcia/* should give you some
examples.
not sure if attach failure handling can be generalized more,
so that it can go out of each drivers...
itojun