Skip to content
GitLab
Menu
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
86a4ce45
Commit
86a4ce45
authored
Dec 07, 2011
by
Tomek Mrugalski
🛰
Browse files
[1238] Changes after review: openSocket*() now returns int
parent
14a64484
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/bin/dhcp6/iface_mgr.cc
View file @
86a4ce45
...
...
@@ -87,11 +87,7 @@ bool IfaceMgr::Iface::delAddress(const isc::asiolink::IOAddress& addr) {
// of the same address added, we are in deep problems anyway.
size_t
size
=
addrs_
.
size
();
addrs_
.
erase
(
remove
(
addrs_
.
begin
(),
addrs_
.
end
(),
addr
),
addrs_
.
end
());
if
(
addrs_
.
size
()
<
size
)
{
return
(
true
);
}
else
{
return
(
false
);
}
return
(
addrs_
.
size
()
<
size
);
}
bool
IfaceMgr
::
Iface
::
delSocket
(
uint16_t
sockfd
)
{
...
...
@@ -274,9 +270,8 @@ IfaceMgr::getIface(const std::string& ifname) {
return
(
NULL
);
// not found
}
uint16_t
IfaceMgr
::
openSocket
(
const
std
::
string
&
ifname
,
const
IOAddress
&
addr
,
int
IfaceMgr
::
openSocket
(
const
std
::
string
&
ifname
,
const
IOAddress
&
addr
,
int
port
)
{
Iface
*
iface
=
getIface
(
ifname
);
if
(
!
iface
)
{
...
...
@@ -293,7 +288,7 @@ IfaceMgr::openSocket(const std::string& ifname,
}
}
u
int
16_t
int
IfaceMgr
::
openSocket4
(
Iface
&
iface
,
const
IOAddress
&
addr
,
int
port
)
{
cout
<<
"Creating UDP4 socket on "
<<
iface
.
getFullName
()
...
...
@@ -335,7 +330,7 @@ IfaceMgr::openSocket4(Iface& iface, const IOAddress& addr, int port) {
return
(
sock
);
}
u
int
16_t
int
IfaceMgr
::
openSocket6
(
Iface
&
iface
,
const
IOAddress
&
addr
,
int
port
)
{
cout
<<
"Creating UDP6 socket on "
<<
iface
.
getFullName
()
...
...
src/bin/dhcp6/iface_mgr.h
View file @
86a4ce45
...
...
@@ -291,8 +291,8 @@ public:
///
/// @return socket descriptor, if socket creation, binding and multicast
/// group join were all successful.
u
int
16_t
openSocket
(
const
std
::
string
&
ifname
,
const
isc
::
asiolink
::
IOAddress
&
addr
,
int
port
);
int
openSocket
(
const
std
::
string
&
ifname
,
const
isc
::
asiolink
::
IOAddress
&
addr
,
int
port
);
/// Opens IPv6 sockets on detected interfaces.
///
...
...
@@ -328,7 +328,7 @@ protected:
/// @param port a port that created socket should be bound to
///
/// @return socket descriptor
u
int
16_t
openSocket4
(
Iface
&
iface
,
const
isc
::
asiolink
::
IOAddress
&
addr
,
int
port
);
int
openSocket4
(
Iface
&
iface
,
const
isc
::
asiolink
::
IOAddress
&
addr
,
int
port
);
/// @brief Opens IPv6 socket.
///
...
...
@@ -341,7 +341,7 @@ protected:
/// @param port a port that created socket should be bound to
///
/// @return socket descriptor
u
int
16_t
openSocket6
(
Iface
&
iface
,
const
isc
::
asiolink
::
IOAddress
&
addr
,
int
port
);
int
openSocket6
(
Iface
&
iface
,
const
isc
::
asiolink
::
IOAddress
&
addr
,
int
port
);
/// @brief Adds an interface to list of known interfaces.
///
...
...
src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
View file @
86a4ce45
...
...
@@ -57,15 +57,13 @@ TEST_F(Dhcpv6SrvTest, basic) {
// interfaces.txt instead. It will pretend to have detected
// fe80::1234 link-local address on eth0 interface. Obviously
// an attempt to bind this socket will fail.
Dhcpv6Srv
*
srv
=
0
;
Dhcpv6Srv
*
srv
=
0
;
ASSERT_NO_THROW
(
{
// open an unpriviledged port
srv
=
new
Dhcpv6Srv
(
DHCP6_SERVER_PORT
+
10000
);
});
if
(
srv
)
{
delete
srv
;
}
delete
srv
;
}
TEST_F
(
Dhcpv6SrvTest
,
Solicit_basic
)
{
...
...
@@ -75,7 +73,7 @@ TEST_F(Dhcpv6SrvTest, Solicit_basic) {
// a dummy content for client-id
boost
::
shared_array
<
uint8_t
>
clntDuid
(
new
uint8_t
[
32
]);
for
(
int
i
=
0
;
i
<
32
;
i
++
)
clntDuid
[
i
]
=
100
+
i
;
clntDuid
[
i
]
=
100
+
i
;
boost
::
shared_ptr
<
Pkt6
>
sol
=
boost
::
shared_ptr
<
Pkt6
>
(
new
Pkt6
(
DHCPV6_SOLICIT
,
...
...
Write
Preview
Supports
Markdown
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