summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-01-21 16:01:24 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-01-21 16:01:24 -0800
commit7526ed705cf79490fbe924912a3b0da64166d2b7 (patch)
tree41e3a89a41e64540722657b31fc94ccb63e4902d
parent9cc2733ed877faed30154035f0efe95633e88ac2 (diff)
downloadinfinitytier-7526ed705cf79490fbe924912a3b0da64166d2b7.tar.gz
infinitytier-7526ed705cf79490fbe924912a3b0da64166d2b7.zip
Check for /dev/tun as well as /dev/net/tun since some Linux devices put it there.
-rw-r--r--osdep/LinuxEthernetTap.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/osdep/LinuxEthernetTap.cpp b/osdep/LinuxEthernetTap.cpp
index 3e225b36..c66b7a38 100644
--- a/osdep/LinuxEthernetTap.cpp
+++ b/osdep/LinuxEthernetTap.cpp
@@ -83,8 +83,11 @@ LinuxEthernetTap::LinuxEthernetTap(
throw std::runtime_error("max tap MTU is 2800");
_fd = ::open("/dev/net/tun",O_RDWR);
- if (_fd <= 0)
- throw std::runtime_error(std::string("could not open TUN/TAP device: ") + strerror(errno));
+ if (_fd <= 0) {
+ _fd = ::open("/dev/tun",O_RDWR);
+ if (_fd <= 0)
+ throw std::runtime_error(std::string("could not open TUN/TAP device: ") + strerror(errno));
+ }
struct ifreq ifr;
memset(&ifr,0,sizeof(ifr));