]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Merge branch 'trac3231'
authorMarcin Siodelski <marcin@isc.org>
Fri, 10 Jan 2014 18:47:09 +0000 (19:47 +0100)
committerMarcin Siodelski <marcin@isc.org>
Fri, 10 Jan 2014 18:47:09 +0000 (19:47 +0100)
Conflicts:
src/lib/dhcp/iface_mgr.cc

1  2 
doc/guide/bind10-guide.xml
src/bin/dhcp4/dhcp4_srv.cc
src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
src/bin/dhcp4/tests/dhcp4_test_utils.cc
src/bin/dhcp4/tests/dhcp4_test_utils.h
src/lib/dhcp/iface_mgr.cc
src/lib/dhcp/iface_mgr.h
src/lib/dhcp/tests/iface_mgr_unittest.cc

Simple merge
Simple merge
index 3787149e969bd360d21bf5d6044477c12a9a4257,d3880b907107b5a5dd570528fad3f1ea1caa371d..5142c70c061956e37a2160ec7154b2c29a4c7939
@@@ -608,32 -743,6 +743,33 @@@ TEST_F(Dhcpv4SrvFakeIfaceTest, ManyDisc
      cout << "Offered address to client3=" << addr3.toText() << endl;
  }
  
- TEST_F(Dhcpv4SrvTest, discoverEchoClientId) {
 +// Checks whether echoing back client-id is controllable, i.e.
 +// whether the server obeys echo-client-id and sends (or not)
 +// client-id
++TEST_F(Dhcpv4SrvFakeIfaceTest, discoverEchoClientId) {
 +    NakedDhcpv4Srv srv(0);
 +
 +    Pkt4Ptr dis = Pkt4Ptr(new Pkt4(DHCPDISCOVER, 1234));
 +    dis->setRemoteAddr(IOAddress("192.0.2.1"));
 +    OptionPtr clientid = generateClientId();
 +    dis->addOption(clientid);
++    dis->setIface("eth0");
 +
 +    // Pass it to the server and get an offer
 +    Pkt4Ptr offer = srv.processDiscover(dis);
 +
 +    // Check if we get response at all
 +    checkResponse(offer, DHCPOFFER, 1234);
 +    checkClientId(offer, clientid);
 +
 +    CfgMgr::instance().echoClientId(false);
 +    offer = srv.processDiscover(dis);
 +
 +    // Check if we get response at all
 +    checkResponse(offer, DHCPOFFER, 1234);
 +    checkClientId(offer, clientid);
 +}
 +
  // This test verifies that incoming REQUEST can be handled properly, that an
  // ACK is generated, that the response has an address and that address
  // really belongs to the configured pool.
@@@ -776,30 -891,6 +918,31 @@@ TEST_F(Dhcpv4SrvFakeIfaceTest, ManyRequ
      cout << "Offered address to client3=" << addr3.toText() << endl;
  }
  
- TEST_F(Dhcpv4SrvTest, requestEchoClientId) {
 +// Checks whether echoing back client-id is controllable
++TEST_F(Dhcpv4SrvFakeIfaceTest, requestEchoClientId) {
 +    NakedDhcpv4Srv srv(0);
 +
 +    Pkt4Ptr dis = Pkt4Ptr(new Pkt4(DHCPREQUEST, 1234));
 +    dis->setRemoteAddr(IOAddress("192.0.2.1"));
 +    OptionPtr clientid = generateClientId();
 +    dis->addOption(clientid);
++    dis->setIface("eth0");
 +
 +    // Pass it to the server and get ACK
 +    Pkt4Ptr ack = srv.processRequest(dis);
 +
 +    // Check if we get response at all
 +    checkResponse(ack, DHCPACK, 1234);
 +    checkClientId(ack, clientid);
 +
 +    CfgMgr::instance().echoClientId(false);
 +    ack = srv.processDiscover(dis);
 +
 +    // Check if we get response at all
 +    checkResponse(ack, DHCPOFFER, 1234);
 +    checkClientId(ack, clientid);
 +}
 +
  
  // This test verifies that incoming (positive) REQUEST/Renewing can be handled properly, that a
  // REPLY is generated, that the response has an address and that address
index 859092728e2c4bc1f440ed978df28489806b8695,341717f6e4976ffbcd12399b7e7133260dee89e0..8f96c1e23c0325355dc8168b65cb28bbd61dd888
@@@ -55,24 -55,8 +55,14 @@@ Dhcpv4SrvTest::Dhcpv4SrvTest(
  
      // it's ok if that fails. There should not be such a file anyway
      unlink(SRVID_FILE);
-     const IfaceMgr::IfaceCollection& ifaces = IfaceMgr::instance().getIfaces();
-     // There must be some interface detected
-     if (ifaces.empty()) {
-         // We can't use ASSERT in constructor
-         ADD_FAILURE() << "No interfaces detected.";
-     }
-     valid_iface_ = ifaces.begin()->getName();
  }
  
 +Dhcpv4SrvTest::~Dhcpv4SrvTest() {
 +
 +    // Make sure that we revert to default value
 +    CfgMgr::instance().echoClientId(true);
 +}
 +
  void Dhcpv4SrvTest::addPrlOption(Pkt4Ptr& pkt) {
  
      OptionUint8ArrayPtr option_prl =
index 94c7ab994991f5282783dcf38add4400d1adb874,c4f78c1f71a183bc5ecec615184771fd22bceab6..f1924826e1279d4154314131a0b5e36400107e11
@@@ -793,8 -930,9 +800,8 @@@ IfaceMgr::send(const Pkt4Ptr& pkt) 
                    << pkt->getIface() << ") specified.");
      }
  
 -    // Skip checking if packet filter is non-NULL because it has been
 -    // already checked when packet filter was set.
 +    // Assuming that packet filter is not NULL, because its modifier checks it.
-     return (packet_filter_->send(*iface, getSocket(*pkt), pkt));
+     return (packet_filter_->send(*iface, getSocket(*pkt).sockfd_, pkt));
  }
  
  
index 0ac845d4e2f448002f4f5e4d6816687f5cfd304e,61580a0fdba0ae1fa3ac52275c53f19348b636b7..568fc4d2726a7685ba2582ea0939bc6f738b98ca
@@@ -862,22 -846,10 +876,14 @@@ protected
      /// @param iface reference to interface structure.
      /// @param addr an address the created socket should be bound to
      /// @param port a port that created socket should be bound to
 +    /// @param join_multicast A boolean parameter which indicates whether
 +    /// socket should join All_DHCP_Relay_Agents_and_servers multicast
 +    /// group.
      ///
      /// @return socket descriptor
 -    int openSocket6(Iface& iface, const isc::asiolink::IOAddress& addr, uint16_t port);
 +    int openSocket6(Iface& iface, const isc::asiolink::IOAddress& addr,
 +                    uint16_t port, const bool join_multicast);
  
-     /// @brief Detects network interfaces.
-     ///
-     /// This method will eventually detect available interfaces. For now
-     /// it offers stub implementation. First interface name and link-local
-     /// IPv6 address is read from interfaces.txt file.
-     void
-     detectIfaces();
      /// @brief Stub implementation of network interface detection.
      ///
      /// This implementations reads a single line from interfaces.txt file