mirror of https://github.com/deavmi/libtun.git
USe new calling parameters
This commit is contained in:
parent
d40a715bd6
commit
8fb598c9ad
|
@ -9,7 +9,7 @@ import core.stdc.stdio;
|
||||||
/**
|
/**
|
||||||
* TUN maintenance routines in `test.c`
|
* TUN maintenance routines in `test.c`
|
||||||
*/
|
*/
|
||||||
extern (C) int createTun(char* interafce);
|
extern (C) int createTun(char* interfaceName, short iffFlags);
|
||||||
extern (C) int destroyTun(int fd);
|
extern (C) int destroyTun(int fd);
|
||||||
|
|
||||||
public class TUNAdapter
|
public class TUNAdapter
|
||||||
|
@ -23,7 +23,7 @@ public class TUNAdapter
|
||||||
{
|
{
|
||||||
int tunFD = open(cast(char*)"/dev/net/tun", _F_RDWR);
|
int tunFD = open(cast(char*)"/dev/net/tun", _F_RDWR);
|
||||||
writeln(tunFD);
|
writeln(tunFD);
|
||||||
writeln(createTun(cast(char*)""));
|
writeln(createTun(cast(char*)"", 1));
|
||||||
writeln(destroyTun(1));
|
writeln(destroyTun(1));
|
||||||
ioctl(0,0,cast(void*)0);
|
ioctl(0,0,cast(void*)0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,16 @@
|
||||||
#include<linux/if_tun.h>
|
#include<linux/if_tun.h>
|
||||||
#include<fcntl.h>
|
#include<fcntl.h>
|
||||||
|
|
||||||
int createTun(char* interfaceName)
|
int createTun(char* interfaceName, short iffFlags)
|
||||||
{
|
{
|
||||||
/* TODO: Add all required error checking */
|
/* TODO: Add all required error checking */
|
||||||
int tunFD = open("/dev/net/tun", O_RDWR);
|
int tunFD = open("/dev/net/tun", O_RDWR);
|
||||||
|
|
||||||
|
struct ifreq interfaceReqData;
|
||||||
|
|
||||||
|
interfaceReqData.ifr_flags = iffFlags;
|
||||||
|
|
||||||
|
|
||||||
return 69;
|
return 69;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue