[LU-17186] Replace deprecated gethostby*() calls with get*info() to support resolv ordering Created: 11/Oct/23 Updated: 08/Jan/24 Resolved: 03/Jan/24 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Lustre 2.16.0 |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Jian Yu | Assignee: | Jian Yu |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Severity: | 3 | ||||||||
| Rank (Obsolete): | 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. |
| Comments |
| Comment by Gerrit Updater [ 11/Oct/23 ] |
|
"Jian Yu <yujian@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52632 |
| Comment by Andreas Dilger [ 20/Dec/23 ] |
|
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. |
| Comment by Jian Yu [ 20/Dec/23 ] |
|
Yes, adilger.
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;
};
|
| Comment by Gerrit Updater [ 03/Jan/24 ] |
|
"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/52632/ |
| Comment by Peter Jones [ 03/Jan/24 ] |
|
Landed for 2.16 |