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