]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
socket: don't set interface for sent packets
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 11 May 2020 10:27:34 +0000 (12:27 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 14 May 2020 13:37:38 +0000 (15:37 +0200)
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 <arekm@maven.pl>
socket.c

index 4879123087c3ad7d359c82e3c637064964c5d85f..65befc7ac9ca00609fb694ef8c688e274f1e28aa 100644 (file)
--- 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
   }