mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
res/res_pjsip: Standardize/fix localnet checks across pjsip.
In2dee95cc
(ASTERISK-27024) and776ffd77
(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
This commit is contained in:
@@ -1127,7 +1127,9 @@ static int transport_localnet_handler(const struct aco_option *opt, struct ast_v
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(state->localnet = ast_append_ha("d", var->value, state->localnet, &error))) {
|
||||
/* We use only the ast_apply_ha() which defaults to ALLOW
|
||||
* ("permit"), so we add DENY rules. */
|
||||
if (!(state->localnet = ast_append_ha("deny", var->value, state->localnet, &error))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user