|
Harald Hoyer |
414eba |
From cf376023e6d0d4abd9816fa954bb917fc2557713 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
414eba |
From: Xunlei Pang <xlpang@redhat.com>
|
|
Harald Hoyer |
414eba |
Date: Tue, 26 Apr 2016 18:05:10 +0800
|
|
Harald Hoyer |
414eba |
Subject: [PATCH] network: dhcp before parsing specified dns through cmdline
|
|
Harald Hoyer |
414eba |
|
|
Harald Hoyer |
414eba |
I met a problem when passing kdump dns to dracut via "nameserver=x.x.x.x",
|
|
Harald Hoyer |
414eba |
the dns I provided didn't appear in the "/etc/resolv.conf".
|
|
Harald Hoyer |
414eba |
|
|
Harald Hoyer |
414eba |
After some debugging, found that when setup dhcp DNS, in setup_interface()
|
|
Harald Hoyer |
414eba |
and setup_interface6(), it has:
|
|
Harald Hoyer |
414eba |
echo "search $search $domain" > /tmp/net.$netif.resolv.conf
|
|
Harald Hoyer |
414eba |
|
|
Harald Hoyer |
414eba |
So if "$search $domain" isn't NULL(this is ture in my kdump environment),
|
|
Harald Hoyer |
414eba |
the dns contents(that is, dns1, dns2, nameserver) in "ifup" before dhcp
|
|
Harald Hoyer |
414eba |
will be discarded.
|
|
Harald Hoyer |
414eba |
|
|
Harald Hoyer |
414eba |
This patch addresses it by handling dhcp first. In fact this is also the
|
|
Harald Hoyer |
414eba |
way the NetworkManager in 1st kernel works.
|
|
Harald Hoyer |
414eba |
|
|
Harald Hoyer |
414eba |
Signed-off-by: Xunlei Pang <xlpang@redhat.com>
|
|
Harald Hoyer |
414eba |
---
|
|
Harald Hoyer |
414eba |
modules.d/40network/ifup.sh | 32 ++++++++++++++++----------------
|
|
Harald Hoyer |
414eba |
1 file changed, 16 insertions(+), 16 deletions(-)
|
|
Harald Hoyer |
414eba |
|
|
Harald Hoyer |
414eba |
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
|
|
Harald Hoyer |
414eba |
index 1185523..41282e7 100755
|
|
Harald Hoyer |
414eba |
--- a/modules.d/40network/ifup.sh
|
|
Harald Hoyer |
414eba |
+++ b/modules.d/40network/ifup.sh
|
|
Harald Hoyer |
414eba |
@@ -321,16 +321,16 @@ fi
|
|
Harald Hoyer |
414eba |
ip=$(getarg ip)
|
|
Harald Hoyer |
414eba |
|
|
Harald Hoyer |
414eba |
if [ -z "$NO_AUTO_DHCP" ] && [ -z "$ip" ]; then
|
|
Harald Hoyer |
414eba |
- for s in $(getargs nameserver); do
|
|
Harald Hoyer |
414eba |
- [ -n "$s" ] || continue
|
|
Harald Hoyer |
414eba |
- echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
|
Harald Hoyer |
414eba |
- done
|
|
Harald Hoyer |
414eba |
-
|
|
Harald Hoyer |
414eba |
if [ "$netroot" = "dhcp6" ]; then
|
|
Harald Hoyer |
414eba |
do_dhcp -6
|
|
Harald Hoyer |
414eba |
else
|
|
Harald Hoyer |
414eba |
do_dhcp -4
|
|
Harald Hoyer |
414eba |
fi
|
|
Harald Hoyer |
414eba |
+
|
|
Harald Hoyer |
414eba |
+ for s in $(getargs nameserver); do
|
|
Harald Hoyer |
414eba |
+ [ -n "$s" ] || continue
|
|
Harald Hoyer |
414eba |
+ echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
|
Harald Hoyer |
414eba |
+ done
|
|
Harald Hoyer |
414eba |
fi
|
|
Harald Hoyer |
414eba |
|
|
Harald Hoyer |
414eba |
|
|
Harald Hoyer |
414eba |
@@ -355,17 +355,6 @@ for p in $(getargs ip=); do
|
|
Harald Hoyer |
414eba |
# If this option isn't directed at our interface, skip it
|
|
Harald Hoyer |
414eba |
[ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
|
|
Harald Hoyer |
414eba |
|
|
Harald Hoyer |
414eba |
- # setup nameserver
|
|
Harald Hoyer |
414eba |
- for s in "$dns1" "$dns2" $(getargs nameserver); do
|
|
Harald Hoyer |
414eba |
- [ -n "$s" ] || continue
|
|
Harald Hoyer |
414eba |
- echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
|
Harald Hoyer |
414eba |
- done
|
|
Harald Hoyer |
414eba |
-
|
|
Harald Hoyer |
414eba |
- # Store config for later use
|
|
Harald Hoyer |
414eba |
- for i in ip srv gw mask hostname macaddr mtu dns1 dns2; do
|
|
Harald Hoyer |
414eba |
- eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
|
|
Harald Hoyer |
414eba |
- done > /tmp/net.$netif.override
|
|
Harald Hoyer |
414eba |
-
|
|
Harald Hoyer |
414eba |
for autoopt in $(str_replace "$autoconf" "," " "); do
|
|
Harald Hoyer |
414eba |
case $autoopt in
|
|
Harald Hoyer |
414eba |
dhcp|on|any)
|
|
Harald Hoyer |
414eba |
@@ -381,6 +370,17 @@ for p in $(getargs ip=); do
|
|
Harald Hoyer |
414eba |
done
|
|
Harald Hoyer |
414eba |
ret=$?
|
|
Harald Hoyer |
414eba |
|
|
Harald Hoyer |
414eba |
+ # setup nameserver
|
|
Harald Hoyer |
414eba |
+ for s in "$dns1" "$dns2" $(getargs nameserver); do
|
|
Harald Hoyer |
414eba |
+ [ -n "$s" ] || continue
|
|
Harald Hoyer |
414eba |
+ echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
|
Harald Hoyer |
414eba |
+ done
|
|
Harald Hoyer |
414eba |
+
|
|
Harald Hoyer |
414eba |
+ # Store config for later use
|
|
Harald Hoyer |
414eba |
+ for i in ip srv gw mask hostname macaddr mtu dns1 dns2; do
|
|
Harald Hoyer |
414eba |
+ eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
|
|
Harald Hoyer |
414eba |
+ done > /tmp/net.$netif.override
|
|
Harald Hoyer |
414eba |
+
|
|
Harald Hoyer |
414eba |
if [ $ret -eq 0 ]; then
|
|
Harald Hoyer |
414eba |
> /tmp/net.${netif}.up
|
|
Harald Hoyer |
414eba |
|