#
-# 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.
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
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
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
--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
(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; \
+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
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"
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."
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
-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
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
}
[ "$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
--- /dev/null
+#!/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