BIND 10 trac2364, updated. b6203bf733422707388f45bc0bece9b3fe40e49d [2364] Remove V6 code from Option::pack4()
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Nov 19 15:06:10 UTC 2012
The branch, trac2364 has been updated
via b6203bf733422707388f45bc0bece9b3fe40e49d (commit)
from 504f64b2975180c69805756c4e6997c9dfdf140c (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 b6203bf733422707388f45bc0bece9b3fe40e49d
Author: Stephen Morris <stephen at isc.org>
Date: Mon Nov 19 15:04:51 2012 +0000
[2364] Remove V6 code from Option::pack4()
-----------------------------------------------------------------------
Summary of changes:
src/lib/dhcp/option.cc | 36 +++++++++++++++++-------------------
1 file changed, 17 insertions(+), 19 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dhcp/option.cc b/src/lib/dhcp/option.cc
index d2be1d2..b4f36d9 100644
--- a/src/lib/dhcp/option.cc
+++ b/src/lib/dhcp/option.cc
@@ -97,8 +97,7 @@ void Option::pack(isc::util::OutputBuffer& buf) {
void
Option::pack4(isc::util::OutputBuffer& buf) {
- switch (universe_) {
- case V4: {
+ if (universe_ == V4) {
if (len() > 255) {
isc_throw(OutOfRange, "DHCPv4 Option " << type_ << " is too big."
<< "At most 255 bytes are supported.");
@@ -109,33 +108,32 @@ Option::pack4(isc::util::OutputBuffer& buf) {
buf.writeUint8(type_);
buf.writeUint8(len() - getHeaderLen());
-
- buf.writeData(&data_[0], data_.size());
+ if (!data_.empty()) {
+ buf.writeData(&data_[0], data_.size());
+ }
LibDHCP::packOptions(buf, options_);
- return;
- }
- case V6:
- /// TODO: Do we need a sanity check for option size here?
- buf.writeUint16(type_);
- buf.writeUint16(len() - getHeaderLen());
- LibDHCP::packOptions(buf, options_);
- return;
- default:
+ } else {
isc_throw(OutOfRange, "Invalid universe type" << universe_);
}
+
+ return;
}
void Option::pack6(isc::util::OutputBuffer& buf) {
- buf.writeUint16(type_);
- buf.writeUint16(len() - getHeaderLen());
+ if (universe_ == V6) {
+ buf.writeUint16(type_);
+ buf.writeUint16(len() - getHeaderLen());
+ if (!data_.empty()) {
+ buf.writeData(&data_[0], data_.size());
+ }
- if (! data_.empty()) {
- buf.writeData(&data_[0], data_.size());
+ LibDHCP::packOptions6(buf, options_);
+ } else {
+ isc_throw(OutOfRange, "Invalid universe type" << universe_);
}
-
- return LibDHCP::packOptions6(buf, options_);
+ return;
}
void Option::unpack(OptionBufferConstIter begin,
More information about the bind10-changes
mailing list