Commit 69bdbf32 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[991] Use pktinfo to pass control messages on Linux only.

parent 37861324
...@@ -162,7 +162,10 @@ PktFilterInet::receive(const Iface& iface, const SocketInfo& socket_info) { ...@@ -162,7 +162,10 @@ PktFilterInet::receive(const Iface& iface, const SocketInfo& socket_info) {
pkt->setRemotePort(from_port); pkt->setRemotePort(from_port);
pkt->setLocalPort(socket_info.port_); pkt->setLocalPort(socket_info.port_);
#ifdef IP_PKTINFO // In the future the OS-specific code may be abstracted to a different
// file but for now we keep it here because there is no code yet, which
// is specific to non-Linux systems.
#if defined (IP_PKTINFO) && defined (OS_LINUX)
struct cmsghdr* cmsg; struct cmsghdr* cmsg;
struct in_pktinfo* pktinfo; struct in_pktinfo* pktinfo;
struct in_addr to_addr; struct in_addr to_addr;
...@@ -223,7 +226,10 @@ PktFilterInet::send(uint16_t sockfd, const Pkt4Ptr& pkt) { ...@@ -223,7 +226,10 @@ PktFilterInet::send(uint16_t sockfd, const Pkt4Ptr& pkt) {
m.msg_iov = &v; m.msg_iov = &v;
m.msg_iovlen = 1; m.msg_iovlen = 1;
#ifdef IP_PKTINFO // In the future the OS-specific code may be abstracted to a different
// file but for now we keep it here because there is no code yet, which
// is specific to non-Linux systems.
#if defined (IP_PKTINFO) && defined (OS_LINUX)
// Setting the interface is a bit more involved. // Setting the interface is a bit more involved.
// //
// We have to create a "control message", and set that to // We have to create a "control message", and set that to
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment