1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-23 22:34:04 +02:00

ipv6-support:

* Automatically detect and propagate MTU from upstream interfaces
* Add site-border feature (RFC 6204, ULA-4)
* Fix a typo

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34896 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
cyrus 2012-12-27 14:10:17 +00:00
parent 49fe1fed52
commit 9b62f5ffba
4 changed files with 27 additions and 11 deletions

View File

@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=ipv6-support PKG_NAME:=ipv6-support
PKG_VERSION:=2012-12-23 PKG_VERSION:=2012-12-27
PKG_RELEASE:=1 PKG_RELEASE:=1
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk

View File

@ -15,11 +15,11 @@ resolve_network network "$device"
# Announce prefixes # Announce prefixes
for prefix in $PREFIXES; do for prefix in $PREFIXES; do
announce_prefix "$prefix" "$network" announce_prefix "$prefix" "$network" "$device"
done done
for prefix in $PREFIXES_LOST; do for prefix in $PREFIXES_LOST; do
announce_prefix "$prefix" "$network" delprefix announce_prefix "$prefix" "$network" "$device" delprefix
done done

View File

@ -1,5 +1,6 @@
config global global config global global
option ula_prefix auto option ula_prefix auto
option site_border 1
config interface wan config interface wan
option mode dhcpv6 option mode dhcpv6

View File

@ -11,7 +11,7 @@ conf_get() {
local __return="$1" local __return="$1"
local __device="$2" local __device="$2"
local __option="$3" local __option="$3"
local __value=$(cat "/proc/sys/net/ipv6/conf/$device/$option") local __value=$(cat "/proc/sys/net/ipv6/conf/$__device/$__option")
eval "$__return=$__value" eval "$__return=$__value"
} }
@ -110,8 +110,9 @@ setup_npt_chain() {
announce_prefix() { announce_prefix() {
local prefix="$1" local prefix="$1"
local network="$2" local network="$2"
local cmd="$3" local device="$3"
local type="$4" local cmd="$4"
local type="$5"
local addr=$(echo "$prefix" | cut -d/ -f1) local addr=$(echo "$prefix" | cut -d/ -f1)
local rem=$(echo "$prefix" | cut -d/ -f2) local rem=$(echo "$prefix" | cut -d/ -f2)
@ -142,6 +143,12 @@ announce_prefix() {
[ "$prefix_action" == "npt" ] && msg="$msg"', "npt": 1' [ "$prefix_action" == "npt" ] && msg="$msg"', "npt": 1'
[ "$type" == "secondary" ] && msg="$msg"', "secondary": 1' [ "$type" == "secondary" ] && msg="$msg"', "secondary": 1'
# Detect MTU
local mtu
conf_get mtu "$device" mtu
msg="$msg"', "mtu": '"$mtu"
ubus call 6distributed "$cmd" "$msg}" ubus call 6distributed "$cmd" "$msg}"
} }
@ -364,6 +371,7 @@ disable_interface() {
enable_ula_prefix() { enable_ula_prefix() {
local network="$1" local network="$1"
local ula="$2" local ula="$2"
local device="$3"
[ -z "$ula" ] && ula="global" [ -z "$ula" ] && ula="global"
# ULA-integration # ULA-integration
@ -392,7 +400,7 @@ enable_ula_prefix() {
} }
# Announce ULA # Announce ULA
[ -n "$ula_prefix" ] && announce_prefix "$ula_prefix" "$network" newprefix secondary [ -n "$ula_prefix" ] && announce_prefix "$ula_prefix" "$network" "$device" newprefix secondary
} }
@ -410,12 +418,12 @@ enable_static() {
conf_set "$device" forwarding 1 conf_set "$device" forwarding 1
# Enable ULA # Enable ULA
enable_ula_prefix "$network" enable_ula_prefix "$network" global "$device"
# Compatibility (deprecated) # Compatibility (deprecated)
enable_ula_prefix "$network" "$network" enable_ula_prefix "$network" "$network" "$device"
# Announce all static prefixes # Announce all static prefixes
config_list_foreach "$network" static_prefix announce_prefix $network config_list_foreach "$network" static_prefix announce_prefix "$network" "$device"
# start relay if there are forced relay members # start relay if there are forced relay members
restart_relay "$network" restart_relay "$network"
@ -506,7 +514,7 @@ enable_6to4() {
local prefix="" local prefix=""
network_get_ipaddr6 prefix "$network" network_get_ipaddr6 prefix "$network"
announce_prefix "$prefix/$prefixlen" "$network" announce_prefix "$prefix/$prefixlen" "$network" "$device"
} }
@ -529,4 +537,11 @@ enable_interface()
[ "$mode" == "router" ] && enable_router "$network" "$device" [ "$mode" == "router" ] && enable_router "$network" "$device"
[ "$mode" == "6to4" -o "$mode" == "6rd" ] && enable_6to4 "$network" "$device" "$mode" [ "$mode" == "6to4" -o "$mode" == "6rd" ] && enable_6to4 "$network" "$device" "$mode"
[ "$mode" == "relay" ] && restart_master_relay "$network" forced [ "$mode" == "relay" ] && restart_master_relay "$network" forced
# Create / Delete site border
local site_border
local cmd="delulaborder"
config_get_bool site_border global site_border 0
[ "$site_border" == "1" ] && cmd="newulaborder"
ubus call 6distributed "$cmd"
} }