Better tun device name length handling.
Signed-off-by: Benjamin Cama <benoar@dolka.fr>
This commit is contained in:
parent
8f944eeb21
commit
4344f5e9c7
2 changed files with 7 additions and 3 deletions
4
l2tpns.c
4
l2tpns.c
|
|
@ -611,8 +611,8 @@ static void inittun(void)
|
||||||
LOG(0, 0, 0, "Can't set tun interface: %s\n", strerror(errno));
|
LOG(0, 0, 0, "Can't set tun interface: %s\n", strerror(errno));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
assert(strlen(ifr.ifr_name) < sizeof(config->tundevice));
|
assert(strlen(ifr.ifr_name) < sizeof(config->tundevice) - 1);
|
||||||
strncpy(config->tundevice, ifr.ifr_name, sizeof(config->tundevice) - 1);
|
strncpy(config->tundevice, ifr.ifr_name, sizeof(config->tundevice));
|
||||||
|
|
||||||
{
|
{
|
||||||
// get the interface index
|
// get the interface index
|
||||||
|
|
|
||||||
6
l2tpns.h
6
l2tpns.h
|
|
@ -616,6 +616,10 @@ struct Tstats
|
||||||
#define SET_STAT(x, y)
|
#define SET_STAT(x, y)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef IFNAMSIZ
|
||||||
|
# define IFNAMSIZ 16
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int debug; // debugging level
|
int debug; // debugging level
|
||||||
|
|
@ -631,7 +635,7 @@ typedef struct
|
||||||
int reload_config; // flag to re-read config (set by cli)
|
int reload_config; // flag to re-read config (set by cli)
|
||||||
int multi_read_count; // amount of packets to read per fd in processing loop
|
int multi_read_count; // amount of packets to read per fd in processing loop
|
||||||
|
|
||||||
char tundevice[10]; // tun device name
|
char tundevice[IFNAMSIZ]; // tun device name
|
||||||
char log_filename[128];
|
char log_filename[128];
|
||||||
|
|
||||||
char l2tp_secret[64]; // L2TP shared secret
|
char l2tp_secret[64]; // L2TP shared secret
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue