]> git.ipfire.org Git - thirdparty/util-linux.git/commit
login: use IPv4 on IPv4-mapping-to-IPv6
authorKarel Zak <kzak@redhat.com>
Tue, 4 Jul 2017 10:50:39 +0000 (12:50 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 20 Sep 2017 12:02:14 +0000 (14:02 +0200)
commitf94343b04417c7353fc83162ded66d1f28ef5f0d
tree026c3c3cd21815b24b28dafaf69ddf4d66cf9fa8
parent1dc4d2efe875eef1231043ef0d54549e35a7864b
login: use IPv4 on IPv4-mapping-to-IPv6

It seems that on some systems (e.g. RHEL7) the libc function
getaddrinfo() is not able to translate ::ffff: address to IPv4. The
result is 0.0.0.0 host address in the last(1) and utmpdump(1) output.

 /sbin/login -h "::ffff:192.168.1.7"

utmpdump:

  [7] [03926] [1   ] [user1   ] [pts/1       ] [::ffff:192.168.1.7  ] [0.0.0.0        ] [Thu May 12 17:49:50 2016    ]

Not sure if this is about order of the getaddrinfo() results, system
configuration or libc version. It's irrelevant for login(1). We have
to be robust enough to write usable address to log files everywhere.

The solution is to detect IPv4-mapping-to-IPv6 and use IPv4 for utmp.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1296233
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/login.c