4 # Setup address label from /etc/gai.conf
6 # Written by YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>, 2010.
10 DEFAULT_GAICONF=/etc/gai.conf
16 if [ x"$verbose" != x"" ]; then
19 if [ x"$debug" = x"" ]; then
24 function do_load_config ()
28 cat $file | while read command prefix label; do
29 if [ x"$command" = x"#label" ]; then
30 if [ ${flush} = 1 ]; then
31 run ${IP} -6 addrlabel flush
34 run ${IP} -6 addrlabel add prefix $prefix label $label
39 function do_list_config ()
41 ${IP} -6 addrlabel list | while read p pfx l lbl; do
42 echo label ${pfx} ${lbl}
48 echo "Usage: $0 [-v] {--list | --config [ ${DEFAULT_GAICONF} ] | --default}"
52 TEMP=`getopt -o c::dlv -l config::,default,list,verbose -n gaiconf -- "$@"`
55 echo "Terminating..." >&2
66 if [ x"$cmd" != x"" ]; then
70 "") gai_conf="${DEFAULT_GAICONF}"
79 if [ x"$cmd" != x"" ]; then
86 if [ x"$cmd" != x"" ]; then
101 echo "Internal error!" >&2
109 if [ x"$gai_conf" = x"${TEMPFILE}" ]; then
110 sed -e 's/^[[:space:]]*//' <<END_OF_DEFAULT >${TEMPFILE}
115 label ::ffff:0:0/96 4
121 do_load_config "$gai_conf"