From: Tomek Mrugalski Date: Wed, 14 Jan 2015 11:22:07 +0000 (+0100) Subject: [3553] Changes after review: X-Git-Tag: trac3712_base~69^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bd9f0c66c3154fc5e93df268bc4565f726443d66;p=thirdparty%2Fkea.git [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 --- diff --git a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc index 489d776713..7a4cf34fc6 100644 --- a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc +++ b/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; diff --git a/src/bin/dhcp6/tests/hooks_unittest.cc b/src/bin/dhcp6/tests/hooks_unittest.cc index 20da23aabb..ec1ac067a0 100644 --- a/src/bin/dhcp6/tests/hooks_unittest.cc +++ b/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; diff --git a/src/lib/dhcp/dhcp4.h b/src/lib/dhcp/dhcp4.h index 5b69f9df23..c074d6ba29 100644 --- a/src/lib/dhcp/dhcp4.h +++ b/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. */ diff --git a/src/lib/dhcp/pkt.cc b/src/lib/dhcp/pkt.cc index abb244a549..83ee05e22f 100755 --- a/src/lib/dhcp/pkt.cc +++ b/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(); diff --git a/src/lib/dhcp/pkt6.cc b/src/lib/dhcp/pkt6.cc index a87d99083a..54cb1e0483 100755 --- a/src/lib/dhcp/pkt6.cc +++ b/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()); diff --git a/src/lib/dhcp/tests/pkt_captures.h b/src/lib/dhcp/tests/pkt_captures.h index 712295f561..f702a2d1f3 100644 --- a/src/lib/dhcp/tests/pkt_captures.h +++ b/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(); diff --git a/src/lib/dhcp/tests/pkt_captures4.cc b/src/lib/dhcp/tests/pkt_captures4.cc index ff422274ae..90eedda67a 100644 --- a/src/lib/dhcp/tests/pkt_captures4.cc +++ b/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 diff --git a/src/lib/dhcp/tests/pkt_captures6.cc b/src/lib/dhcp/tests/pkt_captures6.cc index b1348d6721..796478ca54 100644 --- a/src/lib/dhcp/tests/pkt_captures6.cc +++ b/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 #include -/// @file wireshark.cc +/// @file pkt_captures6.cc /// /// @brief contains packet captures imported from Wireshark ///