mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-01 19:43:03 +00:00
Fix BSD issue (bug #2668)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4065 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
5
acl.c
5
acl.c
@@ -242,13 +242,12 @@ int ast_ouraddrfor(struct in_addr *them, struct in_addr *us)
|
|||||||
|
|
||||||
memset(&m_rtmsg, 0, sizeof(m_rtmsg));
|
memset(&m_rtmsg, 0, sizeof(m_rtmsg));
|
||||||
m_rtmsg.m_rtm.rtm_type = RTM_GET;
|
m_rtmsg.m_rtm.rtm_type = RTM_GET;
|
||||||
m_rtmsg.m_rtm.rtm_flags = RTF_UP | RTF_HOST;
|
|
||||||
m_rtmsg.m_rtm.rtm_version = RTM_VERSION;
|
m_rtmsg.m_rtm.rtm_version = RTM_VERSION;
|
||||||
ast_mutex_lock(&routeseq_lock);
|
ast_mutex_lock(&routeseq_lock);
|
||||||
seq = ++routeseq;
|
seq = ++routeseq;
|
||||||
ast_mutex_unlock(&routeseq_lock);
|
ast_mutex_unlock(&routeseq_lock);
|
||||||
m_rtmsg.m_rtm.rtm_seq = seq;
|
m_rtmsg.m_rtm.rtm_seq = seq;
|
||||||
m_rtmsg.m_rtm.rtm_addrs = RTA_DST;
|
m_rtmsg.m_rtm.rtm_addrs = RTA_DST | RTA_IFA;
|
||||||
m_rtmsg.m_rtm.rtm_msglen = sizeof(struct rt_msghdr) + sizeof(struct sockaddr_in);
|
m_rtmsg.m_rtm.rtm_msglen = sizeof(struct rt_msghdr) + sizeof(struct sockaddr_in);
|
||||||
sin = (struct sockaddr_in *)m_rtmsg.m_space;
|
sin = (struct sockaddr_in *)m_rtmsg.m_space;
|
||||||
sin->sin_family = AF_INET;
|
sin->sin_family = AF_INET;
|
||||||
@@ -268,7 +267,7 @@ int ast_ouraddrfor(struct in_addr *them, struct in_addr *us)
|
|||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
l = read(s, (char *)&m_rtmsg, sizeof(m_rtmsg));
|
l = read(s, (char *)&m_rtmsg, sizeof(m_rtmsg));
|
||||||
} while (l > 0 && (m_rtmsg.m_rtm.rtm_seq != 1 || m_rtmsg.m_rtm.rtm_pid != pid));
|
} while (l > 0 && (m_rtmsg.m_rtm.rtm_seq != seq || m_rtmsg.m_rtm.rtm_pid != pid));
|
||||||
if (l < 0) {
|
if (l < 0) {
|
||||||
if (errno != EAGAIN)
|
if (errno != EAGAIN)
|
||||||
ast_log(LOG_ERROR, "Error reading from routing socket\n");
|
ast_log(LOG_ERROR, "Error reading from routing socket\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user