[ofa-general] [PATCH 2/2] libibmad: print warning when _do_madrpc fails with destination port information
Hal Rosenstock
hrosenstock at xsigo.com
Thu Jun 26 06:00:29 PDT 2008
On Wed, 2008-06-25 at 16:09 -0700, Ira Weiny wrote:
> diff --git a/libibmad/src/portid.c b/libibmad/src/portid.c
> index 7279e14..01f9530 100644
> --- a/libibmad/src/portid.c
> +++ b/libibmad/src/portid.c
...
> @@ -65,29 +66,24 @@ char *
> portid2str(ib_portid_t *portid)
> {
> static char buf[1024] = "local";
> + char drpath[512];
> char *s = buf;
> int i;
>
> if (portid->lid > 0) {
> s += sprintf(s, "Lid %d", portid->lid);
> if (portid->grh_present) {
> - s += sprintf(s, " Gid 0x%" PRIx64 "%" PRIx64,
> - ntohll(*(uint64_t *)portid-
> >gid),
> - ntohll(*(uint64_t *)(portid-
> >gid+8)));
> + char gid[sizeof
> "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"];
> + inet_ntop(AF_INET6, portid->gid, gid, sizeof
> (gid));
> + s += sprintf(s, " Gid %s", gid);
Should this be:
if (inet_ntop(AF_INET6, portid->gid, gid, sizeof (gid))
s += sprintf(s, " Gid %s", gid);
> }
Also, I'm all for this change but I'm also for consistency (I may be a
minority of one on this) so I have to ask whether you plan on updating
diags and/or OpenSM for GID format.
Note also that if this is ported to Windows a wrapper for inet_ntop will
be needed.
-- Hal
More information about the general
mailing list