#!/bin/sh #---------------------------------------------------------------------------- # /etc/rc.d/rc320.route - configuration of additional IPv4 routes # was file /etc/rc.d/route # # Creation: 02.01.2001 fm # Last Update: $Id$ #---------------------------------------------------------------------------- if [ 0"$IP_ROUTE_N" -gt 0 ] then begin_script ROUTE "setting up IPv4 routes ..." route_circ_n=0 # group routes using the same gateway for idx in $(seq 1 $IP_ROUTE_N) do eval route=\$IP_ROUTE_$idx set -- $route net=$(circuit_resolve_address "$1" ipv4) gw=$(circuit_resolve_address "$2" ipv4 addr) dev= if [ -n "$3" ] then dev=$3 elif [ -n "$gw" ] then translate_ipv4_to_dev $gw dev else translate_net_if $2 dev fi [ -n "$dev" ] || continue target=route_target_$(to_shell_id "${gw} ${dev}") eval circ_idx=\$$target if [ -n "$circ_idx" ] then eval nets=\$route_${circ_idx}_nets else route_circ_n=$((route_circ_n+1)) circ_idx=$route_circ_n eval $target=\$circ_idx eval route_${circ_idx}_gw=\$gw eval route_${circ_idx}_dev=\$dev nets= fi nets="$nets $net" eval route_${circ_idx}_nets=\$nets done # convert each route group into a route circuit for circ_idx in $(seq 1 $route_circ_n) do eval nets=\$route_${circ_idx}_nets eval gw=\$route_${circ_idx}_gw eval dev=\$route_${circ_idx}_dev CIRC_N=$((CIRC_N+1)) eval CIRC_${CIRC_N}_NAME=IPv4-Route-\$circ_idx eval CIRC_${CIRC_N}_TYPE=route eval CIRC_${CIRC_N}_ENABLED=yes eval CIRC_${CIRC_N}_UP=yes eval CIRC_${CIRC_N}_TIMES=\"Mo-Su:00-24:0.0:Y\" eval CIRC_${CIRC_N}_ROUTE_DEV=\$dev eval CIRC_${CIRC_N}_ROUTE_GATEWAY_IPV4=\$gw set -- $nets n=1 for net do eval CIRC_${CIRC_N}_NETS_IPV4_${n}=\"$net\" n=$((n+1)) done eval CIRC_${CIRC_N}_NETS_IPV4_N=$((n-1)) done end_script fi