54 lines
1.1 KiB
Plaintext
54 lines
1.1 KiB
Plaintext
|
#!/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
|
||
|
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
|
||
|
}
|
||
|
|
||
|
stop_service() {
|
||
|
local section="$1"
|
||
|
|
||
|
include /lib/network
|
||
|
scan_interfaces
|
||
|
config_load /var/state/network
|
||
|
|
||
|
config_get LAN lan ifname
|
||
|
config_get WAN wan ifname
|
||
|
config_get bridge "$section" bridge
|
||
|
|
||
|
ifconfig $bridge down
|
||
|
ebtables -t broute -F
|
||
|
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
|
||
|
}
|
||
|
|
||
|
stop () {
|
||
|
config_load "6bridge"
|
||
|
config_foreach stop_service 6bridge
|
||
|
}
|