]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Support multiple default gateways from DHCP server (rhbz#1408249)
authorDenis Silakov <dsilakov@virtuozzo.com>
Mon, 9 Jan 2017 09:55:10 +0000 (12:55 +0300)
committerDenis Silakov <dsilakov@virtuozzo.com>
Mon, 9 Jan 2017 09:55:10 +0000 (12:55 +0300)
modules.d/40network/dhclient-script.sh

index f49cdb88bb8faf0aa905dc9a04c8366a1f381089..2ad04f6be2499719205d0a83fec809b416f120ec 100755 (executable)
@@ -48,7 +48,13 @@ setup_interface() {
             # point-to-point connection => set explicit route to gateway
             echo ip route add $gw dev $netif > /tmp/net.$netif.gw
         fi
-        echo ip route replace default via $gw dev $netif >> /tmp/net.$netif.gw
+        IFS=' ' read -r main_gw other_gw <<< "$gw"
+        echo ip route replace default via $main_gw dev $netif >> /tmp/net.$netif.gw
+        if [ -n "$other_gw" ] ; then
+            for g in $other_gw; do
+                echo ip route add default via $g dev $netif >> /tmp/net.$netif.gw
+            done
+        fi
     fi
 
     if getargbool 1 rd.peerdns; then