Browse Source

[2902] Further cleanup as a result of the review.

Marcin Siodelski 12 years ago
parent
commit
9a49846cb4
2 changed files with 17 additions and 22 deletions
  1. 14 7
      src/lib/dhcp/pkt_filter_lpf.cc
  2. 3 15
      src/lib/dhcp/tests/iface_mgr_unittest.cc

+ 14 - 7
src/lib/dhcp/pkt_filter_lpf.cc

@@ -28,14 +28,21 @@ namespace {
 
 using namespace isc::dhcp;
 
-/// The socket filter program, used to filter out all traffic other
-/// than DHCP. In particular, it allows receipt of UDP packets
-/// on a specific (customizable) port. It does not allow fragmented
-/// packets.
+/// The following structure defines a Berkely Packet Filter program to perform
+/// packet filtering. The program operates on Ethernet packets.  To help with
+/// interpretation of the program, for the types of Ethernet packets we are
+/// interested in, the header layout is:
 ///
-/// Socket filter program is platform independent code which is
-/// executed on the kernel level when new packet arrives. This concept
-/// originates from the Berkeley Packet Filtering supported on BSD systems.
+///   6 bytes  Destination Ethernet Address
+///   6 bytes  Source Ethernet Address
+///   2 bytes  Ethernet packet type
+///
+///  20 bytes  Fixed part of IP header
+///  variable  Variable part of IP header
+///
+///   2 bytes  UDP Source port
+///   2 bytes  UDP destination port
+///   4 bytes  Rest of UDP header
 ///
 /// @todo We may want to extend the filter to receive packets sent
 /// to the particular IP address assigned to the interface or

+ 3 - 15
src/lib/dhcp/tests/iface_mgr_unittest.cc

@@ -689,23 +689,11 @@ TEST_F(IfaceMgrTest, socketsFromRemoteAddress) {
     // open sockets on the same ports.
     ifacemgr->closeSockets();
 
-    // The check below has been commented out. It verified the ability
-    // to open suitable socket for sending broadcast request. However,
+    // There used to be a check here that verified the ability to open
+    // suitable socket for sending broadcast request. However,
     // there is no guarantee for such test to work on all systems
     // because some systems may have no broadcast capable interfaces at all.
-
-/* #if defined(OS_LINUX)
-    // Open v4 socket to connect to broadcast address.
-    int socket3  = 0;
-    IOAddress bcastAddr("255.255.255.255");
-    try {
-        socket3 = ifacemgr->openSocketFromRemoteAddress(bcastAddr, PORT2);
-    } catch (const Exception& ex) {
-        std::cout << ex.what() << std::endl;
-        FAIL();
-    }
-    EXPECT_GT(socket3, 0);
-#endif */
+    // Thus, this check has been removed.
 
     // Do not call closeSockets() because it is called by IfaceMgr's
     // virtual destructor.