Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1155?usp=email
to review the following change.
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]>
---
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/1
diff --git a/src/openvpn/helper.c b/src/openvpn/helper.c
index b2ecb1e..b262e8d 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 87c0895..97bf957 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -7362,8 +7362,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", 0,
0, msglevel);
+ atoi_constrained(p[2], &options->keepalive_timeout, "keepalive
timeout", 0, 0, 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
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic9ac18f730e6035126ccf1cf19799548e5fd9316
Gerrit-Change-Number: 1155
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel