9 echo "Usage: ${0##*/} [-u user] [-p password] [-h host_address]
44 echo "Unknown option: $1" >&2
57 port
=$
(printf %02d $
[$port-1])
59 echo "Invalid port number: $port" >&2
69 curl
-isS "http://$switch_host/iss/specific/$fnc.js?Gambit=$gambit" "$@"
73 gambit
=`curl -isS http://$switch_host/ -d "Password=$pass&currlang=0&Login=$user&BrowsingPage=index_dlink.htm&changlang=0" | grep -iEom1 "Gambit=[a-z]+" | cut -d= -f2-`
76 echo "Could not acquire token." >&2
86 if [ "${line:0:1}" = "[" ]
88 set -- ${line//[]\',[]/ }
89 [ "$3" = 6 ] && adm_status
="disabled" || adm_status
="enabled"
90 [ "$2" = 8 ] && status
="down" || status
="up"
91 printf "Port %02d %8s %4s\n" $1 $adm_status $status
96 fetch DynamicForwarding | \
99 if(/^var DynamicForwarding/)
102 while(/\[([^[]+?)\]/)
104 push @T, [split /,/, $1];
107 for my $r (sort { $a->[1] <=> $b->[1]; } @T)
109 $str_port = $r->[1] == $prev_port ? "" : $r->[1];
110 $prev_port = $r->[1];
111 printf "%2s\t%s\n", $str_port, $r->[2];
116 if fetch PortSetting
-d "FormName=portset&port_f=$port&port_t=$port&speed=$speed&mdi=0&flow=0&post_url=cgi_port.&Gambit=$gambit" |
grep -q Page-Exit