소스 검색

Check for /dev/tun as well as /dev/net/tun since some Linux devices put it there.

Adam Ierymenko 9 년 전
부모
커밋
7526ed705c
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 2
      osdep/LinuxEthernetTap.cpp

+ 5 - 2
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));