On 08/23/2017 at 01:50 PM, Ziyue Yang wrote:
On Tue, Aug 22, 2017 at 4:29 PM, Xunlei Pang <xpang(a)redhat.com
<mailto:xpang@redhat.com>> wrote:
On 08/22/2017 at 11:34 AM, Ziyue Yang wrote:
> Hi,
>
> On Tue, Aug 22, 2017 at 9:30 AM, Xunlei Pang <xpang(a)redhat.com
<mailto:xpang@redhat.com> <mailto:xpang@redhat.com
<mailto:xpang@redhat.com>>> wrote:
>
> On 08/22/2017 at 09:10 AM, Baoquan He wrote:
> > On 08/22/17 at 08:59am, Xunlei Pang wrote:
> >> On 08/21/2017 at 10:07 AM, Ziyue Yang wrote:
> >>>
> >>> On Fri, Aug 18, 2017 at 11:33 AM, Xunlei Pang
<xpang(a)redhat.com <mailto:xpang@redhat.com> <mailto:xpang@redhat.com
<mailto:xpang@redhat.com>> <mailto:xpang@redhat.com
<mailto:xpang@redhat.com> <mailto:xpang@redhat.com
<mailto:xpang@redhat.com>>>> wrote:
> >>>
> >>> On 08/13/2017 at 05:41 PM, 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.
> >>> >
> >>> > This commit
> >>> > 1) makes get_remote_host function remove network
interface
> >>> > in ipv6 addresses if there are any to support host
finding;
> >>> > 2) adds is_prefixed_ipv6_link_local function to detect
link local
> >>> > ipv6 address with 'kdump-' prefixed interface
name.
> >>> >
> >>> > Signed-off-by: Ziyue Yang <ziyang(a)redhat.com
<mailto:ziyang@redhat.com> <mailto:ziyang@redhat.com
<mailto:ziyang@redhat.com>> <mailto:ziyang@redhat.com
<mailto:ziyang@redhat.com> <mailto:ziyang@redhat.com
<mailto:ziyang@redhat.com>>>>
> >>> > ---
> >>> > kdump-lib.sh | 12 ++++++++++++
> >>> > 1 file changed, 12 insertions(+)
> >>> >
> >>> > diff --git a/kdump-lib.sh b/kdump-lib.sh
> >>> > index 3f0af91..e67b28f 100755
> >>> > --- a/kdump-lib.sh
> >>> > +++ b/kdump-lib.sh
> >>> > @@ -312,6 +312,14 @@ is_ipv6_address()
> >>> > echo $1 | grep -q ":"
> >>> > }
> >>> >
> >>> > +is_prefixed_ipv6_link_local()
> >>> > +{
> >>> > + is_ipv6_address $1 && {
> >>> > + local _host_postfix=${1##*\%}
> >>> > + echo $_host_postfix | grep -q
"^kdump-eth"
> >>> > + }
> >>> > +}
> >>> > +
> >>> > # get ip address or hostname from nfs/ssh config
value
> >>> > get_remote_host()
> >>> > {
> >>> > @@ -323,6 +331,10 @@ get_remote_host()
> >>> > _config_val=${_config_val%:/*}
> >>> > _config_val=${_config_val#[}
> >>> > _config_val=${_config_val%]}
> >>> > + # factor out network inteface segment in local
ipv6 address
> >>> > + if is_ipv6_address $_config_val; then
> >>> > + _config_val=${_config_val%\%*}
> >>> > + fi
> >>>
> >>> There is something unclear to me, why does ipv6 address
need an interface name followed?
> >>> We can see in kdump_install_net(), it uses "ip -o
route get to $_server" to acquire the
> >>> interface name, is there any chance that the name got is
different from that in "ssh"?
> >>>
> >>>
> >>> ssh related commands needs the interface name for routing,
since for link local ipv6 addresses there might be multiple interfaces that could be used
for routing.
> >> That's what I concerned about, e.g. there are multiple
available routing, via eth0 or eth1.
> >> You specified eth1 for "ssh" in /etc/kdump.conf,
unfortunately kdump_install_net() gets
> >> eth0 as kdump's netdev from $(get_ip_route_field
"$_route" "dev"). Is this possible?
> > An available route entry must include destination ip and next hop
> > information, either next hop ip address, or interface to next hop.
> > Only a destination is not a complete route.
>
> I just simplified.
>
> To be specific, my question is that whether the netdev got from the route
entry can be ensured
> to be the same as the one we specified in "ssh" directive, because
from the code we clearly see
> there are two different sources.
>
> Yes I agree.
> Since $1 in kdump_setup_ifname is promised to be an interface with valid route,
maybe we can use the $1 in kdump_setup_ifname directly as the interface in the ssh_target
related code?
I think we should use the one in "ssh". Please see another reply of me.
Seems we have to modify the logic in kdump_install_net and kdump_setup_netdev if we want
to use the interface specified in kdump.conf, since the interface was automatically chose
by ip command.
This should be easily done by adding a special case in kdump_install_net() to fetch
$_route and $_srcaddr in a different way, how about pseudo-code below:
# Currently this is for sshing to the link local ipv6 target
if "$_server is ipv6 link local with zone index"; then
_netdev="get zone index from $config_val"
# Here we should do some investigation about how ipv6
# link local addr is configured, and verify if it works.
_srcaddr="get link local ipv6 addr of $_netdev"
if "$_netdev is eth* pattern"; then
Prefix "kdump-" to the zone index of "ssh" in
${initdir}/tmp/$$-kdump.conf
fi
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")
fi
kdump_setup_netdev "${_netdev}" "${_srcaddr}"
<snip>
We don't need to touch kdump_setup_netdev().
Like what Xunlei mentioned, either interface is valid once it has ipv6 route for the ssh
target. Maybe we can replace user's choice in this case? Or we may have to consider
network quality difference between the interfaces, which is not supported by kdump yet...
You may get a wrong local link(i.e. ssh target), we can't change the user's
intention.
>
>
>
> >>>
> >>>
> >>>
> >>> Regards,
> >>> Xunlei
> >>>
> >>> > echo $_config_val
> >>> > }
> >>> >
> >>>
> >>>
> >> _______________________________________________
> >> kexec mailing list -- kexec(a)lists.fedoraproject.org
<mailto:kexec@lists.fedoraproject.org> <mailto:kexec@lists.fedoraproject.org
<mailto:kexec@lists.fedoraproject.org>>
> >> To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
<mailto:kexec-leave@lists.fedoraproject.org>
<mailto:kexec-leave@lists.fedoraproject.org
<mailto:kexec-leave@lists.fedoraproject.org>>
>
>