Browse Source

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

Marcin Siodelski 12 years ago
parent
commit
69bdbf32c6
1 changed files with 8 additions and 2 deletions
  1. 8 2
      src/lib/dhcp/pkt_filter_inet.cc

+ 8 - 2
src/lib/dhcp/pkt_filter_inet.cc

@@ -162,7 +162,10 @@ PktFilterInet::receive(const Iface& iface, const SocketInfo& socket_info) {
     pkt->setRemotePort(from_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 in_pktinfo* pktinfo;
     struct in_addr to_addr;
@@ -223,7 +226,10 @@ PktFilterInet::send(uint16_t sockfd, const Pkt4Ptr& pkt) {
     m.msg_iov = &v;
     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.
     //
     // We have to create a "control message", and set that to