Skip to content

Commit

Permalink
Fix bug in ifconfig parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
ljden committed May 12, 2021
1 parent ac0a532 commit ae6c220
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/net-statistics
Expand Up @@ -49,13 +49,13 @@ if ($isNetDown) {

foreach $line (@ifconfig) {
chomp $line;
if($line =~ /inet addr/) {
if($line =~ /inet /) {
$addr = $line;
$addr =~ s/.*inet addr:([^ ]*).*/$1/;
$addr =~ s/.*inet ([^ ]*).*/$1/;
}
if($line =~ /Mask/) {
if($line =~ /netmask/) {
$mask = $line;
$mask =~ s/.*Mask:([^ ]*).*/$1/;
$mask =~ s/.*netmask ([^ ]*).*/$1/;
}
}

Expand Down

0 comments on commit ae6c220

Please sign in to comment.