Uploaded image for project: 'Facter'
  1. Facter
  2. FACT-1468

facter fails to report correct ipaddress when routing_table fails on default gateway entry

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • FACT 3.y
    • None
    • None
    • ubuntu 16.04 in virtual kvm environment
      puppet 4.5.1 (agent 1.5.1-1xenial)

    • Hide

      Should report ipaddress of the interface with default gateway whatever the "ip route" output.

      Show
      Should report ipaddress of the interface with default gateway whatever the "ip route" output.

    Description

      The routing table is as follows:
      default via XXX.XXX.XXX.XXX dev ens3 onlink
      10.42.0.0/16 dev docker0 proto kernel scope link src 10.42.0.1
      XXX.XXX.XXX.XXX/24 dev ens3 proto kernel scope link src XXX.XXX.XXX.XXX
      172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1

      facter fails to parse the default via line due to onlink (FACT-1405) logging a warning.

      Thus fails to detect the primary_interface and thus returns the first interface it finds namely "docker0" which returns the same IP for every host. (and causes issues with exported resources using ipaddress in our case – sshkey)

      I tried reading the code to find out what happens but could not reach a conclusion.

      From what I can see, there are two possible ways to parse the routing table, the first is by reading the output of "ip route show" in
      ./lib/src/facts/linux/networking_resolver.cc:123 void networking_resolver::read_routing_table()

      Which actually makes the warning, the other is by parsing "/proc/net/route" in
      ./lib/src/facts/linux/networking_resolver.cc:97 string networking_resolver::get_primary_interface() const

      But I could not find where it is called. In solaris implementation it is called directly in the same file, so my guess is that this function might not be used at all. Too bad, since with this function (without the check in line 102 "if (routes4.size()) {"), it would work correctly.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pxxsBCNhfhKh23BV Diego Abelenda
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support