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

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