]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#553] Updated after rebase
authorFrancis Dupont <fdupont@isc.org>
Wed, 1 Jul 2020 18:22:20 +0000 (20:22 +0200)
committerFrancis Dupont <fdupont@isc.org>
Tue, 7 Jul 2020 10:47:26 +0000 (12:47 +0200)
src/bin/dhcp4/tests/dhcp4_client.cc
src/bin/dhcp6/tests/dhcp6_client.cc
src/bin/dhcp6/tests/dhcp6_client.h
src/bin/dhcp6/tests/dhcp6_test_utils.cc
src/bin/dhcp6/tests/dhcp6_test_utils.h

index 38290bda922210a2115a2f8ba4a0e6300e90fbbc..a23c915973b98c9fc4f526050b89732ed589f235 100644 (file)
@@ -511,6 +511,7 @@ Dhcp4Client::receiveOneMsg() {
     msg_copy->setRemotePort(msg->getLocalPort());
     msg_copy->setLocalPort(msg->getRemotePort());
     msg_copy->setIface(msg->getIface());
+    msg_copy->setIndex(msg->getIndex());
 
     msg_copy->unpack();
 
index 74f375bef0dd48be084722f0543fbf17c71611f9..3a1522942bc2cbdfb901c4ff8cc37f15b1896c01 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -15,6 +15,7 @@
 #include <dhcp/option6_iaaddr.h>
 #include <dhcp/option6_status_code.h>
 #include <dhcp/pkt6.h>
+#include <dhcp/tests/iface_mgr_test_config.h>
 #include <dhcpsrv/lease.h>
 #include <dhcpsrv/lease_mgr_factory.h>
 #include <dhcpsrv/pool.h>
@@ -103,6 +104,7 @@ Dhcp6Client::Dhcp6Client() :
     duid_(generateDUID(DUID::DUID_LLT)),
     link_local_("fe80::3a60:77ff:fed5:cdef"),
     iface_name_("eth0"),
+    iface_index_(ETH0_INDEX),
     srv_(boost::shared_ptr<NakedDhcpv6Srv>(new NakedDhcpv6Srv(0))),
     use_relay_(false),
     use_oro_(false),
@@ -121,6 +123,7 @@ Dhcp6Client::Dhcp6Client(boost::shared_ptr<NakedDhcpv6Srv>& srv) :
     duid_(generateDUID(DUID::DUID_LLT)),
     link_local_("fe80::3a60:77ff:fed5:cdef"),
     iface_name_("eth0"),
+    iface_index_(ETH0_INDEX),
     srv_(srv),
     use_relay_(false),
     use_oro_(false),
@@ -970,6 +973,7 @@ Dhcp6Client::sendMsg(const Pkt6Ptr& msg) {
     msg_copy->setRemoteAddr(link_local_);
     msg_copy->setLocalAddr(dest_addr_);
     msg_copy->setIface(iface_name_);
+    msg_copy->setIndex(iface_index_);
 
     // Copy classes
     const ClientClasses& classes = msg->getClasses();
index 0fb1cc382cd1f636ffd8595583a6e71eaa36ea83..e236a3d9b76eadb10b85b5bbff4f52abf54d2c14 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -575,6 +575,13 @@ public:
         iface_name_ = iface_name;
     }
 
+    /// @brief Sets the interface to be used by the client.
+    ///
+    /// @param iface_index Interface index.
+    void setIfaceIndex(uint32_t iface_index) {
+        iface_index_ = iface_index;
+    }
+
     /// @brief Sets link local address used by the client.
     ///
     /// @param link_local New link local address.
@@ -912,9 +919,12 @@ private:
     /// @brief Currently used link local address.
     asiolink::IOAddress link_local_;
 
-    /// @brief Currently used interface.
+    /// @brief Currently used interface (name).
     std::string iface_name_;
 
+    /// @brief Currently used interface (index).
+    uint32_t iface_index_;
+
     /// @brief Pointer to the server that the client is communicating with.
     boost::shared_ptr<isc::dhcp::test::NakedDhcpv6Srv> srv_;
 
index 8e7b84ad79a736a86432e13aa6ea3c6faa8a161e..b15deea1740bf6b48ab067e5ec98da95503d1a5d 100644 (file)
@@ -210,6 +210,7 @@ Dhcpv6SrvTest::createMessage(uint8_t message_type, Lease::Type lease_type,
     Pkt6Ptr msg = Pkt6Ptr(new Pkt6(message_type, 1234));
     msg->setRemoteAddr(IOAddress("fe80::abcd"));
     msg->setIface("eth0");
+    msg->setIndex(ETH0_INDEX);
     msg->addOption(createIA(lease_type, addr, prefix_len, iaid));
     return (msg);
 }
@@ -338,6 +339,7 @@ Dhcpv6SrvTest::testRenewBasic(Lease::Type type,
         req.reset(new Pkt6(message_type, 1234));
         req->setRemoteAddr(IOAddress("fe80::abcd"));
         req->setIface("eth0");
+        req->setIndex(ETH0_INDEX);
 
         // from createIA
         uint16_t code;
index 6b0f359780578306ef5c53412fd675813d943f48..a41431ff41b4099a7908af194a230d820b745bdb 100644 (file)
@@ -22,6 +22,7 @@
 #include <dhcp/option_custom.h>
 #include <dhcp/option.h>
 #include <dhcp/iface_mgr.h>
+#include <dhcp/tests/iface_mgr_test_config.h>
 #include <dhcpsrv/cfgmgr.h>
 #include <dhcpsrv/lease_mgr.h>
 #include <dhcpsrv/lease_mgr_factory.h>