[Freeswitch-svn] [commit] r7372 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nta

Freeswitch SVN mikej at freeswitch.org
Sat Jan 26 14:57:56 EST 2008


Author: mikej
Date: Sat Jan 26 14:57:55 2008
New Revision: 7372

Modified:
   freeswitch/trunk/libs/sofia-sip/RELEASE
   freeswitch/trunk/libs/sofia-sip/configure.ac
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c

Log:
sync to darcs tree

Thu Jan 17 07:57:29 EST 2008  Pekka.Pessi at nokia.com
  * configure.ac: prerelease version

Wed Jan 23 13:22:39 EST 2008  Pekka.Pessi at nokia.com
  * test_nta.c: fixed memset() usage. MSG_TRUNC.

Wed Jan 23 13:25:42 EST 2008  Pekka Pessi <Pekka.Pessi at nokia.com>
  * RELEASE, configure.ac: release 1.12.8

Wed Jan 23 13:25:46 EST 2008  Pekka Pessi <Pekka.Pessi at nokia.com>
  tagged rel-sofia-sip_1_12_8

Wed Jan 23 13:25:52 EST 2008  Pekka Pessi <Pekka.Pessi at nokia.com>
  tagged 1.12.8

Wed Jan 23 14:25:07 EST 2008  Pekka.Pessi at nokia.com
  * RELEASE, configure.ac: 1.12.8devel

Fri Jan 25 04:31:39 EST 2008  Pekka.Pessi at nokia.com
  * nta.c: fixed graylisting if used with IPv4/IPv6 only



Modified: freeswitch/trunk/libs/sofia-sip/RELEASE
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/RELEASE	(original)
+++ freeswitch/trunk/libs/sofia-sip/RELEASE	Sat Jan 26 14:57:55 2008
@@ -5,31 +5,26 @@
 Changes since last release
 --------------------------
 
-Beside bugfixes, a server graylisting was added to nta and a few
-improvements in event handling were made in nua interface.
+<changes since last written in freshmeat.net "Changes:" style;
+ and in less than 10 lines, written in 3rd person English, with
+ complete sentences />
 
-A check-based test program was added, too.
+Bugs in blaa and foo have been fixed. The stack now supports
+use of foobar...
 
 API/ABI changes and versioning
 ------------------------------
 
-New features in API are marked with Doxytag macro @NEW_1_12_8 or
- at VERSION_1_12_8.
+<see previous release notes at
+ http://sofia-sip.sourceforge.net/relnotes/ for examples ;
+ - should include all changes to public headers, and 
+   other important information to developers; 
+ - and should be updated _continuously_! />
+
+**template**: New features in API are marked with Doxytag macro @VERSION_1_XX_X.
 
 libsofia-sip-ua:
-- Added nta_sip_is_internal(), nta_msg_is_internal() function in
-  <sofia-sip/nta.h>. Deprecating nta_is_internal_msg().
-- Added su_msg_new(), su_msg_send_to() and su_msg_deinitializer() for more 
-  robust and light-weight message passing in <sofia-sip/su_wait.h>
-- Added su_home_lock(), su_home_trylock(), and su_home_unlock() in
-  <sofia-sip/su_alloc.h>
-- Added type-neutral template macros for hash tables HTABLE2_DECLARE2(), HTABLE2_PROTOS2(),
-  and HTABLE2_BODIES2().
-- Added sres_cache_set_srv_priority() in <sofia-resolv/sres_cache.h> and 
-  sres_set_cached_srv_priority() <sofia-resolv/sres.h> for graylisting
-  SRV records for inresponsive servers.
-- nua_create()/nta_agent_create()/tport_bind() now joins to multicast group
-  if "maddr" parameter is specified
+- **template**: Added foobar() function (sofia-sip/foobar.h).
 - This release is ABI/API compatible with applications linked against 
   any 1.12.x release. However, applications built against this release won't 
   work against an older library. The ABI has been tested with the nua module 
@@ -43,74 +38,32 @@
 Contributors to this release
 ----------------------------
 
-- Bernhard Suttner contributed patch to soa for using a=inactive attribute
-  with call hold
-- Stefan Leuenberger from Netmodule contributed the hack for changing
-  priority of SRV records if a SIP server was inresponsive
-- Daniele Rondina contributed patches fixing crash in STUN discovery cleanup
-  and for transport handling with nta_outgoing_*create()
-- Youness Alaoui sent a iPhone build fix
-- Michael Jerris and Stefan Knoblich from Freeswitch project reported
-  numerous bugs and contributed fixes
-  
+<list of people who contributed to _this_ release
+ - update as people's patches are added, or when you commit stuff
+ - current development team members (see AUTHORS) may be omitted,
+   or listed at the end of the contribur list (depending on the scope 
+   of the work done since the last release)
+ - name of the contributor should be enough (email addresses in AUTHORS),
+   plus a _brief_ description of what was contributed
+ - roughly sorted by number of patches accepted
+/> 
+
+- **template**: First Surname (patch to nua/soa/msg)
+
 See the AUTHORS file in the distribution package.
 
 Notes on new features
 ---------------------
 
-SIP Server Graylisting
-----------------------
-
-The hack contributed by Stefan Leuenberger from Netmodule changes the
-priority of SRV records which are used when SIP URI is resolved.
-
-If your domain has multiple servers, you can define separate SRV records for
-them. If any of them becomes unresponsive, a SIP request sent to it times
-out or gets rejected because of network error and Sofia SIP automatically
-retries with another server. However, as Sofia SIP does not keep track of
-failed servers with the next request it may again try first the failed
-server. The graylisting repriotizes the SRV records so that the priority of
-the failed server gets reduced and it won't be tried again until all other
-servers have failed, too. Note that the SIP URI resolver may get confused
-when using this kind of repriotizing if a single SRV record corresponds to
-multiple servers or servers with multiple addresses.
-
-You can disable the reprioritizing hack by including tag NTATAG_GREYLIST(0)
-with nua_create(), nua_set_params(), nta_agent_create() or
-nta_agent_set_params().
+<information about major new features
+ - new/changed/removed functionality
+ - links to further documentation
+ - section may be omitted for minor releases
+/> 
 
 Bugs fixed in this release
 --------------------------
 
-* Fixed su_home_init not initializing suh_lock.
-* Fixed memory leak when increasing hash table size
-* Fixed problems with multiple authentication challenges. 
-* Fixed sf.net bug #1816647: Outbound contact does not make it to dialogs.
-* Fixed problem with tagargs, amd64 and Sun CC.
-* Fixed nta_outgoing_*create() not using NTATAG_TPORT() if
-  NTATAG_DEFAULT_PROXY() was set. 
-* Fixed memory leak from nua operations.
-* Fixed crash when INVITE destroyed session before UPDATE or PRACK completed
-* Fixed crash in stun when destroying stun context during discovery callback
-* Fixed nta timer interval calculation ignoring some transactions
-* Fixed request merging when client is RFC 2543 proxy
-* Fixed request matching and merging if To/From URI does not match
-* Fixed problem with soa and overlapping INVITEs
-* Fixed handling of RFC 2848 subscriptions (without Event header)
-* Fixed problems with expiration time calculations if NOTIFY is sent before
-  SUBSCRIBE has been responded
-* Fixed su_getaddrinfo() with ephemeral (NULL or "0") service
-* Fixed IPv6 build with Vista SDK
-* Fixed sf.net bug #1867753 (avoid duplicating initial route set
-* Fixed SCTP receive
-* Using tport_log and su_llog() when logging TLS warnings and errors
-* Removed asserts on hairy dialog shutdown cases.
-* Using remote activity mode derived from O/A result rather than mode based on remote
-  offer
-* Fixed mode in SDP offer while on hold
-* Fixed handling of REFER in nua when it gets redirected or challenged
-* Fixed memory corruption when sending of ACK request failed.
-
 < notable bugs fixed in this release
  - check the sf.net bug tracker; see closed bugs,
    sorted by closing date

Modified: freeswitch/trunk/libs/sofia-sip/configure.ac
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/configure.ac	(original)
+++ freeswitch/trunk/libs/sofia-sip/configure.ac	Sat Jan 26 14:57:55 2008
@@ -11,7 +11,7 @@
 dnl ---------------------------
 
 dnl update both the version for AC_INIT and the LIBSOFIA_SIP_UA_MAJOR_MINOR
-AC_INIT([sofia-sip], [1.12.7devel])
+AC_INIT([sofia-sip], [1.12.8devel])
 AC_CONFIG_SRCDIR([libsofia-sip-ua/sip/sofia-sip/sip.h])
 AC_SUBST(VER_LIBSOFIA_SIP_UA_MAJOR_MINOR, [1.12])
 dnl Includedir specific to this sofia version

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c	Sat Jan 26 14:57:55 2008
@@ -8846,12 +8846,14 @@
   uint16_t sq_type;		/* query type */
   uint16_t sq_priority;		/* priority or preference  */
   uint16_t sq_weight;		/* preference or weight */
+  uint16_t sq_grayish;		/* candidate for graylisting */
 };
 
 static int outgoing_resolve_next(nta_outgoing_t *orq);
 static int outgoing_resolving(nta_outgoing_t *orq);
 static int outgoing_resolving_error(nta_outgoing_t *, 
 				    int status, char const *phrase);
+static void outgoing_graylist(nta_outgoing_t *orq, struct sipdns_query *sq);
 static int outgoing_query_naptr(nta_outgoing_t *orq, char const *domain);
 static void outgoing_answer_naptr(sres_context_t *orq, sres_query_t *q,
 				  sres_record_t *answers[]);
@@ -9092,50 +9094,61 @@
 
     /* find latest A/AAAA record */
     sq = sr->sr_head;
-    if (!sq || (sr->sr_a_aaaa1 != sr->sr_a_aaaa2 && sq->sq_type == sr->sr_a_aaaa1))
-	sq = sr->sr_done;	
-    
-    if (sq && sq->sq_otype == sres_type_srv) {
-      char const *target = sq->sq_domain, *proto = sq->sq_proto;
-      unsigned prio = sq->sq_priority, maxprio = prio;
-
-      SU_DEBUG_5(("nta: no response from %s:%s;transport=%s\n", target, sq->sq_port, proto));
-
-      for (sq = sr->sr_head; sq; sq = sq->sq_next) 
-	if (sq->sq_otype == sres_type_srv && sq->sq_priority > maxprio)
-	  maxprio = sq->sq_priority;
-
-      for (sq = sr->sr_done; sq; sq = sq->sq_next)
-	if (sq->sq_otype == sres_type_srv && sq->sq_priority > maxprio)
-	  maxprio = sq->sq_priority;
-
-      for (sq = sr->sr_done; sq; sq = sq->sq_next) {
-	int modified;
-
-	if (sq->sq_type != sres_type_srv || strcmp(proto, sq->sq_proto))
-	  continue;
-
-	/* modify the SRV record(s) corresponding to the latest A/AAAA record */
-	modified = sres_set_cached_srv_priority(
-	  orq->orq_agent->sa_resolver, 
-	  sq->sq_domain, 
-	  target,
-	  sq->sq_port[0] ? (uint16_t)strtoul(sq->sq_port, NULL, 10) : 0,
-	  orq->orq_agent->sa_graylist,
-	  maxprio + 1);
-
-	if (modified >= 0)
-	  SU_DEBUG_3(("nta: reduced priority of %d %s SRV records (increase value to %u)\n",
-		      modified, sq->sq_domain, maxprio + 1));
-	else
-	  SU_DEBUG_3(("nta: failed to reduce %s SRV priority\n", sq->sq_domain));
-      }
+    if (sq && sq->sq_type == sr->sr_a_aaaa2 && sr->sr_a_aaaa1 != sr->sr_a_aaaa2) {
+      sq->sq_grayish = 1;
+    }
+    else {
+      outgoing_graylist(orq, sr->sr_done);
     }
   }
 
   return outgoing_resolve_next(orq);
 }
 
+/** Graylist SRV records */
+static void outgoing_graylist(nta_outgoing_t *orq, struct sipdns_query *sq)
+{
+  struct sipdns_resolver *sr = orq->orq_resolver;
+  char const *target = sq->sq_domain, *proto = sq->sq_proto;
+  unsigned prio = sq->sq_priority, maxprio = prio;
+
+  /* Don't know how to graylist but SRV records */
+  if (sq->sq_otype != sres_type_srv)
+    return;			
+
+  SU_DEBUG_5(("nta: graylisting %s:%s;transport=%s\n", target, sq->sq_port, proto));
+
+  for (sq = sr->sr_head; sq; sq = sq->sq_next) 
+    if (sq->sq_otype == sres_type_srv && sq->sq_priority > maxprio)
+      maxprio = sq->sq_priority;
+
+  for (sq = sr->sr_done; sq; sq = sq->sq_next)
+    if (sq->sq_otype == sres_type_srv && sq->sq_priority > maxprio)
+      maxprio = sq->sq_priority;
+  
+  for (sq = sr->sr_done; sq; sq = sq->sq_next) {
+    int modified;
+
+    if (sq->sq_type != sres_type_srv || strcmp(proto, sq->sq_proto))
+      continue;
+
+    /* modify the SRV record(s) corresponding to the latest A/AAAA record */
+    modified = sres_set_cached_srv_priority(
+      orq->orq_agent->sa_resolver, 
+      sq->sq_domain, 
+      target,
+      sq->sq_port[0] ? (uint16_t)strtoul(sq->sq_port, NULL, 10) : 0,
+      orq->orq_agent->sa_graylist,
+      maxprio + 1);
+
+    if (modified >= 0)
+      SU_DEBUG_3(("nta: reduced priority of %d %s SRV records (increase value to %u)\n",
+		  modified, sq->sq_domain, maxprio + 1));
+    else
+      SU_DEBUG_3(("nta: failed to reduce %s SRV priority\n", sq->sq_domain));
+  }
+}
+
 /** Cancel resolver query */
 su_inline void outgoing_cancel_resolver(nta_outgoing_t *orq)
 {
@@ -9765,6 +9778,9 @@
   }
   else {
     sq->sq_next = sr->sr_done, sr->sr_done = sq;
+
+    if (rlen == 0 && sq->sq_grayish)
+      outgoing_graylist(orq, sq);
   }
 
   if (rlen > 1) 

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c	Sat Jan 26 14:57:55 2008
@@ -2256,11 +2256,15 @@
   END();
 }
 
+#ifndef MSG_TRUNC
+#define MSG_TRUNC 0
+#endif
+
 static ssize_t recv_udp(agent_t *ag, void *b, size_t size)
 {
   ssize_t n;
 
-  memset(b, size, 0);
+  memset(b, 0, size);
   
   for (;;) {
     su_root_step(ag->ag_root, 10L);
@@ -2305,10 +2309,6 @@
   su_sockaddr_t *su = ag->ag_su_nta;
   socklen_t sulen = ag->ag_su_nta_len;
 
-#ifndef MSG_TRUNC
-#define MSG_TRUNC 0
-#endif
-
   /* Empty sink socket */
   su_setblocking(ag->ag_sink_socket, 0);
   while (su_recv(ag->ag_sink_socket, m1, sizeof m1, MSG_TRUNC) >= 0)



More information about the Freeswitch-svn mailing list