Hi,
> ______________________________On 08/25/17 at 03:34pm, Ziyue Yang wrote:
> 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.
>
> Meanwhile, current logic in kdump_install_net will find the
> network interface to use by "ip route" command, which might be
> different from what user specified in kdump.conf in link
> local ipv6 cases.
>
> This commit
> 1) adds a helper function is_ipv6_link_local to find out
> whether a host is a link local ipv6 address.
> 2) changes logic in kdump_install_net to get rid of ifname
> for link local ipv6 before ip command, and use network
> interface specified in link local ipv6 cases.
>
> Signed-off-by: Ziyue Yang <ziyang@redhat.com>
> ---
> dracut-module-setup.sh | 19 ++++++++++++++-----
> kdump-lib.sh | 5 +++++
> 2 files changed, 19 insertions(+), 5 deletions(-)
>
> diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
> index ae13337..97155b6 100755
> --- a/dracut-module-setup.sh
> +++ b/dracut-module-setup.sh
> @@ -341,12 +341,21 @@ kdump_install_net() {
> _server=`echo $_serv_tmp | cut -d' ' -f1`
> fi
>
> - _route=`/sbin/ip -o route get to $_server 2>&1`
> - [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
> + if is_ipv6_link_local $_server; then
> + # use network interface specified by link local address
> + _netdev=${_server##*\%}
> + _server=${_server%\%*}
> + _route=$(/sbin/ip -o route get to $_server dev $_netdev 2>&1)
> + [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
> + _srcaddr=$(get_ip_route_field "$_route" "src")
> + else
> + _route=$(/sbin/ip -o 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
> - _srcaddr=$(get_ip_route_field "$_route" "src")
> - _netdev=$(get_ip_route_field "$_route" "dev")
> + #the field in the ip output changes if we go to another subnet
> + _srcaddr=$(get_ip_route_field "$_route" "src")
> + _netdev=$(get_ip_route_field "$_route" "dev")
> + fi
>
> kdump_setup_netdev "${_netdev}" "${_srcaddr}"
>
> diff --git a/kdump-lib.sh b/kdump-lib.sh
> index 3f0af91..fb3e354 100755
> --- a/kdump-lib.sh
> +++ b/kdump-lib.sh
> @@ -312,6 +312,11 @@ is_ipv6_address()
> echo $1 | grep -q ":"
> }
>
> +is_ipv6_link_local()
> +{
> + echo $1 | grep -q "^fe80::"
> +}
> +
> # get ip address or hostname from nfs/ssh config value
> get_remote_host()
> {
> --
> 2.9.3
_________________
> kexec mailing list -- kexec@lists.fedoraproject.org
> To unsubscribe send an email to kexec-leave@lists.fedoraproject.org
There's other ip route code path, please update them as well.
like:
kdump_setup_iscsi_device()
kdump_static_ip maybe do not need update, I'm not sure, please carefully
check it as well.
Thanks
Dave