Lines Matching refs:tunfd
770 static int tunfd = -1;
798 tunfd = open("/dev/net/tun", O_RDWR | O_NONBLOCK);
799 if (tunfd == -1) {
809 if (dup2(tunfd, kTunFd) < 0)
811 close(tunfd);
812 tunfd = kTunFd;
818 if (ioctl(tunfd, TUNSETIFF, (void*)&ifr) < 0) {
820 if (ioctl(tunfd, TUNSETIFF, (void*)&ifr) < 0)
823 if (ioctl(tunfd, TUNGETIFF, (void*)&ifr) < 0)
917 if (tunfd < 0)
920 int rv = read(tunfd, data, size);
945 if (tunfd < 0)
983 return writev(tunfd, vecs, nfrags);
1024 if (tunfd < 0)