Line | |
---|
1 | #!/bin/sh -
|
---|
2 | #
|
---|
3 | # Clone routing table SRC into routing table DST
|
---|
4 | #
|
---|
5 | # Rick van der Zwet <rick@wirelessleiden.nl>
|
---|
6 | #
|
---|
7 | SRC=${1:-0}
|
---|
8 | DST=${2:-1}
|
---|
9 |
|
---|
10 | # Flush all routes and make sure to re-apply gateway (if existed)
|
---|
11 | gateway=`setfib $DST route -n get default | awk '/gateway:/ {print $2}'`
|
---|
12 | setfib $DST route -qn flush
|
---|
13 | [ -n "$gateway" ] && setfib $DST route -qn add default $gateway
|
---|
14 |
|
---|
15 | # Hack to sync remaining dynamic routes
|
---|
16 | setfib $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
|
---|
18 | done
|
---|
19 |
|
---|
20 |
|
---|
21 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.