[Openvpn-devel,v2] PUSH_UPDATE server: update reporting_addr after ifconfig update

Message ID 20251104085553.8218-1-gert@greenie.muc.de
State New
Headers show
Series [Openvpn-devel,v2] PUSH_UPDATE server: update reporting_addr after ifconfig update | expand

Commit Message

Gert Doering Nov. 4, 2025, 8:55 a.m. UTC
From: Marco Baffo <marco@mandelbit.com>

Update mi->reporting_addr(_ipv6) for status reporting purposes
after sending a PUSH_UPDATE containing an ifconfig(-ipv6) option.

Github: fixes OpenVPN/openvpn#889

Change-Id: Ie15977b44091445b9d1edebe885d92ec5cb5770a
Signed-off-by: Marco Baffo <marco@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1340
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1340
This mail reflects revision 2 of this Change.

Acked-by according to Gerrit (reflected above):

Comments

Gert Doering Nov. 4, 2025, 9:11 a.m. UTC | #1
I have tested this in the scenario I observed when opening #889, and it
now works (push-update-cid <n> "ifconfig ..." and then the new IP/IPv6 
address shows up in "status 3" as well).

Thanks :-)

Your patch has been applied to the master branch.

commit 38e9dd636d115affeb4ec519108978058e4d05a1
Author: Marco Baffo
Date:   Tue Nov 4 09:55:47 2025 +0100

     PUSH_UPDATE server: update reporting_addr after ifconfig update

     Signed-off-by: Marco Baffo <marco@mandelbit.com>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1340
     Message-Id: <20251104085553.8218-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34186.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index 261209d..2b944667 100644
--- a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -4346,6 +4346,7 @@ 
     multi_unlearn_in_addr_t(m, mi, old_addr);
     mi->context.c2.push_ifconfig_defined = false;
     mi->context.c2.push_ifconfig_local = 0;
+    mi->reporting_addr = 0;
 }
 
 /* Function to unlearn previous ifconfig-ipv6 of a client in the server multi_context after a PUSH_UPDATE */
@@ -4358,6 +4359,7 @@ 
     multi_unlearn_in6_addr(m, mi, old_addr6);
     mi->context.c2.push_ifconfig_ipv6_defined = false;
     CLEAR(mi->context.c2.push_ifconfig_ipv6_local);
+    CLEAR(mi->reporting_addr_ipv6);
 }
 
 /**
@@ -4389,6 +4391,8 @@ 
         {
             mi->context.c2.push_ifconfig_defined = true;
             mi->context.c2.push_ifconfig_local = ntohl(new_addr.s_addr);
+            /* set our client's VPN endpoint for status reporting purposes */
+            mi->reporting_addr = mi->context.c2.push_ifconfig_local;
         }
     }
 
@@ -4408,6 +4412,8 @@ 
         {
             mi->context.c2.push_ifconfig_ipv6_defined = true;
             mi->context.c2.push_ifconfig_ipv6_local = new_addr6;
+            /* set our client's VPN endpoint for status reporting purposes */
+            mi->reporting_addr_ipv6 = mi->context.c2.push_ifconfig_ipv6_local;
         }
     }
 }