|
|
a0a3b4 |
From 5bc318633fdf2c5bfea88bf2cf03e5aac2e78a1d Mon Sep 17 00:00:00 2001
|
|
|
a0a3b4 |
From: Harald Hoyer <harald@redhat.com>
|
|
|
a0a3b4 |
Date: Wed, 29 Jun 2016 17:26:17 +0200
|
|
|
a0a3b4 |
Subject: [PATCH] network: dhcp before parsing specified dns through cmdline
|
|
|
a0a3b4 |
|
|
|
a0a3b4 |
I met a problem when passing kdump dns to dracut via "nameserver=x.x.x.x",
|
|
|
a0a3b4 |
the dns I provided didn't appear in the "/etc/resolv.conf".
|
|
|
a0a3b4 |
|
|
|
a0a3b4 |
After some debugging, found that when setup dhcp DNS, in setup_interface()
|
|
|
a0a3b4 |
and setup_interface6(), it has:
|
|
|
a0a3b4 |
echo "search $search $domain" > /tmp/net.$netif.resolv.conf
|
|
|
a0a3b4 |
|
|
|
a0a3b4 |
So if "$search $domain" isn't NULL(this is ture in my kdump environment),
|
|
|
a0a3b4 |
the dns contents(that is, dns1, dns2, nameserver) in "ifup" before dhcp
|
|
|
a0a3b4 |
will be discarded.
|
|
|
a0a3b4 |
|
|
|
a0a3b4 |
This patch addresses it by handling dhcp first. In fact this is also the
|
|
|
a0a3b4 |
way the NetworkManager in 1st kernel works.
|
|
|
a0a3b4 |
|
|
|
a0a3b4 |
Signed-off-by: Xunlei Pang <xlpang@redhat.com>
|
|
|
a0a3b4 |
|
|
|
a0a3b4 |
cherry-pick of commit cf376023e6d0d4abd9816fa954bb917fc2557713
|
|
|
a0a3b4 |
---
|
|
|
a0a3b4 |
modules.d/40network/ifup.sh | 31 +++++++++++++++----------------
|
|
|
a0a3b4 |
1 file changed, 15 insertions(+), 16 deletions(-)
|
|
|
a0a3b4 |
|
|
|
a0a3b4 |
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
|
|
|
a0a3b4 |
index 37f51b9..19b7bbd 100755
|
|
|
a0a3b4 |
--- a/modules.d/40network/ifup.sh
|
|
|
a0a3b4 |
+++ b/modules.d/40network/ifup.sh
|
|
|
a0a3b4 |
@@ -350,16 +350,15 @@ fi
|
|
|
a0a3b4 |
ip=$(getarg ip)
|
|
|
a0a3b4 |
|
|
|
a0a3b4 |
if [ -z "$ip" ]; then
|
|
|
a0a3b4 |
- for s in $(getargs nameserver); do
|
|
|
a0a3b4 |
- [ -n "$s" ] || continue
|
|
|
a0a3b4 |
- echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
|
|
a0a3b4 |
- done
|
|
|
a0a3b4 |
-
|
|
|
a0a3b4 |
if [ "$netroot" = "dhcp6" ]; then
|
|
|
a0a3b4 |
do_dhcp -6
|
|
|
a0a3b4 |
else
|
|
|
a0a3b4 |
do_dhcp -4
|
|
|
a0a3b4 |
fi
|
|
|
a0a3b4 |
+ for s in $(getargs nameserver); do
|
|
|
a0a3b4 |
+ [ -n "$s" ] || continue
|
|
|
a0a3b4 |
+ echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
|
|
a0a3b4 |
+ done
|
|
|
a0a3b4 |
fi
|
|
|
a0a3b4 |
|
|
|
a0a3b4 |
|
|
|
a0a3b4 |
@@ -386,17 +385,6 @@ for p in $(getargs ip=); do
|
|
|
a0a3b4 |
[ "$use_bridge" != 'true' ] && \
|
|
|
a0a3b4 |
[ "$use_vlan" != 'true' ] && continue
|
|
|
a0a3b4 |
|
|
|
a0a3b4 |
- # setup nameserver
|
|
|
a0a3b4 |
- for s in "$dns1" "$dns2" $(getargs nameserver); do
|
|
|
a0a3b4 |
- [ -n "$s" ] || continue
|
|
|
a0a3b4 |
- echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
|
|
a0a3b4 |
- done
|
|
|
a0a3b4 |
-
|
|
|
a0a3b4 |
- # Store config for later use
|
|
|
a0a3b4 |
- for i in ip srv gw mask hostname macaddr dns1 dns2 mtu; do
|
|
|
a0a3b4 |
- eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
|
|
|
a0a3b4 |
- done > /tmp/net.$netif.override
|
|
|
a0a3b4 |
-
|
|
|
a0a3b4 |
for autoopt in $(str_replace "$autoconf" "," " "); do
|
|
|
a0a3b4 |
case $autoopt in
|
|
|
a0a3b4 |
dhcp|on|any)
|
|
|
a0a3b4 |
@@ -412,6 +400,17 @@ for p in $(getargs ip=); do
|
|
|
a0a3b4 |
done
|
|
|
a0a3b4 |
ret=$?
|
|
|
a0a3b4 |
|
|
|
a0a3b4 |
+ # setup nameserver
|
|
|
a0a3b4 |
+ for s in "$dns1" "$dns2" $(getargs nameserver); do
|
|
|
a0a3b4 |
+ [ -n "$s" ] || continue
|
|
|
a0a3b4 |
+ echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
|
|
a0a3b4 |
+ done
|
|
|
a0a3b4 |
+
|
|
|
a0a3b4 |
+ # Store config for later use
|
|
|
a0a3b4 |
+ for i in ip srv gw mask hostname macaddr dns1 dns2 mtu; do
|
|
|
a0a3b4 |
+ eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
|
|
|
a0a3b4 |
+ done > /tmp/net.$netif.override
|
|
|
a0a3b4 |
+
|
|
|
a0a3b4 |
if [ $ret -eq 0 ]; then
|
|
|
a0a3b4 |
> /tmp/net.${netif}.up
|
|
|
a0a3b4 |
|