for (Opts::const_iterator opt = opts.begin(); opt != opts.end(); ++opt) {
Option6IAPtr ia = boost::dynamic_pointer_cast<Option6IA>(opt->second);
if (!ia) {
+ // This is not IA, so let's just store it.
+ config_.options_.insert(*opt);
continue;
}
srv_->shutdown_ = false;
// The client is configured to send through the relay. We achieve that
// adding the relay structure.
- if (use_relay_) {
- Pkt6::RelayInfo relay;
- relay.linkaddr_ = relay_link_addr_;
- relay.peeraddr_ = asiolink::IOAddress("fe80::1");
- relay.msg_type_ = DHCPV6_RELAY_FORW;
- relay.hop_count_ = 1;
- msg->relay_info_.push_back(relay);
+ if (use_relay_ || !relay_info_.empty()) {
+ if (relay_info_.empty()) {
+ // Let's craft the relay info by hand
+ Pkt6::RelayInfo relay;
+ relay.linkaddr_ = relay_link_addr_;
+ relay.peeraddr_ = asiolink::IOAddress("fe80::1");
+ relay.msg_type_ = DHCPV6_RELAY_FORW;
+ relay.hop_count_ = 1;
+ msg->relay_info_.push_back(relay);
+ } else {
+ // The test provided relay_info_, let's use that.
+ msg->relay_info_ = relay_info_;
+ }
}
// Repack the message to simulate wire-data parsing.
msg->pack();
/// @brief Holds the current client configuration obtained from the
/// server over DHCP.
///
- /// Currently it simply contains the collection of leases acquired.
+ /// Currently it simply contains the collection of leases acquired
+ /// and a list of options. Note: this is a simple copy of all
+ /// non-IA options and often includes "protocol" options, like
+ /// server-id and client-id.
struct Configuration {
+ /// @brief List of received leases
std::vector<LeaseInfo> leases_;
+ /// @brief List of received options
+ OptionCollection options_;
+
/// @brief Status code received in the global option scope.
uint16_t status_code_;
/// @brief Link address of the relay to be used for relayed messages.
asiolink::IOAddress relay_link_addr_;
+ /// @brief RelayInfo (information about relays)
+ ///
+ /// Dhcp6Client will typically contruct this info itself, but if
+ /// it is provided here by the test, this data will be used as is.
+ std::vector<Pkt6::RelayInfo> relay_info_;
+
/// @brief Controls whether the client will send ORO
///
/// The actual content of the ORO is specified in oro_.