#!/bin/sh -x if [ x"$new_rfc3442_classless_static_routes" != x"" ]; then if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then routes=($new_rfc3442_classless_static_routes) for(( i=0; i < ${#routes[@]}; )); do net_length=${routes[$i]} ((i++)) net_address=(0 0 0 0) for(( j=0; j < $[$net_length / 8 + ($net_length % 8 ? 1 : 0)]; j++, i++)); do net_address[$j]=${routes[$i]} done gateway=(0 0 0 0) for (( j=0; j < 4; j++, i++ )); do gateway[$j]=${routes[$i]} done old_IFS="$IFS" IFS='.' if [ x"$net_length" == x"32" ]; then /sbin/route add -host "${net_address[*]}" gw "${gateway[*]}" else /sbin/route add -net "${net_address[*]}/$net_length" gw "${gateway[*]}" fi IFS="$old_IFS" done fi fi