wing: update to 20110709 (#9722) * Signed-off-by: Roberto Riggio <roberto.riggio...
authorStephen Walker <stephendwalker@gmail.com>
Sun, 17 Jul 2011 14:17:47 +0000 (14:17 +0000)
committerStephen Walker <stephendwalker@gmail.com>
Sun, 17 Jul 2011 14:17:47 +0000 (14:17 +0000)
SVN-Revision: 27643

net/wing/Makefile
net/wing/files/etc/uci-defaults/wing
net/wing/files/lib/network/wing.sh
net/wing/files/usr/bin/wing_status [new file with mode: 0755]

index 6e6347c696b9023c894e4d466f826fc1d1781129..47892ca763745e122253a443d429eda7c2c4f84a 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2009 OpenWrt.org
+# Copyright (C) 2006-2011 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,9 +8,9 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=wing
-PKG_VERSION:=20110329
-PKG_RELEASE:=2
-PKG_REV:=4ef2a352b29c26ce76d8b3d7c6897d301362a101
+PKG_VERSION:=20110709
+PKG_RELEASE:=1
+PKG_REV:=6aaea18b8e199781dc600681882cb2648f43ec38
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=git://github.com/rriggio/click.git
@@ -18,8 +18,6 @@ PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
 PKG_SOURCE_VERSION:=$(PKG_REV)
 PKG_SOURCE_PROTO:=git
 
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
-
 PKG_BUILD_DEPENDS:=wing/host
 
 include $(INCLUDE_DIR)/package.mk
@@ -34,11 +32,11 @@ define Package/wing
        URL:=http://www.wing-project.org/
 endef
 
-define Package/wing/Description 
+define Package/wing/Description
        Wing is a wireless mesh routing software. The routing protocol
-       is derived from Roofnet. It supports multiple radio interfaces 
+       is derived from Roofnet. It supports multiple radio interfaces
        and link quality routing using the ETX, ETT, or WCETT metric.
-endef 
+endef
 
 EXTRA_CFLAGS=-MD
 
@@ -46,16 +44,12 @@ CONFIGURE_ARGS += \
        --enable-tools=host \
        --enable-userlevel \
        --enable-wifi \
-       --enable-wing \
-       --enable-diffserv \
        --disable-linuxmodule \
        --disable-dynamic-linking \
 
 HOST_CONFIGURE_ARGS += \
        --enable-userlevel \
        --enable-wifi \
-       --enable-diffserv \
-       --enable-wing \
        --disable-linuxmodule \
 
 define Host/Compile
@@ -66,8 +60,9 @@ define Build/Compile
        (cd $(PKG_BUILD_DIR)/userlevel; \
                $(STAGING_DIR_HOST)/bin/click-mkmindriver -p $(PKG_NAME) -C $(STAGING_DIR_HOST) \
                -f $(PKG_BUILD_DIR)/conf/wing/sample.click \
-               -A --all -E Discard -E Print -E PrintWifi -E Null \
+               -A --all -E Discard -E Print -E PrintWifi -E Strip -E Null \
                -E InfiniteSource -E RatedSource -E EtherEncap -E UDPIPEncap \
+               -E RadiotapEncapHT -E SetTXRateHT \
                -E WINGETTMetric -E WINGETXMetric -E WINGHopCountMetric \
                -E ProbeTXRate -E MadwifiRate -E AutoRateFallback -E Minstrel \
                -E FairBuffer -E DeAggregator -E DWRRSched -E WFQSched -E WRRSched; \
index 2f5e0dd5fe5bcdb02055056afd0ad25c39a55cf4..9648a9db4c5452e697806b0787e27733563ab3f8 100644 (file)
@@ -1,6 +1,6 @@
+uci delete network.mesh
 uci set network.mesh=interface
 uci set network.mesh.proto=wing
-uci set network.mesh.profile=bulk
 uci set network.mesh.rc=minstrel
 uci set network.mesh.ls=fcfs
 uci set network.mesh.metric=wcett
@@ -9,18 +9,18 @@ uci set network.mesh.period=10000
 uci set network.mesh.tau=100000
 uci set network.mesh.debug=false
 
-cfg=$(uci add firewall zone)
-uci set firewall.$cfg.name="mesh"
-uci set firewall.$cfg.input="ACCEPT"
-uci set firewall.$cfg.output="ACCEPT"
-uci set firewall.$cfg.forward="REJECT"
-uci set firewall.$cfg.masq="1"
+uci add firewall zone
+uci set firewall.@zone[-1].name="mesh"
+uci set firewall.@zone[-1].input="ACCEPT"
+uci set firewall.@zone[-1].output="ACCEPT"
+uci set firewall.@zone[-1].forward="REJECT"
+uci set firewall.@zone[-1].masq="1"
 
-cfg=$(uci add firewall forwarding)
-uci set firewall.$cfg.src="lan"
-uci set firewall.$cfg.dest="mesh"
+uci add firewall forwarding
+uci set firewall.@forwarding[-1].src="lan"
+uci set firewall.@forwarding[-1].dest="mesh"
 
-cfg=$(uci add firewall forwarding)
-uci set firewall.$cfg.src="mesh"
-uci set firewall.$cfg.dest="wan"
+uci add firewall forwarding
+uci set firewall.@forwarding[-1].src="mesh"
+uci set firewall.@forwarding[-1].dest="wan"
 
index 553ebaa0c231e5debb42ec909b135feb51190e65..49e5d3d940f5a29b5d0e6770a38ff14fc2ce91d7 100644 (file)
@@ -29,7 +29,7 @@ setup_interface_wing() {
 
        config_load wireless
        config_foreach wing_list_interfaces wifi-iface
-       
+
        # start click router
        if [ "$hwmodes" = "" -o "$freqs" = "" -o "$ifnames" = "" -o "$hwaddrs" = "" ]; then
                logger -t "$config" "No raw interfaces available. Exiting."
@@ -49,6 +49,7 @@ setup_interface_wing() {
 
        local hwaddr=$(echo $hwaddrs | sed 's/ .*//');
        local ipaddr=$(printf "$prefix.%d.%d.%d" $(echo $hwaddr | awk -F: '{printf "0x%s 0x%s 0x%s",$4,$5,$6}'))
+       local bcast="$prefix.255.255.255"
        local netmask=255.0.0.0
 
        if ! wing_template_available "profile" "$profile"; then
@@ -77,6 +78,7 @@ setup_interface_wing() {
                -m "$hwmodes" -c "$freqs" -n "$ifnames" -a "$hwaddrs" $dbg \
                | sed -e "s/__XR_IFNAME__/$iface/g" \
                | sed -e "s/__XR_IP__/$ipaddr/g" \
+               | sed -e "s/__XR_BCAST__/$bcast/g" \
                | sed -e "s/__XR_NM__/$netmask/g" \
                | sed -e "s/__XR_PERIOD__/$period/g" \
                | sed -e "s/__XR_TAU__/$tau/g" > /tmp/$iface.click
@@ -104,16 +106,20 @@ setup_interface_wing() {
 
        ps | grep /usr/bin/click | grep -v grep | awk '{print $1}' > /var/run/$iface.pid
 
-       ifconfig "$iface" "$ipaddr" netmask "$netmask" 
+       ifconfig "$iface" "$ipaddr" netmask "$netmask"
+       route add default dev "$iface"
+
+       uci_set_state network $config ifname "$iface"
        uci_set_state network $config ipaddr "$ipaddr"
        uci_set_state network $config netmask "$netmask"
+       uci_set_state network $config gateway "0.0.0.0"
 
        env -i ACTION="ifup" INTERFACE="$config" DEVICE="$iface" PROTO=wing /sbin/hotplug-call "iface" &
 
-} 
+}
 
 wing_template_available() { # prefix, template, default
-       local template="/etc/wing/$1.$2.click" 
+       local template="/etc/wing/$1.$2.click"
        [ ! -f $template ] && {
                return 1
        }
@@ -132,7 +138,7 @@ wing_list_interfaces() {
        [ "$channel" = "0" -o "$channel" = "auto" ] && {
                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}')
        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
diff --git a/net/wing/files/usr/bin/wing_status b/net/wing/files/usr/bin/wing_status
new file mode 100755 (executable)
index 0000000..dd63cac
--- /dev/null
@@ -0,0 +1,124 @@
+#!/bin/sh
+
+# Copyright (c) 2006, Roberto Riggio
+#
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#   - Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#   - Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#   - Neither the name of the CREATE-NET nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ROUTES=0
+STATIC=0
+HOSTS=0
+LINKS=0
+ARP=0
+GATEWAY=0
+PROBES=0
+
+show_status() {
+
+       [ $ROUTES = 1 ] && {
+               printf "Routes:\n"
+               write_handler lt.dijkstra true
+               read_handler lt.routes
+       }
+
+       [ $STATIC = 1 ] && {
+               printf "\nStatic Routes:\n"
+               read_handler wr/querier.static_routes
+       }
+
+       [ $HOSTS = 1 ] && {
+               printf "\nIP:\n"
+               read_handler lt.ip
+               printf "\nHosts:\n"
+               read_handler lt.hosts
+       }
+
+       [ $LINKS = 1 ] && {
+               printf "\nLinks:\n"
+               read_handler lt.links
+       }
+
+       [ $ARP = 1 ] && {
+               printf "\nARP Table:\n"
+               read_handler arp.table
+       }
+
+       [ $GATEWAY = 1 ] && {
+               printf "\nBest gateway:\n"
+               read_handler wr/set_gateway.gateway
+               printf "\nGateways:\n"
+               read_handler wr/gw.gateway_stats
+               printf "\nHNAs:\n"
+               read_handler wr/gw.hnas
+       }
+
+       [ $PROBES = 1 ] && {
+               interfaces=$(read_handler lt.interfaces)
+               for interface in $interfaces; do
+                       printf "\nBroadcast statistics ($interface):\n"
+                       read_handler wr/es/es_$interface.bcast_stats
+               done
+       }
+
+       exit 0
+
+}
+
+if [ $# -eq 0 ]; then
+       ROUTES=1
+       STATIC=1
+       HOSTS=1
+       LINKS=1
+       ARP=1
+       GATEWAY=1
+       PROBES=1
+fi
+
+while getopts "rshlagp" OPTVAL
+do
+       case $OPTVAL in
+       r) ROUTES=1
+         ;;
+       r) STATIC=1
+         ;;
+       h) HOSTS=1
+         ;;
+       l) LINKS=1
+         ;;
+       a) ARP=1
+         ;;
+       g) GATEWAY=1
+         ;;
+       p) PROBES=1
+         ;;
+       *) ROUTES=1; STATIC=1; HOSTS=1; LINKS=1; ARP=1; GATEWAY=1; PROBES=1
+         ;;
+       esac
+done
+
+show_status