EXPECT_NO_THROW(client.doDORA());
}
+// This test verifies that the server is able to handle too long client-id
+// in incoming client message.
+TEST_F(Dhcpv4SrvTest, tooLongClientId) {
+ IfaceMgrTestConfig test_config(true);
+ IfaceMgr::instance().openSockets4();
+ Dhcp4Client client;
+
+ EXPECT_NO_THROW(configure(CONFIGS[0], *client.getServer()));
+
+ // Tell the client to not send client-id on its own.
+ client.includeClientId("");
+
+ // Instead, tell him to send this extra option, which happens to be
+ // an empty client-id.
+ std::vector<uint8_t> data(250, 250);
+ OptionPtr long_client_id(new Option(Option::V4, DHO_DHCP_CLIENT_IDENTIFIER,
+ data));
+ client.addExtraOption(long_client_id);
+
+ // Let's check whether the server is able to process this packet without
+ // throwing any exceptions. We don't care whether the server sent any
+ // responses or not. The goal is to check that the server didn't throw
+ // any exceptions.
+ EXPECT_NO_THROW(client.doDORA());
+}
+
/// @todo: Implement proper tests for MySQL lease/host database,
/// see ticket #4214.
EXPECT_NO_THROW(client.doSARR());
}
+// This test verifies that the server is able to handle a too large DUID (server-id)
+// in incoming client message.
+TEST_F(Dhcpv6SrvTest, tooLongServerId) {
+ Dhcp6Client client;
+
+ // The following configuration enables RSOO options: 110 and 120.
+ // It also configures the server with option 120 which should
+ // "override" the option 120 sent in the RSOO by the relay.
+ string config =
+ "{"
+ " \"preferred-lifetime\": 3000,"
+ " \"rebind-timer\": 2000, "
+ " \"renew-timer\": 1000, "
+ " \"subnet6\": [ { "
+ " \"pools\": [ { \"pool\": \"2001:db8::/64\" } ],"
+ " \"subnet\": \"2001:db8::/48\" "
+ " } ],"
+ " \"valid-lifetime\": 4000"
+ "}";
+
+ EXPECT_NO_THROW(configure(config, *client.getServer()));
+
+ // Tell the client to use this specific server-id.
+ std::vector<uint8_t> data(250, 250);
+ OptionPtr long_server_id(new Option(Option::V6, D6O_SERVERID, data));
+ client.useServerId(long_server_id);
+
+ // Let's check whether the server is able to process this packet without
+ // throwing any exceptions. We don't care whether the server sent any
+ // responses or not. The goal is to check that the server didn't throw
+ // any exceptions.
+ EXPECT_NO_THROW(client.doSARR());
+}
+
/// @todo: Add more negative tests for processX(), e.g. extend sanityCheck() test
/// to call processX() methods.