Blame 0006-network-ifup.sh-handle-dns1-and-dns2-from-ip-setting.patch

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