Hello,

the change to IPv4.pm was messed up. Please try the attached patch.

Thank you.


diff -ru Ocsinventory-Unix-Agent-2.0.5.orig/lib/Ocsinventory/Agent/Backend/OS/Linux/Network/IPv4.pm Ocsinventory-Unix-Agent-2.0.5/lib/Ocsinventory/Agent/Backend/OS/Linux/Network/IPv4.pm
--- Ocsinventory-Unix-Agent-2.0.5.orig/lib/Ocsinventory/Agent/Backend/OS/Linux/Network/IPv4.pm	2012-04-01 16:12:25.000000000 +0200
+++ Ocsinventory-Unix-Agent-2.0.5/lib/Ocsinventory/Agent/Backend/OS/Linux/Network/IPv4.pm	2017-09-22 18:17:48.126665346 +0200
@@ -11,8 +11,8 @@
   my $common = $params->{common};
   my @ip;
   foreach (`ifconfig`){
-    if(/^\s*inet add?r\s*:\s*(\S+)/){
-      ($1=~/127.+/)?next:push @ip, $1
+    if(/^\s*inet (add?r\s*:\s*)?(\S+)/){
+      ($2=~/127.+/)?next:push @ip, $2
     };
   }
 
diff -ru Ocsinventory-Unix-Agent-2.0.5.orig/lib/Ocsinventory/Agent/Backend/OS/Linux/Network/Networks.pm Ocsinventory-Unix-Agent-2.0.5/lib/Ocsinventory/Agent/Backend/OS/Linux/Network/Networks.pm
--- Ocsinventory-Unix-Agent-2.0.5.orig/lib/Ocsinventory/Agent/Backend/OS/Linux/Network/Networks.pm	2012-04-01 16:12:25.000000000 +0200
+++ Ocsinventory-Unix-Agent-2.0.5/lib/Ocsinventory/Agent/Backend/OS/Linux/Network/Networks.pm	2017-09-22 18:11:21.642665346 +0200
@@ -22,13 +22,13 @@
     "/var/lib/dhcp3/dhclient.%s.leases",
     "/var/lib/dhcp3/dhclient.%s.leases",
     "/var/lib/dhcp/dhclient.%s.leases",
-    "/var/lib/dhcp/dhclient.leases",
     "/var/lib/dhcp/dhclient-%s.leases",
     "/var/lib/dhclient/dhclient-%s.leases", ) {
 
     $leasepath = sprintf($_,$if);
     last if (-e $leasepath);
   }
+  $leasepath = "/var/lib/dhcp/dhclient.leases" unless -e $leasepath;
   return undef unless -e $leasepath;
 
   if (open DHCP, $leasepath) {
@@ -158,12 +158,12 @@
 
     } else { # In a section
 
-      $description = $1 if $line =~ /^(\S+)/; # Interface name
-      $ipaddress = $1 if $line =~ /inet addr:(\S+)/i;
-      $ipmask = $1 if $line =~ /\S*mask:(\S+)/i;
-      $macaddr = $1 if $line =~ /hwadd?r\s+(\w{2}:\w{2}:\w{2}:\w{2}:\w{2}:\w{2})/i;
-      $status = 1 if $line =~ /^\s+UP\s/;
-      $type = $1 if $line =~ /link encap:(\S+)/i;
+      $description = $1 if $line =~ /^([^ :]+)[: ]/; # Interface name
+      $ipaddress = $1 if $line =~ /inet (?:addr:)?(\S+)/i;
+      $ipmask = $1 if $line =~ /\S*mask[: ](\S+)/i;
+      $macaddr = $1 if $line =~ /(?:hwadd?r|ether)\s+(\w{2}:\w{2}:\w{2}:\w{2}:\w{2}:\w{2})/i;
+      $status = 1 if $line =~ /(?:^\s+|<)UP(?:\s|,)/;
+      $type = $1 if $line =~ /(?:link encap:|txqueuelen\s+\d+\s+)\(?([^) ]+)\)?/i;
     }
 
 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to