On 07/09/15 at 01:36pm, Dave Young wrote:
On 07/09/15 at 01:35pm, Minfei Huang wrote:
> On 07/09/15 at 01:20pm, Dave Young wrote:
> > On 07/09/15 at 11:18am, Minfei Huang wrote:
> > > Both getent hosts and getent ahosts can potentially print both IPv4 and
> > > IPv6 addresses, but they decide which address(es) to print differently.
> > >
> > > hosts calls gethostbyname2 (the IPv6-supporting variant of
> > > gethostbyname). The behavior is hard-coded: look up an IPv6 address, and
> > > if none exists, look up an IPv4 address.
> > >
> > > ahosts calls getaddrinfo. This function enumerates all protocols for a
> > > given name, so it can return both IPv4 and IPv6 addresses in the same
> > > call. What it returns is determined by the settings in /etc/gai.conf.
> > > Because many applications are still struggling to cope with IPv6, most
> > > distributions prefer IPv4 by default and only use IPv6 by explicit
> > > request.
> >
> > So it is ok and better to use getent ahosts, but the patch is not mandatory for
> > ipv6 support.
> >
>
> No. The lib function is_hostname is the enhancement to support ipv6
> protocol. Without this patch, kdump may cant identify the ipv6 address.
So this is the problem, from patch description I can not get your above
infomation, right? I only see getent stuff so I think it is not mandatory.
Yes. I can add the commit log to explain what this patch does.
Hmm, if this is the case you should split it out from this patch.
getent is an improvement which is independent to this patch series.
Ok. I think I can drop this patch, since there is no bug to report to
use the command "getent hosts".
And this patch will be merged in next patch to setup the ipv6 network.
Thanks
Minfei
>
> > >
> > > Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
> > > ---
> > > dracut-module-setup.sh | 3 +--
> > > kdump-lib.sh | 13 +++++++++++++
> > > 2 files changed, 14 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
> > > index 898229e..ca871fd 100755
> > > --- a/dracut-module-setup.sh
> > > +++ b/dracut-module-setup.sh
> > > @@ -299,8 +299,7 @@ kdump_install_net() {
> > >
> > > _server=`echo $config_val | sed 's/.*@//' | cut -d':'
-f1`
> > >
> > > - _need_dns=`echo $_server|grep "[a-zA-Z]"`
> > > - [ -n "$_need_dns" ] && _server=`getent hosts
$_server|cut -d' ' -f1`
> > > + is_hostname $_server && _server=`getent ahosts $_server |
head -1 | cut -d' ' -f1`
> >
> > It is still doing two things, adding one more function is_hostname.
> >
> > This patch should only contains getent changes. I can accept this version,
> > but split again is better to me.
> >
>
> I do not like to split this patch as two. Maybe I can add the
> introducing about the is_hostname function. Thus it looks better.
>
> Thanks
> Minfei
>
> > >
> > > _netdev=`/sbin/ip route get to $_server 2>&1`
> > > [ $? != 0 ] && echo "Bad kdump location:
$config_val" && exit 1
> > > diff --git a/kdump-lib.sh b/kdump-lib.sh
> > > index 1b98a6f..d12b7c9 100755
> > > --- a/kdump-lib.sh
> > > +++ b/kdump-lib.sh
> > > @@ -206,3 +206,16 @@ is_ipv6_address()
> > > {
> > > echo $1 | grep -q ":"
> > > }
> > > +
> > > +# if the passed parameter is hostname/domain, it will be satisfied with
> > > +# condition which it is without colon ":", and contains the
[a-zA-Z]
> > > +# $1: hostname/ip address
> > > +is_hostname()
> > > +{
> > > + local _hostname=`echo $1 | grep ":"`
> > > +
> > > + if [ -n "$_hostname" ]; then
> > > + return 1
> > > + fi
> > > + echo $1 | grep -q "[a-zA-Z]"
> > > +}
> > > --
> > > 2.1.0
> > >