On 01/05/15 at 10:23am, Dave Young wrote:
On 01/04/15 at 06:27pm, Minfei Huang wrote:
> On 01/04/15 at 01:26pm, Dave Young wrote:
> > On 12/31/14 at 11:02am, Minfei Huang wrote:
> > > On 12/29/14 at 03:35pm, Dave Young wrote:
> > > > On 12/15/14 at 11:20am, Minfei Huang wrote:
> > > > > Add the new lib which checks the ip/domain which you give.
Return true,
> > > > > if the parameter is ipv6, otherwise return false.
> > > > >
> > > > > Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
> > > > > ---
> > > > > kdump-lib.sh | 24 +++++++++++++++++++-----
> > > > > 1 file changed, 19 insertions(+), 5 deletions(-)
> > > > >
> > > > > diff --git a/kdump-lib.sh b/kdump-lib.sh
> > > > > index b886c5d..acb085e 100755
> > > > > --- a/kdump-lib.sh
> > > > > +++ b/kdump-lib.sh
> > > > > @@ -170,10 +170,26 @@ get_remote_host()
> > > > > echo $_config_val
> > > > > }
> > > > >
> > > > > +get_ip_address()
> > > > > +{
> > > > > + local _server=$1 _server_tmp
> > > > > +
> > > > > + _server_tmp=$_server
> > > >
> > > > It is not necessary to assign initial value to _server, directly use
$1 is ok.
> > > > seems $_server_tmp is also redundant
> > >
> > > The original value of parameter may be used if the parameter is ip
> > > address. So the _server_tmp stores the original value.
> >
> > $1 will be ok for that purpose..
> >
> > >
> > > >
> > > > > + _server=`getent ahosts $_server | head -n 1 | cut -d'
' -f1`
> > > > > + _server=${_server:-$_server_tmp}
> > > >
> > > > Could you tell what's the purpose of above line?
> > >
> > > We will get nothing by executing "getent" if the parameter is
ip
> > > address. We use the obove line to promise the _server value is correct.
> > > If the parameter is ip address, give the original value to the _server.
> >
> > Ok, thanks for explanation.
> >
> > >
> > > >
> > > > > + echo $_server
> > > > > +}
> > > > > +
> > > > > +is_ipv6_address()
> > > > > +{
> > > > > + local _server=$(get_ip_address $1)
> > > >
> > > > If the function name is is_ipv6_addresses, it assume the input $1 is
an address,
> > > > so the caller should pass an ip address?
> > >
> > > The function can handle the domain/ip as the parameter, not only the ip
> > > address. And what the function is_ipv6_address meaning is the final ip is
> > > v6, or not. Maybe we will parse the parameter(like domain) to get the
> > > real ip.
> >
> > If the kdump.conf config value is hostname, we do not care if it is ipv6 or
ipv4,
> > right? I remember it will naturally works without this patchset.
>
> We would use the result which gets by executing command
> "getent ahosts $_server | head -n 1 | cut -d' ' -f1" as the ip
address,
> if the kdump.conf config value is domain/hostname.
>
> We would get the ip address by executing command "getent host $_server"
> previously. So it does not work if returns the ipv6 address.
What do you mean for "it does not work", sorry I still do not understand your
point.
We can not make sure that ip address which returns by executing
command "getent host $_server" is ipv4 address. For below instance, it
would return the ipv6 address, if we get the ip address of domain
"google.com". Thus, the kdump does not work well.
>
> Here is the case:
> mhuang $ getent hosts
baidu.com
> 220.181.57.217
baidu.com
> 123.125.114.144
baidu.com
> 220.181.57.216
baidu.com
Here is the instance:
> mhuang $ getent hosts
google.com
> 2404:6800:4005:801::1002
google.com
>
> >
> > >
> > > >
> > > > > + echo $_server | grep -q ":"
> > > > > +}
> > > > > +
> > > > > # check the remote server ip address tpye
> > > > > is_ipv6_target()
> > > > > {
> > > > > - local _server _server_tmp
> > > > > + local _server
> > > > >
> > > > > if is_ssh_dump_target; then
> > > > > _server=`get_option_value ssh`
> > > > > @@ -183,8 +199,6 @@ is_ipv6_target()
> > > > >
> > > > > [ -z "$_server" ] && return 1
> > > > > _server=`get_remote_host $_server`
> > > > > - _server_tmp=$_server
> > > > > - _server=`getent ahosts $_server | head -n 1 | cut -d'
' -f1`
> > > > > - _server=${_server:-$_server_tmp}
> > > > > - echo $_server | grep -q ":"
> > > > > +
> > > > > + echo $(get_ip_address $_server) | grep -q ":"
> > > > > }
> > > > > --
> > > > > 1.8.3.1
> > > > >
> > > > > _______________________________________________
> > > > > kexec mailing list
> > > > > kexec(a)lists.fedoraproject.org
> > > > >
https://lists.fedoraproject.org/mailman/listinfo/kexec
> > > _______________________________________________
> > > kexec mailing list
> > > kexec(a)lists.fedoraproject.org
> > >
https://lists.fedoraproject.org/mailman/listinfo/kexec
> > >
> > >
> _______________________________________________
> kexec mailing list
> kexec(a)lists.fedoraproject.org
>
https://lists.fedoraproject.org/mailman/listinfo/kexec
>
>