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); > > 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? Yuval? > > Thanks
Attachment:
signature.asc
Description: PGP signature