Hi,
Since c886fb58eb56 ("MINOR: server/ip: centralize server ip updates"),
there is a regression with server address resolution made against libc
with getaddrinfo(), specifically when returned address are IPv6 address
with %<interface> notation which specifies which interface index to
access given address (useful when destination is link local).
$ getent ahosts test.lan
fe80::e742:b272:73e:d652%10 STREAM test.lan
fe80::e742:b272:73e:d652%10 DGRAM
fe80::e742:b272:73e:d652%10 RAW
192.168.115.237 STREAM
192.168.115.237 DGRAM
192.168.115.237 RAW
Health check sent to selected destination are failing with the following
error:
[WARNING] (97685) : Health check for server backend/test.lan failed, reason:
Layer4 connection problem, info: "General socket error (Invalid argument)",
check duration: 0ms, status: 0/2 DOWN.
This happens as now call to connect() no longer include sin6_scope_id
field. Diff between the 2.8.7 and 2.9.7
-connect(9, {sa_family=AF_INET6, sin6_port=htons(80), sin6_flowinfo=htonl(0),
inet_pton(AF_INET6, "fe80::e742:b272:73e:d652", &sin6_addr),
sin6_scope_id=if_nametoindex("ve-test.ja3nLv")}, 28) = -1 EINPROGRESS
(Operation now in progress)
+connect(9, {sa_family=AF_INET6, sin6_port=htons(80), sin6_flowinfo=htonl(0),
inet_pton(AF_INET6, "fe80::e742:b272:73e:d652", &sin6_addr), sin6_scope_id=0},
28) = -1 EINVAL (Invalid argument)
Before c886fb58eb56, srv.addr.__ss_padding contains %10, but not after:
- __ss_padding =
"\000\000\000\000\000\000\376\200\000\000\000\000\000\000\347B\262r\a>\326R\n",
'\000' <repeats 94 times>,
+ __ss_padding =
"\000\000\000\000\000\000\376\200\000\000\000\000\000\000\347B\262r\a>\326R",
'\000' <repeats 95 times>,
Note that this particular issue does not happen when USE_GETADDRINFO is
disabled.
Reverting the change made in srv_set_addr_via_libc to original state
(see below) does restore original behaviour.
int srv_set_addr_via_libc(struct server *srv, int *err_code)
{
if (str2ip2(srv->hostname, &srv->addr, 1) == NULL) {
if (err_code)
*err_code |= ERR_WARN;
return 1;
}
return 0;
}
It not clear to me why c886fb58eb56 broke previous behaviour only when
USE_GETADDRINFO is enabled as str2ip2() code handling getaddrinfo() has
not been touched for very long time, however it seems changes made in
srv_set_addr_via_libc() should not be necessary as str2ip2() does
in-place update of server address.
Cheers,
--
Bertrand
signature.asc
Description: PGP signature

