LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

Re: [PATCH] ipvsadm: Enable to work display host name of IPv6

To: Hibari Michiro <hibari.michiro@xxxxxxxxxxxxx>
Subject: Re: [PATCH] ipvsadm: Enable to work display host name of IPv6
Cc: lvs-devel@xxxxxxxxxxxxxxx, Jesper Dangaard Brouer <brouer@xxxxxxxxxx>
From: Julian Anastasov <ja@xxxxxx>
Date: Mon, 12 Jan 2015 22:05:13 +0200 (EET)
        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@xxxxxxxxxxxxx>

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

Acked-by: Julian Anastasov <ja@xxxxxx>

        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@xxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

<Prev in Thread] Current Thread [Next in Thread>