From patchwork Thu Mar 1 12:58:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuval Shaia X-Patchwork-Id: 10251269 X-Patchwork-Delegate: leon@leon.nu Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BED4560365 for ; Thu, 1 Mar 2018 13:04:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 052FD28793 for ; Thu, 1 Mar 2018 13:04:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC3A728D3F; Thu, 1 Mar 2018 13:04:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6821328793 for ; Thu, 1 Mar 2018 13:04:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030872AbeCANE3 (ORCPT ); Thu, 1 Mar 2018 08:04:29 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:34154 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030652AbeCAM6w (ORCPT ); Thu, 1 Mar 2018 07:58:52 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w21CuwvI168658 for ; Thu, 1 Mar 2018 12:58:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2017-10-26; bh=F22w4oIFVErZ4o+Qilx7q91Jnb3gJTocaCtPdq1maKU=; b=Vd3/gj5PB7vsfehB15wlR/cFqy+proxdDWKVV+7plFhU7FW0J08US4WmHjH9Ns1OP98C Ms6Pnakhr2tyMUqy8yuqng8I9K66A+zJ3vTaPe0o+VgaTqM+oWjqHiQWe952KiIxACWm neogTBRFVUb4l4UBPotHov9Z6ofJ4hjg7/K5Q8lJRfjMCdJ9IEuDl22wDzn7zLc7KHAX ukabvV7z0Bl9iQ4fiDhUQE3tU+8nu4uf1MOLAU0GbtOAJGZpHdmCYbKXPYMK8/QqNh8v HTD9zts/E37lVl9mhhkJn76JMOEbuAhYHB13B/L4TU9v1/KZdG+7NPZZ7kZ6W/nhNOgZ cQ== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2geht202r7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 01 Mar 2018 12:58:51 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w21Cwo3d015527 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 1 Mar 2018 12:58:50 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w21Cwoaf012549 for ; Thu, 1 Mar 2018 12:58:50 GMT Received: from yuvallap.br.oracle.com (/10.159.44.99) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 01 Mar 2018 04:58:49 -0800 From: Yuval Shaia To: linux-rdma@vger.kernel.org Cc: Yuval Shaia Subject: [PATCH] librdmacm: Add command line option to specify server Date: Thu, 1 Mar 2018 14:58:46 +0200 Message-Id: <20180301125846.5385-1-yuval.shaia@oracle.com> X-Mailer: git-send-email 2.14.3 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8818 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803010165 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a command line option to allow selecting specific address as done in rdma_client. Signed-off-by: Yuval Shaia --- 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 #include +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); if (ret) { printf("rdma_getaddrinfo: %s\n", gai_strerror(ret)); return ret; @@ -163,8 +164,11 @@ int main(int argc, char **argv) { int op, ret; - while ((op = getopt(argc, argv, "p:")) != -1) { + while ((op = getopt(argc, argv, "s:p:")) != -1) { switch (op) { + case 's': + server = optarg; + break; case 'p': port = optarg; break;