提交 d93a42df authored 作者: Michael Jerris's avatar Michael Jerris

Merge current sofia-sip darcs tree:

Thu Dec 13 09:15:04 EST 2007  Pekka.Pessi@nokia.com
  * libsofia-sip-ua/docs/hide_emails.sh: moved to scripts/ subdir

Thu Dec 13 09:15:34 EST 2007  Pekka.Pessi@nokia.com
  * check_sofia.c: pass xml result file as optional parameter to check_sofia

Thu Dec 20 08:13:37 EST 2007  Pekka.Pessi@nokia.com
  * stun.c: try to avoid using stun handle after returning from discovery callback
  
  Crash reported and partial patch by Daniele Rondina.

Thu Jan  3 07:11:27 EST 2008  Pekka.Pessi@nokia.com
  * tport_type_udp.c: using SO_RCVBUFFORCE and SO_SNDBUFFORCE to set rmem/wmem on udp sockets
  
  Referring reader to Linux sysctls to TPTAG_UDP_RMEM and TPTAG_UDP_WMEM
  documentation.

Thu Jan  3 07:11:47 EST 2008  Pekka.Pessi@nokia.com
  * m4/sac-su2.m4: checks for SO_RCVBUFFORCE and SO_SNDBUFFORCE

Thu Jan  3 08:19:04 EST 2008  Pekka.Pessi@nokia.com
  * nta.c: calculate next timeout only after completing current timeout
    
  Thanks to Mike Jerris for reporting this problem.

Thu Jan  3 11:02:11 EST 2008  Pekka.Pessi@nokia.com
  * sac-su2.m4: checking for IP_ADD_MEMBERSHIP and IP_MULTICAST_LOOP

Thu Jan  3 12:08:39 EST 2008  Pekka.Pessi@nokia.com
  * tport_type_udp.c: when binding to multicast address, join to the group, too.
  
  Use "canonic" IP address (from host-part of the SIP URI) to specify
  interface.

Mon Nov 19 15:01:09 EST 2007  Pekka Pessi <first.lastname@nokia.com>
  * tport_type_udp.c: made IP_ADD_MEMBERSHIP as portable

Fri Jan  4 13:19:01 EST 2008  Pekka.Pessi@nokia.com
  * test_nta.c: added check for request merging (with both 3261 and 2543 proxies)

Fri Jan  4 13:20:35 EST 2008  Pekka.Pessi@nokia.com
  * nta.c: fixed request merging with RFC 2543 proxies
    
  Updated matching of PRACKs with outstanding 100rel, too.

Fri Jan  4 15:27:01 EST 2008  Pekka.Pessi@nokia.com
  * nta.c: follow more closely RFC 3261 request matching rules

Fri Jan  4 15:31:22 EST 2008  Pekka.Pessi@nokia.com
  * nua_session.c: do not clear soa when an overlapping INVITE is received
  
Fri Jan  4 15:32:58 EST 2008  Pekka.Pessi@nokia.com
  * nua/outbound.c: reduce logging

Fri Jan  4 16:51:00 EST 2008  Pekka.Pessi@nokia.com
  * nua_subnotref.c: accept NOTIFY without Event header

Fri Jan  4 16:53:20 EST 2008  Pekka.Pessi@nokia.com
  * nua_notifier.c: fix problem handing expiration time if NOTIFY is sent before SUBSCRIBE has been responded

Fri Jan  4 16:54:08 EST 2008  Pekka.Pessi@nokia.com
  * nua_notifier.c: allow notifier handle to be shut down if SUBSCRIBE has been accpeted but no NOTIFY has been sent



git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7109 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 73cbaf9e
Thu Oct 11 15:56:47 EDT 2007
Sun Jan 6 15:11:42 EST 2008
......@@ -40,7 +40,7 @@ doxygen: built-sources
&& ${DOXYGEN} \
&& popd > /dev/null ; \
done
${top_srcdir}/libsofia-sip-ua/docs/hide_emails.sh docs/html
${top_srcdir}/scripts/hide_emails.sh docs/html
PHONY = doxygen
......
......@@ -101,7 +101,7 @@ doxygen: built-sources
docs/$$d.doxytags > docs/$$d.doxytags.tmp && \
mv -f docs/$$d.doxytags.tmp docs/$$d.doxytags ; \
done
${srcdir}/docs/hide_emails.sh docs/html
${top_srcdir}/scripts/hide_emails.sh docs/html
if HAVE_LCOV
include $(top_srcdir)/rules/lcov.am
......
......@@ -498,10 +498,18 @@ static int nua_notify_client_init(nua_client_request_t *cr,
else if (nu->nu_requested >= now + expires)
nu->nu_expires = nu->nu_requested = now + expires;
}
else {
if (nu->nu_requested >= nu->nu_expires)
nu->nu_expires = nu->nu_requested;
}
}
else {
enum nua_substate substate = nu->nu_substate;
if (nu->nu_requested >= nu->nu_expires)
nu->nu_expires = nu->nu_requested;
if (nu->nu_expires > now) {
tagi_t const *t = tl_find_last(tags, nutag_substate);
if (t)
......@@ -794,8 +802,11 @@ static int nua_notify_usage_shutdown(nua_handle_t *nh,
return 0;
}
else {
if (nua_client_create(nh, nua_r_notify,
&nua_notify_client_methods, NULL) >= 0)
if (nua_client_tcreate(nh, nua_r_notify,
&nua_notify_client_methods,
SIPTAG_EVENT(du->du_event),
NUTAG_SUBSTATE(nua_substate_terminated),
TAG_END()) >= 0)
return 0;
}
......
......@@ -2023,7 +2023,8 @@ int nua_invite_server_respond(nua_server_request_t *sr, tagi_t const *tags)
reliable = 1, early_answer = 1;
}
else if (!nh->nh_soa || sr->sr_status >= 300) {
if (sr->sr_neutral)
return nua_base_server_respond(sr, tags);
}
else if (tags && 100 < sr->sr_status && sr->sr_status < 200 &&
!NHP_ISSET(nh->nh_prefs, early_answer)) {
......
......@@ -581,7 +581,7 @@ int nua_notify_server_preprocess(nua_server_request_t *sr)
sr->sr_usage = du;
eu = nua_dialog_usage_private(du); assert(eu);
eu->eu_notified++;
if (!o->o_id)
if (!o || !o->o_id)
eu->eu_no_id = 1;
if (subs == NULL) {
......
......@@ -503,13 +503,13 @@ int outbound_nat_detect(outbound_t *ob,
}
if (!nat_detected) {
SU_DEBUG_1(("outbound(%p): detected NAT: %s != %s\n",
SU_DEBUG_5(("outbound(%p): detected NAT: %s != %s\n",
(void *)ob->ob_owner, v->v_host, received));
if (ob->ob_oo && ob->ob_oo->oo_status)
ob->ob_oo->oo_status(ob->ob_owner, ob, 101, "NAT detected", TAG_END());
}
else {
SU_DEBUG_1(("outbound(%p): NAT binding changed: "
SU_DEBUG_5(("outbound(%p): NAT binding changed: "
"[%s]:%s != [%s]:%s\n",
(void *)ob->ob_owner, nat_detected, nat_port, received, rport));
if (ob->ob_oo && ob->ob_oo->oo_status)
......@@ -860,8 +860,6 @@ static int response_to_keepalive_options(outbound_t *ob,
else
loglevel = 3, failed = 1;
loglevel = 1; /* XXX ... for now */
if (loglevel >= SU_LOG->log_level) {
sip_contact_t const *m = ob->ob_rcontact;
......@@ -886,7 +884,7 @@ static int response_to_keepalive_options(outbound_t *ob,
ob->ob_oo->oo_probe_error(ob->ob_owner, ob, status, phrase, TAG_END());
}
else if (status == 408) {
SU_DEBUG_1(("outbound(%p): keepalive timeout\n", (void *)ob->ob_owner));
SU_DEBUG_3(("outbound(%p): keepalive timeout\n", (void *)ob->ob_owner));
ob->ob_oo->oo_keepalive_error(ob->ob_owner, ob, status, phrase, TAG_END());
return 0;
}
......@@ -979,7 +977,7 @@ int outbound_process_request(outbound_t *ob,
return 0;
if (ob->ob_keepalive.validating) {
SU_DEBUG_1(("outbound(%p): registration check OPTIONS received\n",
SU_DEBUG_5(("outbound(%p): registration check OPTIONS received\n",
(void *)ob->ob_owner));
ob->ob_keepalive.validated = 1;
}
......
......@@ -1895,23 +1895,23 @@ static int process_test_lifetime(stun_request_t *req, stun_msg_t *binding_respon
if ((req->sr_state == stun_req_timeout) && (req->sr_from_y == -1)) {
SU_DEBUG_0(("%s: lifetime determination failed.\n", __func__));
sd->sd_state = stun_discovery_timeout;
req->sr_state = stun_req_dispose_me;
/* Use per discovery specific callback */
if (sd->sd_callback)
sd->sd_callback(sd->sd_magic, sh, sd, action, sd->sd_state);
req->sr_state = stun_req_dispose_me;
return 0;
}
if (abs(sd->sd_lt_cur - sd->sd_lt) <= STUN_LIFETIME_CI) {
sd->sd_state = stun_discovery_done;
req->sr_state = stun_req_dispose_me;
/* Use per discovery specific callback */
if (sd->sd_callback)
sd->sd_callback(sd->sd_magic, sh, sd, action, sd->sd_state);
req->sr_state = stun_req_dispose_me;
return 0;
}
......@@ -1998,12 +1998,11 @@ static int action_bind(stun_request_t *req, stun_msg_t *binding_response)
memcpy(sd->sd_addr_seen_outside, sa, sizeof(su_sockaddr_t));
sd->sd_state = stun_discovery_done;
req->sr_state = stun_req_dispose_me;
if (sd->sd_callback)
sd->sd_callback(sd->sd_magic, sh, sd, action, sd->sd_state);
req->sr_state = stun_req_dispose_me;
return 0;
}
......@@ -2053,9 +2052,9 @@ static void priv_mark_discovery_done(stun_discovery_t *sd,
stun_request_t *req)
{
sd->sd_state = stun_discovery_done;
req->sr_state = stun_req_dispose_me;
if (sd->sd_callback)
sd->sd_callback(sd->sd_magic, sh, sd, action, sd->sd_state);
req->sr_state = stun_req_dispose_me;
}
/**
......@@ -2290,12 +2289,12 @@ static void stun_sendto_timer_cb(su_root_magic_t *magic,
switch (action) {
case stun_action_binding_request:
sd->sd_state = stun_discovery_timeout;
req->sr_state = stun_req_dispose_me;
/* Use per discovery specific callback */
if (sd->sd_callback)
sd->sd_callback(sd->sd_magic, sh, sd, action, sd->sd_state);
req->sr_state = stun_req_dispose_me;
break;
case stun_action_test_nattype:
......
......@@ -311,6 +311,10 @@ tag_typedef_t tptag_debug_drop = UINTTAG_TYPEDEF(debug_drop);
*
* This is a parameter suitable for tuning.
*
* On Linux systems, the default value for receive buffer is set with
* the sysctl "net.core.rmem_default", and the maximum value is set with
* the sysctl "net.core.rmem_max".
*
* Use with tport_tbind(), nua_create(), nta_agent_create(),
* nta_agent_add_tport(), nth_engine_create(), or initial nth_site_create().
*/
......@@ -322,6 +326,10 @@ tag_typedef_t tptag_udp_rmem = UINTTAG_TYPEDEF(udp_rmem);
*
* This is a parameter suitable for tuning.
*
* On Linux systems, the default value for receive buffer is set with
* the sysctl "net.core.wmem_default", and the maximum value is set with
* the sysctl "net.core.wmem_max".
*
* Use with tport_tbind(), nua_create(), nta_agent_create(),
* nta_agent_add_tport(), nth_engine_create(), or initial nth_site_create().
*/
......
......@@ -35,6 +35,7 @@
#include "config.h"
#include "tport_internal.h"
#include "sofia-sip/hostdomain.h"
#if HAVE_IP_RECVERR || HAVE_IPV6_RECVERR
#include <linux/types.h>
......@@ -113,6 +114,8 @@ int tport_udp_init_primary(tport_primary_t *pri,
unsigned rmem = 0, wmem = 0;
int events = SU_WAIT_IN;
int s;
su_sockaddr_t *su = (su_sockaddr_t *)ai->ai_addr;
int const one = 1; (void)one;
s = su_socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if (s == INVALID_SOCKET)
......@@ -125,20 +128,51 @@ int tport_udp_init_primary(tport_primary_t *pri,
tport_set_tos(s, ai, pri->pri_params->tpp_tos);
#if HAVE_IP_ADD_MEMBERSHIP
if (ai->ai_family == AF_INET &&
IN_MULTICAST(ntohl(su->su_sin.sin_addr.s_addr))) {
/* Try to join to the multicast group */
/* Bind to the SIP address like
<sip:88.77.66.55:5060;maddr=224.0.1.75;transport=udp> */
struct ip_mreq imr[1];
struct in_addr iface;
memset(imr, 0, sizeof imr);
imr->imr_multiaddr = su->su_sin.sin_addr;
if (host_is_ip4_address(tpn->tpn_canon) &&
inet_pton(AF_INET, tpn->tpn_canon, &iface) > 0) {
imr->imr_interface = iface;
}
if (setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP, imr, (sizeof imr)) < 0) {
SU_DEBUG_3(("setsockopt(%s): %s\n",
"IP_ADD_MEMBERSHIP", su_strerror(su_errno())));
}
#if HAVE_IP_MULTICAST_LOOP
else
if (setsockopt(s, IPPROTO_IP, IP_MULTICAST_LOOP, &one, sizeof one) < 0) {
SU_DEBUG_3(("setsockopt(%s): %s\n",
"IP_MULTICAST_LOOP", su_strerror(su_errno())));
}
#endif
}
#endif
#if HAVE_IP_RECVERR
if (ai->ai_family == AF_INET || ai->ai_family == AF_INET6) {
int const one = 1;
if (setsockopt(s, SOL_IP, IP_RECVERR, &one, sizeof(one)) < 0) {
if (setsockopt(s, IPPROTO_IP, IP_RECVERR, &one, sizeof(one)) < 0) {
if (ai->ai_family == AF_INET)
SU_DEBUG_3(("setsockopt(IPVRECVERR): %s\n", su_strerror(su_errno())));
SU_DEBUG_3(("setsockopt(%s): %s\n",
"IPVRECVERR", su_strerror(su_errno())));
}
events |= SU_WAIT_ERR;
}
#endif
#if HAVE_IPV6_RECVERR
if (ai->ai_family == AF_INET6) {
int const one = 1;
if (setsockopt(s, SOL_IPV6, IPV6_RECVERR, &one, sizeof(one)) < 0)
if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVERR, &one, sizeof(one)) < 0)
SU_DEBUG_3(("setsockopt(IPV6_RECVERR): %s\n", su_strerror(su_errno())));
events |= SU_WAIT_ERR;
}
......@@ -150,12 +184,18 @@ int tport_udp_init_primary(tport_primary_t *pri,
TAG_END());
if (rmem != 0 &&
#if HAVE_SO_RCVBUFFORCE
setsockopt(s, SOL_SOCKET, SO_RCVBUFFORCE, (void *)&rmem, sizeof rmem) < 0 &&
#endif
setsockopt(s, SOL_SOCKET, SO_RCVBUF, (void *)&rmem, sizeof rmem) < 0) {
SU_DEBUG_3(("setsockopt(SO_RCVBUF): %s\n",
su_strerror(su_errno())));
}
if (wmem != 0 &&
#if HAVE_SO_SNDBUFFORCE
setsockopt(s, SOL_SOCKET, SO_SNDBUFFORCE, (void *)&wmem, sizeof wmem) < 0 &&
#endif
setsockopt(s, SOL_SOCKET, SO_SNDBUF, (void *)&wmem, sizeof wmem) < 0) {
SU_DEBUG_3(("setsockopt(SO_SNDBUF): %s\n",
su_strerror(su_errno())));
......@@ -409,10 +449,10 @@ int tport_udp_error(tport_t const *self, su_sockaddr_t name[1])
for (c = CMSG_FIRSTHDR(msg); c; c = CMSG_NXTHDR(msg, c)) {
if (0
#if HAVE_IP_RECVERR
|| (c->cmsg_level == SOL_IP && c->cmsg_type == IP_RECVERR)
|| (c->cmsg_level == IPPROTO_IP && c->cmsg_type == IP_RECVERR)
#endif
#if HAVE_IPV6_RECVERR
|| (c->cmsg_level == SOL_IPV6 && c->cmsg_type == IPV6_RECVERR)
|| (c->cmsg_level == IPPROTO_IPV6 && c->cmsg_type == IPV6_RECVERR)
#endif
) {
char info[128];
......
......@@ -273,6 +273,28 @@ AC_DEFINE([HAVE_MSG_TRUNC],1,[Define to 1 if you have MSG_TRUNC flag]),,[
#include <sys/types.h>
#include <sys/socket.h>])
AC_CHECK_DECL([SO_RCVBUFFORCE],
AC_DEFINE([HAVE_SO_RCVBUFFORCE],1,[Define to 1 if you have socket option SO_RCVBUFFORCE]),,[
#include <sys/types.h>
#include <sys/socket.h>])
AC_CHECK_DECL([SO_SNDBUFFORCE],
AC_DEFINE([HAVE_SO_SNDBUFFORCE],1,[Define to 1 if you have socket option SO_SNDBUFFORCE]),,[
#include <sys/types.h>
#include <sys/socket.h>])
AC_CHECK_DECL([IP_ADD_MEMBERSHIP],
AC_DEFINE([HAVE_IP_ADD_MEMBERSHIP],1,[Define to 1 if you have IP_ADD_MEMBERSHIP]),,[
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>])
AC_CHECK_DECL([IP_MULTICAST_LOOP],
AC_DEFINE([HAVE_IP_MULTICAST_LOOP],1,[Define to 1 if you have IP_MULTICAST_LOOP]),,[
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>])
AC_CACHE_CHECK([for struct addrinfo],
[ac_cv_struct_addrinfo],[
ac_cv_struct_addrinfo=no
......
......@@ -51,7 +51,9 @@ int main(int argc, char *argv[])
suite = suite_for_nua();
runner = srunner_create(suite);
srunner_set_xml(runner, "/tmp/result.xml");
if (argv[1]) {
srunner_set_xml(runner, argv[1]);
}
srunner_run_all(runner, CK_NORMAL);
failed = srunner_ntests_failed(runner);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论