net-tools 2.0 has changed the ifconfig format: eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> 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 <nmoreychaisemartin@xxxxxxxx> --- 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]; } -- 2.18.0
Attachment:
signature.asc
Description: OpenPGP digital signature