-# A very simply stateless configuration that provides DNS servers information
-# to all clients, regardless of their point of attachment.
+# A very simply stateless configuration that provides information about DNS
+# servers to all clients, regardless of their point of attachment.
#
# It is also possible to specify options on a per subnet basis
# in the same way as in stateful mode.
Dhcpv6Srv::processDecline(const Pkt6Ptr& decline) {
/// @todo: Implement this
Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, decline->getTransid()));
- return reply;
+ return (reply);
}
Pkt6Ptr
Dhcpv6Srv::processInfRequest(const Pkt6Ptr& infRequest) {
+
+ // Create a Reply packet, with the same trans-id as the client's.
Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, infRequest->getTransid()));
+ // Copy default options (client-id, also relay information if present)
copyDefaultOptions(infRequest, reply);
+ // Append default options (server-id for now, but possibly other options
+ // once we start supporting authentication)
appendDefaultOptions(infRequest, reply);
+ // Try to assign options that were requested by the client.
appendRequestedOptions(infRequest, reply);
- return reply;
+ return (reply);
}
size_t
use_na_(false),
use_pd_(false),
use_relay_(false),
- send_oro_(false),
- send_client_id_(true),
+ use_oro_(false),
+ use_client_id_(true),
prefix_hint_() {
}
use_na_(false),
use_pd_(false),
use_relay_(false),
- send_oro_(false),
- send_client_id_(true),
+ use_oro_(false),
+ use_client_id_(true),
prefix_hint_() {
}
Dhcp6Client::createMsg(const uint8_t msg_type) {
Pkt6Ptr msg(new Pkt6(msg_type, curr_transid_++));
- if (send_client_id_) {
+ if (use_client_id_) {
msg->addOption(getClientId());
}
- if (send_oro_) {
+ if (use_oro_) {
OptionUint16ArrayPtr oro(new OptionUint16Array(Option::V6, D6O_ORO));
oro->setValues(oro_);
Dhcp6Client::doInfRequest() {
context_.query_ = createMsg(DHCPV6_INFORMATION_REQUEST);
- // Not allowed in INF-REQUEST, but hey! Let's test it.
+ // IA_NA, IA_TA and IA_PD options are not allowed in INF-REQUEST,
+ // but hey! Let's test it.
if (use_na_) {
+ // Insert IA_NA option with iaid=1234.
context_.query_->addOption(Option6IAPtr(new Option6IA(D6O_IA_NA,
1234)));
}
// IA-PD is also not allowed. So it may be useful in testing, too.
if (use_pd_) {
+ // Insert IA_PD option with iaid=5678
Option6IAPtr ia(new Option6IA(D6O_IA_PD, 5678));
if (prefix_hint_) {
ia->addOption(prefix_hint_);
-// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
/// @brief Performs stateless (inf-request / reply) exchange.
///
- /// This function generates
+ /// This function generates Information-request message, sends it
+ /// to the server and then receives the reply. Contents of the Inf-Request
+ /// are controlled by use_na_, use_pd_, use_client_id_ and use_oro_
+ /// fields. This method does not process the response in any specific
+ /// way, just stores it.
void doInfRequest();
/// @brief Removes the stateful configuration obtained from the server.
/// @brief Controls whether the client should send a client-id or not
/// @param send should the client-id be sent?
- void sendClientId(bool send) {
- send_client_id_ = send;
+ void useClientId(bool send) {
+ use_client_id_ = send;
}
/// @brief Lease configuration obtained by the client.
/// @brief Link address of the relay to be used for relayed messages.
asiolink::IOAddress relay_link_addr_;
- /// @brief Controls whether client will send ORO
+ /// @brief Controls whether the client will send ORO
///
/// The actual content of the ORO is specified in oro_.
/// It is useful to split the actual content and the ORO sending
/// decision, so we could test cases of sending empty ORO.
- void sendORO(bool send) {
- send_oro_ = send;
+ void useORO(bool send) {
+ use_oro_ = send;
}
/// @brief Instructs client to request specified option in ORO
///
/// @param option_code client will request this option code
void requestOption(uint16_t option_code) {
- send_oro_ = true;
+ use_oro_ = true;
oro_.push_back(option_code);
}
/// @brief List of options to be requested
///
- /// Content of this vector will be sent as ORO if send_oro_ is set
+ /// Content of this vector will be sent as ORO if use_oro_ is set
/// to true. See @ref sendORO for details.
std::vector<uint16_t> oro_;
private:
bool use_pd_; ///< Enable prefix delegation.
bool use_relay_; ///< Enable relaying messages to the server.
- bool send_oro_;
- bool send_client_id_;
+ bool use_oro_; ///< Conth
+ bool use_client_id_;
/// @brief Pointer to the option holding a prefix hint.
Option6IAPrefixPtr prefix_hint_;
#include <dhcp6/tests/dhcp6_test_utils.h>
#include <dhcp6/json_config_parser.h>
#include <config/ccsession.h>
+#include <string.h>
using namespace isc::data;
using namespace isc::dhcp;
// Perform 2-way exchange (Inf-request/reply)
client.requestOption(D6O_NAME_SERVERS);
- client.sendClientId(false);
+ client.useClientId(false);
ASSERT_NO_THROW(client.doInfRequest());
// Confirm that there's a response