]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
configure.ac:
authorFrank Kardel <kardel@ntp.org>
Fri, 8 Sep 2006 20:42:56 +0000 (20:42 +0000)
committerFrank Kardel <kardel@ntp.org>
Fri, 8 Sep 2006 20:42:56 +0000 (20:42 +0000)
  add config fragment to conditionally re-bind sockets
  for OSes that fail to flush cached routes when more
  specific route are discovered.
ntp_io.c:
  re-bind sockets on OSes that fail to
  flush cached routes when more specific
  routes are discovered.

bk: 4501d5d0ya-sbhpLQnRWcUF7y03Mbg

configure.ac
ntpd/ntp_io.c

index bf0515b4f9f174d93cb996cf1fa147b2a66b3d8f..6c4f912b10f62e007176ca00482ba0d6fcf214c1 100644 (file)
@@ -1445,6 +1445,19 @@ case "$ac_cv_func_ctty_for_f_setown" in
  yes) AC_DEFINE(USE_FSETOWNCTTY, 1, [Must we have a CTTY for fsetown?]) ;;
 esac
 
+AC_CACHE_CHECK(if the OS misses to clear cached routes when more specific routes become available, ac_cv_os_routeupdates,
+[[case "$host" in
+ *-*-netbsd*)
+    ans=yes
+    ;;
+ *) ans=no
+    ;;
+esac
+ac_cv_os_routeupdates=$ans]])
+case "$ac_cv_os_routeupdates" in
+ yes) AC_DEFINE(OS_MISSES_SPECIFIC_ROUTE_UPDATES, 1, [need to recreate sockets on changed routing?]) ;;
+esac
+
 ntp_warning='GRONK'
 AC_MSG_CHECKING(if we'll use clock_settime or settimeofday or stime)
 case "$ac_cv_func_clock_settime$ac_cv_func_settimeofday$ac_cv_func_stime" in
index 9d15155d0336db5814b8befb7bf67672c0e46eca..9e4d7b29f9e8cd53b085aea3d42b55c46c932f0a 100644 (file)
@@ -974,13 +974,17 @@ convert_isc_if(isc_interface_t *isc_if, struct interface *itf, u_short port) {
 
 /*
  * refresh_interface
- * check to see if getsockname of the current socket still agrees
- * with the original binding address
- * if not - recreate sockets if possible
+ *
+ * some OSes have been observed to keep
+ * cached routes even when more specific routes
+ * become available.
+ * this can be mitigated by re-binding
+ * the socket.
  */
 static int
 refresh_interface(struct interface * interface)
 {
+#ifdef  OS_MISSES_SPECIFIC_ROUTE_UPDATES
        if (interface->fd != INVALID_SOCKET)
        {
                close_and_delete_fd_from_list(interface->fd);
@@ -993,6 +997,9 @@ refresh_interface(struct interface * interface)
        {
                return 0;       /* invalid sockets are not refreshable */
        }
+#else /* !OS_MISSES_SPECIFIC_ROUTE_UPDATES */
+       return interface->fd != INVALID_SOCKET;
+#endif /* !OS_MISSES_SPECIFIC_ROUTE_UPDATES */
 }
 
 /*