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