Retry send without pktinfo on ENETUNREACH as well

It seems that newer kernels fail with ENETUNREACH instead of EINVAL with
an invalid source address in pktinfo.

This fixes fast reconnect on source address change.
This commit is contained in:
Matthias Schiffer 2019-11-07 18:28:36 +01:00
parent c29b4b0e3c
commit 8dc1ed3a1e
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C

View file

@ -133,8 +133,11 @@ static void send_type(const fastd_socket_t *sock, const fastd_peer_address_t *lo
int ret = sendmsg(sock->fd.fd, &msg, 0);
if (ret < 0 && errno == EINVAL && msg.msg_controllen) {
pr_debug2("sendmsg failed, trying again without pktinfo");
if (ret < 0 && msg.msg_controllen) {
switch (errno) {
case EINVAL:
case ENETUNREACH:
pr_debug2("sendmsg: %s (trying again without pktinfo)", strerror(errno));
if (peer && !fastd_peer_handshake_scheduled(peer))
fastd_peer_schedule_handshake_default(peer);
@ -144,6 +147,7 @@ static void send_type(const fastd_socket_t *sock, const fastd_peer_address_t *lo
ret = sendmsg(sock->fd.fd, &msg, 0);
}
}
if (ret < 0) {
switch (errno) {