round two better code thanks mikej
This commit is contained in:
parent
eafd7e5e15
commit
2324c29917
|
@ -6255,7 +6255,8 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||||
|
|
||||||
if (!is_nat && profile->nat_acl_count) {
|
if (!is_nat && profile->nat_acl_count) {
|
||||||
uint32_t x = 0;
|
uint32_t x = 0;
|
||||||
int ok = 1;
|
int contact_private_ip = 1;
|
||||||
|
int network_private_ip = 0;
|
||||||
char *last_acl = NULL;
|
char *last_acl = NULL;
|
||||||
const char *contact_host = NULL;
|
const char *contact_host = NULL;
|
||||||
|
|
||||||
|
@ -6264,9 +6265,6 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zstr(contact_host)) {
|
if (!zstr(contact_host)) {
|
||||||
for (x = 0; x < profile->nat_acl_count; x++) {
|
|
||||||
last_acl = profile->nat_acl[x];
|
|
||||||
if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) {
|
|
||||||
/* NAT mode double check logic and examples.
|
/* NAT mode double check logic and examples.
|
||||||
|
|
||||||
Example 1: the contact_host is 192.168.1.100 and the network_ip is also 192.168.1.100 the end point
|
Example 1: the contact_host is 192.168.1.100 and the network_ip is also 192.168.1.100 the end point
|
||||||
|
@ -6282,17 +6280,22 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||||
remote NAT over the public internet in addition to endpoints behind nat with you. This simplifies that process.
|
remote NAT over the public internet in addition to endpoints behind nat with you. This simplifies that process.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
if ((ok = switch_check_network_list_ip(network_ip, last_acl))) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Endpoint is already inside nat with us.\n");
|
for (x = 0; x < profile->nat_acl_count; x++) {
|
||||||
ok = 0;
|
last_acl = profile->nat_acl[x];
|
||||||
} else {
|
if ((contact_private_ip = switch_check_network_list_ip(contact_host, last_acl))) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Decision stands they are behind nat.\n");
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (contact_private_ip) {
|
||||||
|
for (x = 0; x < profile->nat_acl_count; x++) {
|
||||||
|
if ((network_private_ip = switch_check_network_list_ip(network_ip, profile->nat_acl[x]))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ok) {
|
if (contact_private_ip && !network_private_ip) {
|
||||||
is_nat = last_acl;
|
is_nat = last_acl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue