[packages] 6scripts: use network.sh to find device names

git-svn-id: svn://svn.openwrt.org/openwrt/packages@31971 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2012-05-29 01:26:11 +00:00
parent 4997a53386
commit cdabe8959f
3 changed files with 42 additions and 45 deletions

View File

@ -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. # This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information. # See /LICENSE for more information.
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=6scripts PKG_NAME:=6scripts
PKG_VERSION:=0.1 PKG_VERSION:=0.1
PKG_RELEASE:=6 PKG_RELEASE:=7
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk

View File

@ -1,22 +1,22 @@
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
START=46 START=46
STOP=46 STOP=46
start_service() { start_service() {
local section="$1" local section="$1"
include /lib/network . /lib/functions/network.sh
scan_interfaces
config_load /var/state/network
config_get LAN lan ifname network_get_physdev LAN lan || return 1
config_get WAN wan ifname network_get_physdev WAN wan || return 1
config_get bridge "$section" bridge config_get bridge "$section" bridge
brctl addbr $bridge brctl addbr $bridge
brctl addif $bridge $LAN brctl addif $bridge $LAN
brctl addif $bridge $WAN brctl addif $bridge $WAN
brctl setfd $bridge 0 brctl setfd $bridge 0
ebtables -t broute -A BROUTING -i $WAN -p ! ipv6 -j DROP ebtables -t broute -A BROUTING -i $WAN -p ! ipv6 -j DROP
ifconfig $bridge up ifconfig $bridge up
} }
@ -24,24 +24,24 @@ start_service() {
stop_service() { stop_service() {
local section="$1" local section="$1"
include /lib/network . /lib/functions/network.sh
scan_interfaces
config_load /var/state/network
config_get LAN lan ifname network_get_physdev LAN lan || return 1
config_get WAN wan ifname network_get_physdev WAN wan || return 1
config_get bridge "$section" bridge config_get bridge "$section" bridge
ifconfig $bridge down ifconfig $bridge down
ebtables -t broute -F ebtables -t broute -F
brctl delif $bridge $WAN brctl delif $bridge $WAN
brctl delif $bridge $LAN brctl delif $bridge $LAN
brctl delbr $bridge brctl delbr $bridge
} }
start() { start() {
if ! [ -f /proc/net/if_inet6 ]; then if ! [ -f /proc/net/if_inet6 ]; then
echo "IPv6 not enabled, install kmod-ipv6"; echo "IPv6 not enabled, install kmod-ipv6";
exit 1; exit 1
fi fi
config_load "6bridge" config_load "6bridge"
config_foreach start_service 6bridge config_foreach start_service 6bridge

View File

@ -1,15 +1,14 @@
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
START=46 START=46
STOP=46 STOP=46
start_service() { start_service() {
local section="$1" local section="$1"
include /lib/network . /lib/functions/network.sh
scan_interfaces
config_load /var/state/network
config_get LAN lan ifname network_get_device LAN lan || return 1
config_get tnlifname "$section" tnlifname config_get tnlifname "$section" tnlifname
config_get remoteip4 "$section" remoteip4 config_get remoteip4 "$section" remoteip4
config_get localip4 "$section" localip4 config_get localip4 "$section" localip4
@ -32,11 +31,9 @@ start_service() {
stop_service() { stop_service() {
local section="$1" local section="$1"
include /lib/network . /lib/functions/network.sh
scan_interfaces
config_load /var/state/network
config_get LAN lan ifname network_get_device LAN lan || return 1
config_get tnlifname "$section" tnlifname config_get tnlifname "$section" tnlifname
config_get remoteip4 "$section" remoteip4 config_get remoteip4 "$section" remoteip4
config_get localip4 "$section" localip4 config_get localip4 "$section" localip4
@ -56,7 +53,7 @@ stop_service() {
start() { start() {
if ! [ -x /usr/sbin/ip ]; then if ! [ -x /usr/sbin/ip ]; then
echo "ip is required to setup the tunnel"; echo "ip is required to setup the tunnel";
exit 1; exit 1
fi fi
config_load "6tunnel" config_load "6tunnel"
config_foreach start_service 6tunnel config_foreach start_service 6tunnel