projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't close control connections when handling a reload command.
[tinc]
/
src
/
uml_device.c
diff --git
a/src/uml_device.c
b/src/uml_device.c
index
26bcb01
..
f0a9869
100644
(file)
--- a/
src/uml_device.c
+++ b/
src/uml_device.c
@@
-1,7
+1,7
@@
/*
device.c -- UML network socket
Copyright (C) 2002-2005 Ivo Timmermans,
/*
device.c -- UML network socket
Copyright (C) 2002-2005 Ivo Timmermans,
- 2002-201
1
Guus Sliepen <guus@tinc-vpn.org>
+ 2002-201
2
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
@@
-77,6
+77,10
@@
static bool setup_device(void) {
return false;
}
return false;
}
+#ifdef FD_CLOEXEC
+ fcntl(write_fd, F_SETFD, FD_CLOEXEC);
+#endif
+
setsockopt(write_fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof one);
if(fcntl(write_fd, F_SETFL, O_NONBLOCK) < 0) {
setsockopt(write_fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof one);
if(fcntl(write_fd, F_SETFL, O_NONBLOCK) < 0) {
@@
-91,6
+95,10
@@
static bool setup_device(void) {
return false;
}
return false;
}
+#ifdef FD_CLOEXEC
+ fcntl(data_fd, F_SETFD, FD_CLOEXEC);
+#endif
+
setsockopt(data_fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof one);
if(fcntl(data_fd, F_SETFL, O_NONBLOCK) < 0) {
setsockopt(data_fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof one);
if(fcntl(data_fd, F_SETFL, O_NONBLOCK) < 0) {
@@
-118,6
+126,10
@@
static bool setup_device(void) {
return false;
}
return false;
}
+#ifdef FD_CLOEXEC
+ fcntl(device_fd, F_SETFD, FD_CLOEXEC);
+#endif
+
setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof one);
if(fcntl(listen_fd, F_SETFL, O_NONBLOCK) < 0) {
setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof one);
if(fcntl(listen_fd, F_SETFL, O_NONBLOCK) < 0) {
@@
-168,7
+180,7
@@
void close_device(void) {
}
static bool read_packet(vpn_packet_t *packet) {
}
static bool read_packet(vpn_packet_t *packet) {
- int
leni
n;
+ int
inle
n;
switch(state) {
case 0: {
switch(state) {
case 0: {
@@
-181,6
+193,10
@@
static bool read_packet(vpn_packet_t *packet) {
return false;
}
return false;
}
+#ifdef FD_CLOEXEC
+ fcntl(request_fd, F_SETFD, FD_CLOEXEC);
+#endif
+
if(fcntl(listen_fd, F_SETFL, O_NONBLOCK) < 0) {
logger(LOG_ERR, "System call `%s' failed: %s", "fcntl", strerror(errno));
running = false;
if(fcntl(listen_fd, F_SETFL, O_NONBLOCK) < 0) {
logger(LOG_ERR, "System call `%s' failed: %s", "fcntl", strerror(errno));
running = false;
@@
-196,7
+212,7
@@
static bool read_packet(vpn_packet_t *packet) {
}
case 1: {
}
case 1: {
- if((
leni
n = read(request_fd, &request, sizeof request)) != sizeof request) {
+ if((
inle
n = read(request_fd, &request, sizeof request)) != sizeof request) {
logger(LOG_ERR, "Error while reading request from %s %s: %s", device_info,
device, strerror(errno));
running = false;
logger(LOG_ERR, "Error while reading request from %s %s: %s", device_info,
device, strerror(errno));
running = false;
@@
-226,14
+242,14
@@
static bool read_packet(vpn_packet_t *packet) {
}
case 2: {
}
case 2: {
- if((
leni
n = read(data_fd, packet->data, MTU)) <= 0) {
+ if((
inle
n = read(data_fd, packet->data, MTU)) <= 0) {
logger(LOG_ERR, "Error while reading from %s %s: %s", device_info,
device, strerror(errno));
running = false;
return false;
}
logger(LOG_ERR, "Error while reading from %s %s: %s", device_info,
device, strerror(errno));
running = false;
return false;
}
- packet->len =
leni
n;
+ packet->len =
inle
n;
device_total_in += packet->len;
device_total_in += packet->len;