On Wed, Aug 18, 2021 at 04:28:13PM +0200, Alexander Bluhm wrote:
> I want to create an enc1 interface for routing domain 1 and set
> additional addresses on lo1.  So my net config looks like this.
> 
> ==> /etc/hostname.enc1 <==
> rdomain 1
> 
> ==> /etc/hostname.lo1 <==
> rdomain 1
> inet alias 10.188.10.74 255.255.255.255
> ...
> 
> /etc/netstart creates enc1 in routing domain 0, but does not place
> it into rdomain 1 due to this error:
> starting network
> ifconfig: SIOCSIFRDOMAIN: Invalid argument
> 
> With some additional debug output netstart does this:
> { ifconfig enc1 || ifconfig enc1 create; }
> { ifconfig lo0 || ifconfig lo0 create; }
> { ifconfig lo1 || ifconfig lo1 create; }
> { ifconfig enc1 || ifconfig enc1 create; }
> ifconfig enc1 rdomain 1
> ...
> { ifconfig lo1 || ifconfig lo1 create; }
> ifconfig lo1 rdomain 1
> ifconfig lo1 inet alias 10.188.10.74 netmask 255.255.255.255
> 
> ifconfig enc1 rdomain 1 fails as lo1 exists, but is still in routing
> domain 0.
> 
> To fix this, I think lo1, lo2, ... should not be created upfront.
> Also more debug output for /etc/netstart -n is necessary to understand
> what is going on.

Debugging code has been added seperately.  The following condition
allows me to create enc1 in routing domain 1.

ok?

bluhm

Index: etc/netstart
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/etc/netstart,v
retrieving revision 1.215
diff -u -p -r1.215 netstart
--- etc/netstart        30 Aug 2021 16:58:52 -0000      1.215
+++ etc/netstart        1 Sep 2021 15:52:56 -0000
@@ -103,6 +103,9 @@ vifscreate() {
                        [[ -f $_hn ]] || continue
                        _if=${_hn#/etc/hostname.}
 
+                       # loopback for routing domain is created by kernel
+                       [[ -n "${_if##lo[1-9]*}" ]] || continue
+
                        if ! ifcreate $_if; then
                                print -u2 "${0##*/}: create for '$_if' failed."
                        fi

Reply via email to