From: Miroslav Lichvar Date: Mon, 11 May 2020 10:27:34 +0000 (+0200) Subject: socket: don't set interface for sent packets X-Git-Tag: 4.0-pre3~145 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e49aececceaa480799fe43fa1ccb1420c3dbe6d4;p=thirdparty%2Fchrony.git socket: don't set interface for sent packets With asymmetric routing (e.g. with BGP) it may not be possible to respond to a request using the same interface. In such case, setting the interface index in IP*_PKTINFO* causes the packet to be silently dropped by the kernel. Until we can predict if sending with the specified interface will succeed, or provide only a hint, don't set the interface and leave it to the kernel to select an interface. This reverts commit 5fc7674e366f ("ntp: set interface index in IP*_PKTINFO when responding"). Reported-by: Arkadiusz Miƛkiewicz --- diff --git a/socket.c b/socket.c index 48791230..65befc7a 100644 --- a/socket.c +++ b/socket.c @@ -1020,8 +1020,6 @@ send_message(int sock_fd, SCK_Message *message, int flags) return 0; ipi->ipi_spec_dst.s_addr = htonl(message->local_addr.ip.addr.in4); - if (message->if_index != INVALID_IF_INDEX) - ipi->ipi_ifindex = message->if_index; #elif defined(IP_SENDSRCADDR) struct in_addr *addr; @@ -1046,8 +1044,6 @@ send_message(int sock_fd, SCK_Message *message, int flags) memcpy(&ipi->ipi6_addr.s6_addr, &message->local_addr.ip.addr.in6, sizeof(ipi->ipi6_addr.s6_addr)); - if (message->if_index != INVALID_IF_INDEX) - ipi->ipi6_ifindex = message->if_index; } #endif }