From 4b8d8ade125e348e23048f8b5e9d3e7d81c26340 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 29 May 2012 01:26:11 +0000 Subject: [PATCH] 6scripts: use network.sh to find device names SVN-Revision: 31971 --- ipv6/6scripts/Makefile | 4 +-- ipv6/6scripts/files/6bridge.init | 58 ++++++++++++++++---------------- ipv6/6scripts/files/6tunnel.init | 25 ++++++-------- 3 files changed, 42 insertions(+), 45 deletions(-) diff --git a/ipv6/6scripts/Makefile b/ipv6/6scripts/Makefile index 0ae95e6ff..434e75673 100644 --- a/ipv6/6scripts/Makefile +++ b/ipv6/6scripts/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2007-2009 OpenWrt.org +# Copyright (C) 2007-2012 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=6scripts PKG_VERSION:=0.1 -PKG_RELEASE:=6 +PKG_RELEASE:=7 include $(INCLUDE_DIR)/package.mk diff --git a/ipv6/6scripts/files/6bridge.init b/ipv6/6scripts/files/6bridge.init index ba98d66be..94e3993c9 100644 --- a/ipv6/6scripts/files/6bridge.init +++ b/ipv6/6scripts/files/6bridge.init @@ -1,53 +1,53 @@ #!/bin/sh /etc/rc.common + START=46 STOP=46 start_service() { local section="$1" - - include /lib/network - scan_interfaces - config_load /var/state/network - config_get LAN lan ifname - config_get WAN wan ifname + . /lib/functions/network.sh + + network_get_physdev LAN lan || return 1 + network_get_physdev WAN wan || return 1 config_get bridge "$section" bridge brctl addbr $bridge brctl addif $bridge $LAN brctl addif $bridge $WAN brctl setfd $bridge 0 - ebtables -t broute -A BROUTING -i $WAN -p ! ipv6 -j DROP - ifconfig $bridge up + + ebtables -t broute -A BROUTING -i $WAN -p ! ipv6 -j DROP + ifconfig $bridge up } stop_service() { - local section="$1" + local section="$1" - include /lib/network - scan_interfaces - config_load /var/state/network + . /lib/functions/network.sh - config_get LAN lan ifname - config_get WAN wan ifname - config_get bridge "$section" bridge + network_get_physdev LAN lan || return 1 + network_get_physdev WAN wan || return 1 + config_get bridge "$section" bridge + + ifconfig $bridge down + ebtables -t broute -F - ifconfig $bridge down - ebtables -t broute -F - brctl delif $bridge $WAN - brctl delif $bridge $LAN - brctl delbr $bridge + brctl delif $bridge $WAN + brctl delif $bridge $LAN + brctl delbr $bridge } + start() { - if ! [ -f /proc/net/if_inet6 ]; then - echo "IPv6 not enabled, install kmod-ipv6"; - exit 1; - fi - config_load "6bridge" - config_foreach start_service 6bridge + if ! [ -f /proc/net/if_inet6 ]; then + echo "IPv6 not enabled, install kmod-ipv6"; + exit 1 + fi + config_load "6bridge" + config_foreach start_service 6bridge } -stop () { - config_load "6bridge" - config_foreach stop_service 6bridge +stop() { + config_load "6bridge" + config_foreach stop_service 6bridge } diff --git a/ipv6/6scripts/files/6tunnel.init b/ipv6/6scripts/files/6tunnel.init index 0e955ee12..06ca29b29 100644 --- a/ipv6/6scripts/files/6tunnel.init +++ b/ipv6/6scripts/files/6tunnel.init @@ -1,16 +1,15 @@ #!/bin/sh /etc/rc.common + START=46 STOP=46 start_service() { local section="$1" - - include /lib/network - scan_interfaces - config_load /var/state/network - config_get LAN lan ifname - config_get tnlifname "$section" tnlifname + . /lib/functions/network.sh + + network_get_device LAN lan || return 1 + config_get tnlifname "$section" tnlifname config_get remoteip4 "$section" remoteip4 config_get localip4 "$section" localip4 config_get localip6 "$section" localip6 @@ -31,13 +30,11 @@ start_service() { stop_service() { local section="$1" - - include /lib/network - scan_interfaces - config_load /var/state/network - config_get LAN lan ifname - config_get tnlifname "$section" tnlifname + . /lib/functions/network.sh + + network_get_device LAN lan || return 1 + config_get tnlifname "$section" tnlifname config_get remoteip4 "$section" remoteip4 config_get localip4 "$section" localip4 config_get localip6 "$section" localip6 @@ -56,13 +53,13 @@ stop_service() { start() { if ! [ -x /usr/sbin/ip ]; then echo "ip is required to setup the tunnel"; - exit 1; + exit 1 fi config_load "6tunnel" config_foreach start_service 6tunnel } -stop () { +stop() { config_load "6tunnel" config_foreach stop_service 6tunnel } -- 2.30.2