BIND 10 trac2902, updated. 8f8bfc92e622717d75684b8bd36181b525a22309 [2902] Cleanup in comments.
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Apr 30 15:50:07 UTC 2013
The branch, trac2902 has been updated
via 8f8bfc92e622717d75684b8bd36181b525a22309 (commit)
from 6e966c8f89b249a3f1c1a87201f24db656a06720 (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 8f8bfc92e622717d75684b8bd36181b525a22309
Author: Marcin Siodelski <marcin at isc.org>
Date: Tue Apr 30 17:49:56 2013 +0200
[2902] Cleanup in comments.
-----------------------------------------------------------------------
Summary of changes:
src/bin/dhcp4/dhcp4_srv.h | 5 +++--
src/lib/dhcp/hwaddr.h | 2 +-
src/lib/dhcp/iface_mgr.h | 20 +++++++++--------
src/lib/dhcp/iface_mgr_bsd.cc | 2 ++
src/lib/dhcp/iface_mgr_sun.cc | 2 ++
src/lib/dhcp/pkt_filter_lpf.cc | 48 ++++++++++++++++++++++------------------
src/lib/dhcp/pkt_filter_lpf.h | 14 ------------
7 files changed, 46 insertions(+), 47 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/dhcp4/dhcp4_srv.h b/src/bin/dhcp4/dhcp4_srv.h
index 32e9f0d..8c6b879 100644
--- a/src/bin/dhcp4/dhcp4_srv.h
+++ b/src/bin/dhcp4/dhcp4_srv.h
@@ -63,8 +63,9 @@ class Dhcpv4Srv : public boost::noncopyable {
/// port on which DHCPv4 server will listen on. That is mostly useful
/// for testing purposes. The Last two arguments of the constructor
/// should be left at default values for normal server operation.
- /// They should be disabled when creating an instance of this class
- /// for unit testing as enabling them requires root privilegs.
+ /// They should be set to 'false' when creating an instance of this
+ /// class for unit testing because features they enable require
+ /// root privileges.
///
/// @param port specifies port number to listen on
/// @param dbconfig Lease manager configuration string. The default
diff --git a/src/lib/dhcp/hwaddr.h b/src/lib/dhcp/hwaddr.h
index ccb1117..848ad23 100644
--- a/src/lib/dhcp/hwaddr.h
+++ b/src/lib/dhcp/hwaddr.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
diff --git a/src/lib/dhcp/iface_mgr.h b/src/lib/dhcp/iface_mgr.h
index 6eb9740..338f8eb 100644
--- a/src/lib/dhcp/iface_mgr.h
+++ b/src/lib/dhcp/iface_mgr.h
@@ -609,7 +609,7 @@ public:
/// Packet Filters expose low-level functions handling sockets opening
/// and sending/receiving packets through those sockets. This function
/// sets custom Packet Filter (represented by a class derived from PktFilter)
- /// to be used by IfaceMgr. Note that, there must be no IPv4 sockets
+ /// to be used by IfaceMgr. Note that there must be no IPv4 sockets open
/// when this function is called. Call closeSockets(AF_INET) to close
/// all hanging IPv4 sockets opened by the current packet filter object.
///
@@ -623,16 +623,18 @@ public:
/// @brief Set Packet Filter object to handle send/receive packets.
///
/// This function sets Packet Filter object to be used by IfaceMgr,
- /// appropriate for the current OS. They will vary depending on the
- /// OS being used if the function argument is set 'true'. There is
- /// no guarantee that there is an implementation that supports this
- /// feature on a particular OS. If there isn't the PktFilterInet
- /// object will be set. If the argument is set to 'false' then
- /// PktFilterInet object instance will be set as the Packet Filter
- /// regrdaless of the OS.
+ /// appropriate for the current OS. Setting the argument to 'true'
+ /// indicates that function should set a packet filter class
+ /// which supports direct responses to clients having no address
+ /// assigned yet. Filters picked by this function will vary, depending
+ /// on the OS being used. There is no guarantee that there is an
+ /// implementation that supports this feature on a particular OS.
+ /// If there isn't, the PktFilterInet object will be set. If the
+ /// argument is set to 'false', PktFilterInet object instance will
+ /// be set as the Packet Filter regrdaless of the OS type.
///
/// @param direct_response_desired specifies whether the Packet Filter
- /// object being set should support direct responses to the host
+ /// object being set should support direct traffic to the host
/// not having address assigned.
void setMatchingPacketFilter(const bool direct_response_desired = false);
diff --git a/src/lib/dhcp/iface_mgr_bsd.cc b/src/lib/dhcp/iface_mgr_bsd.cc
index 7e43436..92b99cd 100644
--- a/src/lib/dhcp/iface_mgr_bsd.cc
+++ b/src/lib/dhcp/iface_mgr_bsd.cc
@@ -52,6 +52,8 @@ bool IfaceMgr::os_receive4(struct msghdr& /*m*/, Pkt4Ptr& /*pkt*/) {
void
IfaceMgr::setMatchingPacketFilter(const bool /* direct_response_desired */) {
+ // @todo Currently we ignore the preference to use direct traffic
+ // because it hasn't been implemented for BSD systems.
boost::shared_ptr<PktFilter> pkt_filter(new PktFilterInet());
setPacketFilter(pkt_filter);
}
diff --git a/src/lib/dhcp/iface_mgr_sun.cc b/src/lib/dhcp/iface_mgr_sun.cc
index ab9d43e..e046791 100644
--- a/src/lib/dhcp/iface_mgr_sun.cc
+++ b/src/lib/dhcp/iface_mgr_sun.cc
@@ -52,6 +52,8 @@ bool IfaceMgr::os_receive4(struct msghdr& /*m*/, Pkt4Ptr& /*pkt*/) {
void
IfaceMgr::setMatchingPacketFilter(const bool /* direct_response_desired */) {
+ // @todo Currently we ignore the preference to use direct traffic
+ // because it hasn't been implemented for Solaris.
boost::shared_ptr<PktFilter> pkt_filter(new PktFilterInet());
setPacketFilter(pkt_filter);
}
diff --git a/src/lib/dhcp/pkt_filter_lpf.cc b/src/lib/dhcp/pkt_filter_lpf.cc
index 1823c3b..23340b5 100644
--- a/src/lib/dhcp/pkt_filter_lpf.cc
+++ b/src/lib/dhcp/pkt_filter_lpf.cc
@@ -27,38 +27,44 @@
namespace {
/// Socket filter program, used to filter out all traffic other
-/// then DHCP. In particular, it allows UDP packets on a specific
-/// (customizable) port. It does not allow fragmented packets.
+/// then DHCP. In particular, it allows receipt of UDP packets
+/// on a specific (customizable) port. It does not allow fragmented
+/// packets.
+///
+/// Socket filter program is platform independent code which is
+/// executed on the kernel level when new packet arrives. This concept
+/// origins from the Berkeley Packet Filtering supported on BSD systems.
+///
/// @todo We may want to extend the filter to receive packets sent
/// to the particular IP address assigned to the interface or
/// broadcast address.
struct sock_filter dhcp_sock_filter [] = {
- // Make sure this is an IP packet...
- BPF_STMT (BPF_LD + BPF_H + BPF_ABS, 12),
- BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, ETHERTYPE_IP, 0, 8),
+ // Make sure this is an IP packet...
+ BPF_STMT (BPF_LD + BPF_H + BPF_ABS, 12),
+ BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, ETHERTYPE_IP, 0, 8),
- // Make sure it's a UDP packet...
- BPF_STMT (BPF_LD + BPF_B + BPF_ABS, 23),
- BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 0, 6),
+ // Make sure it's a UDP packet...
+ BPF_STMT (BPF_LD + BPF_B + BPF_ABS, 23),
+ BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 0, 6),
- // Make sure this isn't a fragment...
- BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 20),
- BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 4, 0),
+ // Make sure this isn't a fragment...
+ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 20),
+ BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 4, 0),
- // Get the IP header length...
- BPF_STMT (BPF_LDX + BPF_B + BPF_MSH, 14),
+ // Get the IP header length...
+ BPF_STMT (BPF_LDX + BPF_B + BPF_MSH, 14),
- // Make sure it's to the right port...
- BPF_STMT (BPF_LD + BPF_H + BPF_IND, 16),
+ // Make sure it's to the right port...
+ BPF_STMT (BPF_LD + BPF_H + BPF_IND, 16),
// Use default DHCP server port, but it can be
// replaced if neccessary.
- BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, isc::dhcp::DHCP4_SERVER_PORT, 0, 1),
+ BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, isc::dhcp::DHCP4_SERVER_PORT, 0, 1),
- // If we passed all the tests, ask for the whole packet.
- BPF_STMT(BPF_RET+BPF_K, (u_int)-1),
+ // If we passed all the tests, ask for the whole packet.
+ BPF_STMT(BPF_RET+BPF_K, (u_int)-1),
- // Otherwise, drop it.
- BPF_STMT(BPF_RET+BPF_K, 0),
+ // Otherwise, drop it.
+ BPF_STMT(BPF_RET+BPF_K, 0),
};
}
@@ -171,7 +177,7 @@ PktFilterLPF::send(const Iface& iface, uint16_t sockfd, const Pkt4Ptr& pkt) {
// Ethernet frame header.
// Note that we don't validate whether HW addresses in 'pkt'
- // are valid because they are validated be the function called.
+ // are valid because they are checked by the function called.
writeEthernetHeader(pkt, buf);
// It is likely that the local address in pkt object is set to
diff --git a/src/lib/dhcp/pkt_filter_lpf.h b/src/lib/dhcp/pkt_filter_lpf.h
index c7e19a5..ef2fa1c 100644
--- a/src/lib/dhcp/pkt_filter_lpf.h
+++ b/src/lib/dhcp/pkt_filter_lpf.h
@@ -77,20 +77,6 @@ public:
virtual int send(const Iface& iface, uint16_t sockfd,
const Pkt4Ptr& pkt);
-protected:
-
- static void assembleEthernetHeader(const Iface& iface,
- const Pkt4Ptr& pkt,
- util::OutputBuffer& out_buf);
-
- static void assembleIpUdpHeader(const Pkt4Ptr& pkt,
- util::OutputBuffer& out_buf);
-
- static uint16_t checksum(const char* buf, const uint32_t buf_size,
- uint32_t sum = 0);
-
- static uint16_t checksumFinish(uint16_t sum);
-
};
} // namespace isc::dhcp
More information about the bind10-changes
mailing list