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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 522970 - (show annotations) (download)
Fri Oct 18 22:44:24 2013 UTC (10 years, 5 months ago) by schedbot
File size: 1382 byte(s)
Copying release 3:4.2.5P1-2.mga4 to pristine/ directory.
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.30