When dumping to ssh via local ipv6 address, the ssh parameter
in kdump.conf is supposed to have the form like
ssh user@fe80::cc1:8bff:fe90:b95f%eth0
where "%eth0" is an existing network interface supporting ipv6.
However, there are 3 problems in enabling ipv6:
1) The get_remote_host function in kdump-lib.sh currently
doesn't remove the network interface in the ipv6 address,
causing the ip command in kdump_install_net function to fail,
leading to a "Bad kdump location" message.
2) The kdump_setup_ifname function in dracut-module-setup.sh
would add 'kdump-' prefix to network interfaces with name like
'eth*', causing ssh target specified in kdump.conf invalid
while dumping process.
3) ssh target with 'kdump-' prefixed interface name is not
in known_hosts while dumping, leading to ssh connection failure.
This patch series handles the problems above.
Ziyue Yang (3):
kdump-lib.sh: support link local ipv6 address with interface name
dracut-module-setup.sh: add 'kdump-' prefix in kdump.conf for link
local ipv6
dracut-kdump.sh: support 'kdump-' prefixed interfaces for link local
ipv6
dracut-kdump.sh | 10 +++++++++-
dracut-module-setup.sh | 15 +++++++++++++++
kdump-lib.sh | 11 +++++++++++
3 files changed, 35 insertions(+), 1 deletion(-)
--
2.9.3
Show replies by date
When dumping to ssh via local ipv6 address, the ssh parameter
in kdump.conf is supposed to have the form like
ssh user@fe80::cc1:8bff:fe90:b95f%eth0
where "%eth0" is an existing network interface supporting ipv6.
The get_remote_host function in kdump-lib.sh currently
doesn't remove the network interface in the link local ipv6
addresses, causing the ip command in kdump_install_net
function to fail, leading to a "Bad kdump location" message.
This commit
1) adds a helper function is_ipv6_link_local to find out
whether a host is a link local ipv6 address;
2) makes get_remote_host function remove network interface
in link local ipv6 addresses if there are any to support
host finding for link local ipv6 addresses.
Signed-off-by: Ziyue Yang <ziyang(a)redhat.com>
---
kdump-lib.sh | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 3f0af91..e67efda 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -312,6 +312,13 @@ is_ipv6_address()
echo $1 | grep -q ":"
}
+is_ipv6_link_local()
+{
+ is_ipv6_address $1 && {
+ echo $1 | grep -q "^fe80::"
+ }
+}
+
# get ip address or hostname from nfs/ssh config value
get_remote_host()
{
@@ -323,6 +330,10 @@ get_remote_host()
_config_val=${_config_val%:/*}
_config_val=${_config_val#[}
_config_val=${_config_val%]}
+ # factor out network inteface segment in link local ipv6 address
+ if is_ipv6_link_local $_config_val; then
+ _config_val=${_config_val%\%*}
+ fi
echo $_config_val
}
--
2.9.3
The kdump_setup_ifname function in dracut-module-setup.sh
would add 'kdump-' prefix to network interfaces with name
like 'eth*', causing ssh target specified in kdump.conf
invalid while dumping process if target is link local ipv6
address with interface name.
This commit makes kdump_setup_ifname update the ssh target
'kdump-' prefix for link local ipv6 address cases.
Signed-off-by: Ziyue Yang <ziyang(a)redhat.com>
---
dracut-module-setup.sh | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index ae13337..6200c29 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -167,6 +167,21 @@ kdump_setup_ifname() {
# 'kdump-' is already persistent, this should be fine.
if [[ $1 =~ eth* ]] && [[ ! $1 =~ ^kdump-* ]]; then
_ifname="kdump-$1"
+ # add 'kdump-' prefix 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 =~ eth* ]] &&
+ [[ ! $_host_postfix =~ ^kdump-* ]]; then
+ _new_ssh_target="$_host_prefix%kdump-$_host_postfix"
+ 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
ssh target with 'kdump-' prefixed interface name is not
in known_hosts while dumping, leading to failure in dump_ssh.
This commit makes dump_ssh cancel 'StrictHostKeyChecking'
for link local ipv6 address cases with 'eth*' like interface
names, for it's not possible to add 'kdump-' variants in hashed
known_hosts.
Signed-off-by: Ziyue Yang <ziyang(a)redhat.com>
---
dracut-kdump.sh | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index b75c2a5..bbb8a45 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -71,10 +71,18 @@ dump_raw()
dump_ssh()
{
- local _opt="-i $1 -o BatchMode=yes -o StrictHostKeyChecking=yes"
+ local _opt="-i $1 -o BatchMode=yes"
local _dir="$KDUMP_PATH/$HOST_IP-$DATEDIR"
local _host=$2
+ # cancel HostKeyChecking for link-local ipv6 address
+ # with "kdump-" prefixed interface name
+ if is_ipv6_link_local $(get_remote_host $_host); then
+ _opt+=" -o StrictHostKeyChecking=no"
+ else
+ _opt+=" -o StrictHostKeyChecking=yes"
+ fi
+
echo "kdump: saving to $_host:$_dir"
cat /var/lib/random-seed > /dev/urandom
--
2.9.3