Add tundevicename configuration option
This commit is contained in:
parent
699dd8b571
commit
f9243ffec5
3 changed files with 17 additions and 5 deletions
7
debian/changelog
vendored
7
debian/changelog
vendored
|
|
@ -1,3 +1,10 @@
|
||||||
|
l2tpns (2.2.1-2fdn3.1) unstable; urgency=low
|
||||||
|
|
||||||
|
* Add tundevicename configuration option
|
||||||
|
* Fix: last_packet no updated in cluster mode
|
||||||
|
|
||||||
|
-- Fernando Alves <fernando.alves@sameswireless.fr> Fri, 21 Dec 2012 11:41:42 +0100
|
||||||
|
|
||||||
l2tpns (2.2.1-2fdn3) unstable; urgency=low
|
l2tpns (2.2.1-2fdn3) unstable; urgency=low
|
||||||
|
|
||||||
* LAC functionality merged from dev-lac branch.
|
* LAC functionality merged from dev-lac branch.
|
||||||
|
|
|
||||||
13
l2tpns.c
13
l2tpns.c
|
|
@ -179,6 +179,7 @@ config_descriptt config_values[] = {
|
||||||
CONFIG("echo_timeout", echo_timeout, INT),
|
CONFIG("echo_timeout", echo_timeout, INT),
|
||||||
CONFIG("idle_echo_timeout", idle_echo_timeout, INT),
|
CONFIG("idle_echo_timeout", idle_echo_timeout, INT),
|
||||||
CONFIG("iftun_address", iftun_address, IPv4),
|
CONFIG("iftun_address", iftun_address, IPv4),
|
||||||
|
CONFIG("tundevicename", tundevicename, STRING),
|
||||||
#ifdef LAC
|
#ifdef LAC
|
||||||
CONFIG("disable_lac_func", disable_lac_func, BOOL),
|
CONFIG("disable_lac_func", disable_lac_func, BOOL),
|
||||||
CONFIG("bind_address_remotelns", bind_address_remotelns, IPv4),
|
CONFIG("bind_address_remotelns", bind_address_remotelns, IPv4),
|
||||||
|
|
@ -690,15 +691,19 @@ static void inittun(void)
|
||||||
int flags = fcntl(tunfd, F_GETFL, 0);
|
int flags = fcntl(tunfd, F_GETFL, 0);
|
||||||
fcntl(tunfd, F_SETFL, flags | O_NONBLOCK);
|
fcntl(tunfd, F_SETFL, flags | O_NONBLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*config->tundevicename)
|
||||||
|
strncpy(ifr.ifr_name, config->tundevicename, IFNAMSIZ);
|
||||||
|
|
||||||
if (ioctl(tunfd, TUNSETIFF, (void *) &ifr) < 0)
|
if (ioctl(tunfd, TUNSETIFF, (void *) &ifr) < 0)
|
||||||
{
|
{
|
||||||
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) - 1);
|
assert(strlen(ifr.ifr_name) < sizeof(config->tundevicename) - 1);
|
||||||
strncpy(config->tundevice, ifr.ifr_name, sizeof(config->tundevice));
|
strncpy(config->tundevicename, ifr.ifr_name, sizeof(config->tundevicename));
|
||||||
|
|
||||||
tunidx = if_nametoindex(config->tundevice);
|
tunidx = if_nametoindex(config->tundevicename);
|
||||||
if (tunidx == 0)
|
if (tunidx == 0)
|
||||||
{
|
{
|
||||||
LOG(0, 0, 0, "Can't get tun interface index\n");
|
LOG(0, 0, 0, "Can't get tun interface index\n");
|
||||||
|
|
@ -5039,7 +5044,7 @@ int main(int argc, char *argv[])
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
inittun();
|
inittun();
|
||||||
LOG(1, 0, 0, "Set up on interface %s\n", config->tundevice);
|
LOG(1, 0, 0, "Set up on interface %s\n", config->tundevicename);
|
||||||
|
|
||||||
initudp();
|
initudp();
|
||||||
initrad();
|
initrad();
|
||||||
|
|
|
||||||
2
l2tpns.h
2
l2tpns.h
|
|
@ -658,7 +658,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[IFNAMSIZ]; // tun device name
|
char tundevicename[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