[Openvpn-devel] [S] Change in openvpn[master]: SIGHUP-restart instance on UDP write error EADDRNOTAVAIL

"cron2 \(Code Review\) via Openvpn-devel" <[email protected]> Wed, 29 Jul 2026 08:08:11 +0000
Newsgroups net.sourceforge.lists.openvpn-devel
Message-ID <[email protected]>
--===============3688971397897032517==
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="XTt6wfftGPo="; charset=UTF-8

--XTt6wfftGPo=
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Attention is currently required from: plaisthos=2E

Hello plaisthos,

I'd l=
ike you to do a code review=2E
Please visit

    http://gerrit=2Eopenvpn=2E=
net/c/openvpn/+/1830?usp=3Demail

to review the following change=2E


Chang=
e subject: SIGHUP-restart instance on UDP write error EADDRNOTAVAIL
=2E=2E=
=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=
=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=
=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E

SIGHUP-restart inst=
ance on UDP write error EADDRNOTAVAIL

If a client device roams to a new ne=
twork attachment point (LAN to WiFi,
WiFi A to WiFi B, =2E=2E=2E) while ope=
nvpn is active and a "VPN server host
route" is installed (--redirect-gatew=
ay, or just overlapping routes with
the VPN server IP), this host route is =
no longer active and the VPN is
generally no longer working=2E

On macOS at=
 least, sendto() will return EADDRNOTAVAIL in many of these
cases, because =
the route is still active but the "egress interface" is
not - so we can not=
ice, and restart the instance=2E  A full SIGHUP restart
is needed because w=
e need to remove all overlapping routes first, before
a reconnect can work=
=2E

Change-Id: I96b5ea3542df77b1be17079874fb9e4970b539ed
Signed-off-by: Ge=
rt Doering <gert@greenie=2Emuc=2Ede>
---
M src/openvpn/forward=2Ec
1 file c=
hanged, 11 insertions(+), 0 deletions(-)



  git pull ssh://gerrit=2Eopenv=
pn=2Enet:29418/openvpn refs/changes/30/1830/1

diff --git a/src/openvpn/for=
ward=2Ec b/src/openvpn/forward=2Ec
index 46e1a53=2E=2E225ba6b 100644
--- a/=
src/openvpn/forward=2Ec
+++ b/src/openvpn/forward=2Ec
@@ -1856,6 +1856,17 @=
@
             msg(M_INFO, "Network unreachable, restarting");
            =
 register_signal(c->sig, SIGUSR1, "network-unreachable");
         }
+
+   =
     /* on some platforms when the client changes to a new network
+       =
  * segment (LAN -> WiFi, etc) and there is a host redirect route
+        =
 * around, we get "cannot assign requested address" as a fairly
+         *=
 reliable (and quick!) indicator for "this connection is dead"
+         */=

+        if (size < 0 && errno =3D=3D EADDRNOTAVAIL)
+        {
+         =
   msg(M_INFO, "UDP socket broken, assuming client-link change, restarting"=
);
+            register_signal(c->sig, SIGHUP, "link-changed");
+        }=

     }
     else
     {

-- 
To view, visit http://gerrit=2Eopenvpn=2Enet/=
c/openvpn/+/1830?usp=3Demail
To unsubscribe, or for help writing mail filte=
rs, visit http://gerrit=2Eopenvpn=2Enet/settings?usp=3Demail

Gerrit-Messag=
eType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Chang=
e-Id: I96b5ea3542df77b1be17079874fb9e4970b539ed
Gerrit-Change-Number: 1830
=
Gerrit-PatchSet: 1
Gerrit-Owner: cron2 <gert@greenie=2Emuc=2Ede>
Gerrit-Rev=
iewer: plaisthos <arne-openvpn@rfc2549=2Eorg>
Gerrit-CC: openvpn-devel <ope=
nvpn-devel@lists=2Esourceforge=2Enet>
Gerrit-Attention: plaisthos <arne-ope=
nvpn@rfc2549=2Eorg>

--XTt6wfftGPo=
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html><html><head><style></style></head><body><p> Attention is cur=
rently required from: plaisthos=2E </p>
<p>cron2 would like plaisthos to <s=
trong>review</strong> this change=2E
</p><p><a href=3D"http://gerrit=2Eopen=
vpn=2Enet/c/openvpn/+/1830?usp=3Demail">View Change</a></p><pre class=3D"bl=
ocks" style=3D"font-family: monospace,monospace; white-space: pre-wrap;">SI=
GHUP-restart instance on UDP write error EADDRNOTAVAIL<br><br>If a client d=
evice roams to a new network attachment point (LAN to WiFi,<br>WiFi A to Wi=
Fi B, =2E=2E=2E) while openvpn is active and a &quot;VPN server host<br>rou=
te&quot; is installed (--redirect-gateway, or just overlapping routes with<=
br>the VPN server IP), this host route is no longer active and the VPN is<b=
r>generally no longer working=2E<br><br>On macOS at least, sendto() will re=
turn EADDRNOTAVAIL in many of these<br>cases, because the route is still ac=
tive but the &quot;egress interface&quot; is<br>not - so we can notice, and=
 restart the instance=2E  A full SIGHUP restart<br>is needed because we nee=
d to remove all overlapping routes first, before<br>a reconnect can work=2E=
<br><br>Change-Id: I96b5ea3542df77b1be17079874fb9e4970b539ed<br>Signed-off-=
by: Gert Doering &lt;gert@greenie=2Emuc=2Ede&gt;<br>---<br>M src/openvpn/fo=
rward=2Ec<br>1 file changed, 11 insertions(+), 0 deletions(-)<br><br></pre>=
<pre class=3D"blocks" style=3D"font-family: monospace,monospace; white-spac=
e: pre-wrap;">git pull ssh://gerrit=2Eopenvpn=2Enet:29418/openvpn refs/chan=
ges/30/1830/1</pre><pre style=3D"font-family: monospace,monospace; white-sp=
ace: pre-wrap;"><span>diff --git a/src/openvpn/forward=2Ec b/src/openvpn/fo=
rward=2Ec</span><br><span>index 46e1a53=2E=2E225ba6b 100644</span><br><span=
>--- a/src/openvpn/forward=2Ec</span><br><span>+++ b/src/openvpn/forward=2E=
c</span><br><span>@@ -1856,6 +1856,17 @@</span><br><span>             msg(M=
_INFO, &quot;Network unreachable, restarting&quot;);</span><br><span>      =
       register_signal(c-&gt;sig, SIGUSR1, &quot;network-unreachable&quot;)=
;</span><br><span>         }</span><br><span style=3D"color: hsl(120, 100%,=
 40%);">+</span><br><span style=3D"color: hsl(120, 100%, 40%);">+        /*=
 on some platforms when the client changes to a new network</span><br><span=
 style=3D"color: hsl(120, 100%, 40%);">+         * segment (LAN -&gt; WiFi,=
 etc) and there is a host redirect route</span><br><span style=3D"color: hs=
l(120, 100%, 40%);">+         * around, we get &quot;cannot assign requeste=
d address&quot; as a fairly</span><br><span style=3D"color: hsl(120, 100%, =
40%);">+         * reliable (and quick!) indicator for &quot;this connectio=
n is dead&quot;</span><br><span style=3D"color: hsl(120, 100%, 40%);">+    =
     */</span><br><span style=3D"color: hsl(120, 100%, 40%);">+        if (=
size &lt; 0 &amp;&amp; errno =3D=3D EADDRNOTAVAIL)</span><br><span style=3D=
"color: hsl(120, 100%, 40%);">+        {</span><br><span style=3D"color: hs=
l(120, 100%, 40%);">+            msg(M_INFO, &quot;UDP socket broken, assum=
ing client-link change, restarting&quot;);</span><br><span style=3D"color: =
hsl(120, 100%, 40%);">+            register_signal(c-&gt;sig, SIGHUP, &quot=
;link-changed&quot;);</span><br><span style=3D"color: hsl(120, 100%, 40%);"=
>+        }</span><br><span>     }</span><br><span>     else</span><br><spa=
n>     {</span><br><span></span><br></pre><p>To view, visit <a href=3D"http=
://gerrit=2Eopenvpn=2Enet/c/openvpn/+/1830?usp=3Demail">change 1830</a>=2E =
To unsubscribe, or for help writing mail filters, visit <a href=3D"http://g=
errit=2Eopenvpn=2Enet/settings?usp=3Demail">settings</a>=2E</p><div itemsco=
pe itemtype=3D"http://schema=2Eorg/EmailMessage"><div itemscope itemprop=3D=
"action" itemtype=3D"http://schema=2Eorg/ViewAction"><link itemprop=3D"url"=
 href=3D"http://gerrit=2Eopenvpn=2Enet/c/openvpn/+/1830?usp=3Demail"/><meta=
 itemprop=3D"name" content=3D"View Change"/></div></div>

<div style=3D"dis=
play:none"> Gerrit-MessageType: newchange </div>
<div style=3D"display:none=
"> Gerrit-Project: openvpn </div>
<div style=3D"display:none"> Gerrit-Branc=
h: master </div>
<div style=3D"display:none"> Gerrit-Change-Id: I96b5ea3542=
df77b1be17079874fb9e4970b539ed </div>
<div style=3D"display:none"> Gerrit-C=
hange-Number: 1830 </div>
<div style=3D"display:none"> Gerrit-PatchSet: 1 <=
/div>
<div style=3D"display:none"> Gerrit-Owner: cron2 &lt;gert@greenie=2Em=
uc=2Ede&gt; </div>
<div style=3D"display:none"> Gerrit-Reviewer: plaisthos =
&lt;arne-openvpn@rfc2549=2Eorg&gt; </div>
<div style=3D"display:none"> Gerr=
it-CC: openvpn-devel &lt;openvpn-devel@lists=2Esourceforge=2Enet&gt; </div>=

<div style=3D"display:none"> Gerrit-Attention: plaisthos &lt;arne-openvpn@=
rfc2549=2Eorg&gt; </div>

</body></html>
--XTt6wfftGPo=--


--===============3688971397897032517==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============3688971397897032517==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

--===============3688971397897032517==--