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

"cron2 \(Code Review\) via Openvpn-devel" <[email protected]> Mon, 3 Aug 2026 11:16:25 +0000
Newsgroups net.sourceforge.lists.openvpn-devel
Message-ID <4b9805147066f5cdb9fcbd3b28038ff9439f43e7-EmailReviewComments-HTML@gerrit.openvpn.net>
--===============5083984232857511787==
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="oGFzOU/VS9M="; charset=UTF-8

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

Attention is currently required from: ordex, plaisthos=2E

cron2 has posted=
 comments on this change by cron2=2E ( http://gerrit=2Eopenvpn=2Enet/c/open=
vpn/+/1830?usp=3Demail )

Change subject: SIGHUP-restart instance on UDP wr=
ite 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


Patch Set 2:

(6 comments)

Patchset:

PS2: 
> !!!
Done


Commi=
t Message:

http://gerrit=2Eopenvpn=2Enet/c/openvpn/+/1830/comment/e511e034=
_10a29e06?usp=3Demail :
PS2, Line 17: not - so we can notice, and restart t=
he instance=2E  A full SIGHUP restart
> I think SIGHUP is a bit too much he=
re since it reloads the config and other things=2E [=E2=80=A6]
SIGUSR1 does=
 not work (at least not if there is a `--persist-tun` in the config, need t=
o re-test `SIGUSR1 without persist-tun`), as we have no signalling for "rem=
ove all routes, but keep tun, reconnect"=2E

I need to look more closely at=
 logs, it seems, as I thought `--ping-restart` would trigger `SIGHUP`, but =
the documentation tells me otherwise=2E  Wait for v3=2E=2E=2E


File src/op=
envpn/forward=2Ec:

http://gerrit=2Eopenvpn=2Enet/c/openvpn/+/1830/comment/=
f2b2751a_e3b2d8b0?usp=3Demail :
PS2, Line 1865:         if (size < 0 && err=
no =3D=3D EADDRNOTAVAIL)
> Here you should be checking for `error_code`, no=
t `errno`=2E [=E2=80=A6]
good catch=2E  Will adjust=2E

No idea what window=
s does, but it's not really relevant - this fixes one particular situation =
on one particular platform, while not making things worse for other platfor=
ms (if *that* error comes back, our socket is no longer fit for the purpose=
)=2E


http://gerrit=2Eopenvpn=2Enet/c/openvpn/+/1830/comment/6ec1208a_91cf=
9db6?usp=3Demail :
PS2, Line 1868:             register_signal(c->sig, SIGH=
UP, "link-changed");
> using SIGHUP this way makes `--config stdin` + `--re=
map-usr1 SIGHUP` a fatal usage error: SIGHUP re- [=E2=80=A6]
I can't follow=
 you=2E  I am not raising SIGUSR1, so why should `remap-usr1` be relevant h=
ere?


http://gerrit=2Eopenvpn=2Enet/c/openvpn/+/1830/comment/9ca7aeec_dcbc=
3856?usp=3Demail :
PS2, Line 1868:             register_signal(c->sig, SIGH=
UP, "link-changed");
> There is no guard preventing this check to fire on a=
 server=2E=2E=2E=2E [=E2=80=A6]
I'm not sure this can be triggered in a mea=
ningful way on a server - there are no redirect routes for client IPs that =
might stop working on an interface change=2E  It might be triggerable if `-=
-bind` is in use and someone configures away the bound IP address - in whic=
h case, we'll just fail either way=2E  But I can add a guard here=2E


http=
://gerrit=2Eopenvpn=2Enet/c/openvpn/+/1830/comment/8e8a2c47_c038c444?usp=3D=
email :
PS2, Line 1868:             register_signal(c->sig, SIGHUP, "link-c=
hanged");
> have you checked how this SIGHUP interacts with `--connect-retr=
y-max` ? SIGHUP makes openvpn re-read [=E2=80=A6]
In this case, we would do=
 a `SIGHUP` reconnect anyway, just "after `--ping-restart` expires"=2E  No?=
  So nothing changes,



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

Gerrit-Message=
Type: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-I=
d: I96b5ea3542df77b1be17079874fb9e4970b539ed
Gerrit-Change-Number: 1830
Ger=
rit-PatchSet: 2
Gerrit-Owner: cron2 <gert@greenie=2Emuc=2Ede>
Gerrit-Review=
er: ordex <antonio@mandelbit=2Ecom>
Gerrit-Reviewer: plaisthos <arne-openvp=
n@rfc2549=2Eorg>
Gerrit-CC: openvpn-devel <openvpn-devel@lists=2Esourceforg=
e=2Enet>
Gerrit-Attention: plaisthos <arne-openvpn@rfc2549=2Eorg>
Gerrit-At=
tention: ordex <antonio@mandelbit=2Ecom>
Gerrit-Comment-Date: Mon, 03 Aug 2=
026 11:16:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In=
-Reply-To: plaisthos <arne-openvpn@rfc2549=2Eorg>
Comment-In-Reply-To: orde=
x <antonio@mandelbit=2Ecom>

--oGFzOU/VS9M=
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: ordex, plaisthos=2E </p>
<p><a href=3D"http://gerrit=
=2Eopenvpn=2Enet/c/openvpn/+/1830?usp=3Demail">View Change</a></p><p>6 comm=
ents:</p><ul style=3D"list-style: none; padding: 0;"><li style=3D"margin: 0=
; padding: 0;"><p>Patchset:</p><ul style=3D"list-style: none; padding: 0;">=
<li style=3D"margin: 0; padding: 0 0 0 16px;"><p style=3D"margin-bottom: 4p=
x;"><a href=3D"http://gerrit=2Eopenvpn=2Enet/c/openvpn/+/1830?tab=3Dcomment=
s&amp;usp=3Demail">Patch Set #2:</a> </p><p><blockquote style=3D"border-lef=
t: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">!!!</blockquote></p><p=
 class=3D"blocks" style=3D"white-space: pre-wrap; word-wrap: break-word;">D=
one</p></li></ul></li><li style=3D"margin: 0; padding: 0;"><p>Commit Messag=
e:</p><ul style=3D"list-style: none; padding: 0;"><li style=3D"margin: 0; p=
adding: 0 0 0 16px;"><p style=3D"margin-bottom: 4px;"><a href=3D"http://ger=
rit=2Eopenvpn=2Enet/c/openvpn/+/1830/comment/e511e034_10a29e06?usp=3Demail"=
>Patch Set #2, Line 17:</a> <code style=3D"font-family:monospace,monospace"=
>not - so we can notice, and restart the instance=2E  A full SIGHUP restart=
</code></p><p><blockquote style=3D"border-left: 1px solid #aaa; margin: 10p=
x 0; padding: 0 10px;">I think SIGHUP is a bit too much here since it reloa=
ds the config and other things=2E [=E2=80=A6]</blockquote></p><p class=3D"b=
locks" style=3D"white-space: pre-wrap; word-wrap: break-word;">SIGUSR1 does=
 not work (at least not if there is a `--persist-tun` in the config, need t=
o re-test `SIGUSR1 without persist-tun`), as we have no signalling for &quo=
t;remove all routes, but keep tun, reconnect&quot;=2E</p><p class=3D"blocks=
" style=3D"white-space: pre-wrap; word-wrap: break-word;">I need to look mo=
re closely at logs, it seems, as I thought `--ping-restart` would trigger `=
SIGHUP`, but the documentation tells me otherwise=2E  Wait for v3=2E=2E=2E<=
/p></li></ul></li><li style=3D"margin: 0; padding: 0;"><p>File src/openvpn/=
forward=2Ec:</p><ul style=3D"list-style: none; padding: 0;"><li style=3D"ma=
rgin: 0; padding: 0 0 0 16px;"><p style=3D"margin-bottom: 4px;"><a href=3D"=
http://gerrit=2Eopenvpn=2Enet/c/openvpn/+/1830/comment/f2b2751a_e3b2d8b0?us=
p=3Demail">Patch Set #2, Line 1865:</a> <code style=3D"font-family:monospac=
e,monospace">        if (size &lt; 0 &amp;&amp; errno =3D=3D EADDRNOTAVAIL)=
</code></p><p><blockquote style=3D"border-left: 1px solid #aaa; margin: 10p=
x 0; padding: 0 10px;">Here you should be checking for `error_code`, not `e=
rrno`=2E [=E2=80=A6]</blockquote></p><p class=3D"blocks" style=3D"white-spa=
ce: pre-wrap; word-wrap: break-word;">good catch=2E  Will adjust=2E</p><p c=
lass=3D"blocks" style=3D"white-space: pre-wrap; word-wrap: break-word;">No =
idea what windows does, but it&#39;s not really relevant - this fixes one p=
articular situation on one particular platform, while not making things wor=
se for other platforms (if *that* error comes back, our socket is no longer=
 fit for the purpose)=2E</p></li><li style=3D"margin: 0; padding: 0 0 0 16p=
x;"><p style=3D"margin-bottom: 4px;"><a href=3D"http://gerrit=2Eopenvpn=2En=
et/c/openvpn/+/1830/comment/6ec1208a_91cf9db6?usp=3Demail">Patch Set #2, Li=
ne 1868:</a> <code style=3D"font-family:monospace,monospace">            re=
gister_signal(c-&gt;sig, SIGHUP, &quot;link-changed&quot;);</code></p><p><b=
lockquote style=3D"border-left: 1px solid #aaa; margin: 10px 0; padding: 0 =
10px;">using SIGHUP this way makes `--config stdin` + `--remap-usr1 SIGHUP`=
 a fatal usage error: SIGHUP re- [=E2=80=A6]</blockquote></p><p class=3D"bl=
ocks" style=3D"white-space: pre-wrap; word-wrap: break-word;">I can&#39;t f=
ollow you=2E  I am not raising SIGUSR1, so why should `remap-usr1` be relev=
ant here?</p></li><li style=3D"margin: 0; padding: 0 0 0 16px;"><p style=3D=
"margin-bottom: 4px;"><a href=3D"http://gerrit=2Eopenvpn=2Enet/c/openvpn/+/=
1830/comment/9ca7aeec_dcbc3856?usp=3Demail">Patch Set #2, Line 1868:</a> <c=
ode style=3D"font-family:monospace,monospace">            register_signal(c=
-&gt;sig, SIGHUP, &quot;link-changed&quot;);</code></p><p><blockquote style=
=3D"border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">There is=
 no guard preventing this check to fire on a server=2E=2E=2E=2E [=E2=80=A6]=
</blockquote></p><p class=3D"blocks" style=3D"white-space: pre-wrap; word-w=
rap: break-word;">I&#39;m not sure this can be triggered in a meaningful wa=
y on a server - there are no redirect routes for client IPs that might stop=
 working on an interface change=2E  It might be triggerable if `--bind` is =
in use and someone configures away the bound IP address - in which case, we=
&#39;ll just fail either way=2E  But I can add a guard here=2E</p></li><li =
style=3D"margin: 0; padding: 0 0 0 16px;"><p style=3D"margin-bottom: 4px;">=
<a href=3D"http://gerrit=2Eopenvpn=2Enet/c/openvpn/+/1830/comment/8e8a2c47_=
c038c444?usp=3Demail">Patch Set #2, Line 1868:</a> <code style=3D"font-fami=
ly:monospace,monospace">            register_signal(c-&gt;sig, SIGHUP, &quo=
t;link-changed&quot;);</code></p><p><blockquote style=3D"border-left: 1px s=
olid #aaa; margin: 10px 0; padding: 0 10px;">have you checked how this SIGH=
UP interacts with `--connect-retry-max` ? SIGHUP makes openvpn re-read [=E2=
=80=A6]</blockquote></p><p class=3D"blocks" style=3D"white-space: pre-wrap;=
 word-wrap: break-word;">In this case, we would do a `SIGHUP` reconnect any=
way, just &quot;after `--ping-restart` expires&quot;=2E  No?  So nothing ch=
anges,</p></li></ul></li></ul><p>To view, visit <a href=3D"http://gerrit=2E=
openvpn=2Enet/c/openvpn/+/1830?usp=3Demail">change 1830</a>=2E To unsubscri=
be, or for help writing mail filters, visit <a href=3D"http://gerrit=2Eopen=
vpn=2Enet/settings?usp=3Demail">settings</a>=2E</p><div itemscope itemtype=
=3D"http://schema=2Eorg/EmailMessage"><div itemscope itemprop=3D"action" it=
emtype=3D"http://schema=2Eorg/ViewAction"><link itemprop=3D"url" href=3D"ht=
tp://gerrit=2Eopenvpn=2Enet/c/openvpn/+/1830?usp=3Demail"/><meta itemprop=
=3D"name" content=3D"View Change"/></div></div>

<div style=3D"display:none=
"> Gerrit-MessageType: comment </div>
<div style=3D"display:none"> Gerrit-P=
roject: openvpn </div>
<div style=3D"display:none"> Gerrit-Branch: master <=
/div>
<div style=3D"display:none"> Gerrit-Change-Id: I96b5ea3542df77b1be170=
79874fb9e4970b539ed </div>
<div style=3D"display:none"> Gerrit-Change-Numbe=
r: 1830 </div>
<div style=3D"display: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: ordex &lt;antonio@man=
delbit=2Ecom&gt; </div>
<div style=3D"display:none"> Gerrit-Reviewer: plais=
thos &lt;arne-openvpn@rfc2549=2Eorg&gt; </div>
<div style=3D"display:none">=
 Gerrit-CC: openvpn-devel &lt;openvpn-devel@lists=2Esourceforge=2Enet&gt; <=
/div>
<div style=3D"display:none"> Gerrit-Attention: plaisthos &lt;arne-ope=
nvpn@rfc2549=2Eorg&gt; </div>
<div style=3D"display:none"> Gerrit-Attention=
: ordex &lt;antonio@mandelbit=2Ecom&gt; </div>
<div style=3D"display:none">=
 Gerrit-Comment-Date: Mon, 03 Aug 2026 11:16:25 +0000 </div>
<div style=3D"=
display:none"> Gerrit-HasComments: Yes </div>
<div style=3D"display:none"> =
Gerrit-Has-Labels: No </div>
<div style=3D"display:none"> Comment-In-Reply-=
To: plaisthos &lt;arne-openvpn@rfc2549=2Eorg&gt; </div>
<div style=3D"displ=
ay:none"> Comment-In-Reply-To: ordex &lt;antonio@mandelbit=2Ecom&gt; </div>=


</body></html>
--oGFzOU/VS9M=--


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


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

--===============5083984232857511787==--