[asterisk-dev] [Code Review]: Add IPv6 Support To Manager
Simon Perreault
simon.perreault at viagenie.ca
Fri Jun 15 07:40:15 CDT 2012
On 2012-06-14 21:06, elguero wrote:
> struct sockaddr_in ser_remote_address_tmp;
>
> 6614
>
> struct ast_sockaddr ser_remote_address_tmp = { { 0, } };
>
> There is no need to initialize the address to zero.
>
> I might be misreading something... from netsock2.h:
>
> "It is important to always initialize ast_sockaddr before use -- even if they are passed to ast_sockaddr_copy() as the underlying storage could be bigger than what ends up being copied -- leaving part of the data unitialized."
>
> Am I misunderstanding this?
You're not misunderstanding, but the author of that note could be
mistaken. There is nothing wrong with "leaving part of the data
uninitialized".
I think this note should be removed, or proper justification added.
> On June 6th, 2012, 7:54 a.m., *Simon Perreault* wrote:
>
> /trunk/main/manager.c
> <https://reviewboard.asterisk.org/r/1968/diff/1/?file=28535#file28535line6892>
> (Diff revision 1)
>
> static int __init_manager(int reload)
>
>
>
> 6868
>
> int bindport = 0;
>
> This variable's scope can be tightened, to reduce action at a distance. When parsing"port", just call ast_sockaddr_set_port(). When parsing"bindaddr", extract the port into a tightly-scoped variable, parse the address, then reset the port. Also, add a warning when"bindaddr" and"bindport" contain contradicting port numbers.
>
> Maybe it should not be part of these changes but I am wondering if we should get rid of the separate port and bindaddr settings in manager.conf and just have one setting (tcpbindaddr? or stick to bindaddr) that can contain an optional port number?
What we did in sip.conf is that we kept both but made bindaddr accept an
optional port. In the sample sip.conf file we only use bindaddr.
Simon
--
DTN made easy, lean, and smart --> http://postellation.viagenie.ca
NAT64/DNS64 open-source --> http://ecdysis.viagenie.ca
STUN/TURN server --> http://numb.viagenie.ca
More information about the asterisk-dev
mailing list