ab0e4d
From 8658cfd92b50197dd4f4d3b6d136950fe007ffc0 Mon Sep 17 00:00:00 2001
ab0e4d
From: Frank Deng <frank.deng@oracle.com>
ab0e4d
Date: Sat, 15 Jun 2019 13:35:42 -0700
ab0e4d
Subject: [PATCH] 35network-legacy: fix classless static route parsing
ab0e4d
ab0e4d
(cherry picked from commit 11e1f680656177cfbba4e06f08b6707f4a812bc0)
ab0e4d
ab0e4d
Resolves: #1811042
ab0e4d
---
ab0e4d
 modules.d/35network-legacy/dhclient-script.sh | 6 ++++--
ab0e4d
 1 file changed, 4 insertions(+), 2 deletions(-)
ab0e4d
ab0e4d
diff --git a/modules.d/35network-legacy/dhclient-script.sh b/modules.d/35network-legacy/dhclient-script.sh
ab0e4d
index f1a60005..44633b30 100755
ab0e4d
--- a/modules.d/35network-legacy/dhclient-script.sh
ab0e4d
+++ b/modules.d/35network-legacy/dhclient-script.sh
ab0e4d
@@ -126,9 +126,11 @@ parse_option_121() {
ab0e4d
         elif [ $mask -gt 8 ]; then
ab0e4d
             destination="$1.$2.0.0/$mask"
ab0e4d
             shift; shift
ab0e4d
-        else
ab0e4d
+        elif [ $mask -gt 0 ]; then
ab0e4d
             destination="$1.0.0.0/$mask"
ab0e4d
             shift
ab0e4d
+        else
ab0e4d
+            destination="0.0.0.0/$mask"
ab0e4d
         fi
ab0e4d
 
ab0e4d
         # Read the gateway
ab0e4d
@@ -138,7 +140,7 @@ parse_option_121() {
ab0e4d
         # Multicast routing on Linux
ab0e4d
         #  - If you set a next-hop address for a multicast group, this breaks with Cisco switches
ab0e4d
         #  - If you simply leave it link-local and attach it to an interface, it works fine.
ab0e4d
-        if [ $multicast -eq 1 ]; then
ab0e4d
+        if [ $multicast -eq 1 -o "$gateway" = "0.0.0.0" ]; then
ab0e4d
             temp_result="$destination dev $interface"
ab0e4d
         else
ab0e4d
             temp_result="$destination via $gateway dev $interface"
ab0e4d