From: Travis Cross Date: Sat, 24 May 2014 00:34:12 +0000 (+0000) Subject: Avoid useless NAT log message X-Git-Tag: v1.4.5~2^2~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e8ba8ed5a59d0af41971cd3817d39bf33c813980;p=thirdparty%2Ffreeswitch.git Avoid useless NAT log message If FS is not behind NAT, then every call generates at least three INFO-level log messages: [INFO] switch_nat.c:589 NAT port mapping disabled This is useless noise. The message is only interesting if you do have NAT enabled but mapping disabled, which might indicate a configuration issue. With this change, we just skip the entire nat_add_mapping function if the NAT system isn't initialized or we're not behind NAT. --- diff --git a/src/switch_nat.c b/src/switch_nat.c index 2b95f8b959..c998c60b8b 100644 --- a/src/switch_nat.c +++ b/src/switch_nat.c @@ -585,6 +585,7 @@ SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping_internal(switch_port_t po switch_status_t status = SWITCH_STATUS_FALSE; switch_event_t *event = NULL; + if (!initialized || !nat_globals.nat_type) return status; if (!nat_globals.mapping) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "NAT port mapping disabled\n"); return status;