diff options
author | Steven Barth <steven@midlink.org> | 2012-11-29 20:14:28 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2012-11-29 20:14:28 +0000 |
commit | 83e4d3209bca8da799e96af268b9d6cd874293d1 (patch) | |
tree | d7fa26cca29081ccca295685b44ed419a5400c7d /package/network/ipv6/ipv6-support/files/dhcpv6.sh | |
parent | d9c6bfbf8e288d2faf2678c635fae67b188812ed (diff) | |
download | master-187ad058-83e4d3209bca8da799e96af268b9d6cd874293d1.tar.gz master-187ad058-83e4d3209bca8da799e96af268b9d6cd874293d1.tar.bz2 master-187ad058-83e4d3209bca8da799e96af268b9d6cd874293d1.zip |
ipv6-support: Add new IPv6-support meta-package
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34422 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/network/ipv6/ipv6-support/files/dhcpv6.sh')
-rwxr-xr-x | package/network/ipv6/ipv6-support/files/dhcpv6.sh | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/package/network/ipv6/ipv6-support/files/dhcpv6.sh b/package/network/ipv6/ipv6-support/files/dhcpv6.sh new file mode 100755 index 0000000000..67fa174d17 --- /dev/null +++ b/package/network/ipv6/ipv6-support/files/dhcpv6.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# Copyright (c) 2012 OpenWrt.org +. /lib/ipv6/support.sh +. /lib/netifd/netifd-proto.sh + +local device="$1" +local state="$2" +local network="" + +resolve_network network "$device" + +# Unknown network +[ -z "$network" ] && exit 0 + + +# Announce prefixes +for prefix in $PREFIXES; do + announce_prefix "$prefix" "$network" +done + +for prefix in $PREFIXES_LOST; do + announce_prefix "$prefix" "$network" delprefix +done + + +# Enable relaying if requested +local prefix_fallback +config_get prefix_fallback "$network" prefix_fallback +[ "$prefix_fallback" == "relay" -a -z "$PREFIXES" -a "$state" != "unbound" ] && + restart_relay "$network" 1 + +# Disable relay if requested +[ "$prefix_fallback" != "relay" -o -n "$PREFIXES" -o "$state" == "unbound" ] && + stop_relay "$network" + + +# Operations in case of success +[ "$state" == "timeout" || "$state" == "unbound" ] && exit 0 + +local peerdns +config_get_bool peerdns "$network" peerdns 0 +[ "peerdns" -eq "1" ] && { + proto_init_update "*" 1 + for server in $RDNSS; do + proto_add_dns_server "$server" + done + for domain in $DOMAINS; do + proto_add_dns_search "$domain" + done + proto_send_update "$network" +} + |