Currently kdump doesn't support ipv6 nfs/ssh dump. Due to the lastet
version of the Internet Protocal, it is a significant feature for kdump
to enhance to support ipv6.
Following is the special config for ipv6 protocal.
For ipv6 nfs dump:
Link scope, /etc/kdump.conf should be specified like
"nfs [fe80::5054:ff:fe48:ca80%eth0]:/mnt"
otherwise
"nfs [2001:db8:0:f101::2]:/mnt"
For ipv6 ssh dump:
Link scope, /etc/kdump.conf should be edited like
"ssh root at fe80::5054:ff:fe48:ca80%eth0"
otherwise
"ssh root at 2001:db8:0:f101::2"
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
dracut-module-setup.sh | 46 +++++++++++++++++++++++++++++-----------------
kdump-lib.sh | 15 +++++++++++++++
2 files changed, 44 insertions(+), 17 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index c6922c0..7b71f60 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -301,24 +301,36 @@ kdump_install_net() {
local _server _netdev _srcaddr
local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
-
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d'
' -f1`
-
- _netdev=`/sbin/ip route get to $_server 2>&1`
- [ $? != 0 ] && echo "Bad kdump location: $config_val" &&
exit 1
-
- #the field in the ip output changes if we go to another subnet
- if [ -n "`echo $_netdev | grep via`" ]
- then
- # we are going to a different subnet
- _srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1`
- _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
+ _server=`get_remote_host $config_val`
+
+ is_hostname $_server && _server=`getent ahosts $_server|cut -d' '
-f1`
+
+ if is_ipv6_host $_server; then
+ _netdev=`/sbin/ip -6 route get to $_server 2>&1`
+ [ $? != 0 ] && echo "Bad kdump location: $config_val"
&& exit 1
+ #the field in the ip output changes if we go to another subnet
+ if [ -n "`echo $_netdev | grep via`" ]; then
+ # we are going to a different subnet
+ _srcaddr=`echo $_netdev|awk '{print $9}'|head -n 1`
+ _netdev=`echo $_netdev|awk '{print $7;}'|head -n 1`
+ else
+ # we are on the same subnet
+ _srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1`
+ _netdev=`echo $_netdev|awk '{print $5}'|head -n 1`
+ fi
else
- # we are on the same subnet
- _srcaddr=`echo $_netdev|awk '{print $5}'|head -n 1`
- _netdev=`echo $_netdev|awk '{print $3}'|head -n 1`
+ _netdev=`/sbin/ip route get to $_server 2>&1`
+ [ $? != 0 ] && echo "Bad kdump location: $config_val"
&& exit 1
+ #the field in the ip output changes if we go to another subnet
+ if [ -n "`echo $_netdev | grep via`" ]; then
+ # we are going to a different subnet
+ _srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1`
+ _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
+ else
+ # we are on the same subnet
+ _srcaddr=`echo $_netdev|awk '{print $5}'|head -n 1`
+ _netdev=`echo $_netdev|awk '{print $3}'|head -n 1`
+ fi
fi
kdump_setup_netdev "${_netdev}" "${_srcaddr}"
"${_server}"
diff --git a/kdump-lib.sh b/kdump-lib.sh
index cc33e01..e643802 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -214,3 +214,18 @@ is_ipv6_target()
[ -z "$_target" ] && return 1
echo $(is_ipv6_host $_target)
}
+
+# if the passed parameter is hostname/domain, it will be satisfied with
+# condition which it is without colon ":", and contains the [a-zA-Z]
+# $1: hostname
+is_hostname()
+{
+ local _hostname=`echo $1 | grep ":"`
+
+ # ipv6 address
+ if [ -n "$_hostname" ]; then
+ return 1
+ else
+ echo $1 | grep -q "[a-zA-Z]"
+ fi
+}
--
1.9.3