]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
Merge branch 'master' into trac1239
authorTomek Mrugalski <tomasz@isc.org>
Tue, 20 Dec 2011 14:06:38 +0000 (15:06 +0100)
committerTomek Mrugalski <tomasz@isc.org>
Tue, 20 Dec 2011 14:06:38 +0000 (15:06 +0100)
Conflicts:
ChangeLog
src/bin/dhcp4/tests/Makefile.am
src/bin/dhcp6/tests/Makefile.am
src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
src/lib/dhcp/libdhcp++.cc
src/lib/dhcp/tests/pkt4_unittest.cc

13 files changed:
1  2 
ChangeLog
src/bin/dhcp4/dhcp4_srv.cc
src/bin/dhcp4/tests/Makefile.am
src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
src/lib/dhcp/iface_mgr.cc
src/lib/dhcp/iface_mgr.h
src/lib/dhcp/libdhcp++.cc
src/lib/dhcp/option.cc
src/lib/dhcp/option.h
src/lib/dhcp/pkt4.cc
src/lib/dhcp/pkt4.h
src/lib/dhcp/tests/iface_mgr_unittest.cc
src/lib/dhcp/tests/pkt4_unittest.cc

diff --cc ChangeLog
index b525e85ac2b50045ef1edd933d876c849fdebe7a,2dbb5e4ea4c901d750888a2c8b9ea83992199ece..355573224251fe25f78a15a7b4cabe679f0fa149
+++ b/ChangeLog
 +3XX.  [func]          tomek
 +      libdhcp++: Transmission and reception of DHCPv4 packets is now
 +      implemented. Low-level hacks are not implemented for transmission
 +      to hosts that don't have IPv4 address yet, so currently the code
 +      is usable for communication with relays only, not hosts on the
 +      same link.
 +      (Trac #1239, #1240, git TBD)
 +
+ 349.  [bug]           dvv
+       resolver: If an upstream server responds with FORMERR to an EDNS query,
+       try querying it without EDNS.
+       (Trac #1386, git 99ad0292af284a246fff20b3702fbd7902c45418)
+ 348.  [bug]           stephen
+       By default the logging output stream is now flushed after each write.
+       This fixes a problem seen on some systems where the log output from
+       different processes was jumbled up.  Flushing can be disabled by setting
+       the appropriate option in the logging configuration.
+       (Trac #1405, git 2f0aa20b44604b671e6bde78815db39381e563bf)
+ 347.  [bug]           jelte
+       Fixed a bug where adding Zonemgr/secondary_zones without explicitely
+       setting the class value of the added zone resulted in a cryptic
+       error in bindctl ("Error: class"). It will now correctly default to
+       IN if not set. This also adds better checks on the name and class
+       values, and better errors if they are bad.
+       (Trac #1414, git 7b122af8489acf0f28f935a19eca2c5509a3677f)
+ 346.  [build]*                jreed
+       Renamed libdhcp to libdhcp++.
+       (Trac #1446, git d394e64f4c44f16027b1e62b4ac34e054b49221d)
+ 345.  [func]          tomek
+       dhcp4: Dummy DHCPv4 component implemented. Currently it does
+       nothing useful, except providing skeleton implementation that can
+       be expanded in the future.
+       (Trac #992, git d6e33479365c8f8f62ef2b9aa5548efe6b194601)
+ 344.  [func]          y-aharen
+       src/lib/statistics: Added statistics counter library for entire server
+       items and per zone items. Also, modified b10-auth to use it. It is
+       also intended to use in the other modules such as b10-resolver.
+       (Trac #510, git afddaf4c5718c2a0cc31f2eee79c4e0cc625499f)
+ 343.  [func]          jelte
+       Added IXFR-out system tests, based on the first two test sets of
+       http://bind10.isc.org/wiki/IxfrSystemTests.
+       (Trac #1314, git 1655bed624866a766311a01214597db01b4c7cec)
+ 342.  [bug]           stephen
+       In the resolver, a FORMERR received from an upstream nameserver
+       now results in a SERVFAIL being returned as a response to the original
+       query.  Additional debug messages added to distinguish between
+       different errors in packets received from upstream nameservers.
+       (Trac #1383, git 9b2b249d23576c999a65d8c338e008cabe45f0c9)
+ 341.  [func]          tomek
+       libdhcp++: Support for handling both IPv4 and IPv6 added.
+       Also added support for binding IPv4 sockets.
+       (Trac #1238, git 86a4ce45115dab4d3978c36dd2dbe07edcac02ac)
+ 340.  [build]         jelte
+       Fixed several linker issues related to recent gcc versions, botan
+       and gtest.
+       (Trac #1442, git 91fb141bfb3aadfdf96f13e157a26636f6e9f9e3)
+ 339.  [bug]           jinmei
+       libxfr, used by b10-auth to share TCP sockets with b10-xfrout,
+       incorrectly propagated ASIO specific exceptions to the application
+       if the given file name was too long.  This could lead to
+       unexpected shut down of b10-auth.
+       (Trac #1387, git a5e9d9176e9c60ef20c0f5ef59eeb6838ed47ab2)
+ 338.  [bug]           jinmei
+       b10-xfrin didn't check SOA serials of SOA and IXFR responses,
+       which resulted in unnecessary transfer or unexpected IXFR
+       timeouts (these issues were not overlooked but deferred to be
+       fixed until #1278 was completed).  Validation on responses to SOA
+       queries were tightened, too.
+       (Trac #1299, git 6ff03bb9d631023175df99248e8cc0cda586c30a)
+ 337.  [func]          tomek
+       libdhcp++: Support for DHCPv4 option that can store a single
+       address or a list of IPv4 addresses added. Support for END option
+       added.
+       (Trac #1350, git cc20ff993da1ddb1c6e8a98370438b45a2be9e0a)
+ 336.  [func]          jelte
+       libdns++ (and its python wrapper) now includes a class Serial, for 
+       SOA SERIAL comparison and addition. Operations on instances of this 
+       class follow the specification from RFC 1982. 
+       Rdata::SOA::getSerial() now returns values of this type (and not 
+       uint32_t).
+       (Trac #1278, git 2ae72d76c74f61a67590722c73ebbf631388acbd)
+ 335.  [bug]*          jelte
+       The DataSourceClientContainer class that dynamically loads 
+       datasource backend libraries no longer provides just a .so file name 
+       to its call to dlopen(), but passes it an absolute path. This means 
+       that it is no longer an system implementation detail that depends on 
+       [DY]LD_LIBRARY_PATH which file is chosen, should there be multiple 
+       options (for instance, when test-running a new build while a 
+       different version is installed).
+       These loadable libraries are also no longer installed in the default 
+       library path, but in a subdirectory of the libexec directory of the 
+       target ($prefix/libexec/[version]/backends).
+       This also removes the need to handle b10-xfin and b10-xfrout as 
+       'special' hardcoded components, and they are now started as regular 
+       components as dictated by the configuration of the boss process.
+       (Trac #1292, git 83ce13c2d85068a1bec015361e4ef8c35590a5d0)
+ 334.  [bug]           jinmei
+       b10-xfrout could potentially create an overflow response message
+       (exceeding the 64KB max) or could create unnecessarily small
+       messages.  The former was actually unlikely to happen due to the
+       effect of name compression, and the latter was marginal and at least
+       shouldn't cause an interoperability problem, but these were still
+       potential problems and were fixed.
+       (Trac #1389, git 3fdce88046bdad392bd89ea656ec4ac3c858ca2f)
+ 333.  [bug]           dvv
+       Solaris needs "-z now" to force non-lazy binding and prevent
+       g++ static initialization code from deadlocking.
+       (Trac #1439, git c789138250b33b6b08262425a08a2a0469d90433)
+ 332.  [bug]           vorner
+       C++ exceptions in the isc.dns.Rdata wrapper are now converted
+       to python ones instead of just aborting the interpretter.
+       (Trac #1407, git 5b64e839be2906b8950f5b1e42a3fadd72fca033)
+ bind10-devel-20111128 released on November 28, 2011
+ 331.  [bug]           shane
+       Fixed a bug in data source library where a zone with more labels
+       than an out-of-bailiwick name server would cause an exception to
+       be raised.
+       (Trac #1430, git 81f62344db074bc5eea3aaf3682122fdec6451ad)
+ 330.  [bug]           jelte
+       Fixed a bug in b10-auth where it would sometimes fail because it
+       tried to check for queued msgq messages before the session was
+       fully running.
+       (git c35d0dde3e835fc5f0a78fcfcc8b76c74bc727ca)
+ 329.  [doc]           vorner, jreed
+       Document the bind10 run control configuration in guide and
+       manual page.
+       (Trac #1341, git c1171699a2b501321ab54207ad26e5da2b092d63)
  328.  [func]          jelte
        b10-auth now passes IXFR requests on to b10-xfrout, and no longer
        responds to them with NOTIMPL.
Simple merge
index c141c0946aeaab4331dc9f01fd628fe53b5c6eff,dcda356ce7387cc9e92bc1e07c8282539b37a562..b956aee8022576921c8594d04032cc0c9ff67d6c
@@@ -37,10 -37,10 +37,11 @@@ dhcp4_unittests_SOURCES += dhcp4_srv_un
  dhcp4_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
  dhcp4_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
  dhcp4_unittests_LDADD = $(GTEST_LDADD)
- dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libdhcp.la
+ dhcp4_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libasiolink.la
+ dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libdhcp++.la
  dhcp4_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
  dhcp4_unittests_LDADD += $(top_builddir)/src/lib/log/liblog.la
 +dhcp4_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libasiolink.la
  endif
  
  noinst_PROGRAMS = $(TESTS)
index 8041425212c3c3623e4d5718d99b9261fd7dab41,c1976e19d5acdd4891caf81ac5c9ad788614db6e..bb6bedee19352a73ce868aa228a2c5f348317c04
@@@ -29,12 -28,11 +29,12 @@@ using namespace isc
  using namespace isc::dhcp;
  
  namespace {
 +const char* const INTERFACE_FILE = "interfaces.txt";
  
  class NakedDhcpv4Srv: public Dhcpv4Srv {
-     // "naked" Interface Manager, exposes internal fields
+     // "naked" DHCPv4 server, exposes internal fields
  public:
 -    NakedDhcpv4Srv() { }
 +    NakedDhcpv4Srv():Dhcpv4Srv(DHCP4_SERVER_PORT + 10000) { }
  
      boost::shared_ptr<Pkt4> processDiscover(boost::shared_ptr<Pkt4>& discover) {
          return Dhcpv4Srv::processDiscover(discover);
@@@ -77,14 -66,10 +77,10 @@@ TEST_F(Dhcpv4SrvTest, basic) 
  
      Dhcpv4Srv* srv = NULL;
      ASSERT_NO_THROW({
 -        srv = new Dhcpv4Srv();
 +        srv = new Dhcpv4Srv(DHCP4_SERVER_PORT + 10000);
      });
  
-     if (srv) {
-         ASSERT_NO_THROW({
-             delete srv;
-         });
-     }
+     delete srv;
  }
  
  TEST_F(Dhcpv4SrvTest, processDiscover) {
Simple merge
Simple merge
index 6ce7766e1b649579524a12142104d4275c8c9e84,c727be208ea65a5735b362f82dd276a5356dedf9..801c1363d7526302f8ef21c4f2b2c6b36eab4cbf
@@@ -91,15 -91,15 +91,15 @@@ LibDHCP::unpackOptions4(const std::vect
      size_t offset = 0;
  
      // 2 - header of DHCPv4 option
-     while (offset + 2 <= buf.size()) {
+     while (offset + 1 <= buf.size()) {
          uint8_t opt_type = buf[offset++];
 -        if (offset + 1 == buf.size()) {
 -            if (opt_type == DHO_END)
 -                return; // just return. Don't need to add DHO_END option
 -            else {
 -                isc_throw(OutOfRange, "Attempt to parse truncated option "
 -                          << opt_type);
 -            }
 +
 +        if (opt_type == DHO_END)
 +          return; // just return. Don't need to add DHO_END option
 +
 +        if (offset + 1 >= buf.size()) {
 +          isc_throw(OutOfRange, "Attempt to parse truncated option "
 +                    << opt_type);
          }
  
          uint8_t opt_len =  buf[offset++];
Simple merge
index ff4f36e8c1344d103a916329221ee8e94dcbe11f,088d094c7ee6322fbb617d5e55c9294e4bd9cc47..00920fbd01cb170262a6291ac9d91c0ccef2eb11
@@@ -237,45 -236,11 +236,31 @@@ public
      bool
      delOption(unsigned short type);
  
 +    /// @brief Returns content of first byte.
 +    ///
 +    /// @exception OutOfRange Thrown if the option has a length of 0.
 +    ///
 +    /// @return value of the first byte
 +    uint8_t getUint8();
 +
 +    /// @brief Returns content of first word.
 +    ///
 +    /// @exception OutOfRange Thrown if the option has a length less than 2.
 +    ///
 +    /// @return uint16_t value stored on first two bytes
 +    uint16_t getUint16();
 +
 +    /// @brief Returns content of first double word.
 +    ///
 +    /// @exception OutOfRange Thrown if the option has a length less than 4.
 +    ///
 +    /// @return uint32_t value stored on first four bytes
 +    uint32_t getUint32();
 +
      /// just to force that every option has virtual dtor
 -    virtual
 -    ~Option();
 +    virtual ~Option();
  
  protected:
-     /// Builds raw (over-wire) buffer of this option, including all
-     /// defined suboptions. Version for building DHCPv4 options.
-     ///
-     /// @param buf output buffer (built options will be stored here)
-     /// @param buf_len buffer length (used for buffer overflow checks)
-     /// @param offset offset from start of the buf buffer
-     ///
-     /// @return offset to the next byte after last used byte
-     virtual unsigned int
-     pack4(boost::shared_array<uint8_t>& buf,
-           unsigned int buf_len,
-           unsigned int offset);
      /// Builds raw (over-wire) buffer of this option, including all
      /// defined suboptions. Version for building DHCPv4 options.
      ///
Simple merge
Simple merge
index feefa46bedcee1fa793542fcd723db944cdcb311,b647c18bf6e0b299b57808a710b96d2fe8564cd3..9ccc55d1ab610b7eb943ff8d8c2133fb9cfedf22
@@@ -362,92 -360,9 +368,93 @@@ TEST_F(IfaceMgrTest, sendReceive6) 
      EXPECT_TRUE( (rcvPkt->remote_port_ == 10546) || (rcvPkt->remote_port_ == 10547) );
  
      delete ifacemgr;
+     unlink(INTERFACE_FILE);
  }
  
 +TEST_F(IfaceMgrTest, sendReceive4) {
 +
 +    // testing socket operation in a portable way is tricky
 +    // without interface detection implemented
 +    createLoInterfacesTxt();
 +
 +    NakedIfaceMgr* ifacemgr = new NakedIfaceMgr();
 +
 +    // let's assume that every supported OS have lo interface
 +    IOAddress loAddr("127.0.0.1");
 +    int socket1 = 0, socket2 = 0;
 +    EXPECT_NO_THROW(
 +        socket1 = ifacemgr->openSocket(LOOPBACK, loAddr, DHCP4_SERVER_PORT + 10000);
 +        socket2 = ifacemgr->openSocket(LOOPBACK, loAddr, DHCP4_SERVER_PORT + 10000 + 1);
 +    );
 +
 +    boost::shared_ptr<Pkt4> sendPkt(new Pkt4(DHCPDISCOVER, 1234) );
 +
 +    sendPkt->setLocalAddr(IOAddress("127.0.0.1"));
 +
 +    sendPkt->setLocalPort(DHCP4_SERVER_PORT + 10000 + 1);
 +    sendPkt->setRemotePort(DHCP4_SERVER_PORT + 10000);
 +    sendPkt->setRemoteAddr(IOAddress("127.0.0.1"));
 +    sendPkt->setIndex(1);
 +    sendPkt->setIface(string(LOOPBACK));
 +    sendPkt->setHops(6);
 +    sendPkt->setSecs(42);
 +    sendPkt->setCiaddr(IOAddress("192.0.2.1"));
 +    sendPkt->setSiaddr(IOAddress("192.0.2.2"));
 +    sendPkt->setYiaddr(IOAddress("192.0.2.3"));
 +    sendPkt->setGiaddr(IOAddress("192.0.2.4"));
 +
 +    uint8_t sname[] = "That's just a string that will act as SNAME";
 +    sendPkt->setSname(sname, strlen((const char*)sname));
 +    uint8_t file[] = "/another/string/that/acts/as/a/file_name.txt";
 +    sendPkt->setFile(file, strlen((const char*)file));
 +
 +    ASSERT_NO_THROW(
 +        sendPkt->pack();
 +    );
 +
 +    boost::shared_ptr<Pkt4> rcvPkt;
 +
 +    EXPECT_EQ(true, ifacemgr->send(sendPkt));
 +
 +    rcvPkt = ifacemgr->receive4();
 +
 +    ASSERT_TRUE( rcvPkt ); // received our own packet
 +
 +    ASSERT_NO_THROW(
 +        rcvPkt->unpack();
 +    );
 +
 +    // let's check that we received what was sent
 +    EXPECT_EQ(sendPkt->len(), rcvPkt->len());
 +
 +    EXPECT_EQ("127.0.0.1", rcvPkt->getRemoteAddr().toText());
 +    EXPECT_EQ(sendPkt->getRemotePort(), rcvPkt->getLocalPort());
 +
 +    // now let's check content
 +    EXPECT_EQ(sendPkt->getHops(), rcvPkt->getHops());
 +    EXPECT_EQ(sendPkt->getOp(),   rcvPkt->getOp());
 +    EXPECT_EQ(sendPkt->getSecs(), rcvPkt->getSecs());
 +    EXPECT_EQ(sendPkt->getFlags(), rcvPkt->getFlags());
 +    EXPECT_EQ(sendPkt->getCiaddr(), rcvPkt->getCiaddr());
 +    EXPECT_EQ(sendPkt->getSiaddr(), rcvPkt->getSiaddr());
 +    EXPECT_EQ(sendPkt->getYiaddr(), rcvPkt->getYiaddr());
 +    EXPECT_EQ(sendPkt->getGiaddr(), rcvPkt->getGiaddr());
 +    EXPECT_EQ(sendPkt->getTransid(), rcvPkt->getTransid());
 +    EXPECT_EQ(sendPkt->getType(), rcvPkt->getType());
 +    EXPECT_TRUE(sendPkt->getSname() == rcvPkt->getSname());
 +    EXPECT_TRUE(sendPkt->getFile() == rcvPkt->getFile());
 +    EXPECT_EQ(sendPkt->getHtype(), rcvPkt->getHtype());
 +    EXPECT_EQ(sendPkt->getHlen(), rcvPkt->getHlen());
 +
 +    // since we opened 2 sockets on the same interface and none of them is multicast,
 +    // none is preferred over the other for sending data, so we really should not
 +    // assume the one or the other will always be choosen for sending data. We should
 +    // skip checking source port of sent address.
 +
 +    delete ifacemgr;
 +}
 +
 +
  TEST_F(IfaceMgrTest, socket4) {
  
      createLoInterfacesTxt();
index bf291e925ee498f8c4cd128f25fd4f070a2b77c6,c5965d10c864d293f5f093997a9b424e5e7b6021..c1cf3765592a65363990985885202b322d5e762e
@@@ -493,8 -493,9 +493,9 @@@ TEST(Pkt4Test, options) 
  
      // that that this extra data actually contain our options
      const uint8_t* ptr = static_cast<const uint8_t*>(buf.getData());
 -    ptr += Pkt4::DHCPV4_PKT_HDR_LEN; // rewind to end of fixed part
 +    ptr += Pkt4::DHCPV4_PKT_HDR_LEN + sizeof(DHCP_OPTIONS_COOKIE); // rewind to end of fixed part
      EXPECT_EQ(0, memcmp(ptr, v4Opts, sizeof(v4Opts)));
+     EXPECT_EQ(DHO_END, static_cast<uint8_t>(*(ptr + sizeof(v4Opts))));
  
      EXPECT_NO_THROW(
          delete pkt;