[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:10:08 +0000
Newsgroups net.sourceforge.lists.openvpn-devel
Message-ID <bf6cffcf8b5facb11f47b7eb50b22a5126d7278e-EmailReplacePatchSet-HTML@gerrit.openvpn.net>
--===============2584602457005961860==
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="t3WaG6FjmwY="; charset=UTF-8

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

Attention is currently required from: plaisthos=2E

Hello plaisthos, 

I'd =
like you to reexamine a change=2E Please visit

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

to look at the new patch set (#2)=2E

=

Change 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-restar=
t instance on UDP write error EADDRNOTAVAIL

If a client device roams to a =
new network attachment point (LAN to WiFi,
WiFi A to WiFi B, =2E=2E=2E) whi=
le openvpn is active and a "VPN server host
route" is installed (--redirect=
-gateway, or just overlapping routes with
the VPN server IP), this host rou=
te is no longer active and the VPN is
generally no longer working=2E

On ma=
cOS at least, sendto() will return EADDRNOTAVAIL in many of these
cases, be=
cause the route is still active but the "egress interface" is
not - so we c=
an notice, and restart the instance=2E  A full SIGHUP restart
is needed bec=
ause we need to remove all overlapping routes first, before
a reconnect can=
 work=2E

Github: OpenVPN/openvpn#1086

Change-Id: I96b5ea3542df77b1be17079=
874fb9e4970b539ed
Signed-off-by: Gert Doering <gert@greenie=2Emuc=2Ede>
---=

M src/openvpn/forward=2Ec
1 file changed, 11 insertions(+), 0 deletions(-)=



  git pull ssh://gerrit=2Eopenvpn=2Enet:29418/openvpn refs/changes/30/18=
30/2

diff --git a/src/openvpn/forward=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 unrea=
chable, restarting");
             register_signal(c->sig, SIGUSR1, "networ=
k-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 requeste=
d address" as a fairly
+         * reliable (and quick!) indicator for "thi=
s connection is dead"
+         */
+        if (size < 0 && errno =3D=3D EA=
DDRNOTAVAIL)
+        {
+            msg(M_INFO, "UDP socket broken, assumi=
ng client-link change, restarting");
+            register_signal(c->sig, S=
IGHUP, "link-changed");
+        }
     }
     else
     {

-- 
To view, vi=
sit http://gerrit=2Eopenvpn=2Enet/c/openvpn/+/1830?usp=3Demail
To unsubscri=
be, or for help writing mail filters, visit http://gerrit=2Eopenvpn=2Enet/s=
ettings?usp=3Demail

Gerrit-MessageType: newpatchset
Gerrit-Project: openvp=
n
Gerrit-Branch: master
Gerrit-Change-Id: I96b5ea3542df77b1be17079874fb9e49=
70b539ed
Gerrit-Change-Number: 1830
Gerrit-PatchSet: 2
Gerrit-Owner: cron2 =
<gert@greenie=2Emuc=2Ede>
Gerrit-Reviewer: plaisthos <arne-openvpn@rfc2549=
=2Eorg>
Gerrit-CC: openvpn-devel <openvpn-devel@lists=2Esourceforge=2Enet>
=
Gerrit-Attention: plaisthos <arne-openvpn@rfc2549=2Eorg>

--t3WaG6FjmwY=
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 <strong>uploaded patch set=
 #2</strong> to this change=2E</p><p><a href=3D"http://gerrit=2Eopenvpn=2En=
et/c/openvpn/+/1830?usp=3Demail">View Change</a></p><pre class=3D"blocks" s=
tyle=3D"font-family: monospace,monospace; white-space: pre-wrap;">SIGHUP-re=
start instance on UDP write error EADDRNOTAVAIL<br><br>If a client device r=
oams to a new network attachment point (LAN to WiFi,<br>WiFi A to WiFi B, =
=2E=2E=2E) while openvpn is active and a &quot;VPN server host<br>route&quo=
t; 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<br>gene=
rally no longer working=2E<br><br>On macOS at least, sendto() will return E=
ADDRNOTAVAIL in many of these<br>cases, because the route is still active b=
ut the &quot;egress interface&quot; is<br>not - so we can notice, and resta=
rt the instance=2E  A full SIGHUP restart<br>is needed because we need to r=
emove all overlapping routes first, before<br>a reconnect can work=2E<br><b=
r>Github: OpenVPN/openvpn#1086<br><br>Change-Id: I96b5ea3542df77b1be1707987=
4fb9e4970b539ed<br>Signed-off-by: Gert Doering &lt;gert@greenie=2Emuc=2Ede&=
gt;<br>---<br>M src/openvpn/forward=2Ec<br>1 file changed, 11 insertions(+)=
, 0 deletions(-)<br><br></pre><pre class=3D"blocks" style=3D"font-family: m=
onospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit=2Eopenvpn=
=2Enet:29418/openvpn refs/changes/30/1830/2</pre><pre style=3D"font-family:=
 monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/openvp=
n/forward=2Ec b/src/openvpn/forward=2Ec</span><br><span>index 46e1a53=2E=2E=
225ba6b 100644</span><br><span>--- a/src/openvpn/forward=2Ec</span><br><spa=
n>+++ b/src/openvpn/forward=2Ec</span><br><span>@@ -1856,6 +1856,17 @@</spa=
n><br><span>             msg(M_INFO, &quot;Network unreachable, restarting&=
quot;);</span><br><span>             register_signal(c-&gt;sig, SIGUSR1, &q=
uot;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</spa=
n><br><span style=3D"color: hsl(120, 100%, 40%);">+         * around, we ge=
t &quot;cannot assign requested address&quot; as a fairly</span><br><span s=
tyle=3D"color: hsl(120, 100%, 40%);">+         * reliable (and quick!) indi=
cator for &quot;this connection is dead&quot;</span><br><span style=3D"colo=
r: hsl(120, 100%, 40%);">+         */</span><br><span style=3D"color: hsl(1=
20, 100%, 40%);">+        if (size &lt; 0 &amp;&amp; errno =3D=3D EADDRNOTA=
VAIL)</span><br><span style=3D"color: hsl(120, 100%, 40%);">+        {</spa=
n><br><span style=3D"color: hsl(120, 100%, 40%);">+            msg(M_INFO, =
&quot;UDP socket broken, assuming client-link change, restarting&quot;);</s=
pan><br><span style=3D"color: hsl(120, 100%, 40%);">+            register_s=
ignal(c-&gt;sig, SIGHUP, &quot;link-changed&quot;);</span><br><span style=
=3D"color: hsl(120, 100%, 40%);">+        }</span><br><span>     }</span><b=
r><span>     else</span><br><span>     {</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 fi=
lters, visit <a href=3D"http://gerrit=2Eopenvpn=2Enet/settings?usp=3Demail"=
>settings</a>=2E</p><div itemscope itemtype=3D"http://schema=2Eorg/EmailMes=
sage"><div itemscope itemprop=3D"action" itemtype=3D"http://schema=2Eorg/Vi=
ewAction"><link itemprop=3D"url" href=3D"http://gerrit=2Eopenvpn=2Enet/c/op=
envpn/+/1830?usp=3Demail"/><meta itemprop=3D"name" content=3D"View Change"/=
></div></div>

<div style=3D"display:none"> Gerrit-MessageType: newpatchset=
 </div>
<div style=3D"display:none"> Gerrit-Project: openvpn </div>
<div st=
yle=3D"display:none"> Gerrit-Branch: master </div>
<div style=3D"display:no=
ne"> Gerrit-Change-Id: I96b5ea3542df77b1be17079874fb9e4970b539ed </div>
<di=
v style=3D"display:none"> Gerrit-Change-Number: 1830 </div>
<div style=3D"d=
isplay:none"> Gerrit-PatchSet: 2 </div>
<div style=3D"display:none"> Gerrit=
-Owner: cron2 &lt;gert@greenie=2Emuc=2Ede&gt; </div>
<div style=3D"display:=
none"> Gerrit-Reviewer: plaisthos &lt;arne-openvpn@rfc2549=2Eorg&gt; </div>=

<div style=3D"display:none"> Gerrit-CC: openvpn-devel &lt;openvpn-devel@li=
sts=2Esourceforge=2Enet&gt; </div>
<div style=3D"display:none"> Gerrit-Atte=
ntion: plaisthos &lt;arne-openvpn@rfc2549=2Eorg&gt; </div>

</body></html>
--t3WaG6FjmwY=--


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


--===============2584602457005961860==
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

--===============2584602457005961860==--