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

retrieve_default_interface uses incorrect method and doesn't work when IPv6-only

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • None
    • None
    • Night's Watch
    • ghost-9.12
    • Needs Assessment
    • Needs Assessment

    Description

      Here: https://github.com/puppetlabs/facter/blob/2c87e9e700dc1f75bda71f3a7805449f37fa1945/lib/facter/resolvers/networking_linux_resolver.rb#L144

      ip route get 1 is not the right way to get the default route egress interface. That's the equivalent of ip route get 1.0.0.0. There is nothing special about the 1.0.0.0 address, so it should not be treated like a way to find out the default route egress interface.

      A better way to get the default route egress interface would be to use the output of ip route show default. This is how it's done with the old tools here: https://github.com/puppetlabs/facter/blob/23a6be6494c0729eaf439e173020bb3be88b75c6/lib/facter/resolvers/networking_resolver.rb#L23

      Also, this method currently neglects to take IPv6 into consideration. There should be a retrieve_default_interface_v6 method that looks at ip -6 route show default and populates a networking.primary6 fact.

      Attachments

        Issue Links

          Activity

            People

              sebastian.miclea Sebastian Miclea
              kenyon Kenyon Ralph
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support