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 | 39 +++++++++++++++++++++++++--------------
kdump-lib.sh | 13 +++++++++++++
2 files changed, 38 insertions(+), 14 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index d61cc44..615455e 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -301,24 +301,35 @@ kdump_install_net() {
local _server _netdev _srcaddr
local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
+ _server=`get_remote_host $config_val`
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d'
' -f1`
+ is_hostname $_server && _server=`getent ahosts $_server|cut -d' '
-f1`
- _netdev=`/sbin/ip route get to $_server 2>&1`
- [ $? != 0 ] && echo "Bad kdump location: $config_val" &&
exit 1
+ 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 $7}'|head -n 1`
- _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
+ if [ -n "`echo $_netdev | grep via`" ]; then
+ # 2001:151::112 via 2001:150::121 from :: dev eth1 src 2001:150::120 metric 0
+ _srcaddr=`echo $_netdev|awk '{print $9}'|head -n 1`
+ _netdev=`echo $_netdev|awk '{print $7;}'|head -n 1`
+ else
+ # 2001:150::11f from :: dev eth1 src 2001:150::120 metric 0
+ _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
+ if [ -n "`echo $_netdev | grep via`" ]; then
+ # 192.168.151.215 via 192.168.150.137 dev kdump-eth1 src 192.168.150.129
+ _srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1`
+ _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
+ else
+ # 192.168.150.137 dev eth1 src 192.168.150.129
+ _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 481876b..e6e1413 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -271,6 +271,19 @@ is_ipv6_target()
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/ip address
+is_hostname()
+{
+ local _hostname=`echo $1 | grep ":"`
+
+ if [ -n "$_hostname" ]; then
+ return 1
+ fi
+ echo $1 | grep -q "[a-zA-Z]"
+}
+
is_atomic()
{
grep -q "ostree" /proc/cmdline
--
2.1.0