Commit 7fa91baa authored by Francis Dupont's avatar Francis Dupont

[#553] Fixed hasOpenSocket

parent 42ba6176
......@@ -484,7 +484,7 @@ AC_SEARCH_LIBS(dlsym, [dl])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
# Detect OS type (it may be used to do OS-specific things, e.g.
# interface detection in DHCP)
......
......@@ -449,16 +449,20 @@ IfaceMgr::hasOpenSocket(const IOAddress& addr) const {
// if address is unspecified (in6addr_any).
if (sock.addr_ == addr) {
return (true);
} else if (sock.addr_ == IOAddress("::")) {
} else if (sock.addr_.isV6Zero()) {
// Handle the case that the address is unspecified (any).
// This happens only with IPv6 so we do not check IPv4.
// In this case, we should check if the specified address
// belongs to any of the interfaces.
for (Iface::Address a : iface->getAddresses()) {
if (addr == a.get()) {
return (true);
for (IfacePtr it : ifaces_) {
for (Iface::Address a : it->getAddresses()) {
if (addr == a.get()) {
return (true);
}
}
}
// The address does not belongs to any interface.
return (false);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment