Subject: configuring clone interfaces before bridge at boot-time?
To: None <tech-net@netbsd.org>
From: Steven M. Bellovin <smb@cs.columbia.edu>
List: tech-net
Date: 10/08/2006 19:56:10
For various reasons associated with Xen, I need to have a tap(4) interface
as part of a bridge.  Current, my ifconfig_tap0 file says

	create
	192.168.42.1

(and I could probably leave out the 'create' line, judging
from /etc/rc.d/network, but that's not really important now.)

The problem is that 'tap' comes after 'bridge' in the collating sequence,
so tap0 isn't created by the time ifconfig_bridge1 -- which has

	create
	!brconfig $int add tap0 up

in it -- is executed.  The question is what to do.

I could, I suppose, explicitly set net_interfaces in rc.conf, but that
gives up the benefits of autoconfig.  I suspect that the right thing to do
is to take this section of the config loop:

                       if [ -n "$args" ] || [ -f /etc/ifconfig.$int ]; then
                                if ifconfig $int create 2>/dev/null && \
                                   checkyesno ipfilter; then
                                        # resync ipf(4)
                                        ipf -y >/dev/null
                                fi
                        fi

and do it in a separate loop, before the rest of the config loop.  That way,
all desired clone interfaces are created before any bridges are configured.

Comments?