Changeset 10652 in hybrid for branches


Ignore:
Timestamp:
May 2, 2012, 10:11:55 PM (13 years ago)
Author:
rick
Message:

Better readable and make sure to sync default route back.

Related-To: nodefactory#129

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/releng-9.0/nanobsd/files/tools/sync-fib-tables

    r10647 r10652  
    77SRC=${1:-0}
    88DST=${2:-1}
    9 setfib $DST route -qn flush && setfib $SRC netstat -nr | grep -v 'default' | awk '/UGD/ {print "setfib '"$DST"' route -q add "$1" "$2}' | sh
    109
     10# Flush all routes and make sure to re-apply gateway (if existed)
     11gateway=`setfib $DST route -n get default  | route -n get default | awk '/gateway:/ {print $2}'`
     12setfib $DST route -qn flush
     13[ -n "$gateway" ] && setfib $DST route -qn add default $gateway
     14
     15# Hack to sync remaining dynamic routes
     16setfib $SRC netstat -nr -f inet | grep -v 'default' | awk '/UGD/ {print $1" "$2}' | while read tgt gw; do
     17  setfib $DST route -qn add $tgt $gw
     18done
     19
     20
     21
Note: See TracChangeset for help on using the changeset viewer.