mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-27 18:17:32 +02:00
ipv6-support: next iteration
* Introduce mode 6rd * Introduce mode 6to4 * Fix announcement of DNS-Servers received from DHCPv6 * Fix some corner-cases in relaying behaviour git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34542 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
6cde8ed783
commit
83ef4411d0
@ -8,7 +8,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ipv6-support
|
||||
PKG_VERSION:=2012-12-03
|
||||
PKG_VERSION:=2012-12-06
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
@ -39,8 +39,9 @@ config_get prefix_fallback "$network" prefix_fallback
|
||||
|
||||
local peerdns
|
||||
config_get_bool peerdns "$network" peerdns 0
|
||||
[ "peerdns" -eq "1" ] && {
|
||||
[ "$peerdns" -eq "1" ] && {
|
||||
proto_init_update "*" 1
|
||||
proto_set_keep 1
|
||||
for server in $RDNSS; do
|
||||
proto_add_dns_server "$server"
|
||||
done
|
||||
|
@ -5,14 +5,8 @@ config interface wan
|
||||
option prefix_fallback relay
|
||||
option peerdns 1
|
||||
|
||||
|
||||
config interface lan
|
||||
option mode router
|
||||
option advertise_prefix 64
|
||||
option relay_master wan
|
||||
|
||||
|
||||
config interface 6in4
|
||||
option mode static
|
||||
list static_prefix 2001:DB8::/48
|
||||
|
||||
|
@ -52,7 +52,6 @@ resolve_network_add() {
|
||||
local __section="$1"
|
||||
local __device="$2"
|
||||
local __return="$3"
|
||||
|
||||
local __cdevice
|
||||
network_get_device __cdevice "$__section"
|
||||
[ "$__cdevice" != "$__device" ] && return
|
||||
@ -154,6 +153,10 @@ add_relay_slave() {
|
||||
# Disable any active distribution
|
||||
[ "$__cmode" == "router" ] && disable_router "$__section"
|
||||
|
||||
# Configure interface to accept RA and send RS
|
||||
conf_set "$__device" accept_ra 2
|
||||
conf_set "$__device" forwarding 2
|
||||
|
||||
eval "$__return"'="$'"$__return"' '"$__device"'"'
|
||||
}
|
||||
|
||||
@ -286,8 +289,8 @@ enable_static() {
|
||||
ula_prefix="fd$r1:$r2:$r3::/48"
|
||||
|
||||
# Save prefix so it will be preserved across reboots
|
||||
uci set network6.$network.ula_prefix=$ula_prefix
|
||||
uci commit network6
|
||||
uci_set network6 "$network" ula_prefix "$ula_prefix"
|
||||
uci_commit network6
|
||||
}
|
||||
|
||||
# Announce ULA
|
||||
@ -313,10 +316,15 @@ enable_router() {
|
||||
|
||||
# Start RD & DHCPv6 service
|
||||
local pid="/var/run/ipv6-router-$network.pid"
|
||||
start_service "/usr/sbin/6relayd -Rserver -Dserver . $device" "$pid"
|
||||
|
||||
# Start server
|
||||
start_service "/usr/sbin/6relayd -S . $device" "$pid"
|
||||
|
||||
# Try relaying if necessary
|
||||
restart_master_relay "$network"
|
||||
|
||||
# start relay if there are forced relay members
|
||||
restart_relay "$network"
|
||||
}
|
||||
|
||||
|
||||
@ -355,6 +363,25 @@ enable_dhcpv6() {
|
||||
}
|
||||
|
||||
|
||||
enable_6to4() {
|
||||
local network="$1"
|
||||
local device="$2"
|
||||
local mode="$3"
|
||||
|
||||
local prefixlen="48"
|
||||
[ "$mode" == "6rd" ] && {
|
||||
local ip4prefix=$(uci_get network "$network" ip4prefixlen 0)
|
||||
local ip6prefix=$(uci_get network "$network" ip6prefixlen 32)
|
||||
prefixlen=$(($ip6prefix + 32 - $ip4prefix))
|
||||
}
|
||||
|
||||
local prefix=""
|
||||
network_get_ipaddr6 prefix "$network"
|
||||
|
||||
announce_prefix "$prefix/$prefixlen" "$network"
|
||||
}
|
||||
|
||||
|
||||
enable_interface()
|
||||
{
|
||||
local network="$1"
|
||||
@ -370,5 +397,6 @@ enable_interface()
|
||||
[ "$mode" == "dhcpv6" -o "$mode" == "static" ] && enable_static "$network" "$device"
|
||||
[ "$mode" == "dhcpv6" ] && enable_dhcpv6 "$network" "$device"
|
||||
[ "$mode" == "router" ] && enable_router "$network" "$device"
|
||||
[ "$mode" == "6to4" -o "$mode" == "6rd" ] && enable_6to4 "$network" "$device" "$mode"
|
||||
[ "$mode" == "relay" ] && restart_master_relay "$network" forced
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user