/[packages]/cauldron/dhcp/current/SOURCES/dhclient-exit-hooks
ViewVC logotype

Contents of /cauldron/dhcp/current/SOURCES/dhclient-exit-hooks

Parent Directory Parent Directory | Revision Log Revision Log


Revision 84557 - (show annotations) (download)
Wed Apr 13 17:56:16 2011 UTC (9 years, 2 months ago) by tv
File size: 1382 byte(s)
SILENT: new file ./SOURCES/dhclient-exit-hooks
1 #!/bin/bash
2 #
3 # This script contains hooks that will be executed when
4 # dhclient exits.
5 #
6
7 # process static route requests
8 if [ x"$new_rfc3442_classless_static_routes" != x"" ]; then
9 if [ x"$reason" == x"BOUND" -o x"$reason" == x"REBOOT" ]; then
10 rfc_routes=($new_rfc3442_classless_static_routes)
11 for(( i=0; i < ${#rfc_routes[@]}; )); do
12 net_length=${rfc_routes[$i]}
13 ((i++))
14 net_address=(0 0 0 0)
15 for(( j=0; j < $[$net_length / 8 + \
16 ($net_length % 8 ? 1 : 0)]; j++, i++)); do
17 net_address[$j]=${rfc_routes[$i]}
18 done
19 gateway=(0 0 0 0)
20 for (( j=0; j < 4; j++, i++ )); do
21 gateway[$j]=${rfc_routes[$i]}
22 done
23 old_IFS="$IFS"
24 IFS='.'
25 if [ x"$net_length" == x"32" ]; then
26 /sbin/route add -host "${net_address[*]}" gw "${gateway[*]}"
27 else
28 /sbin/route add -net "${net_address[*]}/$net_length" gw "${gateway[*]}"
29 fi
30 IFS="$old_IFS"
31 done
32 fi
33 fi

  ViewVC Help
Powered by ViewVC 1.1.28