BIND 10 trac1239, updated. e722aee2fc22e1b94c49451c35bc5f51c78854d2 [1239] Comments cleanup, ChangeLog updated.
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Dec 7 17:14:38 UTC 2011
The branch, trac1239 has been updated
via e722aee2fc22e1b94c49451c35bc5f51c78854d2 (commit)
via f38b0d742bf1b93f64c49c42de68d7ebc9935ec0 (commit)
via 1f27698e244f53266e09d7d115395b1235e15a71 (commit)
from 6c7201e6875c30ef5097126b0b57c9d818301a05 (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 e722aee2fc22e1b94c49451c35bc5f51c78854d2
Author: Tomek Mrugalski <tomasz at isc.org>
Date: Wed Dec 7 18:14:17 2011 +0100
[1239] Comments cleanup, ChangeLog updated.
commit f38b0d742bf1b93f64c49c42de68d7ebc9935ec0
Author: Tomek Mrugalski <tomasz at isc.org>
Date: Wed Dec 7 18:04:07 2011 +0100
[1239] Yet another hack to make stub interface detection semi-work.
commit 1f27698e244f53266e09d7d115395b1235e15a71
Author: Tomek Mrugalski <tomasz at isc.org>
Date: Wed Dec 7 17:56:29 2011 +0100
[1239] Fixed problem with exceptions in interface detection.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 9 ++-
src/bin/dhcp4/tests/dhcp4_srv_unittest.cc | 7 +++
src/bin/dhcp4/tests/interfaces.txt | 3 -
src/bin/dhcp6/tests/dhcp6_srv_unittest.cc | 12 ++++-
src/lib/dhcp/iface_mgr.cc | 83 +++++++++++++---------------
5 files changed, 63 insertions(+), 51 deletions(-)
delete mode 100644 src/bin/dhcp4/tests/interfaces.txt
-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index 4e65830..b525e85 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,10 @@
3XX. [func] tomek
- libdhcp++: Support for handling both IPv4 and IPv6 added.
- Also added support for binding IPv4 sockets.
- (Trac #1238, git TBD)
+ libdhcp++: Transmission and reception of DHCPv4 packets is now
+ implemented. Low-level hacks are not implemented for transmission
+ to hosts that don't have IPv4 address yet, so currently the code
+ is usable for communication with relays only, not hosts on the
+ same link.
+ (Trac #1239, #1240, git TBD)
328. [func] jelte
b10-auth now passes IXFR requests on to b10-xfrout, and no longer
diff --git a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
index 897ac6d..0879b7e 100644
--- a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
+++ b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
@@ -14,6 +14,7 @@
#include <config.h>
#include <iostream>
+#include <fstream>
#include <sstream>
#include <arpa/inet.h>
@@ -28,6 +29,7 @@ using namespace isc;
using namespace isc::dhcp;
namespace {
+const char* const INTERFACE_FILE = "interfaces.txt";
class NakedDhcpv4Srv: public Dhcpv4Srv {
// "naked" Interface Manager, exposes internal fields
@@ -54,9 +56,14 @@ public:
class Dhcpv4SrvTest : public ::testing::Test {
public:
Dhcpv4SrvTest() {
+ unlink(INTERFACE_FILE);
+ fstream fakeifaces(INTERFACE_FILE, ios::out|ios::trunc);
+ fakeifaces << "lo ::1";
+ fakeifaces.close();
}
~Dhcpv4SrvTest() {
+ unlink(INTERFACE_FILE);
};
};
diff --git a/src/bin/dhcp4/tests/interfaces.txt b/src/bin/dhcp4/tests/interfaces.txt
deleted file mode 100644
index 18b07d5..0000000
--- a/src/bin/dhcp4/tests/interfaces.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-eth0 fe80::1
-
-# This file is needed to make stub interface detection work.
diff --git a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
index 50f37af..0eced60 100644
--- a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
+++ b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
@@ -14,6 +14,7 @@
#include <config.h>
#include <iostream>
+#include <fstream>
#include <sstream>
#include <arpa/inet.h>
@@ -29,7 +30,8 @@ using namespace isc::dhcp;
// namespace has to be named, because friends are defined in Dhcpv6Srv class
// Maybe it should be isc::test?
-namespace test {
+namespace {
+const char* const INTERFACE_FILE = "interfaces.txt";
class NakedDhcpv6Srv: public Dhcpv6Srv {
// "naked" Interface Manager, exposes internal fields
@@ -49,7 +51,15 @@ public:
class Dhcpv6SrvTest : public ::testing::Test {
public:
Dhcpv6SrvTest() {
+ unlink(INTERFACE_FILE);
+ fstream fakeifaces(INTERFACE_FILE, ios::out|ios::trunc);
+ fakeifaces << "lo ::1";
+ fakeifaces.close();
+
}
+ ~Dhcpv6SrvTest() {
+ unlink(INTERFACE_FILE);
+ };
};
TEST_F(Dhcpv6SrvTest, basic) {
diff --git a/src/lib/dhcp/iface_mgr.cc b/src/lib/dhcp/iface_mgr.cc
index 4b8a1a9..63c03a8 100644
--- a/src/lib/dhcp/iface_mgr.cc
+++ b/src/lib/dhcp/iface_mgr.cc
@@ -507,14 +507,10 @@ IfaceMgr::send(boost::shared_ptr<Pkt6>& pkt) {
memset(&control_buf_[0], 0, control_buf_len_);
- /*
- * Initialize our message header structure.
- */
+ // Initialize our message header structure.
memset(&m, 0, sizeof(m));
- /*
- * Set the target address we're sending to.
- */
+ // Set the target address we're sending to.
sockaddr_in6 to;
memset(&to, 0, sizeof(to));
to.sin6_family = AF_INET6;
@@ -527,24 +523,20 @@ IfaceMgr::send(boost::shared_ptr<Pkt6>& pkt) {
m.msg_name = &to;
m.msg_namelen = sizeof(to);
- /*
- * Set the data buffer we're sending. (Using this wacky
- * "scatter-gather" stuff... we only have a single chunk
- * of data to send, so we declare a single vector entry.)
- */
+ // Set the data buffer we're sending. (Using this wacky
+ // "scatter-gather" stuff... we only have a single chunk
+ // of data to send, so we declare a single vector entry.)
v.iov_base = (char *) &pkt->data_[0];
v.iov_len = pkt->data_len_;
m.msg_iov = &v;
m.msg_iovlen = 1;
- /*
- * Setting the interface is a bit more involved.
- *
- * We have to create a "control message", and set that to
- * define the IPv6 packet information. We could set the
- * source address if we wanted, but we can safely let the
- * kernel decide what that should be.
- */
+ // Setting the interface is a bit more involved.
+ //
+ // We have to create a "control message", and set that to
+ // define the IPv6 packet information. We could set the
+ // source address if we wanted, but we can safely let the
+ // kernel decide what that should be.
m.msg_control = &control_buf_[0];
m.msg_controllen = control_buf_len_;
cmsg = CMSG_FIRSTHDR(&m);
@@ -597,24 +589,22 @@ IfaceMgr::send(boost::shared_ptr<Pkt4>& pkt)
m.msg_name = &to;
m.msg_namelen = sizeof(to);
- /* Set the data buffer we're sending. (Using this wacky
- * "scatter-gather" stuff... we only have a single chunk
- * of data to send, so we declare a single vector entry.)
- */
+ // Set the data buffer we're sending. (Using this wacky
+ // "scatter-gather" stuff... we only have a single chunk
+ // of data to send, so we declare a single vector entry.)
v.iov_base = (char *) pkt->getBuffer().getData();
v.iov_len = pkt->getBuffer().getLength();
m.msg_iov = &v;
m.msg_iovlen = 1;
- /*
- * Setting the interface is a bit more involved.
- *
- * We have to create a "control message", and set that to
- * define the IPv6 packet information. We could set the
- * source address if we wanted, but we can safely let the
- * kernel decide what that should be.
- */
-#if defined(LINUX)
+// OS_LINUX defines are part of ticket #1237
+#if defined(OS_LINUX)
+ // Setting the interface is a bit more involved.
+ //
+ // We have to create a "control message", and set that to
+ // define the IPv4 packet information. We could set the
+ // source address if we wanted, but we can safely let the
+ // kernel decide what that should be.
struct in_pktinfo *pktinfo;
struct cmsghdr *cmsg;
m.msg_control = &control_buf_[0];
@@ -724,14 +714,12 @@ IfaceMgr::receive4() {
m.msg_iov = &v;
m.msg_iovlen = 1;
- /*
- * Getting the interface is a bit more involved.
- *
- * We set up some space for a "control message". We have
- * previously asked the kernel to give us packet
- * information (when we initialized the interface), so we
- * should get the destination address from that.
- */
+ // Getting the interface is a bit more involved.
+ //
+ // We set up some space for a "control message". We have
+ // previously asked the kernel to give us packet
+ // information (when we initialized the interface), so we
+ // should get the destination address from that.
m.msg_control = &control_buf_[0];
m.msg_controllen = control_buf_len_;
@@ -743,7 +731,8 @@ IfaceMgr::receive4() {
return (boost::shared_ptr<Pkt4>()); // NULL
}
-#if defined(LINUX)
+// OS_LINUX defines are part of ticket #1237
+#if defined(OS_LINUX)
struct cmsghdr* cmsg;
struct in_pktinfo* pktinfo;
unsigned int ifindex = 0;
@@ -758,9 +747,15 @@ IfaceMgr::receive4() {
ifindex = pktinfo->ipi_ifindex;
to_addr = pktinfo->ipi_addr;
- // debug:
- IOAddress tmp(htonl(pktinfo->ipi_spec_dst.s_addr));
- cout << "The other addr is: " << tmp.toText() << endl;
+ // This field is useful, when we are bound to unicast
+ // address e.g. 192.0.2.1 and the packet was sent to
+ // broadcast. This will return broadcast address, not
+ // the address we are bound to.
+
+ // IOAddress tmp(htonl(pktinfo->ipi_spec_dst.s_addr));
+ // cout << "The other addr is: " << tmp.toText() << endl;
+
+ // Perhaps we should uncomment this:
// to_addr = pktinfo->ipi_spec_dst;
found_pktinfo = 1;
}
More information about the bind10-changes
mailing list