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
5dc9b2f5
Commit
5dc9b2f5
authored
Apr 05, 2013
by
Marcin Siodelski
Browse files
[991] Check for the IP_PKTINFO support in send/receive functions.
parent
23fa0135
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/dhcp/pkt_filter_inet.cc
View file @
5dc9b2f5
...
...
@@ -158,13 +158,13 @@ PktFilterInet::receive(const Iface& iface, const SocketInfo& socket_info) {
pkt
->
setRemotePort
(
from_port
);
pkt
->
setLocalPort
(
socket_info
.
port_
);
#ifdef IP_PKTINFO
struct
cmsghdr
*
cmsg
;
struct
in_pktinfo
*
pktinfo
;
struct
in_addr
to_addr
;
memset
(
&
to_addr
,
0
,
sizeof
(
to_addr
));
#ifdef IP_PKTINFO
cmsg
=
CMSG_FIRSTHDR
(
&
m
);
while
(
cmsg
!=
NULL
)
{
if
((
cmsg
->
cmsg_level
==
IPPROTO_IP
)
&&
...
...
@@ -219,6 +219,7 @@ PktFilterInet::send(uint16_t sockfd, const Pkt4Ptr& pkt) {
m
.
msg_iov
=
&
v
;
m
.
msg_iovlen
=
1
;
#ifdef IP_PKTINFO
// Setting the interface is a bit more involved.
//
// We have to create a "control message", and set that to
...
...
@@ -235,7 +236,8 @@ PktFilterInet::send(uint16_t sockfd, const Pkt4Ptr& pkt) {
memset
(
pktinfo
,
0
,
sizeof
(
struct
in_pktinfo
));
pktinfo
->
ipi_ifindex
=
pkt
->
getIndex
();
m
.
msg_controllen
=
cmsg
->
cmsg_len
;
#endif
pkt
->
updateTimestamp
();
int
result
=
sendmsg
(
sockfd
,
&
m
,
0
);
...
...
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