Re: PJSIP internal DNS client binding to random sticky ports can look scary

"Joshua C. Colp" <[email protected]> Fri, 15 Dec 2023 17:32:12 -0400
Newsgroups gmane.comp.telephony.pbx.asterisk.devel
Message-ID <CAM0A2Z00JQjbeQQUzQD1J73Lo1FY_=-4KnEY5=r2R62z6Vmjrg@mail.gmail.com>
--===============2904669262631180059==
Content-Type: multipart/alternative; boundary="000000000000cfd198060c9322f2"

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

On Fri, Dec 15, 2023 at 5:26=E2=80=AFPM C. Maj <[email protected]> wrote=
:

> Howdy,
>
> This came up on the forums and seems appropriate to cross-post to -dev:
>
> https://community.asterisk.org/t/asterisk-listens-on-ipv6-port/99666
>
> OP wrote:
>
> "Please tell me why asterisk listens to ipv6 interface on random udp
> ports? Which module should be disabled or configured so that asterisk
> does not do this?"
>
> Reply mentioned previous discussion:
>
> https://issues-archive.asterisk.org/ASTERISK-25481
>
> Point of concern is in PJSIP pjlib-util resolver:
>
>
> https://github.com/pjsip/pjproject/blob/master/pjlib-util/src/pjlib-util/=
resolver.c
>
> Curious if best fix should be placed in third-party/pjproject/patches/
> to address the particular pj_sock_bind_in() functions, allowing both
> user-adjustable client binding host and port in /etc/asterisk/pjsip.conf
> with appropriate documentation around these new options ?
>
> Or, would a more developmentally-complicated *but
> less-anxiety-inducing-for-end-users* fix involve opening and closing a
> socket *as needed* ?
>

Modern versions of Asterisk don't use the PJSIP resolver. We replace it
with our own callback in res/res_pjsip/pjsip_resolver.c and do it on our
own using either res_resolver_system, or res_resolver_unbound (which would
listen itself). If PJSIP is still listening for DNS responses, then that
would most likely be a bug and a patch to disable it when an external
resolver (in PJSIP speak) is used should be provided to Teluu on their
GitHub to see what they think, and then backported.

--=20
Joshua C. Colp
Asterisk Project Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org

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

<div dir=3D"ltr"><div dir=3D"ltr">On Fri, Dec 15, 2023 at 5:26=E2=80=AFPM C=
. Maj &lt;<a href=3D"mailto:[email protected]">[email protected]</a>&=
gt; wrote:<br></div><div class=3D"gmail_quote"><blockquote class=3D"gmail_q=
uote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,2=
04);padding-left:1ex">Howdy,<br>
<br>
This came up on the forums and seems appropriate to cross-post to -dev:<br>
<br>
<a href=3D"https://community.asterisk.org/t/asterisk-listens-on-ipv6-port/9=
9666" rel=3D"noreferrer" target=3D"_blank">https://community.asterisk.org/t=
/asterisk-listens-on-ipv6-port/99666</a><br>
<br>
OP wrote:<br>
<br>
&quot;Please tell me why asterisk listens to ipv6 interface on random udp <=
br>
ports? Which module should be disabled or configured so that asterisk <br>
does not do this?&quot;<br>
<br>
Reply mentioned previous discussion:<br>
<br>
<a href=3D"https://issues-archive.asterisk.org/ASTERISK-25481" rel=3D"noref=
errer" target=3D"_blank" style=3D"">https://issues-archive.asterisk.org/AST=
ERISK-25481</a><br>
<br>
Point of concern is in PJSIP pjlib-util resolver:<br>
<br>
<a href=3D"https://github.com/pjsip/pjproject/blob/master/pjlib-util/src/pj=
lib-util/resolver.c" rel=3D"noreferrer" target=3D"_blank">https://github.co=
m/pjsip/pjproject/blob/master/pjlib-util/src/pjlib-util/resolver.c</a><br>
<br>
Curious if best fix should be placed in third-party/pjproject/patches/ <br>
to address the particular pj_sock_bind_in() functions, allowing both <br>
user-adjustable client binding host and port in /etc/asterisk/pjsip.conf <b=
r>
with appropriate documentation around these new options ?<br>
<br>
Or, would a more developmentally-complicated *but <br>
less-anxiety-inducing-for-end-users* fix involve opening and closing a <br>
socket *as needed* ?<br></blockquote><div><br></div><div>Modern versions of=
 Asterisk don&#39;t use the PJSIP resolver. We replace it with our own call=
back in res/res_pjsip/pjsip_resolver.c and do it on our own using either re=
s_resolver_system, or res_resolver_unbound (which would listen itself). If =
PJSIP is still listening for DNS responses, then that would most likely be =
a bug and a patch to disable it when an external resolver (in PJSIP speak) =
is used should be provided to Teluu=C2=A0on their GitHub to see what they t=
hink, and then backported.</div></div><div><br></div><span class=3D"gmail_s=
ignature_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature"><=
div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div dir=3D"ltr=
"><div dir=3D"ltr"><div dir=3D"ltr"><div style=3D"font-family:tahoma,sans-s=
erif"><font color=3D"#073763">Joshua C. Colp</font></div><div style=3D"font=
-family:tahoma,sans-serif"><font color=3D"#073763">Asterisk Project Lead</f=
ont></div><div style=3D"font-family:tahoma,sans-serif"><font color=3D"#0737=
63">Sangoma Technologies</font></div><div style=3D"font-family:tahoma,sans-=
serif"><font color=3D"#073763">Check us out at <a href=3D"http://www.sangom=
a.com" target=3D"_blank">www.sangoma.com</a> and <a href=3D"http://www.aste=
risk.org" target=3D"_blank">www.asterisk.org</a></font><br></div></div></di=
v></div></div></div></div></div></div></div></div>

--000000000000cfd198060c9322f2--


--===============2904669262631180059==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

LS0gCl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f
X19fX19fX19fX19fX19fXwotLSBCYW5kd2lkdGggYW5kIENvbG9jYXRpb24gUHJvdmlkZWQgYnkg
aHR0cDovL3d3dy5hcGktZGlnaXRhbC5jb20gLS0KCmFzdGVyaXNrLWRldiBtYWlsaW5nIGxpc3QK
VG8gVU5TVUJTQ1JJQkUgb3IgdXBkYXRlIG9wdGlvbnMgdmlzaXQ6CiAgIGh0dHA6Ly9saXN0cy5k
aWdpdW0uY29tL21haWxtYW4vbGlzdGluZm8vYXN0ZXJpc2stZGV2

--===============2904669262631180059==--