On Mon, Mar 05, 2018 at 08:55:25AM +0200, Leon Romanovsky wrote: > On Thu, Mar 01, 2018 at 02:58:46PM +0200, Yuval Shaia wrote: > > Add a command line option to allow selecting specific address as done in > > rdma_client. > > > > Signed-off-by: Yuval Shaia <yuval.shaia@xxxxxxxxxx> > > --- > > librdmacm/examples/rdma_server.c | 8 ++++++-- > > 1 file changed, 6 insertions(+), 2 deletions(-) > > > > diff --git a/librdmacm/examples/rdma_server.c b/librdmacm/examples/rdma_server.c > > index bcf649fe..77c021ac 100644 > > --- a/librdmacm/examples/rdma_server.c > > +++ b/librdmacm/examples/rdma_server.c > > @@ -36,6 +36,7 @@ > > #include <rdma/rdma_cma.h> > > #include <rdma/rdma_verbs.h> > > > > +static const char *server = "127.0.0.1"; > > static const char *port = "7471"; > > > > static struct rdma_cm_id *listen_id, *id; > > @@ -55,7 +56,7 @@ static int run(void) > > memset(&hints, 0, sizeof hints); > > hints.ai_flags = RAI_PASSIVE; > > hints.ai_port_space = RDMA_PS_TCP; > > - ret = rdma_getaddrinfo(NULL, port, &hints, &res); > > + ret = rdma_getaddrinfo(server, port, &hints, &res); Hi Leon, > > In such case (server is going to be not-NULL), the AI_PASSIVE hint > will be ignored by getaddrinfo, but don't know whenever it is safe to > remove "hints.ai_flags = RAI_PASSIVE;" line above. > > What do you think? Just read man page and realized that you are correct, when 'node' argument is given the AI_PASSIVE is ignored. I am confused, why can't i have them both? i.e be *passive* side of the connection *while* still bind to specific source address. I tried your suggestions, first this flag is used not only in call to getaddrinfo so not sure it is safe to remove the setting. Second, i tried that :) and it fails in rdma_listen phase. > > Thanks -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html