diff --git a/src/inet/Makefile b/src/inet/Makefile index 5617d8e7d711ba..73503e79f5de2b 100644 --- a/src/inet/Makefile +++ b/src/inet/Makefile @@ -37,7 +37,8 @@ CPP_Files = \ InetUtils.cpp \ IPAddress.cpp \ InetInterface.cpp \ - RawEndPoint.cpp + RawEndPoint.cpp \ + TunEndPoint.cpp libnet.a: $(CPP_Objects) ar rvs $@ $^ diff --git a/src/inet/TunEndPoint.cpp b/src/inet/TunEndPoint.cpp index 4a4f2cbd88ac84..722ad7eba51859 100644 --- a/src/inet/TunEndPoint.cpp +++ b/src/inet/TunEndPoint.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include "arpa-inet-compatibility.h" @@ -671,17 +672,21 @@ INET_ERROR TunEndPoint::TunDevOpen (const char *intfName) memset(&ifr, 0, sizeof(ifr)); +#if HAVE_LINUX_IF_TUN_H ifr.ifr_flags = IFF_TUN | IFF_NO_PI; +#endif if (*intfName) { strncpy(ifr.ifr_name, intfName, sizeof(ifr.ifr_name) - 1); } +#if HAVE_LINUX_IF_TUN_H if (ioctl(fd, TUNSETIFF, (void *) &ifr) < 0) { ExitNow(ret = chip::System::MapErrorPOSIX(errno)); } +#endif //Verify name memset(&ifr, 0, sizeof(ifr)); @@ -724,7 +729,11 @@ void TunEndPoint::TunDevClose (void) int TunEndPoint::TunGetInterface (int fd, struct ::ifreq *ifr) { +#if HAVE_LINUX_IF_TUN_H return ioctl(fd, TUNGETIFF, (void*)ifr); +#else + return -1; +#endif } /* Read packets from TUN device in Linux */