Blame SOURCES/0107-network-ifup.sh-handle-dns1-and-dns2-from-ip-setting.patch

966cef
From b0b16988dd6378b51b6cbecbc70953d7f0a2a123 Mon Sep 17 00:00:00 2001
966cef
From: Harald Hoyer <harald@redhat.com>
966cef
Date: Thu, 30 Jan 2014 17:12:24 +0100
966cef
Subject: [PATCH] network/ifup.sh: handle $dns1 and $dns2 from "ip=" settings
966cef
966cef
---
966cef
 dracut.cmdline.7.asc        |  7 +++++++
966cef
 modules.d/40network/ifup.sh | 21 ++++++++++++---------
966cef
 2 files changed, 19 insertions(+), 9 deletions(-)
966cef
966cef
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
966cef
index 963ba07..985285b 100644
966cef
--- a/dracut.cmdline.7.asc
966cef
+++ b/dracut.cmdline.7.asc
966cef
@@ -472,6 +472,13 @@ cannot be used in conjunction with the **ifname** argument for the
966cef
 same <interface>.
966cef
 =====================
966cef
 
966cef
+**ip=**__<client-IP>__:[__<peer>__]:__<gateway-IP>__:__<netmask>__:__<client_hostname>__:__<interface>__:__{none|off|dhcp|on|any|dhcp6|auto6|ibft}__[:[__<dns1>__][:__<dns2>__]]::
966cef
+    explicit network configuration. If you want do define a IPv6 address, put it
966cef
+    in brackets (e.g. [2001:DB8::1]). This parameter can be specified multiple
966cef
+    times. __<peer>__ is optional and is the address of the remote endpoint
966cef
+    for pointopoint interfaces and it may be followed by a slash and a decimal
966cef
+    number, encoding the network prefix length.
966cef
+
966cef
 **ifname=**__<interface>__:__<MAC>__::
966cef
     Assign network device name <interface> (ie "bootnet") to the NIC with
966cef
     MAC <MAC>.
966cef
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
966cef
index 2edcfe6..b33981b 100755
966cef
--- a/modules.d/40network/ifup.sh
966cef
+++ b/modules.d/40network/ifup.sh
966cef
@@ -264,18 +264,15 @@ if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
966cef
     ip link set "$vlanname" up
966cef
 fi
966cef
 
966cef
-# setup nameserver
966cef
-namesrv=$(getargs nameserver)
966cef
-if  [ -n "$namesrv" ] ; then
966cef
-    for s in $namesrv; do
966cef
-        echo nameserver $s
966cef
-    done
966cef
-fi >> /tmp/net.$netif.resolv.conf
966cef
-
966cef
 # No ip lines default to dhcp
966cef
 ip=$(getarg ip)
966cef
 
966cef
 if [ -z "$ip" ]; then
966cef
+    namesrv=$(getargs nameserver)
966cef
+    for s in $namesrv; do
966cef
+        echo nameserver $s >> /tmp/net.$netif.resolv.conf
966cef
+    done
966cef
+
966cef
     if [ "$netroot" = "dhcp6" ]; then
966cef
         do_dhcp -6
966cef
     else
966cef
@@ -307,8 +304,14 @@ for p in $(getargs ip=); do
966cef
     [ "$use_bridge" != 'true' ] && \
966cef
     [ "$use_vlan" != 'true' ] && continue
966cef
 
966cef
+    # setup nameserver
966cef
+    namesrv="$dns1 $dns2 $(getargs nameserver)"
966cef
+    for s in $namesrv; do
966cef
+        echo nameserver $s >> /tmp/net.$netif.resolv.conf
966cef
+    done
966cef
+
966cef
     # Store config for later use
966cef
-    for i in ip srv gw mask hostname macaddr; do
966cef
+    for i in ip srv gw mask hostname macaddr dns1 dns2; do
966cef
         eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
966cef
     done > /tmp/net.$netif.override
966cef