Changeset 32826


Ignore:
Timestamp:
2012-07-24T23:46:18+02:00 (6 years ago)
Author:
blogic
Message:

[packages] Port the wing package to the new netifd infrastructure.

Signed-off-by: Roberto Riggio <roberto.riggio@…>

Location:
packages/net/wing
Files:
2 added
2 deleted
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • packages/net/wing/Makefile

    r29373 r32826  
    11# 
    2 # Copyright (C) 2006-2011 OpenWrt.org 
     2# Copyright (C) 2006-2012 OpenWrt.org 
    33# 
    44# This is free software, licensed under the GNU General Public License v2. 
     
    99 
    1010PKG_NAME:=wing 
    11 PKG_VERSION:=20111103 
     11PKG_VERSION:=20120625 
    1212PKG_RELEASE:=1 
    13 PKG_REV:=23e6455a1cfe0877334f0d18068a3fb47425b8a4 
     13PKG_REV:=ce245718dd01fad9a9bd78dd5792245b7cdd09aa 
    1414 
    1515PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 
     
    6868                -A --all -E Discard -E Print -E PrintWifi -E Strip -E Null \ 
    6969                -E InfiniteSource -E RatedSource -E EtherEncap -E UDPIPEncap \ 
    70                 -E AggregateWingPacketType -E AggregateCounter \ 
    7170                -E RadiotapEncapHT -E SetTXRateHT \ 
    7271                -E WINGETTMetric -E WINGETXMetric -E WINGHopCountMetric \ 
  • packages/net/wing/files/etc/uci-defaults/wing

    r29373 r32826  
    33uci set network.mesh.proto=wing 
    44 
    5 uci add firewall zone 
    6 uci set firewall.@zone[-1].name="mesh" 
    7 uci set firewall.@zone[-1].input="ACCEPT" 
    8 uci set firewall.@zone[-1].output="ACCEPT" 
    9 uci set firewall.@zone[-1].forward="REJECT" 
    10 uci set firewall.@zone[-1].masq="1" 
     5uci delete firewall.zone_mesh 
     6uci set firewall.zone_mesh=zone 
     7uci set firewall.zone_mesh.name="mesh" 
     8uci set firewall.zone_mesh.input="ACCEPT" 
     9uci set firewall.zone_mesh.output="ACCEPT" 
     10uci set firewall.zone_mesh.forward="REJECT" 
     11uci set firewall.zone_mesh.masq="1" 
    1112 
    12 uci add firewall forwarding 
    13 uci set firewall.@forwarding[-1].src="lan" 
    14 uci set firewall.@forwarding[-1].dest="mesh" 
     13uci delete firewall.fwd_lan_mesh 
     14uci set firewall.fwd_lan_mesh=forwarding 
     15uci set firewall.fwd_lan_mesh.src="lan" 
     16uci set firewall.fwd_lan_mesh.dest="mesh" 
    1517 
    16 uci add firewall forwarding 
    17 uci set firewall.@forwarding[-1].src="mesh" 
    18 uci set firewall.@forwarding[-1].dest="wan" 
     18uci delete firewall.fwd_mesh_wan 
     19uci set firewall.fwd_mesh_wan=forwarding 
     20uci set firewall.fwd_mesh_wan.src="mesh" 
     21uci set firewall.fwd_mesh_wan.dest="wan" 
    1922 
     23uci commit 
     24 
  • packages/net/wing/files/lib/netifd/proto/wing.sh

    r32790 r32826  
     1#!/bin/sh 
    12 
    2 scan_wing() { 
    3         config_set "$1" device "wing-$1" 
     3. /etc/functions.sh 
     4. ../netifd-proto.sh 
     5init_proto "$@" 
     6 
     7proto_wing_init_config() { 
     8        no_device=1 
     9        available=1 
     10        proto_config_add_string "ipaddr" 
     11        proto_config_add_string "netmask" 
    412} 
    513 
    6 coldplug_interface_wing() { 
    7         setup_interface_wing "wing-$1" "$1" 
     14proto_wing_teardown() { 
     15        local config="$1" 
     16        local link="wing-$config" 
     17        [ -f "/var/run/$link.pid" ] && { 
     18                kill -9 $(cat /var/run/$link.pid) 
     19                rm /var/run/$link.pid 
     20        } 
     21        env -i ACTION="ifdown" INTERFACE="$config" DEVICE="$link" PROTO=wing /sbin/hotplug-call "link" & 
    822} 
    923 
    10 stop_interface_wing() { 
     24proto_wing_setup() { 
     25 
     26        local iface="$2" 
    1127        local config="$1" 
    12         local iface="wing-$config" 
    13         env -i ACTION="ifdown" INTERFACE="$config" DEVICE="$iface" PROTO=wing /sbin/hotplug-call "iface" & 
    14         [ -f "/var/run/$iface.pid" ] && { 
    15                 kill -9 $(cat /var/run/$iface.pid) 
    16                 rm /var/run/$iface.pid 
    17         } 
    18 } 
    19  
    20 setup_interface_wing() { 
    21  
    22         local iface="$1" 
    23         local config="$2" 
     28        local link="wing-$config" 
    2429 
    2530        local hwmodes="" 
     
    2732        local ifnames="" 
    2833        local hwaddrs="" 
     34 
     35        # temporary hack waiting for a way to delay wing interfaces until the 
     36        # wifi sub-system has been brought up 
     37        sleep 15 
    2938 
    3039        config_load wireless 
     
    7786        /usr/bin/click_config -p $profile -r $rc -s $ls -l $metric \ 
    7887                -m "$hwmodes" -c "$freqs" -n "$ifnames" -a "$hwaddrs" $dbg \ 
    79                 | sed -e "s/__XR_IFNAME__/$iface/g" \ 
     88                | sed -e "s/__XR_IFNAME__/$link/g" \ 
    8089                | sed -e "s/__XR_IP__/$ipaddr/g" \ 
    8190                | sed -e "s/__XR_BCAST__/$bcast/g" \ 
    8291                | sed -e "s/__XR_NM__/$netmask/g" \ 
    8392                | sed -e "s/__XR_PERIOD__/$period/g" \ 
    84                 | sed -e "s/__XR_TAU__/$tau/g" > /tmp/$iface.click 
     93                | sed -e "s/__XR_TAU__/$tau/g" > /tmp/$link.click 
    8594 
    86         /usr/bin/click-align /tmp/$iface.click > /tmp/$iface-aligned.click 2>/var/log/$iface.log 
     95        /usr/bin/click-align /tmp/$link.click > /tmp/$link-aligned.click 2>/var/log/$link.log 
    8796        [ ! -c /dev/net/tun ] && { 
    8897                mkdir -p /dev/net/ 
     
    94103        } 
    95104 
    96         # creating the tun interface below will trigger a net subsystem event 
    97         # prevent it from touching iface by disabling .auto here 
    98         uci_set_state network "$config" auto 0 
    99  
    100         (/usr/bin/click /tmp/$iface-aligned.click >> /var/log/$iface.log 2>&1 &) & 
     105        (/usr/bin/click /tmp/$link-aligned.click >> /var/log/$link.log 2>&1 &) & 
    101106        sleep 2 
    102107        ps | grep /usr/bin/click | grep -q -v grep || { 
     
    105110        } 
    106111 
    107         ps | grep /usr/bin/click | grep -v grep | awk '{print $1}' > /var/run/$iface.pid 
     112        ps | grep /usr/bin/click | grep -v grep | awk '{print $1}' > /var/run/$link.pid 
    108113 
    109         ifconfig "$iface" "$ipaddr" netmask "$netmask" 
    110         route -n | grep -q '^0.0.0.0' || { 
    111         route add default dev "$iface" 
    112        } 
     114        env -i ACTION="ifup" INTERFACE="$config" DEVICE="$link" PROTO=wing /sbin/hotplug-call "link" & 
    113115 
    114         uci_set_state network $config ifname "$iface" 
    115         uci_set_state network $config ipaddr "$ipaddr" 
    116         uci_set_state network $config netmask "$netmask" 
    117         uci_set_state network $config gateway "0.0.0.0" 
     116        proto_init_update "$link" 1 
     117        proto_add_ipv4_address "$ipaddr" "$netmasj" 
    118118 
    119         env -i ACTION="ifup" INTERFACE="$config" DEVICE="$iface" PROTO=wing /sbin/hotplug-call "iface" & 
     119        route -n | grep -q '^0.0.0.0' || { 
     120                proto_add_ipv4_route "0.0.0.0" 0 
     121        } 
     122         
     123        proto_send_update "$config" 
    120124 
    121125} 
     
    153157} 
    154158 
     159add_protocol wing 
     160 
Note: See TracChangeset for help on using the changeset viewer.