]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res/res_pjsip: Standardize/fix localnet checks across pjsip.
authorWalter Doekes <walter+asterisk@wjd.nu>
Tue, 5 Sep 2017 14:16:01 +0000 (16:16 +0200)
committerWalter Doekes <walter+asterisk@wjd.nu>
Tue, 5 Sep 2017 14:17:24 +0000 (09:17 -0500)
commit329e11194712b3effe92c8bdfc47acb565be371a
tree88647e4dc9cf6ba491c3adb3c81386f916c386eb
parent9d79c39be28f11e598f19221c7af136c0023c629
res/res_pjsip: Standardize/fix localnet checks across pjsip.

In 2dee95cc (ASTERISK-27024) and 776ffd77 (ASTERISK-26879) there was
confusion about whether the transport_state->localnet ACL has ALLOW or
DENY semantics.

For the record: the localnet has DENY semantics, meaning that "not in
the list" means ALLOW, and the local nets are in the list.

Therefore, checks like this look wrong, but are right:

    /* See if where we are sending this request is local or not, and if
       not that we can get a Contact URI to modify */
    if (ast_apply_ha(transport_state->localnet, &addr) != AST_SENSE_ALLOW) {
        ast_debug(5, "Request is being sent to local address, "
                     "skipping NAT manipulation\n");

(In the list == localnet == DENY == skip NAT manipulation.)

And conversely, other checks that looked right, were wrong.

This change adds two macro's to reduce the confusion and uses those
instead:

    ast_sip_transport_is_nonlocal(transport_state, addr)
    ast_sip_transport_is_local(transport_state, addr)

ASTERISK-27248 #close

Change-Id: Ie7767519eb5a822c4848e531a53c0fd054fae934
include/asterisk/res_pjsip.h
main/acl.c
res/res_pjsip/config_transport.c
res/res_pjsip_nat.c
res/res_pjsip_sdp_rtp.c
res/res_pjsip_session.c
res/res_pjsip_t38.c