[packages] Port the wing package to the new netifd infrastructure.
Signed-off-by: Roberto Riggio <roberto.riggio@create-net.org> git-svn-id: svn://svn.openwrt.org/openwrt/packages@32826 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
0823b7d98f
commit
e959d57f61
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2006-2011 OpenWrt.org
|
||||
# Copyright (C) 2006-2012 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:=20111103
|
||||
PKG_VERSION:=20120625
|
||||
PKG_RELEASE:=1
|
||||
PKG_REV:=23e6455a1cfe0877334f0d18068a3fb47425b8a4
|
||||
PKG_REV:=ce245718dd01fad9a9bd78dd5792245b7cdd09aa
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=git://github.com/rriggio/click.git
|
||||
@ -67,7 +67,6 @@ define Build/Compile
|
||||
-f $(PKG_BUILD_DIR)/conf/wing/sample.click \
|
||||
-A --all -E Discard -E Print -E PrintWifi -E Strip -E Null \
|
||||
-E InfiniteSource -E RatedSource -E EtherEncap -E UDPIPEncap \
|
||||
-E AggregateWingPacketType -E AggregateCounter \
|
||||
-E RadiotapEncapHT -E SetTXRateHT \
|
||||
-E WINGETTMetric -E WINGETXMetric -E WINGHopCountMetric \
|
||||
-E ProbeTXRate -E MadwifiRate -E AutoRateFallback -E Minstrel \
|
||||
|
@ -2,18 +2,23 @@ uci delete network.mesh
|
||||
uci set network.mesh=interface
|
||||
uci set network.mesh.proto=wing
|
||||
|
||||
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"
|
||||
uci delete firewall.zone_mesh
|
||||
uci set firewall.zone_mesh=zone
|
||||
uci set firewall.zone_mesh.name="mesh"
|
||||
uci set firewall.zone_mesh.input="ACCEPT"
|
||||
uci set firewall.zone_mesh.output="ACCEPT"
|
||||
uci set firewall.zone_mesh.forward="REJECT"
|
||||
uci set firewall.zone_mesh.masq="1"
|
||||
|
||||
uci add firewall forwarding
|
||||
uci set firewall.@forwarding[-1].src="lan"
|
||||
uci set firewall.@forwarding[-1].dest="mesh"
|
||||
uci delete firewall.fwd_lan_mesh
|
||||
uci set firewall.fwd_lan_mesh=forwarding
|
||||
uci set firewall.fwd_lan_mesh.src="lan"
|
||||
uci set firewall.fwd_lan_mesh.dest="mesh"
|
||||
|
||||
uci add firewall forwarding
|
||||
uci set firewall.@forwarding[-1].src="mesh"
|
||||
uci set firewall.@forwarding[-1].dest="wan"
|
||||
uci delete firewall.fwd_mesh_wan
|
||||
uci set firewall.fwd_mesh_wan=forwarding
|
||||
uci set firewall.fwd_mesh_wan.src="mesh"
|
||||
uci set firewall.fwd_mesh_wan.dest="wan"
|
||||
|
||||
uci commit
|
||||
|
||||
|
@ -1,32 +1,41 @@
|
||||
#!/bin/sh
|
||||
|
||||
scan_wing() {
|
||||
config_set "$1" device "wing-$1"
|
||||
. /etc/functions.sh
|
||||
. ../netifd-proto.sh
|
||||
init_proto "$@"
|
||||
|
||||
proto_wing_init_config() {
|
||||
no_device=1
|
||||
available=1
|
||||
proto_config_add_string "ipaddr"
|
||||
proto_config_add_string "netmask"
|
||||
}
|
||||
|
||||
coldplug_interface_wing() {
|
||||
setup_interface_wing "wing-$1" "$1"
|
||||
}
|
||||
|
||||
stop_interface_wing() {
|
||||
proto_wing_teardown() {
|
||||
local config="$1"
|
||||
local iface="wing-$config"
|
||||
env -i ACTION="ifdown" INTERFACE="$config" DEVICE="$iface" PROTO=wing /sbin/hotplug-call "iface" &
|
||||
[ -f "/var/run/$iface.pid" ] && {
|
||||
kill -9 $(cat /var/run/$iface.pid)
|
||||
rm /var/run/$iface.pid
|
||||
local link="wing-$config"
|
||||
[ -f "/var/run/$link.pid" ] && {
|
||||
kill -9 $(cat /var/run/$link.pid)
|
||||
rm /var/run/$link.pid
|
||||
}
|
||||
env -i ACTION="ifdown" INTERFACE="$config" DEVICE="$link" PROTO=wing /sbin/hotplug-call "link" &
|
||||
}
|
||||
|
||||
setup_interface_wing() {
|
||||
proto_wing_setup() {
|
||||
|
||||
local iface="$1"
|
||||
local config="$2"
|
||||
local iface="$2"
|
||||
local config="$1"
|
||||
local link="wing-$config"
|
||||
|
||||
local hwmodes=""
|
||||
local freqs=""
|
||||
local ifnames=""
|
||||
local hwaddrs=""
|
||||
|
||||
# temporary hack waiting for a way to delay wing interfaces until the
|
||||
# wifi sub-system has been brought up
|
||||
sleep 15
|
||||
|
||||
config_load wireless
|
||||
config_foreach wing_list_interfaces wifi-iface
|
||||
|
||||
@ -76,14 +85,14 @@ setup_interface_wing() {
|
||||
|
||||
/usr/bin/click_config -p $profile -r $rc -s $ls -l $metric \
|
||||
-m "$hwmodes" -c "$freqs" -n "$ifnames" -a "$hwaddrs" $dbg \
|
||||
| sed -e "s/__XR_IFNAME__/$iface/g" \
|
||||
| sed -e "s/__XR_IFNAME__/$link/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
|
||||
| sed -e "s/__XR_TAU__/$tau/g" > /tmp/$link.click
|
||||
|
||||
/usr/bin/click-align /tmp/$iface.click > /tmp/$iface-aligned.click 2>/var/log/$iface.log
|
||||
/usr/bin/click-align /tmp/$link.click > /tmp/$link-aligned.click 2>/var/log/$link.log
|
||||
[ ! -c /dev/net/tun ] && {
|
||||
mkdir -p /dev/net/
|
||||
mknod /dev/net/tun c 10 200
|
||||
@ -93,30 +102,25 @@ setup_interface_wing() {
|
||||
fi
|
||||
}
|
||||
|
||||
# creating the tun interface below will trigger a net subsystem event
|
||||
# prevent it from touching iface by disabling .auto here
|
||||
uci_set_state network "$config" auto 0
|
||||
|
||||
(/usr/bin/click /tmp/$iface-aligned.click >> /var/log/$iface.log 2>&1 &) &
|
||||
(/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
|
||||
}
|
||||
|
||||
ps | grep /usr/bin/click | grep -v grep | awk '{print $1}' > /var/run/$iface.pid
|
||||
ps | grep /usr/bin/click | grep -v grep | awk '{print $1}' > /var/run/$link.pid
|
||||
|
||||
ifconfig "$iface" "$ipaddr" netmask "$netmask"
|
||||
route -n | grep -q '^0.0.0.0' || {
|
||||
route add default dev "$iface"
|
||||
}
|
||||
env -i ACTION="ifup" INTERFACE="$config" DEVICE="$link" PROTO=wing /sbin/hotplug-call "link" &
|
||||
|
||||
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"
|
||||
proto_init_update "$link" 1
|
||||
proto_add_ipv4_address "$ipaddr" "$netmasj"
|
||||
|
||||
env -i ACTION="ifup" INTERFACE="$config" DEVICE="$iface" PROTO=wing /sbin/hotplug-call "iface" &
|
||||
route -n | grep -q '^0.0.0.0' || {
|
||||
proto_add_ipv4_route "0.0.0.0" 0
|
||||
}
|
||||
|
||||
proto_send_update "$config"
|
||||
|
||||
}
|
||||
|
||||
@ -152,3 +156,5 @@ wing_list_interfaces() {
|
||||
/sbin/ifconfig $ifname up
|
||||
}
|
||||
|
||||
add_protocol wing
|
||||
|
@ -1,23 +0,0 @@
|
||||
--- a/doc/click-elem2man
|
||||
+++ b/doc/click-elem2man
|
||||
@@ -227,14 +227,15 @@ sub nroff_fixfP ($$) {
|
||||
}
|
||||
|
||||
sub nroff_manref ($$$$) {
|
||||
- map { $_ = "\"$_\"" if (s/\"/\\(dq/g) } @_;
|
||||
+ my @x = @_;
|
||||
+ map { $_ = "\"$_\"" if (s/\"/\\(dq/g) } @x;
|
||||
my($x);
|
||||
- if ($_[0] eq "") {
|
||||
- $x = "\n.M " . $_[1] . " " . $_[2];
|
||||
+ if ($x[0] eq "") {
|
||||
+ $x = "\n.M " . $x[1] . " " . $x[2];
|
||||
} else {
|
||||
- $x = "\n.RM " . $_[0] . " " . $_[1] . " " . $_[2];
|
||||
+ $x = "\n.RM " . $x[0] . " " . $x[1] . " " . $x[2];
|
||||
}
|
||||
- $x .= " " . $_[3] if $_[3] ne "";
|
||||
+ $x .= " " . $x[3] if $x[3] ne "";
|
||||
$x . "\n";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user