Skip to content
Permalink
Browse files

rc: openvpn: remove waits for ntp sync in openvpn code since wanup al…

…ready does it before starting OpenVPN instances.
  • Loading branch information...
RMerl committed Jun 10, 2019
1 parent a34c408 commit a11bc194f0616565d9fd5bbbf564df52e0fcf68e
Showing with 2 additions and 20 deletions.
  1. +2 −20 release/src/router/rc/openvpn.c
@@ -60,7 +60,6 @@ void start_ovpn_client(int clientNum)
int userauth, useronly;
char cpulist[2];
int taskset_ret;
int i;
char prefix[16];

snprintf(prefix, sizeof(prefix), "vpn_client%d_", clientNum);
@@ -71,11 +70,6 @@ void start_ovpn_client(int clientNum)
return;
}

i = 0;
while ((!nvram_get_int("ntp_ready")) && (i++ < 10)) {
sleep(i*i);
}

vpnlog(VPN_LOG_INFO,"VPN GUI client backend starting...");

if ( (pid = pidof(&buffer[6])) >= 0 )
@@ -610,7 +604,7 @@ void start_ovpn_server(int serverNum)
int taskset_ret;
int valid = 0;
int userauth = 0, useronly = 0;
int i, len;
int len;
char prefix[16];
DH *dhparams = NULL;

@@ -622,11 +616,6 @@ void start_ovpn_server(int serverNum)
return;
}

i = 0;
while ((!nvram_get_int("ntp_ready")) && (i++ < 10)) {
sleep(i*i);
}

vpnlog(VPN_LOG_INFO,"VPN GUI server backend starting...");

if ( (pid = pidof(&buffer[6])) >= 0 )
@@ -1521,20 +1510,13 @@ void stop_ovpn_server(int serverNum)
void start_ovpn_eas()
{
char buffer[16], *cur;
int nums[OVPN_CLIENT_MAX], i;
int nums[OVPN_CLIENT_MAX], i = 0;

if (strlen(nvram_safe_get("vpn_serverx_start")) == 0 && strlen(nvram_safe_get("vpn_clientx_eas")) == 0) return;

// wait for time sync for a while
i = 0;
while ((!nvram_get_int("ntp_ready")) && (i++ < 10)) {
sleep(i*i);
}

// Parse and start servers
strlcpy(buffer, nvram_safe_get("vpn_serverx_start"), sizeof(buffer));
if ( strlen(buffer) != 0 ) vpnlog(VPN_LOG_INFO, "Starting OpenVPN servers (eas): %s", buffer);
i = 0;
for( cur = strtok(buffer,","); cur != NULL && i < OVPN_CLIENT_MAX; cur = strtok(NULL, ",")) { nums[i++] = atoi(cur); }
if(i < OVPN_CLIENT_MAX) nums[i] = 0;
for( i = 0; nums[i] > 0 && i < OVPN_CLIENT_MAX; i++ )

0 comments on commit a11bc19

Please sign in to comment.
You can’t perform that action at this time.