BIND 10 trac1239, updated. 6c7201e6875c30ef5097126b0b57c9d818301a05 [1239] Mac OS X compilation fixes.

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Dec 7 16:46:51 UTC 2011


The branch, trac1239 has been updated
       via  6c7201e6875c30ef5097126b0b57c9d818301a05 (commit)
      from  1c36f89dd234c05d3af662a33063169f85b27ef4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6c7201e6875c30ef5097126b0b57c9d818301a05
Author: Tomek Mrugalski <tomasz at isc.org>
Date:   Wed Dec 7 17:45:57 2011 +0100

    [1239] Mac OS X compilation fixes.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dhcp/iface_mgr.cc                |   15 ++++++++++-----
 src/lib/dhcp/tests/iface_mgr_unittest.cc |    2 +-
 2 files changed, 11 insertions(+), 6 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dhcp/iface_mgr.cc b/src/lib/dhcp/iface_mgr.cc
index a73f7cb..4b8a1a9 100644
--- a/src/lib/dhcp/iface_mgr.cc
+++ b/src/lib/dhcp/iface_mgr.cc
@@ -575,8 +575,6 @@ IfaceMgr::send(boost::shared_ptr<Pkt4>& pkt)
     struct msghdr m;
     struct iovec v;
     int result;
-    struct in_pktinfo *pktinfo;
-    struct cmsghdr *cmsg;
 
     Iface* iface = getIface(pkt->getIface());
     if (!iface) {
@@ -616,6 +614,9 @@ IfaceMgr::send(boost::shared_ptr<Pkt4>& pkt)
      * source address if we wanted, but we can safely let the
      * kernel decide what that should be.
      */
+#if defined(LINUX)
+    struct in_pktinfo *pktinfo;
+    struct cmsghdr *cmsg;
     m.msg_control = &control_buf_[0];
     m.msg_controllen = control_buf_len_;
     cmsg = CMSG_FIRSTHDR(&m);
@@ -626,6 +627,7 @@ IfaceMgr::send(boost::shared_ptr<Pkt4>& pkt)
     memset(pktinfo, 0, sizeof(*pktinfo));
     pktinfo->ipi_ifindex = pkt->getIndex();
     m.msg_controllen = cmsg->cmsg_len;
+#endif
 
     cout << "Trying to send " << pkt->getBuffer().getLength() << " bytes to "
          << pkt->getRemoteAddr().toText() << ":" << pkt->getRemotePort()
@@ -700,11 +702,8 @@ IfaceMgr::receive4() {
     struct msghdr m;
     struct iovec v;
     int result;
-    struct cmsghdr* cmsg;
-    struct in_pktinfo* pktinfo;
     struct sockaddr_in from_addr;
     struct in_addr to_addr;
-    unsigned int ifindex = 0;
     boost::shared_ptr<Pkt4> pkt;
     const uint32_t RCVBUFSIZE = 1500;
     uint8_t* buf = (uint8_t*) malloc(RCVBUFSIZE);
@@ -744,6 +743,11 @@ IfaceMgr::receive4() {
         return (boost::shared_ptr<Pkt4>()); // NULL
     }
 
+#if defined(LINUX)
+    struct cmsghdr* cmsg;
+    struct in_pktinfo* pktinfo;
+    unsigned int ifindex = 0;
+
     int found_pktinfo = 0;
     cmsg = CMSG_FIRSTHDR(&m);
     while (cmsg != NULL) {
@@ -767,6 +771,7 @@ IfaceMgr::receive4() {
         delete buf;
         return (boost::shared_ptr<Pkt4>()); // NULL
     }
+#endif
 
     IOAddress to(htonl(to_addr.s_addr));
     IOAddress from(htonl(from_addr.sin_addr.s_addr));
diff --git a/src/lib/dhcp/tests/iface_mgr_unittest.cc b/src/lib/dhcp/tests/iface_mgr_unittest.cc
index 1bad3e5..6eacd97 100644
--- a/src/lib/dhcp/tests/iface_mgr_unittest.cc
+++ b/src/lib/dhcp/tests/iface_mgr_unittest.cc
@@ -412,7 +412,7 @@ TEST_F(IfaceMgrTest, sendReceive4) {
     // let's check that we received what was sent
     EXPECT_EQ(sendPkt->len(), rcvPkt->len());
 
-    EXPECT_EQ(sendPkt->getRemoteAddr().toText(), rcvPkt->getLocalAddr().toText());
+    EXPECT_EQ("127.0.0.1", rcvPkt->getRemoteAddr().toText());
     EXPECT_EQ(sendPkt->getRemotePort(), rcvPkt->getLocalPort());
 
     // now let's check content




More information about the bind10-changes mailing list