Update wing package to latest version.

Signed-off-by: Roberto Riggio <[email protected]>

-- 

Index: net/wing/Makefile
===================================================================
--- net/wing/Makefile   (revision 35016)
+++ net/wing/Makefile   (working copy)
@@ -8,9 +8,9 @@
 include $(TOPDIR)/rules.mk

 PKG_NAME:=wing
-PKG_VERSION:=20120805
-PKG_RELEASE:=2
-PKG_REV:=d189e36d111788a647cd784536137acbe7a92e17
+PKG_VERSION:=20121218
+PKG_RELEASE:=1
+PKG_REV:=a4f901c3442c5bc49d1250007db7f45436069716

 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=git://github.com/rriggio/click.git
Index: net/wing/files/lib/netifd/proto/wing.sh
===================================================================
--- net/wing/files/lib/netifd/proto/wing.sh     (revision 35016)
+++ net/wing/files/lib/netifd/proto/wing.sh     (working copy)
@@ -4,12 +4,12 @@
 . ../netifd-proto.sh
 init_proto "$@"

-proto_wing_init_config() {
-       no_device=1
+proto_wing_init_config() {
+       no_device=1
        available=1
-        proto_config_add_string "ipaddr"
+        proto_config_add_string "ipaddr"
        proto_config_add_string "netmask"
-}
+}

 proto_wing_teardown() {
        local config="$1"
@@ -32,9 +32,9 @@
        local ifnames=""
        local hwaddrs=""

-       # temporary hack waiting for a way to delay wing interfaces until the
+       # temporary hack waiting for a way to delay wing interfaces until the
        # wifi sub-system has been brought up
-       sleep 15
+       sleep 30

        config_load wireless
        config_foreach wing_list_interfaces wifi-iface
@@ -106,7 +106,9 @@
        }

        (/usr/bin/click /tmp/$link-aligned.click >> /var/log/$link.log 2>&1 &) &
+
        sleep 2
+
        ps | grep /usr/bin/click | grep -q -v grep || {
                logger -t "$config" "Unable to start click. Exiting."
                exit 1
@@ -115,9 +117,9 @@
        ps | grep /usr/bin/click | grep -v grep | awk '{print $1}' > 
/var/run/$link.pid

         uci_set_state network $config ifname "$iface"
-        uci_set_state network $config ipaddr "$ipaddr"
+        uci_set_state network $config ipaddr "$ipaddr"
         uci_set_state network $config netmask "$netmask"
-        uci_set_state network $config gateway "0.0.0.0"
+        uci_set_state network $config gateway "0.0.0.0"

        env -i ACTION="ifup" INTERFACE="$config" DEVICE="$link" PROTO=wing 
/sbin/hotplug-call "link" &

@@ -125,10 +127,9 @@
        proto_add_ipv4_address "$ipaddr" "$netmask"
        proto_add_ipv4_route "$prefix.0.0.0" "255.0.0.0" "$iface"

-       route -n | grep -q '^0.0.0.0' || {
-               proto_add_ipv4_route "0.0.0.0" "0" "$iface"
-       }
-       
+       wing_load_static_routes
+       wing_load_static_hnas
+
        proto_send_update "$config"

 }
@@ -145,7 +146,14 @@
        local channel freq hwmode hwaddr ifname mode
        config_get mode $1 mode
        config_get_bool up $1 up
-       [ "$up" = "1" -a "$mode" = "monitor" ] || return 0
+       [ "$up" = "1" ] || {
+               logger -t "$1" "Device not up. Ignoring."
+               return 0
+       }
+       [ "$mode" = "monitor" ] || {
+               logger -t "$1" "Device not in monitor mode. Ignoring."
+               return 0
+       }
        config_get ifname $1 ifname
        config_get device $1 device
        config_get hwmode $device hwmode "11bg"
@@ -154,7 +162,7 @@
                logger -t "$device" "Channel not specified. Ignoring."
                return 0
        }
-       freq=$(iwlist $ifname freq | sed -n "s/^.*Channel 0*$channel : 
\([0-9.]*\).*/\1/p" | awk '{print $1*1000}')
+       freq=$(iw phy $device info | grep "MHz" | grep "\[$channel\]" | sed -n 
"s/^.* \([0-9]*\) MHz.*/\1/p")
        hwaddr=$(/sbin/ifconfig $ifname 2>&1 | sed -n 's/^.*HWaddr 
\([0-9A-Za-z\-]*\).*/\1/p' | sed -e 's/\-/:/g' | cut -c1-17)
        freqs=${freqs:+"$freqs "}$freq
        hwmodes=${hwmodes:+"$hwmodes "}$hwmode
@@ -165,5 +173,100 @@
        /sbin/ifconfig $ifname up
 }

+#
+# HNAs functions
+#
+
+wing_add_static_hna() {
+       logger "Adding hna: $1"
+       uci add_list network.mesh.hna=$1
+       uci commit
+       wing_load_static_hnas
+}
+
+wing_clear_static_hna() {
+       logger "Deleting hna: $1"
+       local list="$(uci get network.mesh.hna)"
+       local elem
+       uci delete network.mesh.hna
+       for elem in $list; do
+               if [ "$elem" != "$1" ]; then
+                       uci add_list network.mesh.hna=$elem
+               fi
+       done
+       uci commit
+}
+
+wing_load_static_hna() {
+       logger "Loading hna: $1"
+       output=$(/usr/bin/write_handler wr/gw.hna_add $1)
+       [ "$output" != "" ] && {
+               logger "Invalid hna: $1"
+               wing_clear_static_hna "$1"
+       }
+}
+
+wing_load_static_hnas() {
+       logger "Loading hnas"
+       /usr/bin/write_handler wr/gw.hnas_clear true
+       config_load network
+       config_list_foreach mesh hna wing_load_static_hna
+}
+
+wing_clear_static_hnas() {
+       logger "Clearing hnas"
+       /usr/bin/write_handler wr/gw.hnas_clear true
+       config_load network
+       config_list_foreach mesh hna wing_clear_static_hna
+}
+
+#
+# Static routes functions
+#
+
+wing_add_static_route() {
+       logger "Adding route: $1"
+       uci add_list network.mesh.route=$1
+       uci commit
+       wing_load_static_routes
+}
+
+wing_clear_static_route() {
+       logger "Deleting route: $1"
+       local list="$(uci get network.mesh.route)"
+       local elem
+       uci delete network.mesh.route
+       for elem in $list; do
+               if [ "$elem" != "$1" ]; then
+                       uci add_list network.mesh.route=$elem
+               fi
+       done
+       uci commit
+}
+
+wing_load_static_route() {
+       logger "Loading route: $1"
+       route=$(echo $1 | sed 's/@/ /')
+       output=$(/usr/bin/write_handler wr/querier.add $route)
+       [ "$output" != "" ] && {
+               logger "Invalid route: $1"
+               wing_clear_static_route "$1"
+       }
+}
+
+wing_load_static_routes() {
+       logger "Loading routes"
+       /usr/bin/write_handler wr/querier.clear_static_routes true
+       config_load network
+       config_list_foreach mesh route wing_load_static_route
+}
+
+wing_clear_static_routes() {
+       logger "Clearing routes"
+       /usr/bin/write_handler wr/querier.clear_static_routes true
+       config_load network
+       config_list_foreach mesh route wing_clear_static_route
+}
+
 add_protocol wing

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to