diff options
author | Steven Barth <cyrus@openwrt.org> | 2014-10-06 11:19:33 +0000 |
---|---|---|
committer | Steven Barth <cyrus@openwrt.org> | 2014-10-06 11:19:33 +0000 |
commit | 8691d75917d91a39f2011d4ddd0713b8562e5e3a (patch) | |
tree | 6dd6cabc1df6ef8098bc22aa2ba07c2bb6ad6f94 /package/network/ipv6/odhcp6c/files | |
parent | 8243e5716747c4a7b47261c00c00afcebee0c593 (diff) | |
download | mtk-20170518-8691d75917d91a39f2011d4ddd0713b8562e5e3a.zip mtk-20170518-8691d75917d91a39f2011d4ddd0713b8562e5e3a.tar.gz mtk-20170518-8691d75917d91a39f2011d4ddd0713b8562e5e3a.tar.bz2 |
odhcp6c: add route-workaround for broken IPv6-ISPs
Some ISP seem to only do stateful DHCPv6 and not sending RAs.
This is technically broken because plain DHCPv6 doesn't carry routes.
We work around here by faking a default route to the DHCPv6 server
if we do not receive a useful RA from the ISP.
This workaround can be turned off with: option fakeroutes 0
Signed-off-by: Steven Barth <steven@midlink.org>
SVN-Revision: 42803
Diffstat (limited to 'package/network/ipv6/odhcp6c/files')
-rwxr-xr-x | package/network/ipv6/odhcp6c/files/dhcpv6.script | 14 | ||||
-rwxr-xr-x | package/network/ipv6/odhcp6c/files/dhcpv6.sh | 6 |
2 files changed, 18 insertions, 2 deletions
diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.script b/package/network/ipv6/odhcp6c/files/dhcpv6.script index 5ab9a1e..37e67bf 100755 --- a/package/network/ipv6/odhcp6c/files/dhcpv6.script +++ b/package/network/ipv6/odhcp6c/files/dhcpv6.script @@ -26,6 +26,15 @@ setup_interface () { for prefix in $PREFIXES; do proto_add_ipv6_prefix "$prefix" + local entry="${prefix#*/}" + entry="${entry#*,}" + entry="${entry#*,}" + local valid="${entry%%,*}" + + if [ -z "$RA_ADDRESSES" -a -z "$RA_ROUTES" -a \ + -z "$RA_DNS" -a "$FAKE_ROUTES" = 1 ]; then + RA_ROUTES="::/0,$SERVER,$valid,4096" + fi done [ -n "$USERPREFIX" ] && proto_add_ipv6_prefix "$USERPREFIX" @@ -51,6 +60,11 @@ setup_interface () { local valid="${entry%%,*}" proto_add_ipv6_address "$addr" "$mask" "$preferred" "$valid" 1 + + if [ -z "$RA_ADDRESSES" -a -z "$RA_ROUTES" -a \ + -z "$RA_DNS" -a "$FAKE_ROUTES" = 1 ]; then + RA_ROUTES="::/0,$SERVER,$valid,4096" + fi done for entry in $RA_ROUTES; do diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.sh b/package/network/ipv6/odhcp6c/files/dhcpv6.sh index 0690bd1..5914abe 100755 --- a/package/network/ipv6/odhcp6c/files/dhcpv6.sh +++ b/package/network/ipv6/odhcp6c/files/dhcpv6.sh @@ -26,14 +26,15 @@ proto_dhcpv6_init_config() { proto_config_add_string "vendorclass" proto_config_add_boolean delegate proto_config_add_int "soltimeout" + proto_config_add_boolean fakeroutes } proto_dhcpv6_setup() { local config="$1" local iface="$2" - local reqaddress reqprefix clientid reqopts noslaaconly forceprefix norelease ip6prefix iface_dslite iface_map ifaceid sourcerouting userclass vendorclass delegate zone_dslite zone_map zone soltimeout - json_get_vars reqaddress reqprefix clientid reqopts noslaaconly forceprefix norelease ip6prefix iface_dslite iface_map ifaceid sourcerouting userclass vendorclass delegate zone_dslite zone_map zone soltimeout + local reqaddress reqprefix clientid reqopts noslaaconly forceprefix norelease ip6prefix iface_dslite iface_map ifaceid sourcerouting userclass vendorclass delegate zone_dslite zone_map zone soltimeout fakeroutes + json_get_vars reqaddress reqprefix clientid reqopts noslaaconly forceprefix norelease ip6prefix iface_dslite iface_map ifaceid sourcerouting userclass vendorclass delegate zone_dslite zone_map zone soltimeout fakeroutes # Configure @@ -72,6 +73,7 @@ proto_dhcpv6_setup() { [ -n "$zone_dslite" ] && proto_export "ZONE_DSLITE=$zone_dslite" [ -n "$zone_map" ] && proto_export "ZONE_MAP=$zone_map" [ -n "$zone" ] && proto_export "ZONE=$zone" + [ "$fakeroutes" != "0" ] && proto_export "FAKE_ROUTES=1" proto_export "INTERFACE=$config" proto_run_command "$config" odhcp6c \ |