Linux agent recording default gateway as gateway for all interfaces

Bug #1247190 reported by Daniel Rich
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OCS Inventory: Unified Unix Agent
Fix Released
Medium
mortheres

Bug Description

In trying to use the network interface data from our Linux hosts, we have notice that the OCS agent is recording the default gateway as the gateway for all interfaces on the host, even if that interface is down or doesn't have an IP assigned. I believe that this is incorrect behavior and that it should only be recording a gateway for interfaces that appear in the routing table.

I am seeing this both on version 2.0 and 2.1 versions of the agent. The Windows agent produces the "correct" results.

As an example, for a host with the following routing table:
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
172.16.185.0 0.0.0.0 255.255.255.0 U 0 0 0 vmnet1
172.20.254.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
172.16.238.0 0.0.0.0 255.255.255.0 U 0 0 0 vmnet8
10.67.4.0 0.0.0.0 255.255.252.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 10.67.4.1 0.0.0.0 UG 0 0 0 eth0

I find the following in the XML generated by the agent:
    <NETWORKS>
      <DESCRIPTION>eth0</DESCRIPTION>
      <DRIVER>tg3</DRIVER>
      <IPADDRESS>10.67.4.68</IPADDRESS>
      <IPDHCP>10.110.48.254</IPDHCP>
      <IPGATEWAY>10.67.4.1</IPGATEWAY>
      <IPMASK>255.255.252.0</IPMASK>
      <IPSUBNET>10.67.4.0</IPSUBNET>
      <MACADDR>00:1F:29:03:15:9B</MACADDR>
      <PCISLOT>0000:02:00.0</PCISLOT>
      <STATUS>Up</STATUS>
      <TYPE>Ethernet</TYPE>
    </NETWORKS>
    <NETWORKS>
      <DESCRIPTION>eth1</DESCRIPTION>
      <DRIVER>tg3</DRIVER>
      <IPGATEWAY>10.67.4.1</IPGATEWAY>
      <IPSUBNET>0.0.0.0</IPSUBNET>
      <MACADDR>00:1F:29:03:15:9A</MACADDR>
      <PCISLOT>0000:01:00.0</PCISLOT>
      <STATUS>Down</STATUS>
      <TYPE>Ethernet</TYPE>
    </NETWORKS>
    <NETWORKS>
      <DESCRIPTION>virbr0</DESCRIPTION>
      <IPADDRESS>172.20.254.1</IPADDRESS>
      <IPGATEWAY>10.67.4.1</IPGATEWAY>
      <IPMASK>255.255.255.0</IPMASK>
      <IPSUBNET>172.20.254.0</IPSUBNET>
      <MACADDR>52:54:00:74:88:E9</MACADDR>
      <STATUS>Up</STATUS>
      <TYPE>Ethernet</TYPE>
      <VIRTUALDEV>1</VIRTUALDEV>
    </NETWORKS>
    <NETWORKS>
      <DESCRIPTION>virbr0-nic</DESCRIPTION>
      <IPGATEWAY>10.67.4.1</IPGATEWAY>
      <IPSUBNET>0.0.0.0</IPSUBNET>
      <MACADDR>52:54:00:74:88:E9</MACADDR>
      <STATUS>Down</STATUS>
      <TYPE>Ethernet</TYPE>
      <VIRTUALDEV>1</VIRTUALDEV>
    </NETWORKS>
    <NETWORKS>
      <DESCRIPTION>vmnet1</DESCRIPTION>
      <IPADDRESS>172.16.185.1</IPADDRESS>
      <IPGATEWAY>10.67.4.1</IPGATEWAY>
      <IPMASK>255.255.255.0</IPMASK>
      <IPSUBNET>172.16.185.0</IPSUBNET>
      <MACADDR>00:50:56:C0:00:01</MACADDR>
      <STATUS>Up</STATUS>
      <TYPE>Ethernet</TYPE>
      <VIRTUALDEV>1</VIRTUALDEV>
    </NETWORKS>
    <NETWORKS>
      <DESCRIPTION>vmnet8</DESCRIPTION>
      <IPADDRESS>172.16.238.1</IPADDRESS>
      <IPGATEWAY>10.67.4.1</IPGATEWAY>
      <IPMASK>255.255.255.0</IPMASK>
      <IPSUBNET>172.16.238.0</IPSUBNET>
      <MACADDR>00:50:56:C0:00:08</MACADDR>
      <STATUS>Up</STATUS>
      <TYPE>Ethernet</TYPE>
      <VIRTUALDEV>1</VIRTUALDEV>
    </NETWORKS>

I can understand having the default gateway on eth0, vmnet1, virbr0 and vmnet8, but eth1 and vibr0-nic should have no default gateway. On windows hosts I see the address, netmask, gateway, and network number all set to 0.0.0.0 for down interfaces, which probably makes more sense.

Revision history for this message
mortheres (mortheres) wrote :

HI,

Can you tell us on which Linux distribution and its version you have the problem ? It will help us for debugging purpose.

Thanks in advance.

Kind regards

--
Guillaume

Changed in ocsinventory-unix-agent:
assignee: nobody → mortheres (mortheres)
importance: Undecided → Medium
Revision history for this message
Daniel Rich (drich-u) wrote :

We're seeing it in RedHat Enterprise Linux 6, I'll dig around to see if I still have any servers on RHEL5 that show the same issue.

Revision history for this message
mortheres (mortheres) wrote :

HI,

Thanks a lot for the information. I have repuced the problem using a laptop (with wifi and wired network interfaces) under Fedora 19. I will fix it as soon as possible.

Kind regards,

--
Guillaume

Changed in ocsinventory-unix-agent:
status: New → In Progress
milestone: none → 2.1
Revision history for this message
mortheres (mortheres) wrote :

Hi,

This a new version of Networks.pm that fix the bug. Can you test it by replacing your /usr/local/share/perl5/Ocsinventory/Agent/Backend/OS/Linux/Network/Networks.pm file by this one ?

If it works for you too, I will commit it :D :D.

Thanks in advance.

Kind regards,

--
Guillaume

Revision history for this message
dwizz (dwizz-donowin) wrote : Re: [team] [Bug 1247190] Re: Linux agent recording default gateway as gateway for all interfaces
Download full text (4.9 KiB)

Salut Guillaume,

Ce n'est pas evident pour une correction: tu n'as sur une machine qu'une seule route par défaut en tout...
Pour les autres, tu ne peux avoir que des routes explicites...
Il faudra peut être voir une forme différente pour ces infos dans la v3

François

Le Samedi 23 novembre 2013 22h56, mortheres <email address hidden> a écrit :

Hi,

This a new version of Networks.pm that fix the bug. Can you test it by
replacing your
/usr/local/share/perl5/Ocsinventory/Agent/Backend/OS/Linux/Network/Networks.pm
file  by this one ?

If it works for you too, I will commit it :D :D.

Thanks in advance.

Kind regards,

--
Guillaume

** Attachment added: "Networks.pm"
  https://bugs.launchpad.net/ocsinventory-unix-agent/+bug/1247190/+attachment/3915626/+files/Networks.pm

--
You received this bug notification because you are a member of OCS
Inventory Core Team, which is subscribed to OCS Inventory.
https://bugs.launchpad.net/bugs/1247190

Title:
  Linux agent recording default gateway as gateway for all interfaces

Status in OCS Inventory NG Unified Unix Agent:
  In Progress

Bug description:
  In trying to use the network interface data from our Linux hosts, we
  have notice that the OCS agent is recording the default gateway as the
  gateway for all interfaces on the host, even if that interface is down
  or doesn't have an IP assigned. I believe that this is incorrect
  behavior and that it should only be recording a gateway for interfaces
  that appear in the routing table.

  I am seeing this both on version 2.0 and 2.1 versions of the agent.
  The Windows agent produces the "correct" results.

  As an example, for a host with the following routing table:
  Kernel IP routing table
  Destination    Gateway        Genmask        Flags  MSS Window  irtt Iface
  172.16.185.0    0.0.0.0        255.255.255.0  U        0 0          0 vmnet1
  172.20.254.0    0.0.0.0        255.255.255.0  U        0 0          0 virbr0
  172.16.238.0    0.0.0.0        255.255.255.0  U        0 0          0 vmnet8
  10.67.4.0      0.0.0.0        255.255.252.0  U        0 0          0 eth0
  169.254.0.0    0.0.0.0        255.255.0.0    U        0 0          0 eth0
  0.0.0.0        10.67.4.1      0.0.0.0        UG        0 0          0 eth0

  I find the following in the XML generated by the agent:
      <NETWORKS>
        <DESCRIPTION>eth0</DESCRIPTION>
        <DRIVER>tg3</DRIVER>
        <IPADDRESS>10.67.4.68</IPADDRESS>
        <IPDHCP>10.110.48.254</IPDHCP>
        <IPGATEWAY>10.67.4.1</IPGATEWAY>
        <IPMASK>255.255.252.0</IPMASK>
        <IPSUBNET>10.67.4.0</IPSUBNET>
        <MACADDR>00:1F:29:03:15:9B</MACADDR>
        <PCISLOT>0000:02:00.0</PCISLOT>
        <STATUS>Up</STATUS>
        <TYPE>Ethernet</TYPE>
      </NETWORKS>
      <NETWORKS>
        <DESCRIPTION>eth1</DESCRIPTION>
        <DRIVER>tg3</DRIVER>
        <IPGATEWAY>10.67.4.1</IPGATEWAY>
        <IPSUBNET>0.0.0.0</IPSUBNET>
        <MACADDR>00:1F:29:03:15:9A</MACADDR>
        <PCISLOT>0000:01:00.0</PCISLOT>
        <STATUS>Down</STATUS>
        <TYPE>Ethernet</TYPE>
      </NETWORKS>
      <NETWORKS>
        <DESCRIPTION>virbr0</DESCRIPTION>
        <IPAD...

Read more...

Revision history for this message
mortheres (mortheres) wrote :

Hi,

Fix has been commited in revision 1176 of the lp:ocsinventory-unix-agent/stable-2.1 branch: http://bazaar.launchpad.net/~ocsinventory-dev/ocsinventory-unix-agent/stable-2.1/revision/1176

It will be released in OCS 2.1 release :D :D

Kind regards,

--
Guillaume

Changed in ocsinventory-unix-agent:
status: In Progress → Fix Committed
Frank (frank-bourdeau)
Changed in ocsinventory-unix-agent:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.