From e49aececceaa480799fe43fa1ccb1420c3dbe6d4 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 11 May 2020 12:27:34 +0200 Subject: [PATCH] socket: don't set interface for sent packets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- socket.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/socket.c b/socket.c index 4879123..65befc7 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 }