You were already able to execute a !command inside the rdomain, either
by specifying the rdomain (on commands which can do that) or by using
route -T manually.

But now, you can't easily execute commands *outside the rdomain*, and
there are some things folk might want to do.

Also, there is an order of evaluation.  Commands before the rdomain
keywords are outside, but commands afterwards are in the rdomain.  That
troubles me a little, especially becuase it's another piece which will
be difficult to document.

Matthieu Herrb <[email protected]> wrote:

> Hi,
> 
> 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 know that parsing this file is complex and somehow fragile but still
> I tried to write a patch.
> 
> What do you think ?
> 
> Of course I'm ok with any enhancements / fixes to my shell foo.
> 
> --- 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]}
> +             ;;
>       '!'*)   _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
>               ;;
>       *)      _cmds[${#_cmds[*]}]="ifconfig $_if ${_c[@]}"
>               ;;
> 
> -- 
> Matthieu Herrb
> 

Reply via email to