Skip to content
This repository has been archived by the owner on Dec 14, 2020. It is now read-only.

Commit

Permalink
openvpn: Initial support for instance-specific log verbosity; don't e…
Browse files Browse the repository at this point in the history
…nable multihome support as OpenVPN cannot support dual-stack (IPv4/IPv6) environments with older kernels when this option is enabled. (Backports from 382_9736)
  • Loading branch information
RMerl committed Mar 22, 2017
1 parent 5e8cb44 commit 24f455b
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions release/src/router/rc/openvpn.c
Expand Up @@ -10,6 +10,7 @@

#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <dirent.h>
#include <string.h>
#include <time.h>
Expand Down Expand Up @@ -290,8 +291,10 @@ void start_vpnclient(int clientNum)
fprintf(fp, "route-up vpnrouting.sh\n");
fprintf(fp, "route-pre-down vpnrouting.sh\n");

nvi = nvram_get_int("vpn_loglevel");
if (nvi >= 0)
sprintf(&buffer[0], "vpn_client%d_verb", clientNum);
if( !nvram_is_empty(&buffer[0]) && (nvi = nvram_get_int(&buffer[0])) >= 0 )
fprintf(fp, "verb %d\n", nvi);
else if ( (nvi = nvram_get_int("vpn_loglevel")) >= 0 )
fprintf(fp, "verb %d\n", nvi);
else
fprintf(fp, "verb 3\n");
Expand Down Expand Up @@ -854,10 +857,8 @@ void start_vpnserver(int serverNum)
//protocol
sprintf(&buffer[0], "vpn_server%d_proto", serverNum);
fprintf(fp, "proto %s\n", nvram_safe_get(&buffer[0]));
if(!strcmp(nvram_safe_get(&buffer[0]), "udp")) {
fprintf(fp, "multihome\n");
if(!strcmp(nvram_safe_get(&buffer[0]), "udp"))
fprintf(fp_client, "proto %s\n", nvram_safe_get(&buffer[0]));
}
else
fprintf(fp_client, "proto tcp-client\n");

Expand Down Expand Up @@ -934,7 +935,10 @@ void start_vpnserver(int serverNum)
fprintf(fp, "keepalive 15 60\n");
fprintf(fp_client, "keepalive 15 60\n");

if ( (nvi = nvram_get_int("vpn_loglevel")) >= 0 )
sprintf(&buffer[0], "vpn_server%d_verb", serverNum);
if( !nvram_is_empty(&buffer[0]) && (nvi = nvram_get_int(&buffer[0])) >= 0 )
fprintf(fp, "verb %d\n", nvi);
else if ( (nvi = nvram_get_int("vpn_loglevel")) >= 0 )
fprintf(fp, "verb %d\n", nvi);
else
fprintf(fp, "verb 3\n");
Expand Down

1 comment on commit 24f455b

@RMerl
Copy link
Owner Author

@RMerl RMerl commented on 24f455b Mar 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional info for the dual-stack issue: https://community.openvpn.net/openvpn/ticket/306

Please sign in to comment.