tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Wait for interface existence?



>>> Common sense tells me that we should create the virtual interfaces
>>> before adding them to the bridge so they should appear first, but
>>> heh ho.
>> That's what I used to do.  It feels unpleasantly fragile, though.

(My "That" being "do the ordering by blindly assuming that
$net_interfaces is procsesed in order".)

Obviously, virtual interfaces need to be created before they can have
anything done with them.  The question is just how to make that happen.

> But that's what your solution also does, but the ordering is not as
> obvious.

Your "that" here must not be the same as my "that"; my scheme was
specifically designed to not depend order in $net_interfaces.

> It's even more fragile as if anything went wrong, you don't get any
> errors as it waits indefinitely.

True.  I'm not sure what to do about that.  For most purposes,
certainly for the particular use case that provoked this, I would
rather have the system up in other respects with the interface missing
from the bridge than I would have network config, and therefore the
whole boot, fail.

>> ifsetup_post_bridge0="..."
> I don't see anything for ifsetup_post_$interface in our rc system?

Maybe not.  Let me check.

...

Turns out that's something I added: an interface designed for running
commands after an interface is brought up (establishing routes is one
obvious use; this is another).  (I also added ifsetup_pre_$INTF, but
that's less relevant to the discussion at hand.)

I don't know what, if anything, stock NetBSD has for similar
functionality.

> brconfig relies on both interfaces being available so by definition
> the bridge is last.

Not quite.  The bridge can be created, and brought up, anytime - even
before any of the other interfaces, if you like.  It's the brconfig add
that has to be delayed until the member interface exists.  (And they
don't have to be added at the same time.)

> Why not add this to /etc/rc.conf?

> network_poststart() {
>         brconfig bridge0 add fxp0
>         brconfig bridge0 add tap0
> }

> if [ "$name" = network ]; then
>         start_postcmd="network_poststart"
> fi

Pragmatically, mostly because I was not aware of the possibility.

I'm not sure what I think of it.  I'll have to let that rattle around
in my head for a while.  At the moment, I react positively in some
respects, negatively in others, but they're all fairly mild.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index