-* Bug [1193] Compile error: conflicting types for emalloc
+* Bug [1041] manycastclient fails with 4.2.5p120.
+* Bug [1193] Compile error: conflicting types for emalloc.
+* Bug [1196] VC6 winsock2.h does not define SO_EXLUSIVEADDRUSE.
* xmt -> aorg timestamp cleanup from Dave Mills, reported by Dave Hart.
* Leap/expire cleanup from Dave Mills.
(4.2.5p178) 2009/05/21 Released by Harlan Stenn <stenn@ntp.org>
}
/*
- * findlocalinterface - find local interface index corresponding to address
+ * findlocalinterface - find local interface corresponding to addr,
+ * which does not have any of flags set. If bast is nonzero, addr is
+ * a broadcast address.
*
* This code attempts to find the local sending address for an outgoing
* address by connecting a new socket to destinationaddress:NTP_PORT
findlocalinterface(
struct sockaddr_storage *addr,
int flags,
- int bflag
+ int bcast
)
{
SOCKET s;
* If we are looking for broadcast interface we need to set this
* socket to allow broadcast
*/
- if (bflag & INT_BROADCAST)
+ if (bcast)
setsockopt(s, SOL_SOCKET, SO_BROADCAST,
- (char *)&on, sizeof(on));
+ (char *)&on, sizeof(on));
rtn = connect(s, (struct sockaddr *)&saddr, SOCKLEN(&saddr));
if (rtn == SOCKET_ERROR)
DPRINTF(4, ("findlocalinterface: kernel maps %s to %s\n", stoa(addr), stoa(&saddr)));
iface = getinterface(&saddr, flags);
+
+ /*
+ * if we didn't find an exact match on saddr check for an
+ * interface on the same subnet as saddr. This handles the
+ * case of the address suggested by the kernel being
+ * excluded by the user's -I and -L options to ntpd, when
+ * another address is enabled on the same subnet.
+ * See http://bugs.ntp.org/1184 for more detail.
+ */
if (NULL == iface)
iface = getsamenetinterface(&saddr, flags);
DPRINTF(4, ("Finding broadcast/multicast interface for addr %s in list of addresses\n",
stoa(addr)));
- interface = findlocalinterface(addr, INT_LOOPBACK|INT_WILDCARD, INT_BROADCAST);
+ interface = findlocalinterface(addr, INT_LOOPBACK | INT_WILDCARD, 1);
if (interface != NULL)
{
- DPRINTF(4, ("Found bcast-/mcast- interface index #%d %s\n", interface->ifnum, interface->name));
+ DPRINTF(4, ("Easily found bcast-/mcast- interface index #%d %s\n", interface->ifnum, interface->name));
return interface;
}