Summary:ASTERISK-15411: Ignores bindaddr on reload
Reporter:Eugene Blanchard (blanchae)Labels:
Date Opened:2010-01-06 16:44:39.000-0600Date Closed:2011-06-07 14:07:21
Versions:Frequency of
Description:chan_iax2.c: Ignoring bindaddr on reload

This bug was noted on
* FreePBX                  : 2.5.1
* Asterisk Source Version  :
* Dahdi Source Version     :
* Libpri Source Version    : 1.4.9
* Addons Source Version    :

With IAX2 and the iax_general_custom.conf file. bindaddr=xxx.xxx.xxx.xxx
is ignored on reload. It defaults back to address which is any interface.


The purpose of the bindaddr="IP address of interface" is to direct IAX2 to
only use a specific interface for communication. This is ABSOLUTELY
necessary if you are using VLANs on your Asterisk PBX.

Example: if you have an IAX softphone (PC) on the Data VLAN and attempt to
register to PiaF using its Voice VLAN interface (which you should for
QoS), PiaF responds with its Data VLAN interface. The softphone chokes on
the reply because it received the wrong IP address. It was expecting a
Voice VLAN IP address. This would also affect any IAX2 trunks coming in from
other VLANs. Causes a routing mess..

This is the asterisk-users@list.digium.com from 2005 concerning this bug

Comments:By: Leif Madsen (lmadsen) 2010-01-08 15:16:42.000-0600

Please reproduce this on a newer version of Asterisk, as your version is significantly old ( is currently released).

By: Eugene Blanchard (blanchae) 2010-12-01 11:42:24.000-0600

Verified on Asterisk The problem to updating is that I have 48 servers to update and it is not a trivial matter.

In chan_iax2.c: Why is bindaddr being ignored on reload?

13059       else if (!strcasecmp(v->name, "bindaddr")) {
13060          if (reload) {
13061             ast_log(LOG_NOTICE, "Ignoring bindaddr on reload\n");
13062          } else {
13063             if (!(ns = ast_netsock_bind(netsock, io, v->value, portno, qos.tos, qos.cos, socket_read, NULL))) {
13064                ast_log(LOG_WARNING, "Unable apply binding to '%s' at line %d\n", v->value, v->lineno);
13065             } else {
13066                   if (strchr(v->value, ':'))
13067                   ast_verb(2, "Binding IAX2 to '%s'\n", v->value);
13068                   else
13069                   ast_verb(2, "Binding IAX2 to '%s:%d'\n", v->value, portno);
13070                if (defaultsockfd < 0)
13071                   defaultsockfd = ast_netsock_sockfd(ns);
13072                ast_netsock_unref(ns);
13073             }
13074          }

By: Eugene Blanchard (blanchae) 2010-12-02 12:20:43.000-0600

It appears that the "failed to load on reload" is normal. Still have the problem where it doesn't bind properly.

Okay, correct me if I'm wrong but the purpose of this command is to direct IAX2 out a specific port. If I have two NIC cards (eth0 and eth1) in my server then I should be able to bind IAX2 to just one of them by issuing the command "bindaddr=" (eth0)in /etc/asterisk/iax_general_custom.conf (assuming that this file is included in iax.conf).

What happens is that IAX2 will still go out eth1. This is easily verified by using iptables to drop IAX2 traffic on eth1, IAX2 clients fail to register. Strangely, SIP doesn't have this problem when using bindaddr.

Test conditions: laptop on network (voice), using both Adore IAX softphone client and Xlite SIP softphone client (for comparison) to register to (eth0) server. Server's eth1 is on network (data). Both protocols have bindaddr= (server's voice interface). SIP works as expected and the server responds on the voice interface, IAX2 does not.

This might be a routing problem in Linux as packet sniffing indicates eth1's mac address. Strangely dropping SIP on eth1 doesn't affect SIP registration. So SIP works fine regardless but IAX2 doesn't.

By: Eugene Blanchard (blanchae) 2010-12-02 13:01:08.000-0600

I'm thinking that at this point, this bug should be closed as it pertains to "bindaddr not reloading" and a new one started on IAX2 not binding using bindaddr.

BTW, the Asterisk log file "full", shows that after the bindaddr command is parsed, IAX2 is bound to

By: Leif Madsen (lmadsen) 2010-12-02 20:29:57.000-0600

Closed per the reporter.