projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Backport fixes from trunk since revision 1555.
[tinc]
/
src
/
cygwin
/
device.c
diff --git
a/src/cygwin/device.c
b/src/cygwin/device.c
index
3be59ce
..
c4c85d8
100644
(file)
--- a/
src/cygwin/device.c
+++ b/
src/cygwin/device.c
@@
-46,8
+46,7
@@
static int device_total_out = 0;
static pid_t reader_pid;
static int sp[2];
static pid_t reader_pid;
static int sp[2];
-bool setup_device(void)
-{
+bool setup_device(void) {
HKEY key, key2;
int i, err;
HKEY key, key2;
int i, err;
@@
-177,7
+176,7
@@
bool setup_device(void)
It passes everything it reads to the socket. */
char buf[MTU];
It passes everything it reads to the socket. */
char buf[MTU];
- long
leni
n;
+ long
inle
n;
CloseHandle(device_handle);
CloseHandle(device_handle);
@@
-200,8
+199,8
@@
bool setup_device(void)
/* Pass packets */
for(;;) {
/* Pass packets */
for(;;) {
- ReadFile(device_handle, buf, MTU, &
leni
n, NULL);
- write(sp[1], buf,
leni
n);
+ ReadFile(device_handle, buf, MTU, &
inle
n, NULL);
+ write(sp[1], buf,
inle
n);
}
}
}
}
@@
-218,8
+217,7
@@
bool setup_device(void)
return true;
}
return true;
}
-void close_device(void)
-{
+void close_device(void) {
cp();
close(sp[0]);
cp();
close(sp[0]);
@@
-229,19
+227,18
@@
void close_device(void)
kill(reader_pid, SIGKILL);
}
kill(reader_pid, SIGKILL);
}
-bool read_packet(vpn_packet_t *packet)
-{
- int lenin;
+bool read_packet(vpn_packet_t *packet) {
+ int inlen;
cp();
cp();
- if((
leni
n = read(sp[0], packet->data, MTU)) <= 0) {
+ if((
inle
n = read(sp[0], 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;
device_total_in += packet->len;
device_total_in += packet->len;
@@
-251,16
+248,15
@@
bool read_packet(vpn_packet_t *packet)
return true;
}
return true;
}
-bool write_packet(vpn_packet_t *packet)
-{
- long lenout;
+bool write_packet(vpn_packet_t *packet) {
+ long outlen;
cp();
ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"),
packet->len, device_info);
cp();
ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"),
packet->len, device_info);
- if(!WriteFile (device_handle, packet->data, packet->len, &
lenout
, NULL)) {
+ if(!WriteFile (device_handle, packet->data, packet->len, &
outlen
, NULL)) {
logger(LOG_ERR, _("Error while writing to %s %s: %s"), device_info, device, winerror(GetLastError()));
return false;
}
logger(LOG_ERR, _("Error while writing to %s %s: %s"), device_info, device, winerror(GetLastError()));
return false;
}
@@
-270,8
+266,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);