summaryrefslogtreecommitdiff
path: root/contrib/ntp/ntpd/ntp_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ntp/ntpd/ntp_io.c')
-rw-r--r--contrib/ntp/ntpd/ntp_io.c59
1 files changed, 44 insertions, 15 deletions
diff --git a/contrib/ntp/ntpd/ntp_io.c b/contrib/ntp/ntpd/ntp_io.c
index 43cf3b8292ba3..2b5a003e00615 100644
--- a/contrib/ntp/ntpd/ntp_io.c
+++ b/contrib/ntp/ntpd/ntp_io.c
@@ -73,6 +73,19 @@
extern int listen_to_virtual_ips;
+#ifndef IPTOS_DSCP_EF
+#define IPTOS_DSCP_EF 0xb8
+#endif
+int qos = IPTOS_DSCP_EF; /* QoS RFC3246 */
+
+#ifdef LEAP_SMEAR
+/* TODO burnicki: This should be moved to ntp_timer.c, but if we do so
+ * we get a linker error. Since we're running out of time before the leap
+ * second occurs, we let it here where it just works.
+ */
+int leap_smear_intv;
+#endif
+
/*
* NIC rule entry
*/
@@ -2018,6 +2031,32 @@ update_interfaces(
if (sys_bclient)
io_setbclient();
+ /*
+ * Check multicast interfaces and try to join multicast groups if
+ * not joined yet.
+ */
+ for (ep = ep_list; ep != NULL; ep = ep->elink) {
+ remaddr_t *entry;
+
+ if (!(INT_MCASTIF & ep->flags) || (INT_MCASTOPEN & ep->flags))
+ continue;
+
+ /* Find remote address that was linked to this interface */
+ for (entry = remoteaddr_list;
+ entry != NULL;
+ entry = entry->link) {
+ if (entry->ep == ep) {
+ if (socket_multicast_enable(ep, &entry->addr)) {
+ msyslog(LOG_INFO,
+ "Joined %s socket to multicast group %s",
+ stoa(&ep->sin),
+ stoa(&entry->addr));
+ }
+ break;
+ }
+ }
+ }
+
return new_interface_found;
}
@@ -2441,12 +2480,12 @@ socket_multicast_enable(
IP_ADD_MEMBERSHIP,
(char *)&mreq,
sizeof(mreq))) {
- msyslog(LOG_ERR,
+ DPRINTF(2, (
"setsockopt IP_ADD_MEMBERSHIP failed: %m on socket %d, addr %s for %x / %x (%s)",
iface->fd, stoa(&iface->sin),
mreq.imr_multiaddr.s_addr,
mreq.imr_interface.s_addr,
- stoa(maddr));
+ stoa(maddr)));
return ISC_FALSE;
}
DPRINTF(4, ("Added IPv4 multicast membership on socket %d, addr %s for %x / %x (%s)\n",
@@ -2471,10 +2510,10 @@ socket_multicast_enable(
if (setsockopt(iface->fd, IPPROTO_IPV6,
IPV6_JOIN_GROUP, (char *)&mreq6,
sizeof(mreq6))) {
- msyslog(LOG_ERR,
+ DPRINTF(2, (
"setsockopt IPV6_JOIN_GROUP failed: %m on socket %d, addr %s for interface %u (%s)",
iface->fd, stoa(&iface->sin),
- mreq6.ipv6mr_interface, stoa(maddr));
+ mreq6.ipv6mr_interface, stoa(maddr)));
return ISC_FALSE;
}
DPRINTF(4, ("Added IPv6 multicast group on socket %d, addr %s for interface %u (%s)\n",
@@ -2776,11 +2815,6 @@ io_multicast_add(
"Joined %s socket to multicast group %s",
stoa(&ep->sin),
stoa(addr));
- else
- msyslog(LOG_ERR,
- "Failed to join %s socket to multicast group %s",
- stoa(&ep->sin),
- stoa(addr));
}
add_addr_to_list(addr, one_ep);
@@ -2851,11 +2885,6 @@ open_socket(
int on = 1;
int off = 0;
-#ifndef IPTOS_DSCP_EF
-#define IPTOS_DSCP_EF 0xb8
-#endif
- int qos = IPTOS_DSCP_EF; /* QoS RFC3246 */
-
if (IS_IPV6(addr) && !ipv6_works)
return INVALID_SOCKET;
@@ -3585,7 +3614,7 @@ io_handler(void)
else if (debug > 4) {
msyslog(LOG_DEBUG, "select(): nfound=%d, error: %m", nfound);
} else {
- DPRINTF(1, ("select() returned %d: %m\n", nfound));
+ DPRINTF(3, ("select() returned %d: %m\n", nfound));
}
# endif /* DEBUG */
# else /* HAVE_SIGNALED_IO */