# These are helper functions for the Minimalistic Network Manager # Author: Christian Pointner activate_interface() { echo 2 > /proc/sys/net/ipv6/conf/default/use_tempaddr modprobe $2 while true; do ip link set up dev $1 >/dev/null 2>&1 if [ $? -eq 0 ]; then break fi echo -n "." sleep 1 echo 2 > /proc/sys/net/ipv6/conf/$1/use_tempaddr done if [ $2 = "eth0" ]; then sleep 2 ethtool -s $2 advertise 0x008 fi echo "" } deactivate_interface() { ip link set down dev $1 >/dev/null 2>&1 modprobe -r $2 } wpa_select_ssid() { NET=$(wpa_cli -i$1 list_networks | awk "BEGIN { FS = \"\\t\" } ; \$2 == \"$2\" { print(\$1) }") if [ -n "$NET" ]; then wpa_cli -i$1 select_network $NET else echo "SSID '$2' is not in wpa_supplicant.conf - ignoring it..." fi } create_6to4() { IPV6_ADDR=`printf "2002:%02x%02x:%02x%02x::1" \`echo "$2" | tr "." " "\`` ip tunnel add mode sit remote 192.88.99.1 name $1 ip link set dev $1 up ip addr add dev $1 $IPV6_ADDR/48 ip -6 route add default dev $1 } destroy_6to4() { ip tunnel del name $1 }