summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomek Mrugalski <tomek@isc.org>2022-07-08 17:23:54 +0200
committerTomek Mrugalski <tomek@isc.org>2022-07-21 11:00:54 +0200
commit558450c1ac0945b5e1fc0dc8673f9398a1af9afc (patch)
treebdc4198b5f5e790ee25747b205ae3f8e2abf4f4c
parent[#2454] Doxygen fixes (diff)
downloadkea-558450c1ac0945b5e1fc0dc8673f9398a1af9afc.tar.xz
kea-558450c1ac0945b5e1fc0dc8673f9398a1af9afc.zip
[#2454] doxygen tags added
-rw-r--r--src/lib/dhcp/libdhcp++.cc10
-rw-r--r--src/lib/dhcp/libdhcp++.h5
-rw-r--r--src/lib/dhcp/option.h2
-rw-r--r--src/lib/dhcp/option4_addrlst.h1
-rw-r--r--src/lib/dhcp/option4_client_fqdn.h3
-rw-r--r--src/lib/dhcp/option6_addrlst.h1
-rw-r--r--src/lib/dhcp/option6_auth.h2
-rw-r--r--src/lib/dhcp/option6_client_fqdn.h3
-rw-r--r--src/lib/dhcp/option6_ia.h1
-rw-r--r--src/lib/dhcp/option6_iaaddr.h1
-rw-r--r--src/lib/dhcp/option6_iaprefix.h1
-rw-r--r--src/lib/dhcp/option6_pdexclude.h1
-rw-r--r--src/lib/dhcp/option6_status_code.h6
-rw-r--r--src/lib/dhcp/option_custom.h1
-rw-r--r--src/lib/dhcp/option_int.h1
-rw-r--r--src/lib/dhcp/option_int_array.h1
-rw-r--r--src/lib/dhcp/option_opaque_data_tuples.h1
-rw-r--r--src/lib/dhcp/option_string.h1
-rw-r--r--src/lib/dhcp/option_vendor.h1
-rw-r--r--src/lib/dhcp/option_vendor_class.h1
20 files changed, 34 insertions, 10 deletions
diff --git a/src/lib/dhcp/libdhcp++.cc b/src/lib/dhcp/libdhcp++.cc
index ca00168212..805925dc9a 100644
--- a/src/lib/dhcp/libdhcp++.cc
+++ b/src/lib/dhcp/libdhcp++.cc
@@ -458,7 +458,7 @@ LibDHCP::unpackOptions4(const OptionBuffer& buf,
const std::string& option_space,
isc::dhcp::OptionCollection& options,
std::list<uint16_t>& deferred,
- bool flexible_pad_end) {
+ bool check) {
size_t offset = 0;
size_t last_offset = 0;
@@ -477,8 +477,8 @@ LibDHCP::unpackOptions4(const OptionBuffer& buf,
const OptionDefContainerTypeIndex& runtime_idx = runtime_option_defs->get<1>();
// Flexible PAD and END parsing.
- bool flex_pad = (flexible_pad_end && (runtime_idx.count(DHO_PAD) == 0));
- bool flex_end = (flexible_pad_end && (runtime_idx.count(DHO_END) == 0));
+ bool flex_pad = (check && (runtime_idx.count(DHO_PAD) == 0));
+ bool flex_end = (check && (runtime_idx.count(DHO_END) == 0));
// The buffer being read comprises a set of options, each starting with
// a one-byte type code and a one-byte length field.
@@ -490,7 +490,7 @@ LibDHCP::unpackOptions4(const OptionBuffer& buf,
uint8_t opt_type = buf[offset++];
// DHO_END is a special, one octet long option
- // Valid in dhcp4 space or when flexible_pad_end is true and
+ // Valid in dhcp4 space or when check is true and
// there is a sub-option configured for this code.
if ((opt_type == DHO_END) && (space_is_dhcp4 || flex_end)) {
// just return. Don't need to add DHO_END option
@@ -501,7 +501,7 @@ LibDHCP::unpackOptions4(const OptionBuffer& buf,
// DHO_PAD is just a padding after DHO_END. Let's continue parsing
// in case we receive a message without DHO_END.
- // Valid in dhcp4 space or when flexible_pad_end is true and
+ // Valid in dhcp4 space or when check is true and
// there is a sub-option configured for this code.
if ((opt_type == DHO_PAD) && (space_is_dhcp4 || flex_pad)) {
continue;
diff --git a/src/lib/dhcp/libdhcp++.h b/src/lib/dhcp/libdhcp++.h
index b4c7b206e6..81f7e84338 100644
--- a/src/lib/dhcp/libdhcp++.h
+++ b/src/lib/dhcp/libdhcp++.h
@@ -217,6 +217,9 @@ public:
/// @param top indicates if this is the first call to pack the options.
/// When true logic to emit the message type first is executed. It
/// defaults to false.
+ /// @param check indicates if the code should be more flexible with
+ /// PAD and END options. If true, PAD and END options will not be parsed.
+ /// This is useful for partial parsing and slightly broken packets.
static void packOptions4(isc::util::OutputBuffer& buf,
const isc::dhcp::OptionCollection& options,
bool top = false, bool check = true);
@@ -226,6 +229,8 @@ public:
///
/// @param options The option container which needs to be updated with split
/// options.
+ /// @param scopedOptions temporary storage for options that are going to be
+ /// split. See @ref ScopedPktOptionsCopy for explanation.
/// @param used The size of the buffer that has already been used by the
/// parent option effectively shrinking the maximum supported length for
/// each options in the container.
diff --git a/src/lib/dhcp/option.h b/src/lib/dhcp/option.h
index dfb26f378a..c469d97efa 100644
--- a/src/lib/dhcp/option.h
+++ b/src/lib/dhcp/option.h
@@ -516,6 +516,7 @@ protected:
/// directly by other classes.
///
/// @param [out] buf output buffer.
+ /// @param check if set to false, allows options larger than 255 for v4
void packHeader(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Store sub options in a buffer.
@@ -526,6 +527,7 @@ protected:
/// derived classes that override pack.
///
/// @param [out] buf output buffer.
+ /// @param check if set to false, allows options larger than 255 for v4
///
/// @todo The set of exceptions thrown by this function depend on
/// exceptions thrown by pack methods invoked on objects
diff --git a/src/lib/dhcp/option4_addrlst.h b/src/lib/dhcp/option4_addrlst.h
index 73a177a74c..7e17aae0b6 100644
--- a/src/lib/dhcp/option4_addrlst.h
+++ b/src/lib/dhcp/option4_addrlst.h
@@ -88,6 +88,7 @@ public:
/// Method will throw if option storing fails for some reason.
///
/// @param buf output buffer (option will be stored there)
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// Returns string representation of the option.
diff --git a/src/lib/dhcp/option4_client_fqdn.h b/src/lib/dhcp/option4_client_fqdn.h
index 2dae79ced3..c34d6b78c6 100644
--- a/src/lib/dhcp/option4_client_fqdn.h
+++ b/src/lib/dhcp/option4_client_fqdn.h
@@ -310,9 +310,10 @@ public:
/// or full.
DomainNameType getDomainNameType() const;
- /// @brief Writes option in the wire format into a buffer.
+ /// @brief Writes option in the wire format into a buffer.
///
/// @param [out] buf output buffer where option data will be stored.
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses option from the received buffer.
diff --git a/src/lib/dhcp/option6_addrlst.h b/src/lib/dhcp/option6_addrlst.h
index 1fb6756f1b..c171b1dea3 100644
--- a/src/lib/dhcp/option6_addrlst.h
+++ b/src/lib/dhcp/option6_addrlst.h
@@ -50,6 +50,7 @@ public:
/// @brief Assembles on-wire form of this option
///
/// @param buf pointer to packet buffer
+ /// @param check if set to false, allows options larger than 255 for v4
void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses received data
diff --git a/src/lib/dhcp/option6_auth.h b/src/lib/dhcp/option6_auth.h
index 555877ab3b..fe2a4d5dc2 100644
--- a/src/lib/dhcp/option6_auth.h
+++ b/src/lib/dhcp/option6_auth.h
@@ -47,6 +47,7 @@ public:
/// byte after stored option.
///
/// @param buf buffer (option will be stored here)
+ /// @param check if set to false, allows options larger than 255 for v4
void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// Writes option in wire-format to buf, for computing hash
@@ -142,4 +143,3 @@ protected:
} // isc::dhcp namespace
} // isc namespace
-
diff --git a/src/lib/dhcp/option6_client_fqdn.h b/src/lib/dhcp/option6_client_fqdn.h
index 613f4ad457..7abe704e99 100644
--- a/src/lib/dhcp/option6_client_fqdn.h
+++ b/src/lib/dhcp/option6_client_fqdn.h
@@ -221,9 +221,10 @@ public:
/// or full.
DomainNameType getDomainNameType() const;
- /// @brief Writes option in the wire format into a buffer.
+ /// @brief Writes option in the wire format into a buffer.
///
/// @param [out] buf output buffer where option data will be stored.
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses option from the received buffer.
diff --git a/src/lib/dhcp/option6_ia.h b/src/lib/dhcp/option6_ia.h
index 49ca81b2a7..9ea7c3e4c2 100644
--- a/src/lib/dhcp/option6_ia.h
+++ b/src/lib/dhcp/option6_ia.h
@@ -46,6 +46,7 @@ public:
/// byte after stored option.
///
/// @param buf buffer (option will be stored here)
+ /// @param check if set to false, allows options larger than 255 for v4
void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses received buffer
diff --git a/src/lib/dhcp/option6_iaaddr.h b/src/lib/dhcp/option6_iaaddr.h
index e3a43af1fb..8a091cf6aa 100644
--- a/src/lib/dhcp/option6_iaaddr.h
+++ b/src/lib/dhcp/option6_iaaddr.h
@@ -55,6 +55,7 @@ public:
/// byte after stored option.
///
/// @param buf pointer to a buffer
+ /// @param check if set to false, allows options larger than 255 for v4
void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses received buffer.
diff --git a/src/lib/dhcp/option6_iaprefix.h b/src/lib/dhcp/option6_iaprefix.h
index 149d7df46d..3d9a7f26dd 100644
--- a/src/lib/dhcp/option6_iaprefix.h
+++ b/src/lib/dhcp/option6_iaprefix.h
@@ -85,6 +85,7 @@ public:
/// @throw BadValue if the address is not IPv6
///
/// @param buf pointer to a buffer
+ /// @param check if set to false, allows options larger than 255 for v4
void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses received buffer.
diff --git a/src/lib/dhcp/option6_pdexclude.h b/src/lib/dhcp/option6_pdexclude.h
index 7179207c0b..bf409d8555 100644
--- a/src/lib/dhcp/option6_pdexclude.h
+++ b/src/lib/dhcp/option6_pdexclude.h
@@ -64,6 +64,7 @@ public:
/// section 4.2 of RFC 6603.
///
/// @param [out] buf Pointer to a buffer.
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses received buffer.
diff --git a/src/lib/dhcp/option6_status_code.h b/src/lib/dhcp/option6_status_code.h
index ac57823f68..f133c5d7b8 100644
--- a/src/lib/dhcp/option6_status_code.h
+++ b/src/lib/dhcp/option6_status_code.h
@@ -46,6 +46,7 @@ public:
/// byte after stored option.
///
/// @param [out] buf Pointer to the output buffer.
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses received buffer.
@@ -74,7 +75,7 @@ public:
/// @brief Returns numeric status code.
uint16_t getStatusCode() const {
- return (status_code_);
+ return (status_code_);
}
/// @brief Returns the name of the status code.
@@ -140,6 +141,7 @@ public:
/// byte after stored option.
///
/// @param [out] buf Pointer to the output buffer.
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses received buffer.
@@ -169,7 +171,7 @@ public:
/// @brief Returns mandatory flag
bool getMandatoryFlag() const {
- return (mandatory_flag_);
+ return (mandatory_flag_);
}
/// @brief Sets new mandatory flag.
diff --git a/src/lib/dhcp/option_custom.h b/src/lib/dhcp/option_custom.h
index e8548c34df..9208651e2d 100644
--- a/src/lib/dhcp/option_custom.h
+++ b/src/lib/dhcp/option_custom.h
@@ -342,6 +342,7 @@ public:
/// @brief Writes DHCP option in a wire format to a buffer.
///
/// @param buf output buffer (option will be stored there).
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses received buffer.
diff --git a/src/lib/dhcp/option_int.h b/src/lib/dhcp/option_int.h
index 6f016426fa..10a4cc6d32 100644
--- a/src/lib/dhcp/option_int.h
+++ b/src/lib/dhcp/option_int.h
@@ -104,6 +104,7 @@ public:
/// byte after stored option.
///
/// @param [out] buf buffer (option will be stored here)
+ /// @param check if set to false, allows options larger than 255 for v4
///
/// @throw isc::dhcp::InvalidDataType if size of a data field type is not
/// equal to 1, 2 or 4 bytes. The data type is not checked in this function
diff --git a/src/lib/dhcp/option_int_array.h b/src/lib/dhcp/option_int_array.h
index 232ca61366..70803d7cec 100644
--- a/src/lib/dhcp/option_int_array.h
+++ b/src/lib/dhcp/option_int_array.h
@@ -137,6 +137,7 @@ public:
/// byte after stored option.
///
/// @param [out] buf buffer (option will be stored here)
+ /// @param check if set to false, allows options larger than 255 for v4
///
/// @throw isc::dhcp::InvalidDataType if size of a data fields type is not
/// equal to 1, 2 or 4 bytes. The data type is not checked in this function
diff --git a/src/lib/dhcp/option_opaque_data_tuples.h b/src/lib/dhcp/option_opaque_data_tuples.h
index a10cd12939..aa05d8a58c 100644
--- a/src/lib/dhcp/option_opaque_data_tuples.h
+++ b/src/lib/dhcp/option_opaque_data_tuples.h
@@ -68,6 +68,7 @@ public:
/// @brief Renders option into the buffer in the wire format.
///
/// @param [out] buf Buffer to which the option is rendered.
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses buffer holding an option.
diff --git a/src/lib/dhcp/option_string.h b/src/lib/dhcp/option_string.h
index 10159cf6bb..241305aa6a 100644
--- a/src/lib/dhcp/option_string.h
+++ b/src/lib/dhcp/option_string.h
@@ -87,6 +87,7 @@ public:
/// is moved to the end of stored data.
///
/// @param [out] buf output buffer where the option will be stored.
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Decodes option data from the provided buffer.
diff --git a/src/lib/dhcp/option_vendor.h b/src/lib/dhcp/option_vendor.h
index de8396ef81..02227ba3ae 100644
--- a/src/lib/dhcp/option_vendor.h
+++ b/src/lib/dhcp/option_vendor.h
@@ -57,6 +57,7 @@ public:
/// unused byte after stored option.
///
/// @param [out] buf buffer (option will be stored here)
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses received buffer
diff --git a/src/lib/dhcp/option_vendor_class.h b/src/lib/dhcp/option_vendor_class.h
index 11d754ea78..66450c4073 100644
--- a/src/lib/dhcp/option_vendor_class.h
+++ b/src/lib/dhcp/option_vendor_class.h
@@ -75,6 +75,7 @@ public:
/// @brief Renders option into the buffer in the wire format.
///
/// @param [out] buf Buffer to which the option is rendered.
+ /// @param check if set to false, allows options larger than 255 for v4
virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
/// @brief Parses buffer holding an option.