[ofa-general] [PATCH] infiniband-diags/src/ibaddr.c: convert GID prints to use inet_ntop

Ira Weiny weiny2 at llnl.gov
Tue Jul 1 18:33:24 PDT 2008


>From c6bd45d3512809957e6551e1ff15766822d63679 Mon Sep 17 00:00:00 2001
From: Ira K. Weiny <weiny2 at llnl.gov>
Date: Tue, 1 Jul 2008 15:48:54 -0700
Subject: [PATCH] infiniband-diags/src/ibaddr.c: convert GID prints to use inet_ntop


Signed-off-by: Ira K. Weiny <weiny2 at llnl.gov>
---
 infiniband-diags/src/ibaddr.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/infiniband-diags/src/ibaddr.c b/infiniband-diags/src/ibaddr.c
index 6c56a3e..7362640 100644
--- a/infiniband-diags/src/ibaddr.c
+++ b/infiniband-diags/src/ibaddr.c
@@ -40,6 +40,7 @@
 #include <unistd.h>
 #include <stdarg.h>
 #include <getopt.h>
+#include <arpa/inet.h>
 
 #include <infiniband/common.h>
 #include <infiniband/umad.h>
@@ -52,6 +53,8 @@ char *argv0 = "ibaddr";
 static int
 ib_resolve_addr(ib_portid_t *portid, int portnum, int show_lid, int show_gid)
 {
+	size_t GID_STR_LEN = 256;
+	char   gid_str[GID_STR_LEN];
 	uint8_t portinfo[64];
 	uint8_t nodeinfo[64];
 	uint64_t guid, prefix;
@@ -74,7 +77,7 @@ ib_resolve_addr(ib_portid_t *portid, int portnum, int show_lid, int show_gid)
 	mad_encode_field(gid, IB_GID_GUID_F, &guid);
 
 	if (show_gid) {
-		printf("GID 0x%s%s ", mad_dump_val(IB_GID_PREFIX_F, buf1, sizeof buf1, &prefix), mad_dump_val(IB_GID_GUID_F, buf2, sizeof buf2, &guid));
+		printf("GID %s ", inet_ntop(AF_INET6, gid, gid_str, GID_STR_LEN));
 	}
 
 	if (show_lid > 0)
-- 
1.5.4.5




More information about the general mailing list