Re: [Ekiga-devel-list] Basic IPv6 support for H.323 calls



On Thursday 04 March 2010 12:04:02 Eugen Dedu wrote:
> > What about adding this kind of functionality to Ekiga (maybe also
> > for direct SIP calls)?
> 
> It would be wonderful.  Could you help please?  Note also
> https://bugzilla.gnome.org/show_bug.cgi?id=331041

Now I've managed to get SIP working over IPv6 tunnel.

Proposed patch for ptlib makes Ekiga listen on IPv6 for SIP. There are
still several things wrong or possibly wrong with it:

* Only IPv6 addresses global scope are considered (is it ok?)
* I'm ignoring mask and MAC address for interfaces with IPv6 (does not
  matter at the moment, but still...)
* Interface with both IPv4 and IPv6 address will appear as two different
  records in interfaces list. It much easier than using ip6Addr field in
  InterfaceEntry.
* When network interface with IPv6 address is present, IPv4 becomes broken.
  Probably some issue in Opal, I'll try to fix it soon.
* It's Unix-specific, maybe even Linux-specific.

A little patch for opal is an obvious fix in address parsing.

--- ptlib-2.6.5-orig/src/ptlib/unix/socket.cxx
+++ ptlib-2.6.5/src/ptlib/unix/socket.cxx
@@ -1556,11 +1556,9 @@ PBoolean PIPSocket::GetInterfaceTable(In
 {
 #if P_HAS_IPV6
   // build a table of IPV6 interface addresses
-  typedef std::map<PString, PString> IP6ListType;
-  IP6ListType ip6Ifaces;
   {
     FILE * file;
-    int dummy;
+    int dummy, scope;
     int addr[16];
     char ifaceName[255];
     if ((file = fopen("/proc/net/if_inet6", "r")) != NULL) {
@@ -1569,17 +1567,21 @@ PBoolean PIPSocket::GetInterfaceTable(In
               &addr[4],  &addr[5],  &addr[6],  &addr[7], 
               &addr[8],  &addr[9],  &addr[10], &addr[11], 
               &addr[12], &addr[13], &addr[14], &addr[15], 
-             &dummy, &dummy, &dummy, &dummy, ifaceName) != EOF) {
+             &dummy, &dummy, &scope, &dummy, ifaceName) != EOF) {
+        PString name(ifaceName);
         PString addrStr(
-          psprintf("%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
+          psprintf("%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
               addr[0],  addr[1],  addr[2],  addr[3], 
               addr[4],  addr[5],  addr[6],  addr[7], 
               addr[8],  addr[9],  addr[10], addr[11], 
               addr[12], addr[13], addr[14], addr[15]
           )
         );
-        PString iface(ifaceName);
-        ip6Ifaces.insert(IP6ListType::value_type(ifaceName, addrStr));
+	if (scope == 0) { // Consider only addresses with global scope
+          PString iface(ifaceName);
+          list.Append(PNEW InterfaceEntry(name, PIPSocket::Address(addrStr),
+              PIPSocket::Address::GetAny(6), "", ""));
+        }
       }
       fclose(file);
     }
@@ -1675,16 +1677,10 @@ PBoolean PIPSocket::GetInterfaceTable(In
 #endif
                   break;
               }
-#if P_HAS_IPV6
-              PString ip6Addr;
-              IP6ListType::const_iterator r = ip6Ifaces.find(name);
-              if (r != ip6Ifaces.end())
-                ip6Addr = r->second;
-#endif
               if (i >= list.GetSize())
                 list.Append(PNEW InterfaceEntry(name, addr, mask, macAddr
 #if P_HAS_IPV6
-                , ip6Addr
+                , ""
 #endif
                 ));
             }


--- opal-3.6.6-orig/src/sip/sippdu.cxx
+++ opal-3.6.6/src/sip/sippdu.cxx
@@ -2025,7 +2025,13 @@ bool SIP_PDU::SendResponse(OpalTransport
       viaAddress = viaAddress.Mid(j+1);
     if ((j = viaAddress.Find (';')) != P_MAX_INDEX)
       viaAddress = viaAddress.Left(j);
-    if ((j = viaAddress.Find (':')) != P_MAX_INDEX) {
+
+    PINDEX bracket = viaAddress.FindLast(']');
+    if (bracket == P_MAX_INDEX)
+      bracket = 0;
+
+    j = viaAddress.FindLast (':');
+    if ((j != P_MAX_INDEX) && (j > bracket)) {
       viaPort = viaAddress.Mid(j+1);
       viaAddress = viaAddress.Left(j);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]