Kdump will parse the hostname to get the ip address, if hostname is
specfied in /etc/kdump.conf. We will get the ip address(ipv4 or ipv6,
according to the DNS server) by using "getent hosts".
For now, it is more reasonable that we shall get all of the ip
address(including ipv4 and ipv6 address) which point to the hostname by
using "getent ahosts". And we will prefer to use the ipv4 address, if
both ipv4 and ipv6 address work.
The reason why we choose the ipv4 as preferred address is to solve the
issue kdump will fail to connect the hostname machine(parsed as ipv6
address), due to the DNS server is ipv4 address in 2nd kernel.
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
dracut-module-setup.sh | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 3d2636e..04a2e15 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -306,12 +306,18 @@ get_ip_route_field()
#$1: config values of net line in kdump.conf
#$2: srcaddr of network device
kdump_install_net() {
- local _server _netdev _srcaddr _route
+ local _server _netdev _srcaddr _route _serv_tmp
local config_val="$1"
_server=$(get_remote_host $config_val)
- is_hostname $_server && _server=`getent hosts $_server | head -n 1 | cut
-d' ' -f1`
+ if is_hostname $_server; then
+ _serv_tmp=`getent ahosts $_server | grep -v : | head -n 1`
+ if [ -z "$_serv_tmp" ]; then
+ _serv_tmp=`getent ahosts $_server | head -n 1`
+ fi
+ _server=`echo $_serv_tmp | cut -d' ' -f1`
+ fi
_route=`/sbin/ip -o route get to $_server 2>&1`
[ $? != 0 ] && echo "Bad kdump location: $config_val" &&
exit 1
--
2.1.0
_______________________________________________
kexec mailing list
kexec(a)lists.fedoraproject.org
https://lists.fedoraproject.org/mailman/listinfo/kexec