Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/doc/guide/dhcp4-srv.xml b/doc/guide/dhcp4-srv.xml
index b70da2a..607b08a 100644
--- a/doc/guide/dhcp4-srv.xml
+++ b/doc/guide/dhcp4-srv.xml
@@ -478,8 +478,8 @@ If a timeout is given though, it should be an integer greater than zero.
</section>
</section>
-<section>
- <title id="hosts4-storage">Hosts Storage</title>
+<section id="hosts4-storage">
+ <title>Hosts Storage</title>
<para>Kea is also able to store information about host reservations in the
database. Hosts database configuration uses the same syntax as lease
diff --git a/doc/guide/dhcp6-srv.xml b/doc/guide/dhcp6-srv.xml
index bf4ce37..044ea56 100644
--- a/doc/guide/dhcp6-srv.xml
+++ b/doc/guide/dhcp6-srv.xml
@@ -1123,27 +1123,28 @@ temporarily override a list of interface names and listen on all interfaces.
<section id="s46-options">
<title>Common Softwire46 Options</title>
<para>Softwire46 options are involved in IPv4 over IPv6 provisioning by
- means of tunneling or tanslation. More is described in
+ means of tunneling or translation. More is described in
<ulink url="http://tools.ietf.org/html/rfc3315">RFC 7598</ulink>.
</para>
<para>
The following encapsulation scheme describes the configuration requirements:
</para>
<screen>
-s46-cont-mape (code: 94, space: dhcp6)
- ├--------s46-rule (code: 89, space: 4over6-mape)
- | └--------s46-portparams (code: 93, space: v4v6rule)
- └--------s46-br (code: 90, space: 4over6-mape)
-
-s46-cont-mapt (code: 95, space: dhcp6)
- ├--------s46-rule (code: 89, space: 4over6-mapt)
- | └--------s46-portparams (code: 93, space: v4v6rule)
- └--------s46-dmr (code: 91, space: 4over6-mapt)
-
-s46-cont-lw (code: 96, space: dhcp6)
- ├--------s46-v4v6bind (code: 92, space: 4over6-lw)
- └--------s46-br (code: 90, space: 4over6-lw)
- └--------s46-portparams (code: 93, space: v4v6bind)
+s46-cont-mape-+ (code: 94, space: dhcp6)
+ |-s46-rule-+ (code: 89, space: 4over6-mape)
+ | `-s46-portparams (code: 93, space: v4v6rule)
+ `-s46-br (code: 90, space: 4over6-mape)
+
+s46-cont-mapt-+ (code: 95, space: dhcp6)
+ |-s46-rule-+ (code: 89, space: 4over6-mapt)
+ | `-s46-portparams (code: 93, space: v4v6rule)
+ `-s46-dmr (code: 91, space: 4over6-mapt)
+
+s46-cont-lw-+ (code: 96, space: dhcp6)
+ |-s46-v4v6bind (code: 92, space: 4over6-lw)
+ |
+ `-s46-br-+ (code: 90, space: 4over6-lw)
+ `-s46-portparams (code: 93, space: v4v6bind)
</screen>
<section>
<title>S46 Rule</title>
diff --git a/src/lib/dhcp/option6_pdexclude.cc b/src/lib/dhcp/option6_pdexclude.cc
index 6e90e8e..b8be272 100644
--- a/src/lib/dhcp/option6_pdexclude.cc
+++ b/src/lib/dhcp/option6_pdexclude.cc
@@ -50,18 +50,19 @@ void Option6PDExclude::pack(isc::util::OutputBuffer& buf) const {
boost::dynamic_bitset<uint8_t> bits(excluded_address_bytes.rbegin(), excluded_address_bytes.rend());
bits = bits << delegated_prefix_length_;
- const uint8_t subtractedPrefixesOctetLength = getSubtractedPrefixesOctetLength();
- for (uint8_t i = 0U; i < subtractedPrefixesOctetLength; i++) {
+ const uint8_t subtractedPrefixesByteLength = getSubtractedPrefixesByteLength();
+ for (uint8_t i = 0U; i < subtractedPrefixesByteLength; i++) {
const boost::dynamic_bitset<uint8_t> tmp = bits >> 120;
uint8_t val = static_cast<uint8_t>(tmp.to_ulong());
//Zero padded bits follow when excluded_prefix_length_ is not divided exactly by 8
- if (i == subtractedPrefixesOctetLength - 1U) {
+ if (i == subtractedPrefixesByteLength - 1U) {
uint8_t subtractedPrefixesBitLength = excluded_prefix_length_ -
delegated_prefix_length_;
- uint8_t zeroPaddingBitLength = (8 - (subtractedPrefixesBitLength % 8)) % 8;
- val <<= zeroPaddingBitLength;
+ uint8_t usefulBitsMask = 0xFF;
+ usefulBitsMask <<= (8 - (subtractedPrefixesBitLength % 8)) % 8;
+ val &= usefulBitsMask;
}
bits = bits << 8;
buf.writeData(&val, sizeof(val));
@@ -80,15 +81,15 @@ void Option6PDExclude::unpack(OptionBufferConstIter begin,
uint16_t Option6PDExclude::len() const {
return getHeaderLen() + sizeof(excluded_prefix_length_)
- + getSubtractedPrefixesOctetLength();
+ + getSubtractedPrefixesByteLength();
}
-uint8_t Option6PDExclude::getSubtractedPrefixesOctetLength() const {
- // Promote what is less than 8 bits to 1 octet.
+uint8_t Option6PDExclude::getSubtractedPrefixesByteLength() const {
+ // Promote what is less than 8 bits to 1 byte.
uint8_t subtractedPrefixesBitLength = excluded_prefix_length_
- delegated_prefix_length_ - 1;
- uint8_t subtractedPrefixesOctetLength = (subtractedPrefixesBitLength / 8) + 1;
- return subtractedPrefixesOctetLength;
+ uint8_t subtractedPrefixesByteLength = (subtractedPrefixesBitLength / 8) + 1;
+ return subtractedPrefixesByteLength;
}
} // end of namespace isc::dhcp
diff --git a/src/lib/dhcp/option6_pdexclude.h b/src/lib/dhcp/option6_pdexclude.h
index b83a945..1811cd5 100644
--- a/src/lib/dhcp/option6_pdexclude.h
+++ b/src/lib/dhcp/option6_pdexclude.h
@@ -85,7 +85,7 @@ protected:
/// @brief Returns the prefix length of the excluded prefix.
///
/// @return prefix length of excluded prefix
- uint8_t getSubtractedPrefixesOctetLength() const;
+ uint8_t getSubtractedPrefixesByteLength() const;
/// @brief The address and prefix length identifying the delegated IPV6
/// prefix.
diff --git a/src/lib/dhcp/option_definition.cc b/src/lib/dhcp/option_definition.cc
index af81982..0f4e2d4 100644
--- a/src/lib/dhcp/option_definition.cc
+++ b/src/lib/dhcp/option_definition.cc
@@ -606,6 +606,7 @@ OptionDefinition::writeToBuffer(const std::string& value,
std::vector<uint8_t> addrV6 = address.toBytes();
boost::dynamic_bitset<uint8_t> bits(addrV6.rbegin(), addrV6.rend());
+ bits = bits << len;
uint8_t lenBytes = (len + 7) / 8;
for (size_t idx = 0; idx < lenBytes; idx++) {
@andreipavelQ

This comment has been minimized.

Copy link
Owner Author

commented Jul 27, 2016

line 9: solved a misplace id that was giving warnings to xsltproc and dblatex
line 24: typo
line 32: replaced unparsable characters with ascii characters
line 72: changed naming of "Octet" to "Byte"
line 87: reverted a bad change: the delegated address' least significant bits should be discarded, not shifted

@andreipavelQ

This comment has been minimized.

Copy link
Owner Author

commented Jul 27, 2016

line 135: on writeToBuffer(), shift the bits so that the delegated prefix is discarded and we can process the rest up to the excluded prefix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.