]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Make gateway processing POSIX-compliant 193/head
authorDenis Silakov <dsilakov@virtuozzo.com>
Fri, 13 Jan 2017 15:44:40 +0000 (18:44 +0300)
committerDenis Silakov <dsilakov@virtuozzo.com>
Fri, 13 Jan 2017 15:44:40 +0000 (18:44 +0300)
modules.d/40network/dhclient-script.sh

index 2ad04f6be2499719205d0a83fec809b416f120ec..3d9af99f24502e7194b8f257ee332a2794bcf5b6 100755 (executable)
@@ -48,13 +48,16 @@ setup_interface() {
             # point-to-point connection => set explicit route to gateway
             echo ip route add $gw dev $netif > /tmp/net.$netif.gw
         fi
-        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
+
+        echo "$gw" | {
+            IFS=' ' read -r main_gw other_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