examples/udhcp/simple.script: fix IPv6 support when using udhcpc
authorStefan Agner <stefan.agner@toradex.com>
Tue, 16 Jun 2020 08:06:27 +0000 (10:06 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 21 Jun 2020 01:02:02 +0000 (03:02 +0200)
The udhcpc script calls ip addr flush .. which flushes addresses
of any address family, including IPv6. However, busybox udhcpc is
IPv4 only and should not influence IPv6 addressing. Hence use ip
addr flush with family constraint.

The script particularly broke IPv6 SLAAC: Typically when udhcpc
calls the script the kernel already assigned the IPv6 link-local
address. The flush removes the link-local IPv6 address again and
prohibits proper IPv6 operation such as SLAAC since neighbor
discovery protocol relies on IPv6 link-local addressing.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
[Taken from https://git.openembedded.org/openembedded-core/commit/meta/recipes-core/busybox/files/simple.script?id=b77541dbb2f442e51842f9d24c8745a6df2d1478]
Signed-off-by: Quentin Schulz <quentin.schulz@streamunlimited.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
examples/udhcp/simple.script

index 6658fbeefadf243de06df0321048983700682a18..f079ec8b849fed1414adc70f49f971ce897c15ff 100755 (executable)
@@ -18,7 +18,7 @@ case "$1" in
        deconfig)
                echo "Clearing IP addresses on $interface, upping it"
                if command -v ip >/dev/null; then
-                       ip addr flush dev $interface
+                       ip -4 addr flush dev $interface
                        ip link set dev $interface up
                else
                        ifconfig $interface 0.0.0.0