Add more detailed error message when TAP open fails

Closes #94
This commit is contained in:
emanuele-f 2019-04-24 01:02:36 +02:00
parent fc16352198
commit 08b992cbb7

View File

@ -78,7 +78,7 @@ int tuntap_open(tuntap_dev *device,
device->fd = open(tuntap_device, O_RDWR); device->fd = open(tuntap_device, O_RDWR);
if(device->fd < 0) { if(device->fd < 0) {
traceEvent(TRACE_ERROR, "ioctl() [%s][%d]\n", strerror(errno), errno); traceEvent(TRACE_ERROR, "tuntap open() error: %s[%d]. Is the tun kernel module loaded?\n", strerror(errno), errno);
return -1; return -1;
} }
@ -88,7 +88,7 @@ int tuntap_open(tuntap_dev *device,
rc = ioctl(device->fd, TUNSETIFF, (void *)&ifr); rc = ioctl(device->fd, TUNSETIFF, (void *)&ifr);
if(rc < 0) { if(rc < 0) {
traceEvent(TRACE_ERROR, "ioctl() [%s][%d]\n", strerror(errno), rc); traceEvent(TRACE_ERROR, "tuntap ioctl(TUNSETIFF, IFF_TAP) error: %s[%d]\n", strerror(errno), rc);
close(device->fd); close(device->fd);
return -1; return -1;
} }