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
Sebastian Schrader
Kea
Commits
26be6ac4
Commit
26be6ac4
authored
Jun 26, 2015
by
Francis Dupont
Browse files
[master] Finished merge of trac3919 (cppcheck small fixes)
parents
de7a4a80
01c369e5
Changes
24
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
26be6ac4
970. [bug] fdupont
Refactored some code to suppress cppcheck warnings.
(Trac #3919, git xxx)
969. [func] tomek
KEA_SOCKET_TEST_DIR environment variable can be used to specify
the directory for opening Unix sockets during tests. That may
...
...
src/bin/dhcp6/dhcp6_srv.cc
View file @
26be6ac4
...
...
@@ -1611,7 +1611,6 @@ Dhcpv6Srv::assignIA_PD(const Pkt6Ptr& query, const Pkt6Ptr& answer,
// will try to honor the hint, but it is just a hint - some other address
// may be used instead. If fake_allocation is set to false, the lease will
// be inserted into the LeaseMgr as well.
Lease6Collection
old_leases
;
AllocEngine
::
ClientContext6
ctx
(
subnet
,
duid
,
ia
->
getIAID
(),
hint
,
Lease
::
TYPE_PD
,
false
,
false
,
string
(),
fake_allocation
);
ctx
.
callout_handle_
=
getCalloutHandle
(
query
);
...
...
src/bin/dhcp6/json_config_parser.cc
View file @
26be6ac4
...
...
@@ -194,13 +194,10 @@ public:
// Try to obtain the pool parameters. It will throw an exception if any
// of the required parameters are not present or invalid.
std
::
string
addr_str
;
uint32_t
prefix_len
;
uint32_t
delegated_len
;
try
{
addr_str
=
string_values_
->
getParam
(
"prefix"
);
prefix_len
=
uint32_values_
->
getParam
(
"prefix-len"
);
delegated_len
=
uint32_values_
->
getParam
(
"delegated-len"
);
std
::
string
addr_str
=
string_values_
->
getParam
(
"prefix"
);
uint32_t
prefix_len
=
uint32_values_
->
getParam
(
"prefix-len"
);
uint32_t
delegated_len
=
uint32_values_
->
getParam
(
"delegated-len"
);
// Attempt to construct the local pool.
pool_
.
reset
(
new
Pool6
(
Lease
::
TYPE_PD
,
IOAddress
(
addr_str
),
...
...
src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
View file @
26be6ac4
...
...
@@ -2086,7 +2086,7 @@ TEST_F(Dhcpv6SrvTest, relayOverrideAndClientClass) {
/// @param codes a vector of option codes to be created
/// @param payload specified payload (0 = fill payload with repeating option code)
/// @return RSOO with nested options
OptionPtr
createRSOO
(
const
std
::
vector
<
uint16_t
>
codes
,
uint8_t
payload
=
0
)
{
OptionPtr
createRSOO
(
const
std
::
vector
<
uint16_t
>
&
codes
,
uint8_t
payload
=
0
)
{
OptionDefinitionPtr
def
=
LibDHCP
::
getOptionDef
(
Option
::
V6
,
D6O_RSOO
);
if
(
!
def
)
{
isc_throw
(
BadValue
,
"Can't find RSOO definition"
);
...
...
src/bin/dhcp6/tests/fqdn_unittest.cc
View file @
26be6ac4
...
...
@@ -389,7 +389,7 @@ public:
const
std
::
string
&
exp_hostname
,
const
uint8_t
client_flags
=
Option6ClientFqdn
::
FLAG_S
,
const
IOAddress
expected_address
=
IOAddress
(
"2001:db8:1:1::dead:beef"
),
const
IOAddress
&
expected_address
=
IOAddress
(
"2001:db8:1:1::dead:beef"
),
const
bool
include_oro
=
true
)
{
// Create a message of a specified type, add server id and
// FQDN option.
...
...
src/bin/perfdhcp/tests/command_options_unittest.cc
View file @
26be6ac4
...
...
@@ -472,7 +472,6 @@ TEST_F(CommandOptionsTest, Base) {
" -l 127.0.0.1 all"
));
std
::
vector
<
uint8_t
>
v1
=
opt
.
getMacTemplate
();
std
::
vector
<
uint8_t
>
v2
=
opt
.
getDuidTemplate
();
v2
=
opt
.
getDuidTemplate
();
EXPECT_TRUE
(
std
::
equal
(
v1
.
begin
(),
v1
.
end
(),
mac
));
EXPECT_TRUE
(
std
::
equal
(
v2
.
begin
(),
v2
.
end
(),
duid
));
// Test valid DUID.
...
...
@@ -786,7 +785,7 @@ TEST_F(CommandOptionsTest, Interface) {
// The local loopback interface should be available.
// If no interface have been found for any reason we should
// not fail this test.
if
(
ifaces
.
size
()
>
0
)
{
if
(
!
ifaces
.
empty
()
)
{
// Get the name of the interface we detected.
iface_name
=
(
*
ifaces
.
begin
())
->
getName
();
// Use the name in the command parser.
...
...
src/bin/perfdhcp/tests/perf_pkt4_unittest.cc
View file @
26be6ac4
...
...
@@ -74,6 +74,7 @@ public:
255
,
255
,
255
,
255
,
// giaddr
};
// cppcheck-suppress variableScope
uint8_t
v4Opts
[]
=
{
DHO_HOST_NAME
,
3
,
0
,
1
,
2
,
// Host name option.
DHO_BOOT_SIZE
,
3
,
10
,
11
,
12
,
// Boot file size option
...
...
src/lib/asiodns/tests/dns_server_unittest.cc
View file @
26be6ac4
// Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011
, 2015
Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
...
...
@@ -269,6 +269,7 @@ class TCPClient : public SimpleClient {
static
const
unsigned
int
SERVER_TIME_OUT
=
2
;
TCPClient
(
asio
::
io_service
&
service
,
const
ip
::
tcp
::
endpoint
&
server
)
:
SimpleClient
(
service
,
SERVER_TIME_OUT
),
data_to_send_
(
""
),
data_to_send_len_
(
0
),
send_data_delay_
(
0
),
send_data_len_delay_
(
0
)
{
server_
=
server
;
...
...
src/lib/asiolink/tests/udp_socket_unittest.cc
View file @
26be6ac4
...
...
@@ -177,8 +177,11 @@ TEST(UDPSocket, processReceivedData) {
uint8_t
inbuff
[
32
];
// Buffer to check
OutputBufferPtr
outbuff
(
new
OutputBuffer
(
16
));
// Where data is put
// cppcheck-suppress variableScope
size_t
expected
;
// Expected amount of data
// cppcheck-suppress variableScope
size_t
offset
;
// Where to put next data
// cppcheck-suppress variableScope
size_t
cumulative
;
// Cumulative data received
// Set some dummy values in the buffer to check
...
...
src/lib/config/tests/module_spec_unittests.cc
View file @
26be6ac4
// Copyright (C) 2009, 2011 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2009, 2011
, 2015
Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
...
...
@@ -306,10 +306,12 @@ TEST(ModuleSpec, CheckFormat) {
item_default
=
""
;
item_format
=
"
\"
item_format
\"
:
\"
date
\"
"
;
specs
.
push_back
(
","
+
item_format
);
// cppcheck-suppress redundantAssignment
item_default
=
""
;
item_format
=
"
\"
item_format
\"
:
\"
time
\"
"
;
specs
.
push_back
(
","
+
item_format
);
// cppcheck-suppress redundantAssignment
item_default
=
"
\"
item_default
\"
:
\"
a
\"
"
;
specs
.
push_back
(
","
+
item_default
);
item_default
=
"
\"
item_default
\"
:
\"
b
\"
"
;
...
...
src/lib/cryptolink/tests/hash_unittests.cc
View file @
26be6ac4
// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2014
, 2015
Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
...
...
@@ -560,8 +560,6 @@ namespace {
}
TEST
(
HashTest
,
HashLength
)
{
std
::
vector
<
uint8_t
>
result
;
EXPECT_EQ
(
8
,
digestVectorLength
(
MD5
,
8
));
EXPECT_EQ
(
16
,
digestVectorLength
(
MD5
,
16
));
EXPECT_EQ
(
16
,
digestVectorLength
(
MD5
,
40
));
...
...
src/lib/cryptolink/tests/hmac_unittests.cc
View file @
26be6ac4
...
...
@@ -638,8 +638,6 @@ namespace {
}
TEST
(
HMACTest
,
HMACSigLengthArgument
)
{
std
::
vector
<
uint8_t
>
sig
;
EXPECT_EQ
(
8
,
sigVectorLength
(
MD5
,
8
));
EXPECT_EQ
(
16
,
sigVectorLength
(
MD5
,
16
));
EXPECT_EQ
(
16
,
sigVectorLength
(
MD5
,
40
));
...
...
src/lib/dhcp/iface_mgr.cc
View file @
26be6ac4
...
...
@@ -487,7 +487,6 @@ IfaceMgr::openSockets4(const uint16_t port, const bool use_bcast,
}
}
Iface
::
AddressCollection
addrs
=
iface
->
getAddresses
();
BOOST_FOREACH
(
Iface
::
Address
addr
,
iface
->
getAddresses
())
{
// Skip non-IPv4 addresses and those that weren't selected..
if
(
!
addr
.
get
().
isV4
()
||
!
addr
.
isSpecified
())
{
...
...
src/lib/dhcp/libdhcp++.cc
View file @
26be6ac4
...
...
@@ -363,7 +363,8 @@ size_t LibDHCP::unpackOptions6(const OptionBuffer& buf,
offset
+=
opt_len
;
}
return
(
offset
);
last_offset
=
offset
;
return
(
last_offset
);
}
size_t
LibDHCP
::
unpackOptions4
(
const
OptionBuffer
&
buf
,
...
...
@@ -463,7 +464,8 @@ size_t LibDHCP::unpackOptions4(const OptionBuffer& buf,
options
.
insert
(
std
::
make_pair
(
opt_type
,
opt
));
offset
+=
opt_len
;
}
return
(
offset
);
last_offset
=
offset
;
return
(
last_offset
);
}
size_t
LibDHCP
::
unpackVendorOptions6
(
const
uint32_t
vendor_id
,
...
...
src/lib/dhcp/pkt4.cc
View file @
26be6ac4
...
...
@@ -81,6 +81,9 @@ Pkt4::Pkt4(const uint8_t* data, size_t len)
data_
.
resize
(
len
);
memcpy
(
&
data_
[
0
],
data
,
len
);
memset
(
sname_
,
0
,
MAX_SNAME_LEN
);
memset
(
file_
,
0
,
MAX_FILE_LEN
);
}
size_t
...
...
src/lib/dhcp/tests/pkt6_unittest.cc
View file @
26be6ac4
...
...
@@ -828,8 +828,7 @@ TEST_F(Pkt6Test, relayPack) {
EXPECT_EQ
(
opt
->
len
(),
optRelay1
->
len
());
OptionBuffer
data
=
opt
->
getData
();
ASSERT_EQ
(
data
.
size
(),
sizeof
(
relay_opt_data
));
EXPECT_EQ
(
0
,
memcmp
(
relay_opt_data
,
relay_opt_data
,
sizeof
(
relay_opt_data
)));
EXPECT_EQ
(
0
,
memcmp
(
&
data
[
0
],
relay_opt_data
,
sizeof
(
relay_opt_data
)));
}
...
...
src/lib/dhcpsrv/lease.h
View file @
26be6ac4
...
...
@@ -246,7 +246,8 @@ struct Lease4 : public Lease {
/// @brief Default constructor
///
/// Initialize fields that don't have a default constructor.
Lease4
()
:
Lease
(
0
,
0
,
0
,
0
,
0
,
0
,
false
,
false
,
""
,
HWAddrPtr
())
{
Lease4
()
:
Lease
(
0
,
0
,
0
,
0
,
0
,
0
,
false
,
false
,
""
,
HWAddrPtr
()),
ext_
(
0
)
{
}
/// @brief Copy constructor
...
...
src/lib/dhcpsrv/mysql_lease_mgr.cc
View file @
26be6ac4
...
...
@@ -308,6 +308,7 @@ public:
/// all variables are initialized/set in the methods before they are used.
MySqlLease4Exchange
()
:
addr4_
(
0
),
hwaddr_length_
(
0
),
client_id_length_
(
0
),
client_id_null_
(
MLM_FALSE
),
subnet_id_
(
0
),
valid_lifetime_
(
0
),
fqdn_fwd_
(
false
),
fqdn_rev_
(
false
),
hostname_length_
(
0
)
{
memset
(
hwaddr_buffer_
,
0
,
sizeof
(
hwaddr_buffer_
));
memset
(
client_id_buffer_
,
0
,
sizeof
(
client_id_buffer_
));
...
...
@@ -666,6 +667,8 @@ public:
/// The initialization of the variables here is nonly to satisfy cppcheck -
/// all variables are initialized/set in the methods before they are used.
MySqlLease6Exchange
()
:
addr6_length_
(
0
),
duid_length_
(
0
),
iaid_
(
0
),
lease_
(
0
),
lease_type_
(
0
),
prefixlen_
(
0
),
pref_lifetime_
(
0
),
subnet_id_
(
0
),
valid_lifetime_
(
0
),
fqdn_fwd_
(
false
),
fqdn_rev_
(
false
),
hostname_length_
(
0
),
hwaddr_length_
(
0
),
hwaddr_null_
(
MLM_FALSE
),
hwtype_
(
0
),
hwaddr_source_
(
0
)
{
...
...
src/lib/dns/master_loader.cc
View file @
26be6ac4
...
...
@@ -670,7 +670,7 @@ MasterLoader::MasterLoaderImpl::generateForIter(const std::string& str,
int
offset
=
0
;
unsigned
int
width
;
char
base
[
2
]
=
{
'd'
,
0
};
// char plus null byte
// cppcheck-suppress invalidscanf
// cppcheck-suppress invalidscanf
_libc
const
int
n
=
sscanf
(
scan_str
,
"{%d,%u,%1[doxXnN]}"
,
&
offset
,
&
width
,
base
);
switch
(
n
)
{
...
...
@@ -807,7 +807,7 @@ MasterLoader::MasterLoaderImpl::doGenerate() {
unsigned
int
start
;
unsigned
int
stop
;
unsigned
int
step
;
// cppcheck-suppress invalidscanf
// cppcheck-suppress invalidscanf
_libc
const
int
n
=
sscanf
(
range
.
c_str
(),
"%u-%u/%u"
,
&
start
,
&
stop
,
&
step
);
if
((
n
<
2
)
||
(
stop
<
start
))
{
reportError
(
lexer_
.
getSourceName
(),
lexer_
.
getSourceLine
(),
...
...
src/lib/dns/rdata/generic/naptr_35.cc
View file @
26be6ac4
// Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011
, 2015
Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
...
...
@@ -34,7 +34,7 @@ using namespace isc::dns;
class
NAPTRImpl
{
public:
NAPTRImpl
()
:
replacement
(
"."
)
{}
NAPTRImpl
()
:
order
(
0
),
preference
(
0
),
replacement
(
"."
)
{}
NAPTRImpl
(
InputBuffer
&
buffer
,
size_t
rdata_len
)
:
replacement
(
"."
)
{
if
(
rdata_len
<
4
||
buffer
.
getLength
()
-
buffer
.
getPosition
()
<
4
)
{
...
...
Prev
1
2
Next
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