Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
john dickinson
Kea
Commits
9dcea047
Commit
9dcea047
authored
Nov 26, 2021
by
john dickinson
Browse files
addressed issues in review
parent
55ff60c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/lib/dhcp_ddns/ncr_msg.cc
View file @
9dcea047
...
...
@@ -105,6 +105,19 @@ D2Dhcid::fromClientId(const std::vector<uint8_t>& clientid_data,
// | 255 | i1 | i2 | i3 | i4 | d1 | d2 |...
// +-----+----+----+----+----+----+----+---
if
(
!
clientid_data
.
empty
()
&&
clientid_data
[
0
]
==
255
)
{
if
(
clientid_data
.
size
()
<=
5
)
{
isc_throw
(
isc
::
dhcp_ddns
::
DhcidRdataComputeError
,
"unable to compute DHCID from client identifier, embedded DUID "
"length of: "
<<
clientid_data
.
size
()
<<
", is too short"
);
}
// RFC3315 states that the DUID is a type code of 2 octets followed
// by no more then 128 octets. So add the 5 from above and make sure
// the length is not too long.
if
(
clientid_data
.
size
()
>
135
)
{
isc_throw
(
isc
::
dhcp_ddns
::
DhcidRdataComputeError
,
"unable to compute DHCID from client identifier, embedded DUID "
"length of: "
<<
clientid_data
.
size
()
<<
", is too long"
);
}
std
::
vector
<
uint8_t
>::
const_iterator
start
=
clientid_data
.
begin
()
+
5
;
std
::
vector
<
uint8_t
>::
const_iterator
end
=
clientid_data
.
end
();
std
::
vector
<
uint8_t
>
duid
(
start
,
end
);
...
...
src/lib/dhcp_ddns/tests/ncr_unittests.cc
View file @
9dcea047
...
...
@@ -476,13 +476,13 @@ TEST_F(DhcidTest, fromClientIdDUID) {
// Make sure that the DHCID is valid.
EXPECT_EQ
(
dhcid_ref
,
dhcid
.
toStr
());
// Make sure that
the empty FQDN
is not accepted.
std
::
vector
<
uint8_t
>
empty_wire_fqdn
;
EXPECT_THROW
(
dhcid
.
fromClientId
(
clientid
,
empty_
wire_fqdn
),
// Make sure that
a too long client identifier
is not accepted.
clientid
.
resize
(
136
)
;
EXPECT_THROW
(
dhcid
.
fromClientId
(
clientid
,
wire_fqdn
_
),
isc
::
dhcp_ddns
::
DhcidRdataComputeError
);
// Make sure that
the empty
client identifier is not accepted.
clientid
.
clear
(
);
// Make sure that
a too short
client identifier is not accepted.
clientid
.
resize
(
5
);
EXPECT_THROW
(
dhcid
.
fromClientId
(
clientid
,
wire_fqdn_
),
isc
::
dhcp_ddns
::
DhcidRdataComputeError
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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