projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
61b441d
)
Const correctness.
author
Guus Sliepen
<guus@tinc-vpn.org>
Mon, 6 Nov 2017 21:44:12 +0000
(22:44 +0100)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Mon, 6 Nov 2017 21:44:12 +0000
(22:44 +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
6d68bc7
..
5a572ba
100644
(file)
--- a/
src/bsd/device.c
+++ b/
src/bsd/device.c
@@
-56,7
+56,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"
;
#if defined(ENABLE_TUNEMU)
static device_type_t device_type = DEVICE_TYPE_TUNEMU;
#elif defined(HAVE_OPENBSD) || defined(HAVE_FREEBSD) || defined(HAVE_DRAGONFLY)
#if defined(ENABLE_TUNEMU)
static device_type_t device_type = DEVICE_TYPE_TUNEMU;
#elif defined(HAVE_OPENBSD) || defined(HAVE_FREEBSD) || defined(HAVE_DRAGONFLY)
@@
-116,8
+116,6
@@
static bool setup_utun(void) {
iface = xstrdup(name);
}
iface = xstrdup(name);
}
- device_info = "OS X utun device";
-
logger(DEBUG_ALWAYS, LOG_INFO, "%s is a %s", device, device_info);
return true;
logger(DEBUG_ALWAYS, LOG_INFO, "%s is a %s", device, device_info);
return true;
diff --git
a/src/cygwin/device.c
b/src/cygwin/device.c
index
1265f9d
..
6d94988
100644
(file)
--- a/
src/cygwin/device.c
+++ b/
src/cygwin/device.c
@@
-38,7
+38,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 pid_t reader_pid;
static int sp[2];
static pid_t reader_pid;
static int sp[2];
@@
-219,8
+219,6
@@
static bool setup_device(void) {
return false;
}
return false;
}
- device_info = "Windows tap device";
-
logger(DEBUG_ALWAYS, LOG_INFO, "%s (%s) is a %s", device, iface, device_info);
return true;
logger(DEBUG_ALWAYS, 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
c43d586
..
80232e1
100644
(file)
--- a/
src/dummy_device.c
+++ b/
src/dummy_device.c
@@
-22,12
+22,13
@@
#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 bool setup_device(void) {
static bool setup_device(void) {
- device =
"dummy"
;
- iface =
"dummy"
;
+ device =
xstrdup("dummy")
;
+ iface =
xstrdup("dummy")
;
logger(DEBUG_ALWAYS, LOG_INFO, "%s (%s) is a %s", device, iface, device_info);
return true;
}
logger(DEBUG_ALWAYS, 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
23178a3
..
54ea5dc
100644
(file)
--- a/
src/linux/device.c
+++ b/
src/linux/device.c
@@
-44,7
+44,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 bool setup_device(void) {
if(!get_config_string(lookup_config(config_tree, "Device"), &device)) {
static bool setup_device(void) {
if(!get_config_string(lookup_config(config_tree, "Device"), &device)) {
diff --git
a/src/mingw/device.c
b/src/mingw/device.c
index
1116b5e
..
49d0cd3
100644
(file)
--- a/
src/mingw/device.c
+++ b/
src/mingw/device.c
@@
-43,7
+43,7
@@
static vpn_packet_t device_read_packet;
static vpn_packet_t device_write_packet;
char *device = NULL;
char *iface = NULL;
static vpn_packet_t device_write_packet;
char *device = NULL;
char *iface = NULL;
-static c
har *device_info = NULL
;
+static c
onst char *device_info = "Windows tap device"
;
extern char *myport;
extern char *myport;
diff --git
a/src/multicast_device.c
b/src/multicast_device.c
index
c19852b
..
99f26ca
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 struct addrinfo *ai = NULL;
static mac_t ignore_src = {{0}};
static struct addrinfo *ai = NULL;
static mac_t ignore_src = {{0}};
@@
-40,8
+40,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
0ac970c
..
3ec8e57
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 bool setup_device(void) {
struct ifreq ifr;
static bool setup_device(void) {
struct ifreq ifr;
@@
-47,8
+47,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(DEBUG_ALWAYS, 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(DEBUG_ALWAYS, LOG_ERR, "Could not open %s: %s", device_info,
strerror(errno));
diff --git
a/src/solaris/device.c
b/src/solaris/device.c
index
9480dda
..
f27954b
100644
(file)
--- a/
src/solaris/device.c
+++ b/
src/solaris/device.c
@@
-53,7
+53,7
@@
int device_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;
static bool setup_device(void) {
char *type;
static bool setup_device(void) {
char *type;
diff --git
a/src/uml_device.c
b/src/uml_device.c
index
3f52104
..
dbb13e9
100644
(file)
--- a/
src/uml_device.c
+++ b/
src/uml_device.c
@@
-36,7
+36,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"
;
enum request_type { REQ_NEW_CONTROL };
enum request_type { REQ_NEW_CONTROL };
@@
-65,8
+65,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(DEBUG_ALWAYS, LOG_ERR, "Could not open write %s: %s", device_info, strerror(errno));
event_exit();
if((write_fd = socket(PF_UNIX, SOCK_DGRAM, 0)) < 0) {
logger(DEBUG_ALWAYS, LOG_ERR, "Could not open write %s: %s", device_info, strerror(errno));
event_exit();
diff --git
a/src/vde_device.c
b/src/vde_device.c
index
4cbf712
..
0170af3
100644
(file)
--- a/
src/vde_device.c
+++ b/
src/vde_device.c
@@
-34,7
+34,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"
;
static bool setup_device(void) {
libvdeplug_dynopen(plug);
static bool setup_device(void) {
libvdeplug_dynopen(plug);
@@
-54,8
+54,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,