All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hibari Michiro <hibari.michiro@lab.ntt.co.jp>
To: lvs-devel@vger.kernel.org
Cc: hibari.michiro@lab.ntt.co.jp
Subject: [PATCH] ipvsadm: Enable to work display host name of IPv6
Date: Fri, 09 Jan 2015 17:41:29 +0900	[thread overview]
Message-ID: <54AF9439.8040409@lab.ntt.co.jp> (raw)

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>





             reply	other threads:[~2015-01-09  8:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-09  8:41 Hibari Michiro [this message]
2015-01-12 20:05 ` [PATCH] ipvsadm: Enable to work display host name of IPv6 Julian Anastasov
2015-01-16 10:30   ` Jesper Dangaard Brouer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54AF9439.8040409@lab.ntt.co.jp \
    --to=hibari.michiro@lab.ntt.co.jp \
    --cc=lvs-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.