#---------------------------------------------------------------------------- # /etc/rc.d/base-helper.ipv6 __FLI4LVER__ # basic helper functions for IPv6 # # Creation: 2007-10-21 kristov # Last Update: $Id$ #---------------------------------------------------------------------------- #---------------------------------------------------------------------------- # some useful functions # translate_ip_net # translates a config value like IP_NET_1, calls set_error # if an error happens #---------------------------------------------------------------------------- translate_ip6_net () { tin_param="$1" case $tin_param in none | default | pppoe | dynamic) res=$tin_param ;; any) res=::0/0 ;; IPV6_NET_*_IPADDR | ip_net_*_ipaddr) tmp=`echo $tin_param | sed -e 's/_IPADDR//I'` get_value $tmp res=`echo $res | sed -e 's#/.*##'` ;; IPV6_NET_* | ip_net_*) get_value $tin_param ;; IPV6_ROUTE_* | ip_route_*) get_value $tin_param set $res res=$1 case $res in ::0/0) set_error "you can't use a default route entry in a packet filter rule" ;; esac ;; @*) if lookup_name `echo $tin_param | sed -e 's/^@//'` then return fi set_error "unable to lookup name $tin_param" ;; *) if echo $tin_param | grep '^[0-9a-zA-Z:]\+\(/[0-9]*\)\?$' >/dev/null 2>&1 then res="$tin_param" return fi set_error ;; esac if is_error then set_error "invalid value '$tin_param' in translate_ip6_net ()" fi }