Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Feb 2007 07:54:30 -0800
From:      Luigi Rizzo <rizzo@icir.org>
To:        Soeren Straarup <xride@x12.dk>, frank@dynamical-systems.org, ports@freebsd.org
Subject:   libosip2 regression (was Re: any maintainer for linphone ?)
Message-ID:  <20070216075430.B7015@xorpc.icir.org>
In-Reply-To: <20070216041534.GD78895@x12.dk>; from xride@x12.dk on Fri, Feb 16, 2007 at 05:15:34AM %2B0100
References:  <20070215193529.A98565@xorpc.icir.org> <20070216041534.GD78895@x12.dk>

next in thread | previous in thread | raw e-mail | index | archive | help

--zhXaljGHf11kAtnf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

As i mentioned earlier, the upgrade of libosip2 from 2.2.2 to 2.2.3
broke the linphone port(s). There is a proposal for a fix, but
it very very intrusive.

So i was wondering if there was a good reason to upgrade libosip
to version 2.2.3, and there doesn't seem to be one (see details below).

As a result I would like to downgrade libosip2 to version 2.2.2
(possibly with a minuscule patch) in order to unbreak the port that
was broken by the upgrade. It takes much less work this way.
Comments/objections, especially from the maintainers of the relevant
ports ?

		--- FULL DETAILS ---

I did a bit of checking of which ports use libosip with

	cd /usr/ports
	make search bdeps=libosip

and the result is the following:
+ one port (net/libexosip2) uses libosip-3.0.1 so it is not under discussion;
+ two ports (net/linphone-base, net/linphone) use libosip2 and are broken
  by the upgrade;
+ one port (net/siproxd) builds fine with both libosip2.2.2 and libosip2.2.3

The PR that requested the upgrade
	http://www.freebsd.org/cgi/query-pr.cgi?pr=99242
does not have any comment on why the change was useful.

The 'ChangeLog' in libosip2.2.3 reports this:

    libosip2 (2.2.3)
        * fix 64-bit (amd64) issue with hash.
        * remove SDP negotiation (much better to do it in your applications)
  
and the diff (attached) which relate to the first part are minuscule:
a change of size in a hash table, and the change of a field in
an internal structure from time_t to a struct timeval in a 

My suggestion is to downgrade libosip2 to version 2.2.2 and
apply the patch attached.

Objections ?

	cheers
	luigi
-----------------------------------+-------------------------------------
  Luigi RIZZO, rizzo@iet.unipi.it  . Dip. di Ing. dell'Informazione
  http://www.iet.unipi.it/~luigi/  . Universita` di Pisa
  TEL/FAX: +39-050-2217.533/600    . via Diotisalvi 2, 56122 PISA (Italy)
  Mobile   +39-347-0373137
-----------------------------------+-------------------------------------

--zhXaljGHf11kAtnf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="libosip.diff"

diff -ubwr ../../work.2.2.2/libosip2-2.2.2/include/osip2/osip.h ./include/osip2/osip.h
--- ../../work.2.2.2/libosip2-2.2.2/include/osip2/osip.h	Thu Nov 24 14:27:03 2005
+++ ./include/osip2/osip.h	Wed Jan 11 15:13:18 2006
@@ -460,7 +460,7 @@
     struct osip_dialog *dialog; /**< related dialog */
     osip_message_t *msg2xx;     /**< buffer to retransmit */
     osip_message_t *ack;        /**< ack message if needed */
-    time_t start;               /**< Time of first retransmission */
+    struct timeval start;       /**< Time of first retransmission */
     int interval;               /**< delay between retransmission, in ms */
     char *dest;                 /**< destination host */
     int port;                   /**< destination port */
diff -ubwr ../../work.2.2.2/libosip2-2.2.2/src/osip2/osip.c ./src/osip2/osip.c
--- ../../work.2.2.2/libosip2-2.2.2/src/osip2/osip.c	Thu Nov 24 14:27:03 2005
+++ ./src/osip2/osip.c	Wed Jan 11 15:21:15 2006
@@ -157,7 +157,7 @@
 void
 osip_add_ixt (osip_t * osip, ixt_t * ixt)
 {
-  /* ajout dans la liste de osip_t->ixt */
+  /* add in list osip_t->ixt */
   osip_ixt_lock (osip);
   osip_list_add (osip->ixt_retransmissions, (void *) ixt, 0);
   osip_ixt_unlock (osip);
@@ -196,9 +196,10 @@
   pixt->dialog = NULL;
   pixt->msg2xx = NULL;
   pixt->ack = NULL;
-  pixt->start = time (NULL);
-  pixt->interval = 500;
-  pixt->counter = 7;
+  pixt->interval = DEFAULT_T1;
+  osip_gettimeofday(&pixt->start, NULL);
+  add_gettimeofday(&pixt->start, pixt->interval+10);
+  pixt->counter = 10;
   pixt->dest = NULL;
   pixt->port = 5060;
   pixt->sock = -1;
@@ -295,12 +296,14 @@
 }
 
 void
-ixt_retransmit (osip_t * osip, ixt_t * ixt, time_t current)
+ixt_retransmit (osip_t * osip, ixt_t * ixt, struct timeval *current)
 {
-  if ((current - ixt->start) * 1000 > ixt->interval)
+  if (osip_timercmp(current, &ixt->start, >))
     {
       ixt->interval = ixt->interval * 2;
-      ixt->start = current;
+      if (ixt->interval > 4000)
+         ixt->interval = 4000;
+      add_gettimeofday (&ixt->start, ixt->interval);
       if (ixt->ack != NULL)
         osip->cb_send_message (NULL, ixt->ack, ixt->dest, ixt->port, ixt->sock);
       else if (ixt->msg2xx != NULL)
@@ -313,15 +316,16 @@
 osip_retransmissions_execute (osip_t * osip)
 {
   int i;
-  time_t current;
   ixt_t *ixt;
+  struct timeval current;
+
+  osip_gettimeofday (&current, NULL);
 
-  current = time (NULL);
   osip_ixt_lock (osip);
   for (i = 0; !osip_list_eol (osip->ixt_retransmissions, i); i++)
     {
       ixt = (ixt_t *) osip_list_get (osip->ixt_retransmissions, i);
-      ixt_retransmit (osip, ixt, current);
+      ixt_retransmit (osip, ixt, &current);
       if (ixt->counter == 0)
         {
           /* remove it */
@@ -1808,12 +1812,16 @@
     ixt = (ixt_t *) osip_list_get_first (osip->ixt_retransmissions, &iterator);
     while (osip_list_iterator_has_elem (iterator))
       {
-        struct timeval cmpTime;
-        div_t dValue = div (ixt->interval, 1000);
-
-        cmpTime.tv_sec = (long) (ixt->start + dValue.quot);
-        cmpTime.tv_usec = dValue.rem * 1000;
-        min_timercmp (lower_tv, &cmpTime);
+        min_timercmp (lower_tv, &ixt->start);
+	if (osip_timercmp (&now, lower_tv, >))
+	  {
+	    lower_tv->tv_sec = 0;
+	    lower_tv->tv_usec = 0;
+#ifdef OSIP_MT
+	    osip_mutex_unlock (nist_fastmutex);
+#endif
+	    return;
+	  }
 
         ixt = (ixt_t *) osip_list_get_next (&iterator);
       }
diff -ubwr ../../work.2.2.2/libosip2-2.2.2/src/osip2/osip_transaction.c ./src/osip2/osip_transaction.c
--- ../../work.2.2.2/libosip2-2.2.2/src/osip2/osip_transaction.c	Thu Nov 24 14:27:03 2005
+++ ./src/osip2/osip_transaction.c	Wed Feb  1 18:31:03 2006
@@ -600,6 +600,9 @@
   if (b_origrequest != NULL && b_request != NULL)
     /* case where both request contains a branch */
     {
+      if ( ! b_origrequest->gvalue ) return -1;
+      if ( ! b_request->gvalue )     return -1;
+
       length_br = strlen (b_origrequest->gvalue);
       length_br2 = strlen (b_request->gvalue);
       if (length_br != length_br2)
diff -ubwr ../../work.2.2.2/libosip2-2.2.2/src/osipparser2/osip_parser_cfg.c ./src/osipparser2/osip_parser_cfg.c
--- ../../work.2.2.2/libosip2-2.2.2/src/osipparser2/osip_parser_cfg.c	Thu Nov 24 14:27:03 2005
+++ ./src/osipparser2/osip_parser_cfg.c	Fri Jan  6 18:46:27 2006
@@ -32,8 +32,15 @@
  * Anyway, this mechanism improves the search time (from binary seach (log(n)) to 1).
  */
 
-#define HASH_TABLE_SIZE 150     /* set this to the hash table size, 150 is the first size
-                                   where no conflicts occur                               */
+#ifndef HASH_TABLE_SIZE
+#ifdef __amd64__
+#define HASH_TABLE_SIZE 450
+#else
+#define HASH_TABLE_SIZE 150     /* set this to the hash table size, 150 is the
+				   first size where no conflicts occur */
+#endif
+#endif
+
 static int hdr_ref_table[HASH_TABLE_SIZE];      /* the hashtable contains indices to the pconfig table    */
 
 /*
@@ -146,6 +153,10 @@
       } else
         {
           /* oops, conflict!-> change the hash table or use another hash function size */
+	  
+	  OSIP_TRACE (osip_trace
+		      (__FILE__, __LINE__, OSIP_ERROR, NULL,
+		       "conflict with current hashtable size\n"));
           return -1;
         }
     }

--zhXaljGHf11kAtnf--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070216075430.B7015>