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

IPv6 are incorrectly parsed, leading to missing ip in the reported facts.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: FACT 2.4.6
    • Fix Version/s: FACT 2.4.7, FACT 2.5.0
    • Component/s: Community
    • Labels:
      None
    • Template:
    • Acceptance Criteria:
      Hide

      Should correctly report IPv6 addresses starting with 'f', 'e', '8', '0', or '1'.

      Show
      Should correctly report IPv6 addresses starting with 'f', 'e', '8', '0', or '1'.
    • Story Points:
      1
    • Sprint:
      Client 2016-05-18
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Facter would fail to report IPv6 addresses starting with any of the characters 'f', 'e', '8', '0', or '1'. This should now be fixed.

      Description

      When one has this interface defined:

      1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
          inet 127.0.0.1/8 scope host lo
             valid_lft forever preferred_lft forever
          inet6 ::1/128 scope host
             valid_lft forever preferred_lft forever
      2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master ovs-system state UP qlen 1000
          link/ether 00:76:07:c6:71:5d brd ff:ff:ff:ff:ff:ff
          inet6 fe80::276:7ff:fec6:715d/64 scope link
             valid_lft forever preferred_lft forever
      3: ovs-system: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
          link/ether 86:2c:6d:c1:a0:43 brd ff:ff:ff:ff:ff:ff
      4: br-ex: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
          link/ether 00:76:07:c6:71:5d brd ff:ff:ff:ff:ff:ff
          inet 192.0.2.10/24 brd 192.0.2.255 scope global br-ex
             valid_lft forever preferred_lft forever
          inet6 fe80::276:7ff:fec6:715d/64 scope link
             valid_lft forever preferred_lft forever
      5: vlan10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
          link/ether 66:50:32:ba:27:f4 brd ff:ff:ff:ff:ff:ff
          inet6 2001:db8:fd00:1000::11/64 scope global
             valid_lft forever preferred_lft forever
          inet6 fe80::6450:32ff:feba:27f4/64 scope link
             valid_lft forever preferred_lft forever
      6: vlan20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
          link/ether f6:74:96:5d:db:3d brd ff:ff:ff:ff:ff:ff
          inet6 fd00:fd00:fd00:2000::13/64 scope global
             valid_lft forever preferred_lft forever
          inet6 fe80::f474:96ff:fe5d:db3d/64 scope link
             valid_lft forever preferred_lft forever
      

      Then some IPv6 addresses are missing from the facts:

      ipaddress => 192.0.2.10
      ipaddress6 => fd00:fd00:fd00:4000::11
      ipaddress6_vlan10 => 2001:db8:fd00:1000::11
      ipaddress_br_ex => 192.0.2.10
      

      here, ipaddress6_vlan20 should point to fd00:fd00:fd00:2000::13

      The problem seems to come from the regex used in facter/utils/ip.rb:

      https://github.com/puppetlabs/facter/blob/2.4.6/lib/facter/util/ip.rb#L9 (but it's there since forever)

      inet6 (?:addr: )?((?![fe80|::1])(?>[0-9,a-f,A-F]*\:{1,2})+[0-9,a-f,A-F]{0,4})
      

      should be

      inet6 (?:addr: )?((?!(?:fe80|::1))(?>[0-9,a-f,A-F]*\:{1,2})+[0-9,a-f,A-F]{0,4})
      

      You can check on rubular:

        Attachments

          Activity

            People

            Assignee:
            john.duarte John Duarte
            Reporter:
            sofer Sofer Athlan-Guyot
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support