From 0b670ee67e82450971c0b311e653b439fbe9489f Mon Sep 17 00:00:00 2001 From: swalker Date: Sun, 17 Jul 2011 14:17:47 +0000 Subject: [PATCH] [packages] wing: update to 20110709 (#9722) * Signed-off-by: Roberto Riggio * remove unrecognized configure options * remove trailing whitespace git-svn-id: svn://svn.openwrt.org/openwrt/packages@27643 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- net/wing/Makefile | 23 +++---- net/wing/files/etc/uci-defaults/wing | 26 ++++---- net/wing/files/lib/network/wing.sh | 16 +++-- net/wing/files/usr/bin/wing_status | 124 +++++++++++++++++++++++++++++++++++ 4 files changed, 157 insertions(+), 32 deletions(-) create mode 100755 net/wing/files/usr/bin/wing_status diff --git a/net/wing/Makefile b/net/wing/Makefile index 6e6347c69..47892ca76 100644 --- a/net/wing/Makefile +++ b/net/wing/Makefile @@ -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; \ diff --git a/net/wing/files/etc/uci-defaults/wing b/net/wing/files/etc/uci-defaults/wing index 2f5e0dd5f..9648a9db4 100644 --- a/net/wing/files/etc/uci-defaults/wing +++ b/net/wing/files/etc/uci-defaults/wing @@ -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" diff --git a/net/wing/files/lib/network/wing.sh b/net/wing/files/lib/network/wing.sh index 553ebaa0c..49e5d3d94 100644 --- a/net/wing/files/lib/network/wing.sh +++ b/net/wing/files/lib/network/wing.sh @@ -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 index 000000000..dd63cacd1 --- /dev/null +++ b/net/wing/files/usr/bin/wing_status @@ -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 -- 2.11.0