projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Check for ethernet/ipv4/ipv6 related structures.
[tinc]
/
src
/
darwin
/
device.c
diff --git
a/src/darwin/device.c
b/src/darwin/device.c
index
3da6726
..
ef6c777
100644
(file)
--- a/
src/darwin/device.c
+++ b/
src/darwin/device.c
@@
-17,35
+17,22
@@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: device.c,v 1.1.2.
8 2003/07/12 17:41:47
guus Exp $
+ $Id: device.c,v 1.1.2.
9 2003/07/18 13:41:36
guus Exp $
*/
*/
-#include "config.h"
-
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <fcntl.h>
-#include <net/if.h>
-#include <unistd.h>
-#include <string.h>
+#include "system.h"
-#include <utils.h>
#include "conf.h"
#include "conf.h"
-#include "net.h"
#include "logger.h"
#include "logger.h"
-
-#include "
system
.h"
+#include "net.h"
+#include "
utils
.h"
#define DEFAULT_DEVICE "/dev/tun0"
int device_fd = -1;
int device_type;
char *device;
#define DEFAULT_DEVICE "/dev/tun0"
int device_fd = -1;
int device_type;
char *device;
-char *i
nter
face;
+char *iface;
char *device_info;
int device_total_in = 0;
int device_total_out = 0;
char *device_info;
int device_total_in = 0;
int device_total_out = 0;
@@
-57,8
+44,8
@@
int setup_device(void)
if(!get_config_string(lookup_config(config_tree, "Device"), &device))
device = DEFAULT_DEVICE;
if(!get_config_string(lookup_config(config_tree, "Device"), &device))
device = DEFAULT_DEVICE;
- if(!get_config_string(lookup_config(config_tree, "Interface"), &i
nter
face))
- i
nter
face = rindex(device, '/') ? rindex(device, '/') + 1 : device;
+ if(!get_config_string(lookup_config(config_tree, "Interface"), &iface))
+ iface = rindex(device, '/') ? rindex(device, '/') + 1 : device;
if((device_fd = open(device, O_RDWR | O_NONBLOCK)) < 0) {
logger(LOG_ERR, _("Could not open %s: %s"), device, strerror(errno));
if((device_fd = open(device, O_RDWR | O_NONBLOCK)) < 0) {
logger(LOG_ERR, _("Could not open %s: %s"), device, strerror(errno));