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