Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Dec 1998 20:55:58 -0000
From:      Paul Richards <paul@originative.co.uk>
To:        "'Poul-Henning Kamp'" <phk@FreeBSD.ORG>, arch@FreeBSD.ORG
Subject:   RE: IFF_UP, IFF_RUNNING semantics...
Message-ID:  <E40CBF0361C7D111914000C0F0303D108842@OCTOPUS>

next in thread | raw e-mail | index | archive | help
> -----Original Message-----
> From: Poul-Henning Kamp [mailto:phk@FreeBSD.ORG]
> Sent: Saturday, December 12, 1998 7:44 PM
> To: arch@FreeBSD.ORG
> Subject: IFF_UP, IFF_RUNNING semantics...
> 
> 
> 
> I'm trying to unravel how IFF_UP and IFF_RUNNING is supposed to work.
> 
> I would expect one of them (IFF_RUNNING ?) to mean "should be
> running" as in "root configured this one to be running" and the
> other (IFF_UP ?) to mean "is running" as in "hardware/protocols
> are ready to pass packets".

I think that's more or less it. Stevens says IFF_RUNNING is "resources
are allocated" and IFF_UP is "interface is running".

> In this model, IFF_UP would control the routes.  Either by yanking
> the route when IFF_UP disappears, or by not selecting routes where
> the interface doesn't have IFF_UP set.
> 
> Looking over the sources, it is obvious that very few people if any
> have any idea about the semantics about IFF_UP and IFF_RUNNING either.
> 
> For an example why this is important imagine an UTP ethernet which 
> doesn't receive a heartbeat.  In that case the hardware knows the
> interface is down and the route should be disabled so the packets
> could attempt to flow another way.

In this case I'd say the driver should drop IFF_UP but not IFF_RUNNING
since while resources are allocated for it to run the hardware isn't
allowing it to.

In my lnc driver (which is the same as most drivers I think including
the example in Stevens Illustrated Vol2) it's closely tied to the
hardware. If the lance initialises ok and the chip is running then
IFF_RUNNING is set. This either happens at boot or when IFF_UP is set
and IFF_RUNNING isn't, in which case lnc_start is called. If IFF_UP is
cleared i.e. the interface is going down, then the lance chip is stopped
and IFF_RUNNING is cleared. Therefore, IFF_RUNNING is basically an
indication of whether the lance chip is running or not. The driver
doesn't do anything for things like heartbeat failures other than report
them. I guess it might make sense to clear IFF_UP. I'm not sure how
you'd restart the interface if a transient hardware problem went away
though.

It's not clear from Stevens exactly what he means by "resources
allocated" and he only mentions IFF_RUNNING once and that's in a table
on p.67 Vol2. From a quick grep of the networking sources (sys/net*)
IFF_RUNNING seems to be virtually unused, it only appears in a handful
of files, mainly pseudo drivers and even then it's just or'd with
IFF_UP.

Paul Richards Ph.D.
Originative Solutions Ltd

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E40CBF0361C7D111914000C0F0303D108842>