using namespace std;
using namespace boost;
-const std::string HARDCODED_DNS_SERVER = "2001:db8:1::1";
-
Dhcpv6Srv::Dhcpv6Srv(uint16_t port) {
LOG_DEBUG(dhcp6_logger, DBG_DHCP6_START, DHCP6_OPEN_SOCKET).arg(port);
.arg(question->getRemoteAddr().toText());
return;
}
- // Add DNS_SERVERS option. It should have been configured.
- const Subnet::OptionContainer& options = subnet->getOptions();
- const Subnet::OptionContainerTypeIndex& idx = options.get<1>();
- const Subnet::OptionContainerTypeRange range =
- idx.equal_range(D6O_NAME_SERVERS);
- // In theory we may have multiple options with the same
- // option code. They are not differentiated right now
- // until support for option spaces is implemented.
- // Until that's the case, simply add the first found option.
- if (std::distance(range.first, range.second) > 0) {
- answer->addOption(range.first->option);
- }
+
}
void Dhcpv6Srv::appendRequestedOptions(const Pkt6Ptr& question, Pkt6Ptr& answer) {
return;
}
- // Add dns-servers option.
- OptionPtr dnsservers(new Option6AddrLst(D6O_NAME_SERVERS,
- IOAddress(HARDCODED_DNS_SERVER)));
- answer->addOption(dnsservers);
-
// Client requests some options using ORO option. Try to
// get this option from client's message.
boost::shared_ptr<Option6IntArray<uint16_t> > option_oro =
// We have not requested option with code 1000 so it should not
// be included in the response.
ASSERT_FALSE(adv->getOption(1000));
+ ASSERT_FALSE(adv->getOption(D6O_NAME_SERVERS));
// Let's now request option with code 1000.
// We expect that server will include this option in its reply.
boost::shared_ptr<Option6IntArray<uint16_t> >
option_oro(new Option6IntArray<uint16_t>(D6O_ORO));
- // Create vector with one code equal to 1000.
- std::vector<uint16_t> codes(1, 1000);
+ // Create vector with two option codes.
+ std::vector<uint16_t> codes(2);
+ codes[0] = 1000;
+ codes[1] = D6O_NAME_SERVERS;
// Pass this code to option.
option_oro->setValues(codes);
// Append ORO to SOLICIT message.
// - copy of client-id
// - server-id
// - IA that includes IAADDR
-TEST_F(Dhcpv6SrvTest, SolicitBasic2) {
+TEST_F(Dhcpv6SrvTest, SolicitBasic) {
boost::scoped_ptr<NakedDhcpv6Srv> srv;
ASSERT_NO_THROW( srv.reset(new NakedDhcpv6Srv(0)) );