Lines Matching refs:tun
41 * including tun/tap forwarding and routing domains.
128 * SSH_TUN_LINUX Use the (newer) Linux tun/tap device
129 * SSH_TUN_FREEBSD Use the FreeBSD tun/tap device
142 sys_tun_open(int tun, int mode, char **ifname)
151 if ((fd = open("/dev/net/tun", O_RDWR)) == -1) {
164 name = "tun%d";
168 if (tun != SSH_TUNID_ANY) {
169 if (tun > SSH_TUNID_MAX) {
171 tun, strerror(errno));
174 snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), name, tun);
183 if (tun == SSH_TUNID_ANY)
208 sys_tun_open(int tun, int mode, char **ifname)
213 const char *tunbase = "tun";
228 if (tun <= SSH_TUNID_MAX) {
229 snprintf(name, sizeof(name), "/dev/%s%d", tunbase, tun);
231 } else if (tun == SSH_TUNID_ANY) {
232 for (tun = 100; tun >= 0; tun--) {
234 tunbase, tun);
239 debug("%s: invalid tunnel %u\n", __func__, tun);
263 snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s%d", tunbase, tun);