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
ISC Open Source Projects
Kea
Commits
6ce36056
Commit
6ce36056
authored
Aug 27, 2011
by
Tomek Mrugalski
🛰
Browse files
[1186] Advertise is now sent properly.
parent
8dbb407b
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/bin/dhcp6/dhcp6_srv.cc
View file @
6ce36056
...
...
@@ -103,8 +103,6 @@ Dhcpv6Srv::run() {
// TODO add support for config session (see src/bin/auth/main.cc)
// so this daemon can be controlled from bob
sleep
(
1
);
}
return
(
true
);
...
...
@@ -165,15 +163,15 @@ Dhcpv6Srv::processSolicit(boost::shared_ptr<Pkt6> solicit) {
reply
->
addOption
(
clientid
);
// add server-id
//
reply->addOption(getServerID());
reply
->
addOption
(
getServerID
());
return
reply
;
}
boost
::
shared_ptr
<
Pkt6
>
Dhcpv6Srv
::
processRequest
(
boost
::
shared_ptr
<
Pkt6
>
request
)
{
boost
::
shared_ptr
<
Pkt6
>
reply
(
new
Pkt6
(
DHCPV6_REPLY
,
request
->
getTransid
(),
Pkt6
::
UDP
)
);
/// TODO: Implement processRequest() for real
boost
::
shared_ptr
<
Pkt6
>
reply
=
processSolicit
(
request
);
reply
->
setType
(
DHCPV6_REPLY
);
return
reply
;
}
...
...
src/lib/dhcp/option.cc
View file @
6ce36056
...
...
@@ -87,7 +87,7 @@ Option::pack6(boost::shared_array<char> buf,
ptr
+=
2
;
*
(
uint16_t
*
)
ptr
=
htons
(
data_len_
);
ptr
+=
2
;
memcpy
(
ptr
,
&
data_
[
0
],
data_len_
);
memcpy
(
ptr
,
&
data_
[
offset_
],
data_len_
);
return
offset
+
len
();
}
...
...
src/lib/dhcp/pkt6.cc
View file @
6ce36056
...
...
@@ -134,15 +134,24 @@ Pkt6::packUDP() {
try
{
// DHCPv6 header: message-type (1 octect) + transaction id (3 octets)
data_
[
0
]
=
msg_type_
;
// that's elegant, but it doesn't work
data_
[
1
]
=
(
transid_
>>
16
)
&
0xff
;
data_
[
2
]
=
(
transid_
>>
8
)
&
0xff
;
data_
[
3
]
=
(
transid_
)
&
0xff
;
// that's ugly, but it does work
int
tmp
=
transid_
;
data_
[
3
]
=
tmp
%
256
;
tmp
/=
256
;
data_
[
2
]
=
tmp
%
256
;
tmp
/=
256
;
data_
[
1
]
=
tmp
%
256
;
tmp
/=
256
;
// the rest are options
unsigned
short
offset
=
LibDHCP
::
packOptions6
(
data_
,
length
,
4
/*offset*/
,
options_
);
// sanity check
if
(
offset
!=
length
)
{
isc_throw
(
OutOfRange
,
"Packet build failed: expected size="
...
...
@@ -205,7 +214,8 @@ Pkt6::unpackUDP() {
return
(
false
);
}
msg_type_
=
data_
[
0
];
transid_
=
(
data_
[
1
]
<<
16
)
+
(
data_
[
2
]
<<
8
)
+
data_
[
3
];
transid_
=
((
unsigned
int
)
data_
[
1
]
<<
16
)
+
((
unsigned
int
)
data_
[
2
]
<<
8
)
+
(
unsigned
int
)
data_
[
3
];
transid_
=
transid_
&
0xffffff
;
unsigned
int
offset
=
LibDHCP
::
unpackOptions6
(
data_
,
data_len_
,
...
...
src/lib/dhcp/pkt6.h
View file @
6ce36056
...
...
@@ -49,6 +49,7 @@ namespace isc {
unsigned
short
len
();
unsigned
char
getType
();
void
setType
(
unsigned
char
type
)
{
msg_type_
=
type
;
};
unsigned
int
getTransid
()
{
return
transid_
;
};
/// TODO need getter/setter wrappers
...
...
@@ -97,7 +98,7 @@ namespace isc {
DHCPv6Proto_
proto_
;
// UDP (most) or TCP (bulk leasequery or failover)
int
msg_type_
;
// DHCPv6 message type
int
transid_
;
// DHCPv6 transaction-id
unsigned
int
transid_
;
// DHCPv6 transaction-id
};
}
...
...
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