]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
Merge branch 'trac1283'
authorMukund Sivaraman <muks@isc.org>
Fri, 17 Jan 2014 09:14:23 +0000 (14:44 +0530)
committerMukund Sivaraman <muks@isc.org>
Fri, 17 Jan 2014 09:14:23 +0000 (14:44 +0530)
Conflicts:
src/lib/dhcp/iface_mgr.cc

14 files changed:
1  2 
src/bin/dhcp4/config_parser.cc
src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
src/bin/dhcp4/tests/dhcp4_test_utils.cc
src/bin/dhcp6/config_parser.cc
src/bin/dhcp6/dhcp6_srv.cc
src/bin/dhcp6/tests/config_parser_unittest.cc
src/lib/dhcp/iface_mgr.cc
src/lib/dhcp/pkt4.cc
src/lib/dhcp/tests/iface_mgr_unittest.cc
src/lib/dhcp/tests/pkt4_unittest.cc
src/lib/dhcp_ddns/ncr_msg.cc
src/lib/dhcpsrv/subnet.cc
src/lib/dhcpsrv/tests/alloc_engine_unittest.cc
src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc

Simple merge
Simple merge
Simple merge
index 8624c69b2ab72915d82d36e6f5f2bd0b2d4e1b45,6681cd7cb8b7103d2d22889526783c1b1431566b..e3ffe483522c55bc7897d56e381bb451bbb8facc
@@@ -497,15 -414,12 +497,14 @@@ IfaceMgr::openSockets6(const uint16_t p
          for (Iface::AddressCollection::iterator addr = unicasts.begin();
               addr != unicasts.end(); ++addr) {
  
 -            sock = openSocket(iface->getName(), *addr, port);
 -            if (sock < 0) {
 -                const char* errstr = strerror(errno);
 -                isc_throw(SocketConfigError, "failed to open unicast socket on "
 -                          << *addr << " on interface " << iface->getName()
 -                          << ", reason: " << errstr);
 +            try {
 +                openSocket(iface->getName(), *addr, port);
 +            } catch (const Exception& ex) {
 +                IFACEMGR_ERROR(SocketConfigError, error_handler,
 +                               "Failed to open unicast socket on  interface "
 +                               << iface->getName() << ", reason: "
 +                               << ex.what());
 +                continue;
              }
  
              count++;
                  continue;
              }
  
 -            sock = openSocket(iface->getName(), *addr, port);
 -            if (sock < 0) {
 -                const char* errstr = strerror(errno);
 -                isc_throw(SocketConfigError, "failed to open link-local socket on "
 -                          << *addr << " on interface "
 -                          << iface->getName() << ", reason: " << errstr);
 -            }
 -
 -            // Binding socket to unicast address and then joining multicast group
 -            // works well on Mac OS (and possibly other BSDs), but does not work
 -            // on Linux.
 -            if ( !joinMulticast(sock, iface->getName(),
 -                                string(ALL_DHCP_RELAY_AGENTS_AND_SERVERS))) {
 -                close(sock);
 -                isc_throw(SocketConfigError, "Failed to join "
 -                          << ALL_DHCP_RELAY_AGENTS_AND_SERVERS
 -                          << " multicast group.");
 +            // Open socket and join multicast group only if the interface
 +            // is multicast-capable.
 +            // @todo The DHCPv6 requires multicast so we may want to think
 +            // whether we want to open the socket on a multicast-incapable
 +            // interface or not. For now, we prefer to be liberal and allow
 +            // it for some odd use cases which may utilize non-multicast
 +            // interfaces. Perhaps a warning should be emitted if the
 +            // interface is not a multicast one.
 +
 +            // The sock variable will hold a socket descriptor. It may be
 +            // used to close a socket if the function fails to bind to
 +            // multicast address on Linux systems. Because we only bind
 +            // a socket to multicast address on Linux, on other systems
 +            // the sock variable will be initialized but unused. We have
 +            // to suppress the cppcheck warning which shows up on non-Linux
 +            // systems.
 +            // cppcheck-suppress variableScope
 +            int sock;
 +            try {
 +                // cppcheck-suppress unreadVariable
 +                sock = openSocket(iface->getName(), *addr, port,
 +                                  iface->flag_multicast_);
 +
 +            } catch (const Exception& ex) {
 +                IFACEMGR_ERROR(SocketConfigError, error_handler,
 +                               "Failed to open link-local socket on "
 +                               " interface " << iface->getName() << ": "
 +                               << ex.what());
 +                continue;
              }
  
              count++;
Simple merge
Simple merge
Simple merge
Simple merge