From: Frank Kardel Date: Fri, 8 Sep 2006 20:42:56 +0000 (+0000) Subject: configure.ac: X-Git-Tag: NTP_4_2_3P41~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=376732bcaa2577b17d06fe93c6fe39c26ce2a688;p=thirdparty%2Fntp.git configure.ac: 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 --- diff --git a/configure.ac b/configure.ac index bf0515b4f..6c4f912b1 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/ntpd/ntp_io.c b/ntpd/ntp_io.c index 9d15155d0..9e4d7b29f 100644 --- a/ntpd/ntp_io.c +++ b/ntpd/ntp_io.c @@ -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 */ } /*