Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-17186

Replace deprecated gethostby*() calls with get*info() to support resolv ordering

Details

    • Improvement
    • Resolution: Fixed
    • Minor
    • Lustre 2.16.0
    • None
    • None
    • 3
    • 9223372036854775807

    Description

      Please update the last places in the code where gethostbyaddr() and gethostbyname() are used, especially in the Kerberos user space utility with getaddrinfo() and getnameinfo().

      That will make Lustre compatible with the /etc/gai.conf file that gives control over how these calls return info, especially ordering of IP address when a DNS host has multiple IP addresses.

      (see man gai.conf)
       

      CONFORMING TO
      POSIX.1-2001  specifies  gethostbyname(), gethostbyaddr(), sethostent(), endhostent(), gethostent(), and h_errno; gethostbyname(), gethostbyaddr(), and h_errno are marked obsolescent in that standard. 
      POSIX.1-2008 removes the specifications of gethostbyname(), gethostbyaddr(), and h_errno, recommending the use of getaddrinfo(3) and getnameinfo(3) instead.
      

      This is simple enough that this ticket could be handled by somebody which is not a Kerberos expert.

      Attachments

        Issue Links

          Activity

            [LU-17186] Replace deprecated gethostby*() calls with get*info() to support resolv ordering
            pjones Peter Jones added a comment -

            Landed for 2.16

            pjones Peter Jones added a comment - Landed for 2.16

            "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/52632/
            Subject: LU-17186 utils: replace gethostby*() with get*info()
            Project: fs/lustre-release
            Branch: master
            Current Patch Set:
            Commit: de82fd88a7e9300f9558f1d30fe1ed744be11aa2

            gerrit Gerrit Updater added a comment - "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/52632/ Subject: LU-17186 utils: replace gethostby*() with get*info() Project: fs/lustre-release Branch: master Current Patch Set: Commit: de82fd88a7e9300f9558f1d30fe1ed744be11aa2
            yujian Jian Yu added a comment -

            Yes, adilger.
            The getaddrinfo() function allocates and initializes a linked list of addrinfo structures, one for each network address that matches node and service, subject to any restrictions imposed by hints, and returns a pointer to the start of the list in res. The items in the linked list are linked by the ai_next field.

                   int getaddrinfo(const char *node, const char *service,
                                   const struct addrinfo *hints,
                                   struct addrinfo **res);
            
                   struct addrinfo {
                       int              ai_flags;
                       int              ai_family;
                       int              ai_socktype;
                       int              ai_protocol;
                       socklen_t        ai_addrlen;
                       struct sockaddr *ai_addr;
                       char            *ai_canonname;
                       struct addrinfo *ai_next;
                   };
            
            yujian Jian Yu added a comment - Yes, adilger . The getaddrinfo() function allocates and initializes a linked list of addrinfo structures, one for each network address that matches node and service , subject to any restrictions imposed by hints , and returns a pointer to the start of the list in res . The items in the linked list are linked by the ai_next field. int getaddrinfo( const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res); struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; socklen_t ai_addrlen; struct sockaddr *ai_addr; char *ai_canonname; struct addrinfo *ai_next; };

            Jian, does the getaddrinfo() interface allow returning multiple addresses for the same hostname, and do the tools handle this? It would be useful for LU-16738 if a single MGS hostname could resolve to multiple NIDs with round-robin DNS, and would allow shortening the mount command line.

            adilger Andreas Dilger added a comment - Jian, does the getaddrinfo() interface allow returning multiple addresses for the same hostname, and do the tools handle this? It would be useful for LU-16738 if a single MGS hostname could resolve to multiple NIDs with round-robin DNS, and would allow shortening the mount command line.

            "Jian Yu <yujian@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52632
            Subject: LU-17186 utils: replace gethostby*() with getaddrinfo()
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: 2d293e9b72eecd41607834bc5bff31ad24814112

            gerrit Gerrit Updater added a comment - "Jian Yu <yujian@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52632 Subject: LU-17186 utils: replace gethostby*() with getaddrinfo() Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 2d293e9b72eecd41607834bc5bff31ad24814112

            People

              yujian Jian Yu
              yujian Jian Yu
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: