Lines Matching +full:remote +full:- +full:pid

1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
24 pri->dev = dev; in tuntap_user_init()
33 tap_check_ips(pri->gate_addr, addr); in tuntap_add_addr()
34 if ((pri->fd == -1) || pri->fixed_config) in tuntap_add_addr()
36 open_addr(addr, netmask, pri->dev_name); in tuntap_add_addr()
44 if ((pri->fd == -1) || pri->fixed_config) in tuntap_del_addr()
46 close_addr(addr, netmask, pri->dev_name); in tuntap_del_addr()
58 dup2(data->stdout_fd, 1); in tuntap_pre_exec()
59 close(data->close_me); in tuntap_pre_exec()
62 static int tuntap_open_tramp(char *gate, int *fd_out, int me, int remote, in tuntap_open_tramp() argument
73 int pid, n, err; in tuntap_open_tramp() local
77 data.stdout_fd = remote; in tuntap_open_tramp()
80 pid = run_helper(tuntap_pre_exec, &data, argv); in tuntap_open_tramp()
82 if (pid < 0) in tuntap_open_tramp()
83 return pid; in tuntap_open_tramp()
85 close(remote); in tuntap_open_tramp()
104 err = -errno; in tuntap_open_tramp()
105 printk(UM_KERN_ERR "tuntap_open_tramp : recvmsg failed - " in tuntap_open_tramp()
109 helper_wait(pid); in tuntap_open_tramp()
115 return -EINVAL; in tuntap_open_tramp()
117 if ((cmsg->cmsg_level != SOL_SOCKET) || in tuntap_open_tramp()
118 (cmsg->cmsg_type != SCM_RIGHTS)) { in tuntap_open_tramp()
121 return -EINVAL; in tuntap_open_tramp()
135 err = tap_open_common(pri->dev, pri->gate_addr); in tuntap_open()
139 if (pri->fixed_config) { in tuntap_open()
140 pri->fd = os_open_file("/dev/net/tun", in tuntap_open()
142 if (pri->fd < 0) { in tuntap_open()
144 "err = %d\n", -pri->fd); in tuntap_open()
145 return pri->fd; in tuntap_open()
149 strlcpy(ifr.ifr_name, pri->dev_name, sizeof(ifr.ifr_name)); in tuntap_open()
150 if (ioctl(pri->fd, TUNSETIFF, &ifr) < 0) { in tuntap_open()
151 err = -errno; in tuntap_open()
154 close(pri->fd); in tuntap_open()
161 err = -errno; in tuntap_open()
162 printk(UM_KERN_ERR "tuntap_open : socketpair failed - " in tuntap_open()
169 len--; in tuntap_open()
172 err = tuntap_open_tramp(pri->gate_addr, &pri->fd, fds[0], in tuntap_open()
179 printk(UM_KERN_ERR "tuntap_open_tramp failed - " in tuntap_open()
180 "err = %d\n", -err); in tuntap_open()
184 pri->dev_name = uml_strdup(buffer); in tuntap_open()
190 iter_addresses(pri->dev, open_addr, pri->dev_name); in tuntap_open()
193 return pri->fd; in tuntap_open()
200 if (!pri->fixed_config) in tuntap_close()
201 iter_addresses(pri->dev, close_addr, pri->dev_name); in tuntap_close()
203 pri->fd = -1; in tuntap_close()