On Wed, Jul 29, 2020 at 11:54:17AM +0200, Matthieu Herrb wrote: > When I'm configuring an interface with a spécific rdomain, I'd assume > that '!' commands (especially /sbin/route commands) are executed in > the rdomain for this interface. I see where you're coming from, but the diff seems flawed.
I don't have a better approach for this at hand, but as it stands, I'm happy with having to do `route -T1 exec' manually if need be. > I know that parsing this file is complex and somehow fragile but still > I tried to write a patch. In any way, /usr/src/distrib/miniroot/install.sub:parse_hn_line() will require the same treatment to keep netstart(8) and installer in sync. Also, if something like this went in, I'd like to see hostname.if(5) explicitly document `!' behaviour wrt. to the routing domain. > --- netstart.orig Wed Jul 29 11:19:53 2020 > +++ netstart Wed Jul 29 11:52:39 2020 > @@ -67,8 +67,16 @@ > _cmds[${#_cmds[*]}]="ifconfig $_if ${_c[@]} up;dhclient $_if" > V4_DHCPCONF=true > ;; > + rdomain) ((${#_c[*]} == 2)) || return > + _cmds[${#_cmds[*]}]="ifconfig $_if rdomain ${_c[_name]}" > + _rdomain=${_c[_name]} > + ;; This assumes `rdomain' is set on its own hostname.if(5) line, so config like "up rdomain 1" won't set `_rdomain' here... > '!'*) _cmd=$(print -- "${_c[@]}" | sed 's/\$if/'$_if'/g') > - _cmds[${#_cmds[*]}]="${_cmd#!}" > + if [[ $_rdomain -ne 0 ]]; then > + _cmds[${#_cmds[*]}]="/sbin/route -T$_rdomain exec > ${_cmd#!}" > + else > + _cmds[${#_cmds[*]}]="${_cmd#!}" > + fi > ;; and that causes the interface to be in rdomain 1 while executing in rdomain 0.