[ewg] RE: [PATCH] link-local address fix for rdma_resolve_addr
David J. Wilder
dwilder at us.ibm.com
Tue Oct 27 11:22:18 PDT 2009
On Thu, 2009-10-22 at 15:02 -0700, Sean Hefty wrote:
> >For ipv6 I ran what I described previously. What I do need to do is add
> >the option to rping to specify a source address and run it with various
> >address. Any help you can give defining what exactly needs to be tested
> >would be appreciated.
>
> You can also test with ucmatose to verify ipv4 still works. Use the -b option
> to bind to a specific address.
>
> - Sean
>
Sean
This patch adds ipv6 support to ucmatose.
Signed-off-by: David Wilder <dwilder at us.ibm.com>
------------------------------------------------------
examples/cmatose.c | 31 +++++++++++++++++++------------
1 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/examples/cmatose.c b/examples/cmatose.c
index 8c12347..481a6d0 100644
--- a/examples/cmatose.c
+++ b/examples/cmatose.c
@@ -516,15 +516,15 @@ static int get_addr(char *dst, struct sockaddr_in *addr)
return ret;
}
- if (res->ai_family != PF_INET) {
+ if (res->ai_family == PF_INET)
+ memcpy(addr, res->ai_addr, sizeof(struct sockaddr_in));
+ else if (res->ai_family == PF_INET6)
+ memcpy(addr, res->ai_addr, sizeof(struct sockaddr_in6));
+ else
ret = -1;
- goto out;
- }
- *addr = *(struct sockaddr_in *) res->ai_addr;
-out:
- freeaddrinfo(res);
- return ret;
+ freeaddrinfo(res);
+ return ret;
}
static int run_server(void)
@@ -543,11 +543,18 @@ static int run_server(void)
ret = get_addr(src_addr, &test.src_in);
if (ret)
goto out;
- } else
+ if(test.src_in.sin_family == AF_INET)
+ ((struct sockaddr_in *) &test.src_in)->sin_port = port;
+ else
+ ((struct sockaddr_in6 *) &test.src_in)->sin6_port=port;
+
+ } else {
test.src_in.sin_family = PF_INET;
+ test.src_in.sin_port = port;
+ }
+
+ ret = rdma_bind_addr(listen_id, (struct sockaddr *)&test.src_in);
- test.src_in.sin_port = port;
- ret = rdma_bind_addr(listen_id, test.src_addr);
if (ret) {
perror("cmatose: bind address failed");
goto out;
@@ -628,8 +635,8 @@ static int run_client(void)
printf("cmatose: connecting\n");
for (i = 0; i < connections; i++) {
ret = rdma_resolve_addr(test.nodes[i].cma_id,
- src_addr ? test.src_addr : NULL,
- test.dst_addr, 2000);
+ src_addr ? (struct sockaddr *)&test.src_in : NULL,
+ (struct sockaddr *)&test.dst_in, 2000);
if (ret) {
perror("cmatose: failure getting addr");
connect_error();
More information about the ewg
mailing list