[PATCH] Ethernet cleanup; 802.1p input and M_PROMISC

Yar Tikhiy yar at comp.chem.msu.su
Sun Mar 4 07:05:03 UTC 2007


On Sat, Mar 03, 2007 at 11:40:06PM +0000, Bruce M Simpson wrote:
> Yar Tikhiy wrote:
> >
> >In fact, there two independent flags indicating interface's readiness:
> >IFF_UP and IFF_DRV_RUNNING.  The former is controlled by the admin
> >and the latter, by the driver.  E.g., an interface can be UP but
> >not really ready to operate due to h/w reasons, or vice versa.
> >Perhaps we should check both flags to see if the interface is, so
> >to say, up and running.  if_vlan.c has an obvious macro for that,
> >and it can go to if_var.h to avoid code duplication if we decide it's
> >the right way to take.
> >  
> Thanks for looking at this.
> 
> The purpose of the IFF_UP check is to immediately drop frames destined 
> for an interface which is administratively configured down.
> 
> Surely if ether_input() is called from the driver, there should be no 
> need to check IFF_DRV_RUNNING? Indeed if the hardware flips to a state 
> where it is not running but its internal queues or descriptor rings are 
> draining, this might cause frames to be lost?

Now I see your point, thanks!  Well, at least in theory, the driver
shouldn't call ether_input() if the interface isn't running.  OTOH,
the interface shouldn't be getting traffic if it's !UP.  However,
I suspect that not all drivers handle IFF_UP fully or even can do
it at all due to hardware limitations.  As I understand it, in an
ideal world a !UP interface should be deaf and dumb and not interfering
in any way with the network still connected to it physically.
Therefore discarding inbound traffic from a !UP interface may be a
necessary workaround, but it may not be enough.  All that boils
down to this: The IFF_UP check in ether_input() is more to a sanity
check than to the way for IFF_UP to work.  Therefore we can add the
IFF_DRV_RUNNING sanity check there, too, for completeness.

-- 
Yar


More information about the freebsd-net mailing list