From: "cron2 (Code Review)"
Date: Mon, 21 Jul 2025 18:08:07 +0000
In-Reply-To:
References:
Reply-To: gert@...1296..., arne-openvpn@...1227..., marco@...2726...,
openvpn-devel@lists.sourceforge.net, frank@...2641...,
lstipakov@...277...
Message-ID: <2b33e02a8ac59e8cbed5ce24bb1ac7d5c6f5fe34-EmailReviewComments-HTML@...2715...>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="ul0rUlzOpio="; charset=UTF-8
Subject: [Openvpn-devel] [L] Change in openvpn[master]: PUSH_UPDATE: Allow
OpenVPN in client mode to receive and handle PUSH ...
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
To: mrbff
Cc: flichtenheld , stipa , plaisthos , openvpn-devel
--ul0rUlzOpio=
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: cron2, flichtenheld, mrbff, stipa.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/ope=
nvpn/+/808?usp=3Demail )
Change subject: PUSH_UPDATE: Allow OpenVPN in client mode to receive and ha=
ndle PUSH UPDATE control messages to allow options updating at runtime.
......................................................................
Patch Set 19: Code-Review-1
Copied votes on follow-up patch sets have been updated:
* Code-Review-1 has been copied to patch set 20 (copy condition: "changekin=
d:NO_CHANGE OR changekind:TRIVIAL_REBASE OR is:MIN").
(10 comments)
Patchset:
PS19:
So, I think this works and is sufficently save and efficient, but I'm and o=
ld man and like my lawn orderly... so as discussed on IRC, please adjust a =
few minor points.
File src/openvpn/options.c:
http://gerrit.openvpn.net/c/openvpn/+/808/comment/849fb9c1_8109d087 :
PS19, Line 5567: apply_push_options(struct options *options,
please do not move that one around in options.c, this makes comparing old/n=
ew harder without good benefit, also breaks git blame...
http://gerrit.openvpn.net/c/openvpn/+/808/comment/25512e6f_b2eb183f :
PS19, Line 5654:
so I would call check_push_update_option_flags() from here, possibly moving=
the "while isspace(*line) { line++; }" part up here as well. Then we can =
keep "apply_pull_filter()" focused on "pull filter", not dealing with a num=
ber of extra conditions... (just "is_update", see there)
File src/openvpn/options_util.c:
http://gerrit.openvpn.net/c/openvpn/+/808/comment/5c5cd074_1394fe2c :
PS19, Line 198: if (!line || !*line || !**line)
the use of a double pointer irritates me, because we never move the pointer=
, instead `memmove()` the buffer...
I think we should just do `(*line)++` instead of the `memmove()` below - po=
ssibly also getting rid of the `strlen(str)` thing, or `str` altogether :-)=
- so keep the pointer, call it from `apply_push_options()` and accept a mo=
ving `*line` pointer.
Also, I'm not sure if "empty string" should be treated as `false` or just i=
gnored (return true, that is) - the existing environment where `apply_pull_=
filter()` is used does not care for "empty lines".
A NULL pointer is a programming error that must never happen, so an ASSERT(=
line) is valid.
http://gerrit.openvpn.net/c/openvpn/+/808/comment/6ffca9a9_893ed859 :
PS19, Line 231:
If there is whitespace here (`? route`) we'll fail with `pushed option is =
not updateable: ' route'`, if I'm not misreading it.
I'd document that "there must not be whitespace between the flag letters an=
d the option" and then we could add an `if (isspace(**line)) { complain; re=
turn false; }` here... the documentation is important, the error handling n=
ot so much (as it will hit the `return false` anyway)
http://gerrit.openvpn.net/c/openvpn/+/808/comment/bc8b42ab_3cf0ba0c :
PS19, Line 252: msg(D_PUSH, "Pushed option is not updatable: '%=
s'", *line);
Maybe add an " Ignoring." to the string, so it's clear "this is information=
al, but not an error, and this is how we handle it"? Since the other one h=
as "Restarting"...
http://gerrit.openvpn.net/c/openvpn/+/808/comment/ce24fecc_c0a39fcd :
PS19, Line 270: if (!o->pull_filter_list && !(is_update))
So, if we call `check_push_update_option_flags()` from outside, we do not n=
eed this extra dance, checking o->pull_filter_list twice...
http://gerrit.openvpn.net/c/openvpn/+/808/comment/8974bb49_5a803112 :
PS19, Line 276: while (isspace(*line))
It makes sense to move that upwards to `apply_push_options()`, before calli=
ng anything on the line. So both all functions called do not need to bothe=
r about leading whitespace.
http://gerrit.openvpn.net/c/openvpn/+/808/comment/8689afde_5d9ee877 :
PS19, Line 310: return true;
This duplication of the messages and `return true` looks a bit silly :-) - =
I would suggest to do
```
/* on PUSH_UPDATE, "reject" and "ignore" filters are treated the sa=
me */
else if ( (f->type =3D=3D PUF_TYPE_IGNORE || is_update)
&& strncmp(line, f->pattern, f->size) =3D=3D 0)
{
msg(D_PUSH, "Pushed option removed by filter: '%s'", line);
return true;
}
```
File src/openvpn/push_util.c:
http://gerrit.openvpn.net/c/openvpn/+/808/comment/b8dd5363_84e249de :
PS19, Line 23: true))
Just for the record - this is the really-old-style OpenVPN formatting, whic=
h we no longer use. That said, I know it's the same as in `process_incomin=
g_push_reply()`, so it makes sense to keep it the same, and then clang-form=
at will change both at once.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/808?usp=3Demail
To unsubscribe, or for help writing mail filters, visit http://gerrit.openv=
pn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6ecd4cb47571cc8c20e46de8595c742aeec6064a
Gerrit-Change-Number: 808
Gerrit-PatchSet: 19
Gerrit-Owner: mrbff
Gerrit-Reviewer: cron2
Gerrit-Reviewer: flichtenheld
Gerrit-Reviewer: plaisthos
Gerrit-Reviewer: stipa
Gerrit-CC: openvpn-devel
Gerrit-Attention: cron2
Gerrit-Attention: flichtenheld
Gerrit-Attention: mrbff
Gerrit-Attention: stipa
Gerrit-Comment-Date: Mon, 21 Jul 2025 18:08:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
--ul0rUlzOpio=
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: cron2, flichtenheld, mrbff, stipa=
.
Patch set 19:Code-Review -1
V=
iew Change
10 comments:
So, I think this works and is sufficently =
save and efficient, but I'm and old man and like my lawn orderly... so =
as discussed on IRC, please adjust a few minor points.
File src/openvpn/options.c:
Patch Set #19, Line 5567: apply_push_options(struct=
options *options,
please do not move that one around in options.c, this makes co=
mparing old/new harder without good benefit, also breaks git blame...
=
li>Patch Set #19, Line 5654:
so I would call check_push_update_option_flags() from here, possi=
bly moving the "while isspace(*line) { line++; }" part up here as=
well. Then we can keep "apply_pull_filter()" focused on "p=
ull filter", not dealing with a number of extra conditions... (just &=
quot;is_update", see there)
File src/openvpn/options_util.c:
Patch Set #19, Line 198: if (!line || !*line || !**line)<=
/p>
the use of a =
double pointer irritates me, because we never move the pointer, instead `me=
mmove()` the buffer...
I think we should just do `(*line)++` instead of the `memmove()` =
below - possibly also getting rid of the `strlen(str)` thing, or `str` alto=
gether :-) - so keep the pointer, call it from `apply_push_options()` and a=
ccept a moving `*line` pointer.
Also, I'm not sure if "empty string" shoul=
d be treated as `false` or just ignored (return true, that is) - the existi=
ng environment where `apply_pull_filter()` is used does not care for "=
empty lines".
A NULL pointer is a programming error that must never happen, so an A=
SSERT(line) is valid.
Patch Set #19, Line 231:
If there is whitespace here (`? route`=
) we'll fail with `pushed option is not updateable: ' route'`,=
if I'm not misreading it.
I'd document that "there must not be whitespace =
between the flag letters and the option" and then we could add an `if =
(isspace(**line)) { complain; return false; }` here... the documentation is=
important, the error handling not so much (as it will hit the `return fals=
e` anyway)
Patch Set #19, Line 252: msg(D_PUSH, "Pushed option=
is not updatable: '%s'", *line);
Maybe add an " Ignoring."=
; to the string, so it's clear "this is informational, but not an =
error, and this is how we handle it"? Since the other one has "R=
estarting"...
Patch Set #19, Line 270: if (!o->pull_filter_list &=
& !(is_update))
So, if we call `check_push_update_option_flags()` from outsid=
e, we do not need this extra dance, checking o->pull_filter_list twice..=
.
Patch Set #19, Line 276: while (isspace(*line))
It makes sense to move that upwar=
ds to `apply_push_options()`, before calling anything on the line. So both=
all functions called do not need to bother about leading whitespace.
=
li>Patch Set #19, Line 310: return true;
This duplication of the messages and `=
return true` looks a bit silly :-) - I would suggest to do
```
/=
* on PUSH_UPDATE, "reject" and "ignore" filters are tre=
ated the same */
else if ( (f->type =3D=3D PUF_TYPE_IGNORE ||=
is_update)
&& strncmp(line, f->pattern, f=
->size) =3D=3D 0)
{
msg(D_PUSH, "Pushed o=
ption removed by filter: '%s'", line);
return t=
rue;
}
```
File src/openvpn/push_util.c:
Patch Set #19, Line 23: true))
Just for the record -=
this is the really-old-style OpenVPN formatting, which we no longer use. =
That said, I know it's the same as in `process_incoming_push_reply()`, =
so it makes sense to keep it the same, and then clang-format will change bo=
th at once.
To view, visit change 808. To unsubscribe,=
or for help writing mail filters, visit settings.
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6ecd4cb47571cc8c20e46de8595=
c742aeec6064a
Gerrit-Change-Number: 808
Gerrit-PatchSet: 19
Gerrit-Owner: mrbff <marco@...2726...> <=
/div>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...=
1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...=
.1227...>
Gerrit-Reviewer: stipa <lstipakov@...277...=
>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...=
ts.sourceforge.net>
Gerrit-Attention: cron2 <gert@...1296...>=
;
Gerrit-Attention: flichtenheld <frank@...2375...=
41...>
Gerrit-Attention: mrbff <marco@...2726...&g=
t;
Gerrit-Attention: stipa <lstipakov@...1663...=
.>
Gerrit-Comment-Date: Mon, 21 Jul 2025 18:08:07=
+0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
--ul0rUlzOpio=--