Date: Sun, 4 Mar 2007 10:04:58 +0300 From: Yar Tikhiy <yar@comp.chem.msu.su> To: Bruce M Simpson <bms@incunabulum.net> Cc: freebsd-net@freebsd.org Subject: Re: [PATCH] Ethernet cleanup; 802.1p input and M_PROMISC Message-ID: <20070304070458.GG40430@comp.chem.msu.su> In-Reply-To: <45EA0756.2000107@incunabulum.net> References: <45E8B964.2090200@incunabulum.net> <20070303215359.GB40430@comp.chem.msu.su> <45EA0756.2000107@incunabulum.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070304070458.GG40430>