From patchwork Wed Aug 1 13:36:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Morey-Chaisemartin X-Patchwork-Id: 10552311 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-2.web.codeaurora.org (Postfix) with ESMTP id 0965E13BF for ; Wed, 1 Aug 2018 13:36:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE0CB2B4EA for ; Wed, 1 Aug 2018 13:36:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E22602B51E; Wed, 1 Aug 2018 13:36:58 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,T_TVD_MIME_EPI 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 986742B512 for ; Wed, 1 Aug 2018 13:36:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389280AbeHAPWr (ORCPT ); Wed, 1 Aug 2018 11:22:47 -0400 Received: from mx2.suse.de ([195.135.220.15]:46176 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389108AbeHAPWq (ORCPT ); Wed, 1 Aug 2018 11:22:46 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2CA10ACB0 for ; Wed, 1 Aug 2018 13:36:56 +0000 (UTC) From: Nicolas Morey-Chaisemartin Subject: [PATCH rdma-core 2/3] rxe: support newer ifconfig To: linux-rdma@vger.kernel.org References: <2fb5bb71-8b9c-3164-a89d-526c73a06fbb@suse.de> Openpgp: preference=signencrypt Message-ID: <17479029-7d54-accb-ee5b-a7baa07beeb3@suse.de> Date: Wed, 1 Aug 2018 15:36:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <2fb5bb71-8b9c-3164-a89d-526c73a06fbb@suse.de> 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 net-tools 2.0 has changed the ifconfig format: eth0: flags=4163 mtu 1500 inet 10.0.2.127 netmask 255.255.255.0 broadcast 10.0.2.255 Fix the regexp to support both older and newer versions of net-tools Signed-off-by: Nicolas Morey-Chaisemartin --- providers/rxe/rxe_cfg.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/providers/rxe/rxe_cfg.in b/providers/rxe/rxe_cfg.in index cf9e04ca6818..5d01f3a613c9 100755 --- a/providers/rxe/rxe_cfg.in +++ b/providers/rxe/rxe_cfg.in @@ -197,15 +197,15 @@ sub get_dev_info { @lines = `ifconfig $eth`; foreach $line (@lines) { # get IP address - if ($line =~ /inet addr/) { - $line =~ s/^\s+inet addr://g; + if ($line =~ /inet (addr)?/) { + $line =~ s/^\s+inet (addr)?:?//g; @fields = split(/\s+/, $line); $ipv4_addr{$eth} = $fields[0]; } # get ethernet mtu - if ($line =~ /MTU:/) { - $line =~ s/^.*MTU://g; + if ($line =~ /(MTU|mtu)[: ]/) { + $line =~ s/^.*(MTU|mtu)[: ]//g; @fields = split(/\s+/, $line); $eth_mtu{$eth} = $fields[0]; }