projects
/
oweals
/
tinc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
afda1d9
)
Const correctness.
author
Guus Sliepen
<guus@tinc-vpn.org>
Sat, 4 Nov 2017 13:28:21 +0000
(14:28 +0100)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Sat, 4 Nov 2017 13:28:21 +0000
(14:28 +0100)
src/bsd/device.c
patch
|
blob
|
history
src/cygwin/device.c
patch
|
blob
|
history
src/dummy_device.c
patch
|
blob
|
history
src/linux/device.c
patch
|
blob
|
history
src/mingw/device.c
patch
|
blob
|
history
src/multicast_device.c
patch
|
blob
|
history
src/raw_socket_device.c
patch
|
blob
|
history
src/solaris/device.c
patch
|
blob
|
history
src/uml_device.c
patch
|
blob
|
history
src/vde_device.c
patch
|
blob
|
history
diff --git
a/src/bsd/device.c
b/src/bsd/device.c
index 62e7e84b8e216f529f2075acea090798640807e9..23d6d6977ada8cca57226aa795b80062f4fef869 100644
(file)
--- a/
src/bsd/device.c
+++ b/
src/bsd/device.c
@@
-55,7
+55,7
@@
typedef enum device_type {
int device_fd = -1;
char *device = NULL;
char *iface = NULL;
int device_fd = -1;
char *device = NULL;
char *iface = NULL;
-static c
har *device_info = NULL
;
+static c
onst char *device_info = "OS X utun device"
;
static uint64_t device_total_in = 0;
static uint64_t device_total_out = 0;
#if defined(ENABLE_TUNEMU)
static uint64_t device_total_in = 0;
static uint64_t device_total_out = 0;
#if defined(ENABLE_TUNEMU)
@@
-117,8
+117,6
@@
static bool setup_utun(void) {
iface = xstrdup(name);
}
iface = xstrdup(name);
}
- device_info = "OS X utun device";
-
logger(LOG_INFO, "%s is a %s", device, device_info);
return true;
logger(LOG_INFO, "%s is a %s", device, device_info);
return true;
diff --git
a/src/cygwin/device.c
b/src/cygwin/device.c
index 3a242bfaa3c2f589d2d8e608b3e4fddc17ed2f4c..1165d675cf5281d14fa36e05744b266ae88f83e7 100644
(file)
--- a/
src/cygwin/device.c
+++ b/
src/cygwin/device.c
@@
-37,7
+37,7
@@
int device_fd = -1;
static HANDLE device_handle = INVALID_HANDLE_VALUE;
char *device = NULL;
char *iface = NULL;
static HANDLE device_handle = INVALID_HANDLE_VALUE;
char *device = NULL;
char *iface = NULL;
-static c
har *device_info = NULL
;
+static c
onst char *device_info = "Windows tap device"
;
static uint64_t device_total_in = 0;
static uint64_t device_total_out = 0;
static uint64_t device_total_in = 0;
static uint64_t device_total_out = 0;
@@
-221,8
+221,6
@@
static bool setup_device(void) {
return false;
}
return false;
}
- device_info = "Windows tap device";
-
logger(LOG_INFO, "%s (%s) is a %s", device, iface, device_info);
return true;
logger(LOG_INFO, "%s (%s) is a %s", device, iface, device_info);
return true;
diff --git
a/src/dummy_device.c
b/src/dummy_device.c
index deda7d4670be6437f1b03931f182285771065aa8..4b01072368c13334f884530a1fef01fec273234f 100644
(file)
--- a/
src/dummy_device.c
+++ b/
src/dummy_device.c
@@
-22,15
+22,16
@@
#include "device.h"
#include "logger.h"
#include "net.h"
#include "device.h"
#include "logger.h"
#include "net.h"
+#include "xalloc.h"
-static char *device_info = "dummy device";
+static c
onst c
har *device_info = "dummy device";
static uint64_t device_total_in = 0;
static uint64_t device_total_out = 0;
static bool setup_device(void) {
static uint64_t device_total_in = 0;
static uint64_t device_total_out = 0;
static bool setup_device(void) {
- device =
"dummy"
;
- iface =
"dummy"
;
+ device =
xstrdup("dummy")
;
+ iface =
xstrdup("dummy")
;
logger(LOG_INFO, "%s (%s) is a %s", device, iface, device_info);
return true;
}
logger(LOG_INFO, "%s (%s) is a %s", device, iface, device_info);
return true;
}
diff --git
a/src/linux/device.c
b/src/linux/device.c
index 990de6a812149131190ebd2918bee0b471c14536..38debe842d1d4fae3ba34609052be8af9ace44a4 100644
(file)
--- a/
src/linux/device.c
+++ b/
src/linux/device.c
@@
-47,7
+47,7
@@
char *device = NULL;
char *iface = NULL;
static char *type = NULL;
static char ifrname[IFNAMSIZ];
char *iface = NULL;
static char *type = NULL;
static char ifrname[IFNAMSIZ];
-static char *device_info;
+static c
onst c
har *device_info;
static uint64_t device_total_in = 0;
static uint64_t device_total_out = 0;
static uint64_t device_total_in = 0;
static uint64_t device_total_out = 0;
diff --git
a/src/mingw/device.c
b/src/mingw/device.c
index 341d7a9f9c15eac49e983976524e522bbe1b32b5..321c51511d76a9d523399f5e95cd9b9e5822cdcf 100644
(file)
--- a/
src/mingw/device.c
+++ b/
src/mingw/device.c
@@
-37,7
+37,7
@@
int device_fd = -1;
static HANDLE device_handle = INVALID_HANDLE_VALUE;
char *device = NULL;
char *iface = NULL;
static HANDLE device_handle = INVALID_HANDLE_VALUE;
char *device = NULL;
char *iface = NULL;
-static c
har *device_info = NULL
;
+static c
onst char *device_info = "Windows tap device"
;
static uint64_t device_total_in = 0;
static uint64_t device_total_out = 0;
static uint64_t device_total_in = 0;
static uint64_t device_total_out = 0;
@@
-236,8
+236,6
@@
static bool setup_device(void) {
status = true;
DeviceIoControl(device_handle, TAP_IOCTL_SET_MEDIA_STATUS, &status, sizeof(status), &status, sizeof(status), &len, NULL);
status = true;
DeviceIoControl(device_handle, TAP_IOCTL_SET_MEDIA_STATUS, &status, sizeof(status), &status, sizeof(status), &len, NULL);
- device_info = "Windows tap device";
-
logger(LOG_INFO, "%s (%s) is a %s", device, iface, device_info);
return true;
logger(LOG_INFO, "%s (%s) is a %s", device, iface, device_info);
return true;
diff --git
a/src/multicast_device.c
b/src/multicast_device.c
index 2cc7163a625913158c32b0b4e314eaea191e2edd..93a40c4134b30412e030c88a0333201b133f68f3 100644
(file)
--- a/
src/multicast_device.c
+++ b/
src/multicast_device.c
@@
-29,7
+29,7
@@
#include "route.h"
#include "xalloc.h"
#include "route.h"
#include "xalloc.h"
-static c
har *device_info
;
+static c
onst char *device_info = "multicast socket"
;
static uint64_t device_total_in = 0;
static uint64_t device_total_out = 0;
static uint64_t device_total_in = 0;
static uint64_t device_total_out = 0;
@@
-43,8
+43,6
@@
static bool setup_device(void) {
char *space;
int ttl = 1;
char *space;
int ttl = 1;
- device_info = "multicast socket";
-
get_config_string(lookup_config(config_tree, "Interface"), &iface);
if(!get_config_string(lookup_config(config_tree, "Device"), &device)) {
get_config_string(lookup_config(config_tree, "Interface"), &iface);
if(!get_config_string(lookup_config(config_tree, "Device"), &device)) {
diff --git
a/src/raw_socket_device.c
b/src/raw_socket_device.c
index 92f07c6266e248708d70b5d870b030af20bca674..f4ed6941bbafc7af01c62f362cf214010657994f 100644
(file)
--- a/
src/raw_socket_device.c
+++ b/
src/raw_socket_device.c
@@
-33,7
+33,7
@@
#include "xalloc.h"
#if defined(PF_PACKET) && defined(ETH_P_ALL) && defined(AF_PACKET) && defined(SIOCGIFINDEX)
#include "xalloc.h"
#if defined(PF_PACKET) && defined(ETH_P_ALL) && defined(AF_PACKET) && defined(SIOCGIFINDEX)
-static c
har *device_info
;
+static c
onst char *device_info = "raw_socket"
;
static uint64_t device_total_in = 0;
static uint64_t device_total_out = 0;
static uint64_t device_total_in = 0;
static uint64_t device_total_out = 0;
@@
-50,8
+50,6
@@
static bool setup_device(void) {
device = xstrdup(iface);
}
device = xstrdup(iface);
}
- device_info = "raw socket";
-
if((device_fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL))) < 0) {
logger(LOG_ERR, "Could not open %s: %s", device_info,
strerror(errno));
if((device_fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL))) < 0) {
logger(LOG_ERR, "Could not open %s: %s", device_info,
strerror(errno));
diff --git
a/src/solaris/device.c
b/src/solaris/device.c
index 527823e0b219e8712d9519df9b594a36d3087bf6..fa2e6e64e7f9e9e75c72f70bc372c934111edca8 100644
(file)
--- a/
src/solaris/device.c
+++ b/
src/solaris/device.c
@@
-53,7
+53,7
@@
static int if_fd = -1;
static int ip_fd = -1;
char *device = NULL;
char *iface = NULL;
static int ip_fd = -1;
char *device = NULL;
char *iface = NULL;
-static char *device_info = NULL;
+static c
onst c
har *device_info = NULL;
uint64_t device_total_in = 0;
uint64_t device_total_out = 0;
uint64_t device_total_in = 0;
uint64_t device_total_out = 0;
diff --git
a/src/uml_device.c
b/src/uml_device.c
index ee9e03f4291419aa3372348888b2053b543f9178..4a03bb7bae9f2716ff991c24f5d268d3c9c8f77b 100644
(file)
--- a/
src/uml_device.c
+++ b/
src/uml_device.c
@@
-35,7
+35,7
@@
static int request_fd = -1;
static int data_fd = -1;
static int write_fd = -1;
static int state = 0;
static int data_fd = -1;
static int write_fd = -1;
static int state = 0;
-static c
har *device_info
;
+static c
onst char *device_info = "UML network socket"
;
extern char *identname;
extern volatile bool running;
extern char *identname;
extern volatile bool running;
@@
-70,8
+70,6
@@
static bool setup_device(void) {
get_config_string(lookup_config(config_tree, "Interface"), &iface);
get_config_string(lookup_config(config_tree, "Interface"), &iface);
- device_info = "UML network socket";
-
if((write_fd = socket(PF_UNIX, SOCK_DGRAM, 0)) < 0) {
logger(LOG_ERR, "Could not open write %s: %s", device_info, strerror(errno));
running = false;
if((write_fd = socket(PF_UNIX, SOCK_DGRAM, 0)) < 0) {
logger(LOG_ERR, "Could not open write %s: %s", device_info, strerror(errno));
running = false;
diff --git
a/src/vde_device.c
b/src/vde_device.c
index 20302b0d9f44ff3e0cad0c8daa60a2c744678e9c..6d854a61d644e86f23a73575c705fc28f71c427b 100644
(file)
--- a/
src/vde_device.c
+++ b/
src/vde_device.c
@@
-33,7
+33,7
@@
static struct vdepluglib plug;
static struct vdeconn *conn = NULL;
static int port = 0;
static char *group = NULL;
static struct vdeconn *conn = NULL;
static int port = 0;
static char *group = NULL;
-static c
har *device_info
;
+static c
onst char *device_info = "VDE socket"
;
extern char *identname;
extern volatile bool running;
extern char *identname;
extern volatile bool running;
@@
-59,8
+59,6
@@
static bool setup_device(void) {
get_config_string(lookup_config(config_tree, "VDEGroup"), &group);
get_config_string(lookup_config(config_tree, "VDEGroup"), &group);
- device_info = "VDE socket";
-
struct vde_open_args args = {
.port = port,
.group = group,
struct vde_open_args args = {
.port = port,
.group = group,