Currently the kdump_setup_ifname function would not add
'kdump-' prefix to ssh target specified in link local ipv6
cases, causing ssh dumping failed.
This commit makes kdump_setup_ifname add 'kdump-' prefix to
the ssh target specified in kdump.conf in link local ipv6
address cases.
Signed-off-by: Ziyue Yang <ziyang(a)redhat.com>
---
dracut-module-setup.sh | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 9e70d15..ecfdb50 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -167,6 +167,20 @@ kdump_setup_ifname() {
# 'kdump-' is already persistent, this should be fine.
if [[ $1 =~ eth* ]] && [[ ! $1 =~ ^kdump-* ]]; then
_ifname="kdump-$1"
+ # add 'kdump-' prefix to ssh target for link local ipv6 address
+ local _ssh_target=$(get_option_value "ssh")
+ [[ ! -z $_ssh_target ]] && {
+ local _ssh_host=$(get_remote_host $_ssh_target)
+ if is_ipv6_link_local "$_ssh_host"; then
+ local _host_prefix=${_ssh_target%\%*}
+ local _host_postfix=${_ssh_target##*\%}
+ if [[ $_host_postfix == $1 ]]; then
+ _new_ssh_target="$_host_prefix%$_ifname"
+ sed -i "/^ssh\ /d" ${initdir}/tmp/$$-kdump.conf
+ echo "ssh $_new_ssh_target" >>
${initdir}/tmp/$$-kdump.conf
+ fi
+ fi
+ }
else
_ifname="$1"
fi
--
2.9.3