Browse Source

[1540] Leftover minor fixes from experiments/dhcp4 branch.

Tomek Mrugalski 13 years ago
parent
commit
03effee3f2
2 changed files with 7 additions and 4 deletions
  1. 5 4
      src/lib/dhcp/iface_mgr.cc
  2. 2 0
      src/lib/dhcp/tests/pkt4_unittest.cc

+ 5 - 4
src/lib/dhcp/iface_mgr.cc

@@ -574,12 +574,12 @@ IfaceMgr::send(boost::shared_ptr<Pkt6>& pkt) {
 
     result = sendmsg(getSocket(*pkt), &m, 0);
     if (result < 0) {
-        cout << "Send packet failed." << endl;
+        isc_throw(Unexpected, "Pkt6 send failed: sendmsg() returned " << result);
     }
     cout << "Sent " << pkt->data_len_ << " bytes over socket " << getSocket(*pkt)
          << " on " << iface->getFullName() << " interface: "
-         << " dst=" << pkt->remote_addr_.toText()
-         << ", src=" << pkt->local_addr_.toText()
+         << " dst=[" << pkt->remote_addr_.toText() << "]:" << pkt->remote_port_
+         << ", src=" << pkt->local_addr_.toText() << "]:" << pkt->remote_port_
          << endl;
 
     return (result);
@@ -1019,9 +1019,10 @@ IfaceMgr::getSocket(isc::dhcp::Pkt4 const& pkt) {
     SocketCollection::const_iterator s;
     for (s = iface->sockets_.begin(); s != iface->sockets_.end(); ++s) {
         if (s->family_ != AF_INET) {
-            // don't use IPv4 sockets
+            // don't use IPv6 sockets
             continue;
         }
+
         /// TODO: Add more checks here later. If remote address is
         /// not link-local, we can't use link local bound socket
         /// to send data.

+ 2 - 0
src/lib/dhcp/tests/pkt4_unittest.cc

@@ -594,6 +594,8 @@ TEST(Pkt4Test, metaFields) {
     EXPECT_EQ(42, pkt->getIndex());
     EXPECT_EQ("1.2.3.4", pkt->getRemoteAddr().toText());
     EXPECT_EQ("4.3.2.1", pkt->getLocalAddr().toText());
+
+    delete pkt;
 }
 
 } // end of anonymous namespace