[S] Change in openvpn[master]: options: Move <= 0 check for keepalive settings earlier

"cron2 \(Code Review\) via Openvpn-devel" <[email protected]>
Newsgroups gmane.network.openvpn.devel
Message-ID <f0b19f2db280659c4c312d6751112b743311ce1f-EmailReplacePatchSet-HTML@gerrit.openvpn.net>
cron2 has uploaded a new patch set (#9) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1155?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2


Change subject: options: Move <= 0 check for keepalive settings earlier
......................................................................

options: Move <= 0 check for keepalive settings earlier

Use the atoi_constrained function.

Change-Id: Ic9ac18f730e6035126ccf1cf19799548e5fd9316
Signed-off-by: Frank Lichtenheld <[email protected]>
Acked-by: Gert Doering <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1155
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg36939.html
Signed-off-by: Gert Doering <[email protected]>
---
M src/openvpn/helper.c
M src/openvpn/options.c
2 files changed, 3 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/55/1155/9

diff --git a/src/openvpn/helper.c b/src/openvpn/helper.c
index 9e7ad93..4c540a6 100644
--- a/src/openvpn/helper.c
+++ b/src/openvpn/helper.c
@@ -552,14 +552,10 @@
         /*
          * Sanity checks.
          */
-        if (o->keepalive_ping <= 0 || o->keepalive_timeout <= 0)
-        {
-            msg(M_USAGE, "--keepalive parameters must be > 0");
-        }
         if (o->keepalive_ping * 2 > o->keepalive_timeout)
         {
             msg(M_USAGE,
-                "the second parameter to --keepalive (restart timeout=%d) must be at least twice the value of the first parameter (ping interval=%d).  A ratio of 1:5 or 1:6 would be even better.  Recommended setting is --keepalive 10 60.",
+                "The second parameter to --keepalive (restart timeout=%d) must be at least twice the value of the first parameter (ping interval=%d).  A ratio of 1:5 or 1:6 would be even better.  Recommended setting is --keepalive 10 60.",
                 o->keepalive_timeout, o->keepalive_ping);
         }
         if (o->ping_send_timeout || o->ping_rec_timeout)
diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 62c0bbb..8012192 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -6777,8 +6777,8 @@
     else if (streq(p[0], "keepalive") && p[1] && p[2] && !p[3])
     {
         VERIFY_PERMISSION(OPT_P_GENERAL);
-        options->keepalive_ping = atoi_warn(p[1], msglevel);
-        options->keepalive_timeout = atoi_warn(p[2], msglevel);
+        atoi_constrained(p[1], &options->keepalive_ping, "keepalive ping", 1, INT_MAX, msglevel);
+        atoi_constrained(p[2], &options->keepalive_timeout, "keepalive timeout", 1, INT_MAX, msglevel);
     }
     else if (streq(p[0], "ping") && p[1] && !p[2])
     {

-- 
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1155?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic9ac18f730e6035126ccf1cf19799548e5fd9316
Gerrit-Change-Number: 1155
Gerrit-PatchSet: 9
Gerrit-Owner: flichtenheld <[email protected]>
Gerrit-Reviewer: cron2 <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.