source: hybrid/branches/releng-9.0/nanobsd/files/tools/sync-fib-tables@ 10694

Last change on this file since 10694 was 10653, checked in by rick, 13 years ago

Typo.

  • Property svn:executable set to *
File size: 560 bytes
Line 
1#!/bin/sh -
2#
3# Clone routing table SRC into routing table DST
4#
5# Rick van der Zwet <rick@wirelessleiden.nl>
6#
7SRC=${1:-0}
8DST=${2:-1}
9
10# Flush all routes and make sure to re-apply gateway (if existed)
11gateway=`setfib $DST 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 TracBrowser for help on using the repository browser.