mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-25 15:08:53 +00:00
Address comments from Mark Michelson
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357014 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -12270,7 +12270,7 @@ static int check_srcaddr(struct ast_sockaddr *addr)
|
||||
{
|
||||
int sd;
|
||||
|
||||
sd = socket(ast_sockaddr_is_ipv4(addr) ? AF_INET : AF_INET6, SOCK_DGRAM, 0);
|
||||
sd = socket(addr->ss.ss_family, SOCK_DGRAM, 0);
|
||||
if (sd < 0) {
|
||||
ast_log(LOG_ERROR, "Socket: %s\n", strerror(errno));
|
||||
return -1;
|
||||
@@ -12302,8 +12302,7 @@ static int peer_set_srcaddr(struct iax2_peer *peer, const char *srcaddr)
|
||||
if (!(tmp = ast_strdupa(srcaddr)))
|
||||
return -1;
|
||||
|
||||
host = strsep(&tmp, ":");
|
||||
portstr = tmp;
|
||||
ast_sockaddr_split_hostport(tmp, &host, &portstr, 0);
|
||||
|
||||
if (portstr) {
|
||||
port = atoi(portstr);
|
||||
|
@@ -167,6 +167,11 @@ struct ast_netsock *ast_netsock_bind(struct ast_netsock_list *list, struct io_co
|
||||
struct ast_sockaddr addr;
|
||||
|
||||
if (ast_sockaddr_parse(&addr, bindinfo, 0)) {
|
||||
if (!ast_sockaddr_is_ipv4(&addr)) {
|
||||
ast_log(LOG_WARNING, "Only IPv4 addresses are supported at this time.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!ast_sockaddr_port(&addr)) {
|
||||
ast_sockaddr_set_port(&addr, defaultport);
|
||||
}
|
||||
|
Reference in New Issue
Block a user