odhcp6c: fix some more compatibility issues
authorSteven Barth <cyrus@openwrt.org>
Mon, 13 Jul 2015 21:52:25 +0000 (21:52 +0000)
committerSteven Barth <cyrus@openwrt.org>
Mon, 13 Jul 2015 21:52:25 +0000 (21:52 +0000)
Signed-off-by: Steven Barth <steven@midlink.org>
SVN-Revision: 46337

package/network/ipv6/odhcp6c/files/dhcpv6.script

index 84eb706ebcec603483b549cb8cefe335b219513a..b8cbddb9422f3da0655de0093ff8f08e18e617bb 100755 (executable)
@@ -76,6 +76,7 @@ setup_interface () {
        done
 
        for entry in $RA_ROUTES; do
+               local duplicate=0
                local addr="${entry%%/*}"
                entry="${entry#*/}"
                local mask="${entry%%,*}"
@@ -86,12 +87,16 @@ setup_interface () {
                entry="${entry#*,}"
                local metric="${entry%%,*}"
 
-               if [ -z "$gw" ]; then
-                       proto_add_ipv6_route "$addr" "$mask" "$gw" "$metric" "$valid"
+               for xentry in $RA_ROUTES; do
+                       local xprefix="${xentry%%,*}"
+                       xentry="${xentry#*,}"
+                       local xgw="${xentry%%,*}"
 
-                       # work around if there is a PIO matching a RIO
-                       # Linux seems to prefer source-dest over dest-only even if metric is higher
-                       proto_add_ipv6_route "$addr" "$mask" "$gw" "$metric" "$valid" "$addr/$mask"
+                       [ -n "$gw" -a -z "$xgw" -a "$addr/$mask" = "$xprefix" ] && duplicate=1
+               done
+
+               if [ -z "$gw" -o "$duplicate" = 1 ]; then
+                       proto_add_ipv6_route "$addr" "$mask" "$gw" "$metric" "$valid"
                else
                        for prefix in $PREFIXES $ADDRESSES; do
                                local paddr="${prefix%%,*}"