BIND 10 trac2902, updated. b91e4297ed4ba93adcb9af382f00c301876bf8de [2902] More comprehensive comments in the packet receiving function.

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Apr 23 17:50:37 UTC 2013


The branch, trac2902 has been updated
       via  b91e4297ed4ba93adcb9af382f00c301876bf8de (commit)
      from  f5b9768aba32bb7673458eeeb14f0f56734427bc (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 b91e4297ed4ba93adcb9af382f00c301876bf8de
Author: Marcin Siodelski <marcin at isc.org>
Date:   Tue Apr 23 19:50:28 2013 +0200

    [2902] More comprehensive comments in the packet receiving function.

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

Summary of changes:
 src/lib/dhcp/pkt_filter_lpf.cc |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

-----------------------------------------------------------------------
diff --git a/src/lib/dhcp/pkt_filter_lpf.cc b/src/lib/dhcp/pkt_filter_lpf.cc
index 93aae14..6202219 100644
--- a/src/lib/dhcp/pkt_filter_lpf.cc
+++ b/src/lib/dhcp/pkt_filter_lpf.cc
@@ -64,15 +64,30 @@ PktFilterLPF::receive(const Iface& iface, const SocketInfo& socket_info) {
 
     InputBuffer buf(raw_buf, data_len);
 
+    // @todo: This is awkward way to solve the chicken and egg problem
+    // whereby we don't know the offset where DHCP data start in the
+    // received buffer when we create the packet object. The dummy
+    // object is created so as we can pass it to the functions which
+    // decode IP stack and find actual offset of the DHCP packet.
+    // Once we find the offset we can create another Pkt4 object from
+    // the reminder of the input buffer and set the IP addresses and
+    // ports from the dummy packet. We should consider making this
+    // in some more elegant way.
     Pkt4Ptr dummy_pkt = Pkt4Ptr(new Pkt4(DHCPDISCOVER, 0));
+
+    // Decode ethernet, ip and udp headers.
     decodeEthernetHeader(buf, dummy_pkt);
     decodeIpUdpHeader(buf, dummy_pkt);
 
+    // Read the DHCP data.
     std::vector<uint8_t> dhcp_buf;
     buf.readVector(dhcp_buf, buf.getLength() - buf.getPosition());
 
+    // Decode DHCP data into the Pkt4 object.
     Pkt4Ptr pkt = Pkt4Ptr(new Pkt4(&dhcp_buf[0], dhcp_buf.size()));
 
+    // Set the appropriate packet members using data collected from
+    // the decoded headers.
     pkt->setIndex(iface.getIndex());
     pkt->setIface(iface.getName());
     pkt->setLocalAddr(dummy_pkt->getLocalAddr());



More information about the bind10-changes mailing list