All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipvsadm: Enable to work display host name of IPv6
@ 2015-01-09  8:41 Hibari Michiro
  2015-01-12 20:05 ` Julian Anastasov
  0 siblings, 1 reply; 3+ messages in thread
From: Hibari Michiro @ 2015-01-09  8:41 UTC (permalink / raw)
  To: lvs-devel; +Cc: hibari.michiro

So far ipvsadm can not display host name of IPv6.
This patch add process in the case of IPv6 for
addr_to_host function.

Signed-off-by: Michiro Hibari <hibari.michiro@lab.ntt.co.jp>
---
 ipvsadm.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/ipvsadm.c b/ipvsadm.c
index 72ddc8a..162d4a2 100644
--- a/ipvsadm.c
+++ b/ipvsadm.c
@@ -1770,8 +1770,14 @@ static char * addr_to_host(int af, const void *addr)
 {
 	struct hostent *host;
-	if ((host = gethostbyaddr((char *) addr,
-				  sizeof(struct in_addr), af)) != NULL)
+	if (af == AF_INET)
+		host = gethostbyaddr((char *) addr,
+				     sizeof(struct in_addr), af);
+	else
+		host = gethostbyaddr((char *) addr,
+				     sizeof(struct in6_addr), af);
+
+	if (host != NULL)
 		return (char *) host->h_name;
 	else
 		return (char *) NULL;
-- 
1.8.3.1

-- 
Michiro Hibari <hibari.michiro@lab.ntt.co.jp>





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ipvsadm: Enable to work display host name of IPv6
  2015-01-09  8:41 [PATCH] ipvsadm: Enable to work display host name of IPv6 Hibari Michiro
@ 2015-01-12 20:05 ` Julian Anastasov
  2015-01-16 10:30   ` Jesper Dangaard Brouer
  0 siblings, 1 reply; 3+ messages in thread
From: Julian Anastasov @ 2015-01-12 20:05 UTC (permalink / raw)
  To: Hibari Michiro; +Cc: lvs-devel, Jesper Dangaard Brouer


	Hello,

On Fri, 9 Jan 2015, Hibari Michiro wrote:

> So far ipvsadm can not display host name of IPv6.
> This patch add process in the case of IPv6 for
> addr_to_host function.
> 
> Signed-off-by: Michiro Hibari <hibari.michiro@lab.ntt.co.jp>

	Looks good to me. Still, comment could be
better. Jesper, please apply!

Acked-by: Julian Anastasov <ja@ssi.bg>

	One day we should convert it to getnameinfo()

> ---
>  ipvsadm.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/ipvsadm.c b/ipvsadm.c
> index 72ddc8a..162d4a2 100644
> --- a/ipvsadm.c
> +++ b/ipvsadm.c
> @@ -1770,8 +1770,14 @@ static char * addr_to_host(int af, const void *addr)
>  {
>  	struct hostent *host;
> -	if ((host = gethostbyaddr((char *) addr,
> -				  sizeof(struct in_addr), af)) != NULL)
> +	if (af == AF_INET)
> +		host = gethostbyaddr((char *) addr,
> +				     sizeof(struct in_addr), af);
> +	else
> +		host = gethostbyaddr((char *) addr,
> +				     sizeof(struct in6_addr), af);
> +
> +	if (host != NULL)
>  		return (char *) host->h_name;
>  	else
>  		return (char *) NULL;
> -- 
> 1.8.3.1

Regards

--
Julian Anastasov <ja@ssi.bg>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ipvsadm: Enable to work display host name of IPv6
  2015-01-12 20:05 ` Julian Anastasov
@ 2015-01-16 10:30   ` Jesper Dangaard Brouer
  0 siblings, 0 replies; 3+ messages in thread
From: Jesper Dangaard Brouer @ 2015-01-16 10:30 UTC (permalink / raw)
  To: Julian Anastasov; +Cc: Hibari Michiro, lvs-devel, brouer

On Mon, 12 Jan 2015 22:05:13 +0200 (EET)
Julian Anastasov <ja@ssi.bg> wrote:

> On Fri, 9 Jan 2015, Hibari Michiro wrote:
> 
> > So far ipvsadm can not display host name of IPv6.
> > This patch add process in the case of IPv6 for
> > addr_to_host function.
> > 
> > Signed-off-by: Michiro Hibari <hibari.michiro@lab.ntt.co.jp>
> 
> 	Looks good to me. Still, comment could be
> better. Jesper, please apply!

Thanks Hibari Michiro, applied.

But I updated the commit text, see:
 https://git.kernel.org/cgit/utils/kernel/ipvsadm/ipvsadm.git/commit/?id=a30224d4a04e63
 
> Acked-by: Julian Anastasov <ja@ssi.bg>
> 
> 	One day we should convert it to getnameinfo()

Also added a note to the commit text about this future plan to use
getnameinfo().


> > diff --git a/ipvsadm.c b/ipvsadm.c
> > index 72ddc8a..162d4a2 100644
> > --- a/ipvsadm.c
> > +++ b/ipvsadm.c
> > @@ -1770,8 +1770,14 @@ static char * addr_to_host(int af, const void *addr)
> >  {
> >  	struct hostent *host;
> > -	if ((host = gethostbyaddr((char *) addr,
> > -				  sizeof(struct in_addr), af)) != NULL)
> > +	if (af == AF_INET)
> > +		host = gethostbyaddr((char *) addr,
> > +				     sizeof(struct in_addr), af);
> > +	else
> > +		host = gethostbyaddr((char *) addr,
> > +				     sizeof(struct in6_addr), af);
> > +
> > +	if (host != NULL)
> >  		return (char *) host->h_name;
> >  	else
> >  		return (char *) NULL;

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Sr. Network Kernel Developer at Red Hat
  Author of http://www.iptv-analyzer.org
  LinkedIn: http://www.linkedin.com/in/brouer

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-16 10:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-09  8:41 [PATCH] ipvsadm: Enable to work display host name of IPv6 Hibari Michiro
2015-01-12 20:05 ` Julian Anastasov
2015-01-16 10:30   ` Jesper Dangaard Brouer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.