Hi,

On Fri, Sep 1, 2017 at 1:30 PM, Dave Young <dyoung@redhat.com> wrote:
Hi Ziyue,
On 09/01/17 at 12:26pm, Ziyue Yang wrote:
> Hi,
>
> On Fri, Sep 1, 2017 at 11:06 AM, Dave Young <dyoung@redhat.com> wrote:
>
> > 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.
> >
> Updates of route paths in kdump_static_ip and kdump_setup_iscsi_device may
> not be tested well, for currently I'm working for the ssh case only..this
> might cause the patch too long as well. What about forming these updates in
> another patch series, once the is_ipv6_link_local function is acked and
> merged?

We'd better to solve all of these in one patch serie. For static ip it
might be not necessary according to discussion previously from Baoquan
and Pingfan, but I'm not sure. Even if we do not need change them I'm
not sure if we should skip the case somewhere or not..

Just confirmed that kdump_static_ip doesn't need any modification, as Baoquan and Pingfan said.
As for the iscsi function, I'll build a soft iscsi server to check it out later.
 
>
>
> >
> > Thanks
> > Dave
> >
> >
> Thanks

Thanks
Dave

Thanks