#include <dhcp/tests/iface_mgr_test_config.h>
#include <dhcp6/json_config_parser.h>
#include <dhcp6/tests/dhcp6_message_test.h>
+#include <dhcpsrv/utils.h>
using namespace isc;
using namespace isc::asiolink;
};
+// Test that clientID is mandatory and serverID forbidden for Confirm messages
+TEST_F(ConfirmTest, sanityCheck) {
+ NakedDhcpv6Srv srv(0);
+
+ // No clientID should fail
+ Pkt6Ptr confirm = Pkt6Ptr(new Pkt6(DHCPV6_CONFIRM, 1234));
+ EXPECT_THROW(srv.processConfirm(confirm), RFCViolation);
+
+ // A clientID should succeed
+ OptionPtr clientid = generateClientId();
+ confirm->addOption(clientid);
+ EXPECT_NO_THROW(srv.processConfirm(confirm));
+
+ // A serverID should fail
+ confirm->addOption(srv.getServerID());
+ EXPECT_THROW(srv.processConfirm(confirm), RFCViolation);
+}
+
// Test that directly connected client's Confirm message is processed and Reply
// message is sent back. In this test case, the client sends Confirm for two
// addresses that belong to the same IAID and are sent within the same IA_NA
using Dhcpv6Srv::processSolicit;
using Dhcpv6Srv::processRequest;
using Dhcpv6Srv::processRenew;
+ using Dhcpv6Srv::processRebind;
+ using Dhcpv6Srv::processConfirm;
using Dhcpv6Srv::processRelease;
+ using Dhcpv6Srv::processDecline;
+ using Dhcpv6Srv::processInfRequest;
using Dhcpv6Srv::processClientFqdn;
using Dhcpv6Srv::createNameChangeRequests;
using Dhcpv6Srv::createRemovalNameChangeRequest;
#include <dhcp/tests/iface_mgr_test_config.h>
#include <dhcp6/json_config_parser.h>
#include <dhcp6/tests/dhcp6_message_test.h>
+#include <dhcpsrv/utils.h>
using namespace isc;
using namespace isc::asiolink;
}
};
+// Test that clientID is mandatory and serverID forbidden for Rebind messages
+TEST_F(RebindTest, sanityCheck) {
+ NakedDhcpv6Srv srv(0);
+
+ // No clientID should fail
+ Pkt6Ptr rebind = Pkt6Ptr(new Pkt6(DHCPV6_REBIND, 1234));
+ EXPECT_THROW(srv.processRebind(rebind), RFCViolation);
+
+ // A clientID should succeed
+ OptionPtr clientid = generateClientId();
+ rebind->addOption(clientid);
+ EXPECT_NO_THROW(srv.processRebind(rebind));
+
+ // A serverID should fail
+ rebind->addOption(srv.getServerID());
+ EXPECT_THROW(srv.processRebind(rebind), RFCViolation);
+}
+
// Test that directly connected client's Rebind message is processed and Reply
// message is sent back.
TEST_F(RebindTest, directClient) {