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

Facter FQDN resolution is incorrect on Windows



    • Bug
    • Status: Accepted
    • Normal
    • Resolution: Unresolved
    • FACT 3.0.1
    • None
    • Windows


      Native Facter has followed parts of the previous model on Windows when resolving network facts. Unfortunately, it would seem that the method of calculating FQDN might be errant.

      FQDN Is currently a combination of hostname + domain:

      FQDN is later calculated by concatenating these 2 pieces of data at https://github.com/puppetlabs/facter/blob/89550ef649866692afff9c7bd94044fe6c67cf4c/lib/src/facts/resolvers/networking_resolver.cc#L48-L51

      This might be correct, but a better way of doing this is likely to use GetComputerNameEx with a COMPUTER_NAME_FORMAT of ComputerNameDnsFullyQualified, given the registry parsing / interface spelunking is more complicated than necessary.

      When I first ran across this code, I didn't realize that Native Facter was at least using the DNS host name resolution in GetComputerNameEx, and had suggested that Facter might want to use the Winsock gethostname function. This was a bad suggestion given GetComputerNameEx can handle DNS hostnames, and given gethostname may return a hostname or FQDN based on implementation details, which make it a less attractive solution.

      Not sure if it's worth changing Facter 2.x, which uses Netbios name + DNS domain name to calculate a FQDN. That might work under a lot of circumstances, but is not accurate, given Netbios names do not have to match DNS hostnames on Windows.




            Unassigned Unassigned
            ethan Ethan Brown
            1 Vote for this issue
            7 Start watching this issue



              Zendesk Support