История изменений
Исправление gagarin0, (текущая версия) :
в первую очередь нужно читать man tun
The tunnel device, normally /dev/tunN, is exclusive-open (it cannot be
opened if it is already open) and is restricted to the super-user
(regardless of file system permissions).
потом можно почитать код https://nxr.netbsd.org/xref/src/sys/net/if_tun.c
/*
343 * tunnel open - must be superuser & the device must be
344 * configured in
345 */
346 static int
347 tunopen(dev_t dev, int flag, int mode, struct lwp *l)
348 {
349 struct ifnet *ifp;
350 struct tun_softc *tp;
351 int error;
352
353 error = kauth_authorize_network(l->l_cred, KAUTH_NETWORK_INTERFACE_TUN,
354 KAUTH_REQ_NETWORK_INTERFACE_TUN_ADD, NULL, NULL, NULL);
355 if (error)
356 return error;
Исходная версия gagarin0, :
в первую очередь нужно читать man tun
The tunnel device, normally /dev/tunN, is exclusive-open (it cannot be
opened if it is already open) and is restricted to the super-user
(regardless of file system permissions).
потом можно почитать код https://nxr.netbsd.org/xref/src/sys/net/if_tun.c?utm_source=chatgpt.com#353
/*
343 * tunnel open - must be superuser & the device must be
344 * configured in
345 */
346 static int
347 tunopen(dev_t dev, int flag, int mode, struct lwp *l)
348 {
349 struct ifnet *ifp;
350 struct tun_softc *tp;
351 int error;
352
353 error = kauth_authorize_network(l->l_cred, KAUTH_NETWORK_INTERFACE_TUN,
354 KAUTH_REQ_NETWORK_INTERFACE_TUN_ADD, NULL, NULL, NULL);
355 if (error)
356 return error;