From: "cron2 (Code Review)" Date: Sun, 12 Oct 2025 11:18:28 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., marco@...2726..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <1388712bcbe7e8b8a132d486dc09adab3aba8e12-EmailReviewComments-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="Mwz3bjxAOPU="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: PUSH_UPDATE server: remove old IP(s) from vhash after sending a messa... List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: mrbff Cc: plaisthos , flichtenheld , openvpn-devel --Mwz3bjxAOPU= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, mrbff, plaisthos. cron2 has posted comments on this change by mrbff. ( http://gerrit.openvpn.= net/c/openvpn/+/1253?usp=3Demail ) Change subject: PUSH_UPDATE server: remove old IP(s) from vhash after sendi= ng a message containing ifconfig(-ipv6) ...................................................................... Patch Set 3: Code-Review-1 (7 comments) Patchset: PS3: I like this latest version, and it should work nicely. There might be a missing `free()` - this needs to be checked. While at it,= I've found a few other things that could use a bit of polishing. File src/openvpn/multi.c: http://gerrit.openvpn.net/c/openvpn/+/1253/comment/723a899a_4779f06b?usp=3D= email : PS3, Line 4296: msg(D_MULTI_LOW, "MULTI: Remove: %s -> %s", mroute_addr= _print(&r->addr, &gc), multi_instance_string(mi, false, &gc)); this is too much logging ;-) I'd remove one of them, and change the other to include something like `MUL= TI: multi_unlearn_addr(): DEL %s` so it's clear it's not the normal "MULTI:= DEL" path. Also, if we want to be totally fancy, we could use the mi prefix code here ``` set_prefix(mi); msg(...) // no multi_instance_string() needed, as that's handled by msg_se= t_prefix() clear_prefix(); ``` as for the message level, I'd use `D_MULTI_LOW` (as that is used by multi.c= for the "Learn" message). http://gerrit.openvpn.net/c/openvpn/+/1253/comment/80047d20_27d7418e?usp=3D= email : PS3, Line 4301: we might have a memleak here. I looked at the code in "multi.c" that delet= es mroutes (check_stale_routes(), multi_reap_range()), and those call `mult= i_route_del(r)` to do ``` route_quota_dec(mi); multi_instance_dec_refcount(mi); free(route); ``` so you have the first two here, but not the `free()` - not 100% sure if thi= s is required, but it smells like it. (`hash_remove_by_value()` seems to not do anything about the thing pointed = to) Maybe just calling `multi_route_del(r)` here is the right thing (after the = hash_remove_by_value() call, to avoid a use-after-free)? http://gerrit.openvpn.net/c/openvpn/+/1253/comment/f301c3e7_e77a6296?usp=3D= email : PS3, Line 4320: ASSERT(mroute_extract_openvpn_sockaddr(&addr, &remote_s= i, false)); This works, but feels more clumsy than needed - looking through mroute.c, I= find `mroute_get_in_addr_t(struct mroute_addr *out, const in_addr_t in, int mask= )` which should do the same with less lines of intermediate structure filling = :-) (have not tested this, just compared code) http://gerrit.openvpn.net/c/openvpn/+/1253/comment/8290fc03_3b80051e?usp=3D= email : PS3, Line 4339: `mroute_get_in6_addr(&addr, a6, 0)` does this for you http://gerrit.openvpn.net/c/openvpn/+/1253/comment/cbc56eb6_41bab12b?usp=3D= email : PS3, Line 4366: old_addr.s_addr =3D ntohl(mi->context.c2.push_i= fconfig_local); we could just do `in_addr_t old_addr =3D ...` here and save the detour via = `struct in_addr`? File src/openvpn/push_util.c: http://gerrit.openvpn.net/c/openvpn/+/1253/comment/07ab8769_ed9bfa83?usp=3D= email : PS3, Line 158: memset(&o, 0, sizeof(struct options)); please use `CLEAR(o);` for that. It does exactly the same, but we use it i= n this situation so it's clear "this is not just a random memset() but to 0= -initialize the options struct". -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1253?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: comment Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I07a8ddd9026eef64b6f5abde98702a9801616a5f Gerrit-Change-Number: 1253 Gerrit-PatchSet: 3 Gerrit-Owner: mrbff Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-Attention: mrbff Gerrit-Comment-Date: Sun, 12 Oct 2025 11:18:28 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes --Mwz3bjxAOPU= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: flichtenheld, mrbff, plaisthos.

Patch set 3:Code-Review -1=

V= iew Change

7 comments: