Package: ocsinventory-agent
Version: 2:2.0.5-1.2
Severity: normal
Tags: patch

Dear Maintainer,

in order to get information about network interfaces ocsinventory-agent
runs ifconfig and tries to parse its output. Due to the update of
net-tools to version 1.60+git20161116.90da8a0 the output format of
ifconfig changed. Consequently ocsinventory-agent fails to gather
network interface information. I patched the regular expressions in the
parsing routine, which solved the problem for me. I believe the patched
version works equally in Jessie and Stretch.

Please consider classifying net-tools as a dependendy or at least
'recommended package' since net-tools is only optional in Stretch.


-- System Information:
Debian Release: 9.0
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-3-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages ocsinventory-agent depends on:
ii  debconf [debconf-2.0]                1.5.61
ii  libnet-ip-perl                       1.26-1
ii  libnet-ssleay-perl                   1.80-1
ii  libperl5.24 [libcompress-zlib-perl]  5.24.1-3
ii  libproc-daemon-perl                  0.23-1
ii  libwww-perl                          6.15-1
ii  libxml-simple-perl                   2.22-1
ii  perl                                 5.24.1-3
ii  po-debconf                           1.0.20
ii  ucf                                  3.0036

Versions of packages ocsinventory-agent recommends:
pn  dmidecode  <none>
ii  hdparm     9.51+ds-1
ii  pciutils   1:3.5.2-1

Versions of packages ocsinventory-agent suggests:
pn  nmap           <none>
pn  read-edid      <none>
pn  smartmontools  <none>

-- debconf information:
  ocsinventory-agent/server:
* ocsinventory-agent/method: local
  ocsinventory-agent/tag:
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-06-13 14:48:35.554077693 +0200
@@ -11,7 +11,7 @@
   my $common = $params->{common};
   my @ip;
   foreach (`ifconfig`){
-    if(/^\s*inet add?r\s*:\s*(\S+)/){
+    if(/^\s*inet (?add?r\s*:\s*)?(\S+)/){
       ($1=~/127.+/)?next:push @ip, $1
     };
   }
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-06-13 15:49:08.659405493 +0200
@@ -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;
     }
 
 

Reply via email to