diff options
author | Todd T. Fries <todd@cvs.openbsd.org> | 2005-10-25 14:18:39 +0000 |
---|---|---|
committer | Todd T. Fries <todd@cvs.openbsd.org> | 2005-10-25 14:18:39 +0000 |
commit | eb8a9af10c2a7c457380633332c2934e4967192e (patch) | |
tree | 4ca085412b9f0a7fbba527cd9f359da1f3ca8799 /etc/netstart | |
parent | 09808d14c94028943c4b3fe19ec6c8b18c310380 (diff) |
better logic from krw@:
- do not process mygate for v4 if dhcp
- do not process mygate for v6 if rtsol
this also makes the mygate processing logic more readable
ok krw@
Diffstat (limited to 'etc/netstart')
-rw-r--r-- | etc/netstart | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/etc/netstart b/etc/netstart index 866c4537fee..cb6f6ceb19a 100644 --- a/etc/netstart +++ b/etc/netstart @@ -1,11 +1,12 @@ #!/bin/sh - # -# $OpenBSD: netstart,v 1.109 2005/10/14 15:46:41 todd Exp $ +# $OpenBSD: netstart,v 1.110 2005/10/25 14:18:38 todd Exp $ # Strip comments (and leading/trailing whitespace if IFS is set) # from a file and spew to stdout stripcom() { local _l + [[ -f $1 ]] || return while read _l; do [[ -n ${_l%%#*} ]] && echo $_l done<$1 @@ -77,7 +78,7 @@ ifstart() { [ "$bcaddr" = "NONE" ] && bcaddr= cmd="ifconfig $if $name $mask $bcaddr $ext1 $ext2 down" cmd="$cmd;dhclient $if" - setgateway=N + dhcpif="$dhcpif $if" ;; "rtsol") rtsolif="$rtsolif $if" @@ -310,18 +311,16 @@ ifmstart "trunk vlan pfsync carp" # /etc/mygate, if it exists, contains the name of my gateway host # that name must be in /etc/hosts. -if [ "X${setgateway}" != X"N" -a -f /etc/mygate ]; then - route -qn delete default > /dev/null 2>&1 - route -qn delete -inet6 default > /dev/null 2>&1 - # Now parse the mygate file - stripcom /etc/mygate | while read gw; do - case "$gw" in - *:*) af=-inet6;; - *) af=;; - esac - route -qn add -host $af default $gw - done -fi +[[ -z $dhcpif ]] && stripcom /etc/mygate | while read gw; do + [[ $gw == @(*:*) ]] && continue + route -qn delete default > /dev/null 2>&1 + route -qn add -host default $gw && break +done +[[ -z $rtsolif ]] && stripcom /etc/mygate | while read gw; do + [[ $gw == !(*:*) ]] && continue + route -qn delete -inet6 default > /dev/null 2>&1 + route -qn add -host -inet6 default $gw && break +done # Multicast routing. # |