]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
35network-legacy: fix classless static route parsing
authorFrank Deng <frank.deng@oracle.com>
Sat, 15 Jun 2019 20:35:42 +0000 (13:35 -0700)
committerHarald Hoyer <harald@hoyer.xyz>
Fri, 19 Jul 2019 14:16:26 +0000 (16:16 +0200)
modules.d/35network-legacy/dhclient-script.sh

index fc6ed0a36110bb69ef9e5beb9d4b5ff31a209fa8..66cfe34bffdde2ef41e93c90572b6825931482a0 100755 (executable)
@@ -126,9 +126,11 @@ parse_option_121() {
         elif [ $mask -gt 8 ]; then
             destination="$1.$2.0.0/$mask"
             shift; shift
-        else
+        elif [ $mask -gt 0 ]; then
             destination="$1.0.0.0/$mask"
             shift
+        else
+            destination="0.0.0.0/$mask"
         fi
 
         # Read the gateway
@@ -138,7 +140,7 @@ parse_option_121() {
         # Multicast routing on Linux
         #  - If you set a next-hop address for a multicast group, this breaks with Cisco switches
         #  - If you simply leave it link-local and attach it to an interface, it works fine.
-        if [ $multicast -eq 1 ]; then
+        if [ $multicast -eq 1 -o "$gateway" = "0.0.0.0" ]; then
             temp_result="$destination dev $interface"
         else
             temp_result="$destination via $gateway dev $interface"