mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-23 10:05:08 +00:00
Make it compile on linux, added copyright
This commit is contained in:
parent
c5e6cfa708
commit
151a9134fa
7
dnstun.c
7
dnstun.c
@ -1,5 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006 Bjorn Andersson <flex@kryo.se>
|
* Copyright (c) 2006
|
||||||
|
* Bjorn Andersson <flex@kryo.se>,
|
||||||
|
* Erik Ekman <yarrick@kryo.se>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
@ -15,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "tun.h"
|
#include "tun.h"
|
||||||
|
|
||||||
@ -23,8 +26,6 @@ main()
|
|||||||
{
|
{
|
||||||
open_tun();
|
open_tun();
|
||||||
|
|
||||||
sleep(10);
|
|
||||||
|
|
||||||
close_tun();
|
close_tun();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
9
tun.c
9
tun.c
@ -1,5 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006 Bjorn Andersson <flex@kryo.se>
|
* Copyright (c) 2006
|
||||||
|
* Bjorn Andersson <flex@kryo.se>,
|
||||||
|
* Erik Ekman <yarrick@kryo.se>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
@ -18,6 +20,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -107,7 +110,7 @@ close_tun()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
write_tun(u_char *buf, int len)
|
write_tun(uint8_t *buf, int len)
|
||||||
{
|
{
|
||||||
if (write(tun_fd, buf, len) != len)
|
if (write(tun_fd, buf, len) != len)
|
||||||
err(1, "write_tun: %s", strerror(errno));
|
err(1, "write_tun: %s", strerror(errno));
|
||||||
@ -116,7 +119,7 @@ write_tun(u_char *buf, int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
read_tun(u_char *buf, int len)
|
read_tun(uint8_t *buf, int len)
|
||||||
{
|
{
|
||||||
return read(tun_fd, buf, len);
|
return read(tun_fd, buf, len);
|
||||||
}
|
}
|
||||||
|
12
tun.h
12
tun.h
@ -1,5 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006 Bjorn Andersson <flex@kryo.se>
|
* Copyright (c) 2006
|
||||||
|
* Bjorn Andersson <flex@kryo.se>,
|
||||||
|
* Erik Ekman <yarrick@kryo.se>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
@ -20,9 +22,9 @@
|
|||||||
extern char *tun_device;
|
extern char *tun_device;
|
||||||
extern int tun_fd;
|
extern int tun_fd;
|
||||||
|
|
||||||
extern int open_tun();
|
int open_tun();
|
||||||
extern void close_tun();
|
void close_tun();
|
||||||
extern int write_tun(u_char *buf, int len);
|
int write_tun(uint8_t *buf, int len);
|
||||||
extern int read_tun(u_char *buf, int len);
|
int read_tun(uint8_t *buf, int len);
|
||||||
|
|
||||||
#endif /* _TUN_H_ */
|
#endif /* _TUN_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user