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 | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 97155b6..597d4a4 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -167,6 +167,7 @@ kdump_setup_ifname() {
# 'kdump-' is already persistent, this should be fine.
if [[ $1 =~ eth* ]] && [[ ! $1 =~ ^kdump-* ]]; then
_ifname="kdump-$1"
+ kdump_setup_ipv6_link_local_ifname "ssh" $1 $_ifname
else
_ifname="$1"
fi
@@ -174,6 +175,32 @@ kdump_setup_ifname() {
echo "$_ifname"
}
+# Set ifname in network dumping targets to a specified one
+# in link local ipv6 cases
+# $1: kdump.conf's config item name
+# $2: interface name to change
+# $3: interface name to assign
+kdump_setup_ipv6_link_local_ifname()
+{
+ local _config_item=$1
+ local _ifname=$2
+ local _new_ifname=$3
+
+ local _target=$(get_option_value $_config_item)
+ [[ -n $_target ]] && {
+ local _host=$(get_remote_host $_target)
+ if is_ipv6_link_local "$_host"; then
+ local _target_prefix=${_target%\%*}
+ local _target_postfix=${_target##*\%}
+ if [[ $_target_postfix == $_ifname ]]; then
+ _new_target="$_target_prefix%$_new_ifname"
+ sed -i "/^$_config_item\ /d" ${initdir}/tmp/$$-kdump.conf
+ echo "$_config_item $_new_target" >>
${initdir}/tmp/$$-kdump.conf
+ fi
+ fi
+ }
+}
+
kdump_setup_bridge() {
local _netdev=$1
local _brif _dev _mac _kdumpdev
--
2.9.3