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.
>
> > + 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