Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Adam Osuchowski
Kea
Commits
7cdae45e
Commit
7cdae45e
authored
Dec 14, 2012
by
Marcin Siodelski
Browse files
[2549] Check address type in some option pack() methods.
parent
6b7ef74b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/lib/dhcp/option6_addrlst.cc
View file @
7cdae45e
...
...
@@ -72,6 +72,12 @@ void Option6AddrLst::pack(isc::util::OutputBuffer& buf) {
for
(
AddressContainer
::
const_iterator
addr
=
addrs_
.
begin
();
addr
!=
addrs_
.
end
();
++
addr
)
{
if
(
!
addr
->
isV6
())
{
isc_throw
(
isc
::
BadValue
,
addr
->
toText
()
<<
" is not an IPv6 address"
);
}
// If an address is IPv6 address it should have assumed
// length of V6ADDRESS_LEN.
buf
.
writeData
(
&
addr
->
toBytes
()[
0
],
V6ADDRESS_LEN
);
}
}
...
...
@@ -104,8 +110,7 @@ std::string Option6AddrLst::toText(int indent /* =0 */) {
}
uint16_t
Option6AddrLst
::
len
()
{
return
(
OPTION6_HDR_LEN
+
addrs_
.
size
()
*
V6ADDRESS_LEN
);
return
(
OPTION6_HDR_LEN
+
addrs_
.
size
()
*
V6ADDRESS_LEN
);
}
}
// end of namespace isc::dhcp
...
...
src/lib/dhcp/option6_iaaddr.cc
View file @
7cdae45e
...
...
@@ -51,7 +51,10 @@ void Option6IAAddr::pack(isc::util::OutputBuffer& buf) {
// length without 4-byte option header
buf
.
writeUint16
(
len
()
-
getHeaderLen
());
if
(
!
addr_
.
isV6
())
{
isc_throw
(
isc
::
BadValue
,
addr_
.
toText
()
<<
" is not an IPv6 address"
);
}
buf
.
writeData
(
&
addr_
.
toBytes
()[
0
],
isc
::
asiolink
::
V6ADDRESS_LEN
);
buf
.
writeUint32
(
preferred_
);
...
...
src/lib/dhcpsrv/addr_utilities.cc
View file @
7cdae45e
...
...
@@ -168,7 +168,7 @@ namespace isc {
namespace
dhcp
{
isc
::
asiolink
::
IOAddress
firstAddrInPrefix
(
const
isc
::
asiolink
::
IOAddress
&
prefix
,
uint8_t
len
)
{
uint8_t
len
)
{
if
(
prefix
.
isV4
())
{
return
(
firstAddrInPrefix4
(
prefix
,
len
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment