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

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