projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move RSA key generation into the wrappers.
[tinc]
/
src
/
bsd
/
device.c
diff --git
a/src/bsd/device.c
b/src/bsd/device.c
index
5e7a198
..
35038c7
100644
(file)
--- a/
src/bsd/device.c
+++ b/
src/bsd/device.c
@@
-1,7
+1,7
@@
/*
device.c -- Interaction BSD tun/tap device
/*
device.c -- Interaction BSD tun/tap device
- Copyright (C) 2001-200
4 Ivo Timmermans <ivo@tinc-vpn.org>
,
- 2001-200
4
Guus Sliepen <guus@tinc-vpn.org>
+ Copyright (C) 2001-200
5 Ivo Timmermans
,
+ 2001-200
7
Guus Sliepen <guus@tinc-vpn.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-142,13
+142,13
@@
void close_device(void) {
}
bool read_packet(vpn_packet_t *packet) {
}
bool read_packet(vpn_packet_t *packet) {
- int
leni
n;
+ int
inle
n;
cp();
switch(device_type) {
case DEVICE_TYPE_TUN:
cp();
switch(device_type) {
case DEVICE_TYPE_TUN:
- if((
leni
n = read(device_fd, packet->data + 14, MTU - 14)) <= 0) {
+ if((
inle
n = read(device_fd, packet->data + 14, MTU - 14)) <= 0) {
logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info,
device, strerror(errno));
return false;
logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info,
device, strerror(errno));
return false;
@@
-170,14
+170,14
@@
bool read_packet(vpn_packet_t *packet) {
return false;
}
return false;
}
- packet->len =
leni
n + 14;
+ packet->len =
inle
n + 14;
break;
case DEVICE_TYPE_TUNIFHEAD: {
u_int32_t type;
break;
case DEVICE_TYPE_TUNIFHEAD: {
u_int32_t type;
- struct iovec vector[2] = {{&type, sizeof
(type)
}, {packet->data + 14, MTU - 14}};
+ struct iovec vector[2] = {{&type, sizeof
type
}, {packet->data + 14, MTU - 14}};
- if((
leni
n = readv(device_fd, vector, 2)) <= 0) {
+ if((
inle
n = readv(device_fd, vector, 2)) <= 0) {
logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info,
device, strerror(errno));
return false;
logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info,
device, strerror(errno));
return false;
@@
-201,18
+201,18
@@
bool read_packet(vpn_packet_t *packet) {
return false;
}
return false;
}
- packet->len =
leni
n + 10;
+ packet->len =
inle
n + 10;
break;
}
case DEVICE_TYPE_TAP:
break;
}
case DEVICE_TYPE_TAP:
- if((
leni
n = read(device_fd, packet->data, MTU)) <= 0) {
+ if((
inle
n = read(device_fd, packet->data, MTU)) <= 0) {
logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info,
device, strerror(errno));
return false;
}
logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info,
device, strerror(errno));
return false;
}
- packet->len =
leni
n;
+ packet->len =
inle
n;
break;
default:
break;
default:
@@
-227,8
+227,7
@@
bool read_packet(vpn_packet_t *packet) {
return true;
}
return true;
}
-bool write_packet(vpn_packet_t *packet)
-{
+bool write_packet(vpn_packet_t *packet) {
cp();
ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"),
cp();
ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"),
@@
-245,7
+244,7
@@
bool write_packet(vpn_packet_t *packet)
case DEVICE_TYPE_TUNIFHEAD: {
u_int32_t type;
case DEVICE_TYPE_TUNIFHEAD: {
u_int32_t type;
- struct iovec vector[2] = {{&type, sizeof
(type)}, {packet->data + 14, MTU
- 14}};
+ struct iovec vector[2] = {{&type, sizeof
type}, {packet->data + 14, packet->len
- 14}};
int af;
af = (packet->data[12] << 8) + packet->data[13];
int af;
af = (packet->data[12] << 8) + packet->data[13];
@@
-289,8
+288,7
@@
bool write_packet(vpn_packet_t *packet)
return true;
}
return true;
}
-void dump_device_stats(void)
-{
+void dump_device_stats(void) {
cp();
logger(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device);
cp();
logger(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device);