Browse Source

[3553] Changes after review:
- copyright year updated
- comment clarified
- added @todo in Pkt::setHWAddrMember()
- getMACfromDocsis*() don't use intermediate members, will accept
options with length 1

Tomek Mrugalski 10 years ago
parent
commit
bd9f0c66c3

+ 1 - 2
src/bin/dhcp6/tests/dhcp6_srv_unittest.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2014  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2015  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
@@ -52,7 +52,6 @@
 
 using namespace isc;
 using namespace isc::data;
-//using namespace isc::config;
 using namespace isc::test;
 using namespace isc::asiolink;
 using namespace isc::dhcp;

+ 1 - 2
src/bin/dhcp6/tests/hooks_unittest.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2015 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
@@ -39,7 +39,6 @@
 
 using namespace isc;
 using namespace isc::data;
-//using namespace isc::config;
 using namespace isc::test;
 using namespace isc::asiolink;
 using namespace isc::dhcp;

+ 2 - 2
src/lib/dhcp/dhcp4.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2011, 2014 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2011, 2014-2015 by Internet Systems Consortium, Inc. ("ISC")
  * Copyright (c) 1995-2003 by Internet Software Consortium
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -54,7 +54,7 @@ static const uint16_t BOOTP_BROADCAST = 32768L;
 /* Possible values for hardware type (htype) field... */
 enum HType {
     HTYPE_ETHER = 1,   /* Ethernet 10Mbps */
-    HTYPE_DOCSIS = 1,  /* the traffic captures we have from cable modems as well
+    HTYPE_DOCSIS = 1,  /* The traffic captures we have from cable modems as well
                           as this list by IANA: http://www.iana.org/assignments/
                           arp-parameters/arp-parameters.xhtml suggest that
                           Ethernet (1) should be used in DOCSIS environment. */

+ 3 - 1
src/lib/dhcp/pkt.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2015 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
@@ -129,6 +129,8 @@ HWAddrPtr
 Pkt::getMAC(uint32_t hw_addr_src) {
     HWAddrPtr mac;
 
+    /// @todo: Implement an array of method pointers instead of set of ifs
+
     // Method 1: from raw sockets.
     if (hw_addr_src & HWAddr::HWADDR_SOURCE_RAW) {
         mac = getRemoteHWAddr();

+ 5 - 5
src/lib/dhcp/pkt6.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2015 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
@@ -644,8 +644,8 @@ Pkt6::getMACFromDocsisModem() {
         return (HWAddrPtr());
     }
 
-    OptionBuffer buf = device_id->getData();
-    if (buf.size() > 1) {
+    // If the option contains any data, use it as MAC address
+    if (!device_id->getData().empty()) {
         return (HWAddrPtr(new HWAddr(device_id->getData(), HTYPE_DOCSIS)));
     } else {
         return (HWAddrPtr());
@@ -675,8 +675,8 @@ Pkt6::getMACFromDocsisCMTS() {
         return (HWAddrPtr());
     }
 
-    OptionBuffer buf = cm_mac->getData();
-    if (buf.size() > 1) {
+    // If the option contains any data, use it as MAC address
+    if (!cm_mac->getData().empty()) {
         return (HWAddrPtr(new HWAddr(cm_mac->getData(), HTYPE_DOCSIS)));
     } else {
         return (HWAddrPtr());

+ 2 - 2
src/lib/dhcp/tests/pkt_captures.h

@@ -1,4 +1,4 @@
-// Copyright (C) 2014  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2015 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
@@ -37,7 +37,7 @@ public:
     /// @return relayed DISCOVER
     static isc::dhcp::Pkt4Ptr captureRelayedDiscover2();
 
-    // see wireshark.cc for descriptions
+    // see pkt_captures6.cc for descriptions
     // The descriptions are too large and too closely related to the
     // code, so it is kept in .cc rather than traditionally in .h
     static isc::dhcp::Pkt6Ptr captureSimpleSolicit();

+ 1 - 1
src/lib/dhcp/tests/pkt_captures4.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2013  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2015  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

+ 2 - 2
src/lib/dhcp/tests/pkt_captures6.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2015 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
@@ -18,7 +18,7 @@
 #include <dhcp/tests/pkt_captures.h>
 #include <string>
 
-/// @file   wireshark.cc
+/// @file   pkt_captures6.cc
 ///
 /// @brief  contains packet captures imported from Wireshark
 ///