]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Merge branch 'trac2526'
authorMarcin Siodelski <marcin@isc.org>
Mon, 17 Dec 2012 14:35:20 +0000 (15:35 +0100)
committerMarcin Siodelski <marcin@isc.org>
Mon, 17 Dec 2012 14:35:20 +0000 (15:35 +0100)
Conflicts:
src/lib/dhcp/pkt4.cc
src/lib/dhcp/std_option_defs.h

1  2 
src/bin/dhcp6/dhcp6_srv.cc
src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
src/lib/dhcp/option.cc
src/lib/dhcp/option.h
src/lib/dhcp/pkt4.cc
src/lib/dhcp/tests/pkt4_unittest.cc

Simple merge
Simple merge
Simple merge
index 15c885c968996c43fba24d42762ee566008f974a,35342951fe5bdd1943e82f30487c610294da4b60..15c8f4eb43dce44923ca9ce0b6f12acfe5d695ee
@@@ -188,12 -185,12 +189,13 @@@ Pkt4::unpack() 
  }
  
  void Pkt4::check() {
-     boost::shared_ptr<Option> typeOpt = getOption(DHO_DHCP_MESSAGE_TYPE);
+     boost::shared_ptr<OptionInt<uint8_t> > typeOpt =
+         boost::dynamic_pointer_cast<OptionInt<uint8_t> >(getOption(DHO_DHCP_MESSAGE_TYPE));
      if (typeOpt) {
-         uint8_t msg_type = typeOpt->getUint8();
+         uint8_t msg_type = typeOpt->getValue();
 -        if (msg_type>DHCPLEASEACTIVE) {
 -            isc_throw(BadValue, "Invalid DHCP message type received:" << msg_type);
 +        if (msg_type > DHCPLEASEACTIVE) {
 +            isc_throw(BadValue, "Invalid DHCP message type received: "
 +                      << msg_type);
          }
          msg_type_ = msg_type;
  
index 2ef982aa3badf46e7aa4da47bd886093de50a5a7,e484dcce35ad259b305e1bdb7b7bc67c7450db19..bd848ff26f6e6d0a18fb0956d6fd738d5311c584
@@@ -456,19 -451,19 +456,23 @@@ TEST(Pkt4Test, file) 
          delete pkt;
      }
  
 +    // Check that a null argument generates an exception.
 +    Pkt4 pkt4(DHCPOFFER, 1234);
 +    EXPECT_THROW(pkt4.setFile(NULL, Pkt4::MAX_FILE_LEN), InvalidParameter);
 +    EXPECT_THROW(pkt4.setFile(NULL, 0), InvalidParameter);
  }
  
+ /// V4 Options being used for pack/unpack testing.
+ /// For test simplicity, all selected options have
+ /// variable length data so as there are no restrictions
+ /// on a length of their data.
  static uint8_t v4Opts[] = {
-     12,  3, 0,   1,  2,
-     13,  3, 10, 11, 12,
-     14,  3, 20, 21, 22,
-     53, 1, 1, // DHCP_MESSAGE_TYPE (required to not throw exception during unpack)
-     128, 3, 30, 31, 32,
-     254, 3, 40, 41, 42,
+     12,  3, 0,   1,  2, // Hostname
+     14,  3, 10, 11, 12, // Merit Dump File
+     53, 1, 1, // Message Type (required to not throw exception during unpack)
+     60,  3, 20, 21, 22, // Class Id
+     128, 3, 30, 31, 32, // Vendor specific
+     254, 3, 40, 41, 42, // Reserved
  };
  
  TEST(Pkt4Test, options) {