From: Francis Dupont Date: Wed, 11 Apr 2018 15:40:52 +0000 (+0200) Subject: [master] Fixed merge error X-Git-Tag: trac5458a_base~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab60973a8ee02f585ac6b6b5ccb1a20966f8a019;p=thirdparty%2Fkea.git [master] Fixed merge error --- diff --git a/src/bin/dhcp6/tests/classify_unittests.cc b/src/bin/dhcp6/tests/classify_unittests.cc index 631ae9f777..d99b5fcd5f 100644 --- a/src/bin/dhcp6/tests/classify_unittests.cc +++ b/src/bin/dhcp6/tests/classify_unittests.cc @@ -1029,98 +1029,6 @@ TEST_F(ClassifyTest, clientClassifyPool) { EXPECT_TRUE(ia_na3->getOption(D6O_IAADDR)); } -// Checks if the client-class field is indeed used for pool selection. -TEST_F(ClassifyTest, clientClassifyPool) { - IfaceMgrTestConfig test_config(true); - - NakedDhcpv6Srv srv(0); - - // This test configures 2 pools. - // The second pool does not play any role here. The client's - // IP address belongs to the first pool, so only that first - // pool is being tested. - std::string config = "{ \"interfaces-config\": {" - " \"interfaces\": [ \"*\" ]" - "}," - "\"preferred-lifetime\": 3000," - "\"rebind-timer\": 2000, " - "\"renew-timer\": 1000, " - "\"client-classes\": [ " - " { " - " \"name\": \"foo\" " - " }, " - " { " - " \"name\": \"bar\" " - " } " - "], " - "\"subnet6\": [ " - " { \"pools\": [ " - " { " - " \"pool\": \"2001:db8:1::/64\", " - " \"client-class\": \"foo\" " - " }, " - " { " - " \"pool\": \"2001:db8:2::/64\", " - " \"client-class\": \"xyzzy\" " - " } " - " ], " - " \"subnet\": \"2001:db8:2::/40\" " - " } " - "], " - "\"valid-lifetime\": 4000 }"; - - ASSERT_NO_THROW(configure(config)); - - OptionPtr clientid = generateClientId(); - Pkt6Ptr query1 = Pkt6Ptr(new Pkt6(DHCPV6_SOLICIT, 1234)); - query1->setRemoteAddr(IOAddress("2001:db8:1::3")); - query1->addOption(generateIA(D6O_IA_NA, 234, 1500, 3000)); - query1->addOption(clientid); - query1->setIface("eth1"); - Pkt6Ptr query2 = Pkt6Ptr(new Pkt6(DHCPV6_SOLICIT, 1234)); - query2->setRemoteAddr(IOAddress("2001:db8:1::3")); - query2->addOption(generateIA(D6O_IA_NA, 234, 1500, 3000)); - query2->addOption(clientid); - query2->setIface("eth1"); - Pkt6Ptr query3 = Pkt6Ptr(new Pkt6(DHCPV6_SOLICIT, 1234)); - query3->setRemoteAddr(IOAddress("2001:db8:1::3")); - query3->addOption(generateIA(D6O_IA_NA, 234, 1500, 3000)); - query3->addOption(clientid); - query3->setIface("eth1"); - - // This discover does not belong to foo class, so it will not - // be serviced - srv.classifyPacket(query1); - Pkt6Ptr response1 = srv.processSolicit(query1); - ASSERT_TRUE(response1); - OptionPtr ia_na1 = response1->getOption(D6O_IA_NA); - ASSERT_TRUE(ia_na1); - EXPECT_TRUE(ia_na1->getOption(D6O_STATUS_CODE)); - EXPECT_FALSE(ia_na1->getOption(D6O_IAADDR)); - - // Let's add the packet to bar class and try again. - query2->addClass("bar"); - // Still not supported, because it belongs to wrong class. - srv.classifyPacket(query2); - Pkt6Ptr response2 = srv.processSolicit(query2); - ASSERT_TRUE(response2); - OptionPtr ia_na2 = response2->getOption(D6O_IA_NA); - ASSERT_TRUE(ia_na2); - EXPECT_TRUE(ia_na2->getOption(D6O_STATUS_CODE)); - EXPECT_FALSE(ia_na2->getOption(D6O_IAADDR)); - - // Let's add it to matching class. - query3->addClass("foo"); - // This time it should work - srv.classifyPacket(query3); - Pkt6Ptr response3 = srv.processSolicit(query3); - ASSERT_TRUE(response3); - OptionPtr ia_na3 = response3->getOption(D6O_IA_NA); - ASSERT_TRUE(ia_na3); - EXPECT_FALSE(ia_na3->getOption(D6O_STATUS_CODE)); - EXPECT_TRUE(ia_na3->getOption(D6O_IAADDR)); -} - // Tests whether a packet with custom vendor-class (not erouter or docsis) // is classified properly. TEST_F(ClassifyTest, vendorClientClassification2) {