addresses on that interface.
bk: 4ad69770UjMPMqJfcP_kAFfvL7y5ow
+* [Bug 1342] ignore|drop one IPv6 address on an interface blocks all
+ addresses on that interface.
(4.2.5p232-RC) 2009/10/14 Released by Harlan Stenn <stenn@ntp.org>
* [Bug 1302] OpenSSL under Windows needs applink support.
* [Bug 1337] fix incorrect args to setsockopt(fd, IP_MULTICAST_IF,...).
}
/*
- * Unlike on POSIX systems, Windows does not provide the broadcast
- * address associated with each interface address, so we need to
- * reconstruct it from the address and mask.
+ * Windows always provides 255.255.255.255 as the the broadcast
+ * address. ntpd needs to know the broadcast address which will target
+ * only that network interface, not all. Reconstruct it from the
+ * address and mask.
*/
-
static void
get_broadcastaddr(isc_netaddr_t *bcastaddr, isc_netaddr_t *addr, isc_netaddr_t *netmask) {
(struct sockaddr *)&(iter->IFData.iiBroadcastAddress));
}
- /*
- * If the interface is broadcast, get the broadcast address.
- */
- if ((iter->current.flags & INTERFACE_F_BROADCAST) != 0) {
- get_addr(AF_INET, &iter->current.broadcast,
- (struct sockaddr *)&(iter->IFData.iiBroadcastAddress));
- /* !!! get_broadcastaddr(&iter->current.broadcast, &iter->current.address,
- &iter->current.netmask); */
- }
-
- if (ifNamed == FALSE)
- sprintf(iter->current.name,
- "TCP/IP Interface %d", iter->numIF);
-
/*
* Get the network mask.
*/
(struct sockaddr *)&(iter->IFData.iiNetmask));
/*
- * If the interface is broadcast, get the broadcast address.
+ * If the interface is broadcast, get the broadcast address,
+ * based on the unicast address and network mask.
*/
- if ((iter->current.flags & INTERFACE_F_BROADCAST) != 0) {
- get_addr(AF_INET, &iter->current.broadcast,
- (struct sockaddr *)&(iter->IFData.iiBroadcastAddress));
- get_broadcastaddr(&iter->current.broadcast, &iter->current.address,
- &iter->current.netmask);
- }
+ if ((iter->current.flags & INTERFACE_F_BROADCAST) != 0)
+ get_broadcastaddr(&iter->current.broadcast,
+ &iter->current.address,
+ &iter->current.netmask);
if (ifNamed == FALSE)
sprintf(iter->current.name,
curr_peer->host_mode))
peer_config(&peeraddr,
- ANY_INTERFACE_CHOOSE(&peeraddr),
+ NULL,
hmode,
curr_peer->peerversion,
curr_peer->minpoll,
static void
list_if_listening(
- struct interface * interface
+ struct interface * iface
)
{
- msyslog(LOG_INFO, "Listening on interface #%d %s, %s#%d %s",
- interface->ifnum,
- interface->name,
- stoa(&interface->sin),
- SRCPORT(&interface->sin),
- (interface->ignore_packets)
- ? "Disabled"
- : "Enabled");
+ msyslog(LOG_INFO, "%s on %d %s %s UDP %d",
+ (iface->ignore_packets)
+ ? "Listen and drop"
+ : "Listen normally",
+ iface->ifnum,
+ iface->name,
+ stoa(&iface->sin),
+ SRCPORT(&iface->sin));
}
* another address is enabled on the same subnet.
* See http://bugs.ntp.org/1184 for more detail.
*/
- if (NULL == iface)
+ if (NULL == iface || iface->ignore_packets)
iface = getsamenetinterface(&saddr, flags);
/* Don't use an interface which will ignore replies */
*/
nif = findlocalinterface(addr, 0, 0);
- if (nif) {
+ if (nif != NULL && !nif->ignore_packets) {
DPRINTF(2, ("findlocalcastinterface: kernel recommends interface #%d %s for %s\n",
nif->ifnum, nif->name, stoa(addr)));
return nif;
}
/*
- * Find an address in the list on the same network as addr
+ * Find an address in the list on the same network as addr which is not
+ * addr.
*/
static struct interface *
find_samenet_addr_in_list(
entry != NULL;
entry = entry->link)
- if (same_network(&entry->addr, &entry->interface->mask,
- addr)) {
+ if (!SOCK_EQ(addr, &entry->addr)
+ && same_network(&entry->addr,
+ &entry->interface->mask,
+ addr)) {
DPRINTF(4, ("FOUND\n"));
return entry->interface;
}
* clear crypto if we change the local address
*/
if (peer->dstadr != piface && !(peer->cast_flags &
- MDF_BCLNT))
+ (MDF_ACAST | MDF_BCLNT)))
peer_clear(peer, "XFAC");
/*
if ( isc_win32os_majorversion() <= 4 )
accept_wildcard_if_for_winnt = 1;
- /* Command line users should put -n in the options */
+ /*
+ * This is a hack in the Windows port of ntpd. Before the
+ * portable ntpd libopts processing of the command line, we
+ * need to know if we're "daemonizing" (attempting to start as
+ * a service). There is undoubtedly a better way. Legitimate
+ * option combinations are broken by this code , such as:
+ * ntpd -nc debug.conf
+ */
while (argv[i]) {
- if (!_strnicmp(argv[i], "-d", 2) ||
- !strcmp(argv[i], "-q") ||
- !strcmp(argv[i], "--help") ||
- !strcmp(argv[i], "-n")) {
+ if (!_strnicmp(argv[i], "-d", 2)
+ || !strcmp(argv[i], "--debug_level")
+ || !strcmp(argv[i], "--set-debug_level")
+ || !strcmp(argv[i], "-q")
+ || !strcmp(argv[i], "--quit")
+ || !strcmp(argv[i], "-?")
+ || !strcmp(argv[i], "--help")
+ || !_strnicmp(argv[i], "-n", 2)
+ || !strcmp(argv[i], "--nofork")
+ || !strcmp(argv[i], "--saveconfigquit")) {
foreground = TRUE;
break;
}
i++;
}
- if (foreground) {
- /* run in console window */
+ if (foreground) /* run in console window */
rc = ntpdmain(argc, argv);
- } else {
+ else {
/* Start up as service */
SERVICE_TABLE_ENTRY dispatchTable[] = {