+++ /dev/null
-Bottom: 9cfb1ddbdd89bfe7a45eb80019ef27af2267dd2e
-Top: 1ab5f7833d1baaba821d175e19964a67ad69afe5
-Author: Sean Hefty <sean.hefty@intel.com>
-Date: 2010-12-17 10:20:05 -0800
-
-ib_acme: support querying by gids
-
-Allow the user to specify gids when querying path data.
-
-Signed-off-by: Sean Hefty <sean.hefty@intel.com>
-
-
----
-
-diff --git a/man/ib_acme.1 b/man/ib_acme.1
-index e5256a0..9e44822 100644
---- a/man/ib_acme.1
-+++ b/man/ib_acme.1
-@@ -18,9 +18,8 @@ create address and configuration files for the ib_acm service.
- .TP\r
- \-f addr_format\r
- Specifies the format of the src_addr and dest_addr parameters. Valid\r
--address formats are: 'i', 'n', 'p', and 'u', which indicate that the src_addr\r
--and dest_addr parameters are ip addresses, system network names, LIDs,\r
--or the format is unspecified, respectively. If the -f option is omitted,\r
-+address formats are: 'i' ip address, 'n' host name, 'l' lid, 'g' gid,\r
-+and 'u' unspecified. If the -f option is omitted,\r
- an unspecified address format is assumed. ib_acme will use getaddrinfo or\r
- other mechanisms to determine which format the address uses.\r
- .TP\r
-diff --git a/src/acme.c b/src/acme.c
-index dd645c1..d42ba81 100644
---- a/src/acme.c
-+++ b/src/acme.c
-@@ -67,7 +67,7 @@ extern char **parse(char *args, int *count);
- static void show_usage(char *program)
- {
- printf("usage 1: %s\n", program);
-- printf(" [-f addr_format] - i(p), n(ame), l(id), or u(nspecified)\n");
-+ printf(" [-f addr_format] - i(p), n(ame), l(id), g(gid), or u(nspecified)\n");
- printf(" default: 'u'\n");
- printf(" [-s src_addr] - format defined by -f option\n");
- printf(" [-d] dest_addr - format defined by -f option\n");
-@@ -500,6 +500,30 @@ static int resolve_lid(struct ibv_path_record *path)
- return ret;
- }
-
-+static int resolve_gid(struct ibv_path_record *path)
-+{
-+ int ret;
-+
-+ ret = inet_pton(AF_INET6, src_addr, &path->sgid);
-+ if (ret <= 0) {
-+ printf("inet_pton error on source address (%s): 0x%x\n", src_addr, ret);
-+ return ret;
-+ }
-+
-+ ret = inet_pton(AF_INET6, dest_addr, &path->dgid);
-+ if (ret <= 0) {
-+ printf("inet_pton error on dest address (%s): 0x%x\n", dest_addr, ret);
-+ return ret;
-+ }
-+
-+ path->reversible_numpath = IBV_PATH_RECORD_REVERSIBLE | 1;
-+ ret = ib_acm_resolve_path(path, get_resolve_flags());
-+ if (ret)
-+ printf("ib_acm_resolve_path failed: %s\n", strerror(errno));
-+
-+ return ret;
-+}
-+
- static int verify_resolve(struct ibv_path_record *path)
- {
- int ret;
-@@ -589,6 +613,10 @@ static int resolve(char *program, char *dest_arg)
- memset(&path, 0, sizeof path);
- ret = resolve_lid(&path);
- break;
-+ case 'g':
-+ memset(&path, 0, sizeof path);
-+ ret = resolve_gid(&path);
-+ break;
- default:
- show_usage(program);
- exit(1);