diff options
Diffstat (limited to 'tap.c')
-rw-r--r-- | tap.c | 24 |
1 files changed, 19 insertions, 5 deletions
@@ -320,12 +320,23 @@ static size_t tap_send_frames_pasta(struct ctx *c, size_t i; for (i = 0; i < n; i++) { - if (write(c->fd_tap, (char *)iov[i].iov_base, - iov[i].iov_len) < 0) { + if (write(c->fd_tap, iov[i].iov_base, iov[i].iov_len) < 0) { debug("tap write: %s", strerror(errno)); - if (errno != EAGAIN && errno != EWOULDBLOCK) - tap_handler(c, c->fd_tap, EPOLLERR, NULL); - i--; + + switch (errno) { + case EAGAIN: +#if EAGAIN != EWOULDBLOCK + case EWOULDBLOCK: +#endif + case EINTR: + i--; + break; + case ENOBUFS: + case ENOSPC: + break; + default: + die("Write error on tap device, exiting"); + } } } @@ -1237,6 +1248,9 @@ void tap_handler(struct ctx *c, int fd, uint32_t events, exit(EXIT_SUCCESS); } + if (c->mode == MODE_PASTA) + die("Error on tap device, exiting"); + tap_sock_init(c); } } |