]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3795] One extra unit-test implemented for pkt6-receive-drop
authorTomek Mrugalski <tomasz@isc.org>
Fri, 19 Jun 2015 13:54:30 +0000 (15:54 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Fri, 19 Jun 2015 13:54:30 +0000 (15:54 +0200)
src/bin/dhcp6/tests/sarr_unittest.cc

index f7a75b0218ff5725d3fb7e2e506ee550e6fe1c78..247484478fd91229464648963e609afcd66a23fe 100644 (file)
@@ -373,7 +373,8 @@ TEST_F(SARRTest, pkt6ReceiveDropStat1) {
 }
 
 // This test verifies that pkt6-receive-drop is increased properly when the
-// client's packet is rejected due to sending to unicast.
+// client's packet is rejected due to having too many client-id options
+// (exactly one is expected).
 TEST_F(SARRTest, pkt6ReceiveDropStat2) {
 
     // Let's use one of the existing configurations and tell the client to
@@ -396,5 +397,34 @@ TEST_F(SARRTest, pkt6ReceiveDropStat2) {
     EXPECT_EQ(1, pkt6_recv_drop->getInteger().first);
 }
 
+// This test verifies that pkt6-receive-drop is increased properly when the
+// client's packet is rejected due to having too many
+TEST_F(SARRTest, pkt6ReceiveDropStat3) {
+
+    // Let's use one of the existing configurations and tell the client to
+    // ask for an address.
+    Dhcp6Client client;
+    configure(CONFIGS[1], *client.getServer());
+    client.setInterface("eth1");
+    client.useNA();
+
+    client.setDestAddress(asiolink::IOAddress("2001:db8::1")); // Pretend it's unicast
+
+    // Let's send our client-id as server-id. That will result in the
+    // packet containing the client-id twice. That should cause RFCViolation
+    // exception.
+    client.useServerId(client.getClientId());
+    client.doSolicit();
+
+    // Ok, let's check the statistics. None should be present.
+    using namespace isc::stats;
+    StatsMgr& mgr = StatsMgr::instance();
+
+    ObservationPtr pkt6_recv_drop = mgr.getObservation("pkt6-receive-drop");
+    ASSERT_TRUE(pkt6_recv_drop);
+
+    EXPECT_EQ(1, pkt6_recv_drop->getInteger().first);
+}
+
 
 } // end of anonymous namespace