mirror of
https://github.com/rcornwell/sims.git
synced 2026-01-23 02:47:57 +00:00
SCP: Removed unused file.
This commit is contained in:
parent
af1c92aaa7
commit
5fc5881a4b
36
sim_tun.c
36
sim_tun.c
@ -1,36 +0,0 @@
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_tun.h>
|
||||
|
||||
int tun_alloc(char *dev)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
int fd, err;
|
||||
|
||||
fd = open ("/dev/net/tun", O_RDWR);
|
||||
if (fd == -1)
|
||||
return -1;
|
||||
|
||||
memset (&ifr, 0, sizeof ifr);
|
||||
|
||||
/* Flags: IFF_TUN - TUN device (no Ethernet headers)
|
||||
* IFF_TAP - TAP device
|
||||
* IFF_NO_PI - Do not provide packet information
|
||||
*/
|
||||
ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
|
||||
if (dev && *dev)
|
||||
strncpy (ifr.ifr_name, dev, IFNAMSIZ);
|
||||
|
||||
err = ioctl (fd, TUNSETIFF, &ifr);
|
||||
if (err == -1) {
|
||||
close (fd);
|
||||
return err;
|
||||
}
|
||||
if (dev)
|
||||
strcpy (dev, ifr.ifr_name);
|
||||
return fd;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user