Re: [GnomeMeeting-devel-list] Registration via IP address failed



On Thu, Feb 23, 2006 at 11:49:20AM +0100, CJ van den Berg wrote:
> It appears to be a problem with the version of pwlib that the snapshots are
> compiled against.

I've double checked the version pwlib used in the snapshots and it appears
to be a checkout from HEAD from cvs1.sourceforge.net:/cvsroot/openh323,
which should be ok. What is weird is that src/ptlib/unix/socket.h claims to
be version 1.117, but version 1.117 on sourceforge is different (it contains
the GetInterfaceTable patch), which seems pretty strange to me.  I've
attached a diff between the snapshot version 1.117 and the sourceforge
version 1.117.

Could this be a cvs update glitch or something? Killian?

-- 
CJ van den Berg

mailto:cj vdbonline com
  xmpp:cj vdbonline com
   sip:8918316 sipgate de
--- socket_snapshot.cxx	2006-02-23 12:18:05.000000000 +0100
+++ socket_sourceforge.cxx	2006-02-23 12:14:32.000000000 +0100
@@ -27,8 +27,8 @@
  * Contributor(s): ______________________________________.
  *
  * $Log: socket.cxx,v $
- * Revision 1.117  2006/02/21 11:16:23  csoutheren
- * Patch to allow duplicate interface table entries
+ * Revision 1.117  2006/02/21 13:57:31  csoutheren
+ * Second attempt at fixing problem with interfaces having multiple addresses
  *
  * Revision 1.116  2006/02/18 15:57:45  dsandras
  * Applied patch from Richard van der Hoff and Stephane Epardaud <stef lunatech
@@ -1833,7 +1833,9 @@
   PBYTEArray buffer;
   struct ifconf ifConf;
   
-#ifdef SIOCGIFNUM
+
+  // HERE
+#if defined(SIOCGIFNUM)
   int ifNum;
   PAssert(::ioctl(sock.GetHandle(), SIOCGIFNUM, &ifNum) >= 0, "could not do ioctl for ifNum");
   ifConf.ifc_len = ifNum * sizeof(ifreq);
@@ -1849,7 +1851,7 @@
     while (ifName < ifEndList) {
 
       struct ifreq ifReq;
-      strcpy(ifReq.ifr_name, ifName->ifr_name);
+      memcpy(&ifReq, ifName, sizeof(ifreq));
 
       if (ioctl(sock.GetHandle(), SIOCGIFFLAGS, &ifReq) >= 0) {
         int flags = ifReq.ifr_flags;
@@ -1858,15 +1860,20 @@
 
           PString macAddr;
 #if defined(SIO_Get_MAC_Address)
+          memcpy(&ifReq, ifName, sizeof(ifreq));
           if (ioctl(sock.GetHandle(), SIO_Get_MAC_Address, &ifReq) >= 0) {
             PEthSocket::Address a((BYTE *)ifReq.ifr_macaddr);
             macAddr = (PString)a;
           }
 #endif
 
+          memcpy(&ifReq, ifName, sizeof(ifreq));
           if (ioctl(sock.GetHandle(), SIOCGIFADDR, &ifReq) >= 0) {
-            PIPSocket::Address addr = ((sockaddr_in *)&ifReq.ifr_addr)->sin_addr;
 
+            sockaddr_in * sin = (sockaddr_in *)&ifReq.ifr_addr;
+            PIPSocket::Address addr = sin->sin_addr;
+
+            memcpy(&ifReq, ifName, sizeof(ifreq));
             if (ioctl(sock.GetHandle(), SIOCGIFNETMASK, &ifReq) >= 0) {
               PIPSocket::Address mask = 
 #ifndef __BEOS__
@@ -1874,16 +1881,27 @@
 #else
     ((sockaddr_in *)&ifReq.ifr_mask)->sin_addr;
 #endif // !__BEOS__
-
+              PINDEX i;
+              for (i = 0; i < list.GetSize(); i++) {
+#ifdef P_TORNADO
+                if (list[i].GetName() == name &&
+                    list[i].GetAddress() == addr)
+                    if(list[i].GetNetMask() == mask)
+#else
+                if (list[i].GetName() == name &&
+                    list[i].GetAddress() == addr &&
+                    list[i].GetNetMask() == mask)
+#endif
+                  break;
+              }
 #if P_HAS_IPV6
               PString ip6Addr;
-              IP6ListType::iterator r = ip6Ifaces.find(name);
-              if (r != ip6Ifaces.end()) {
+              IP6ListType::const_iterator r = ip6Ifaces.find(name);
+              if (r != ip6Ifaces.end())
                 ip6Addr = r->second;
-                ip6Ifaces.erase(r);
-              }
 #endif
-              list.Append(PNEW InterfaceEntry(name, addr, mask, macAddr
+              if (i >= list.GetSize())
+                list.Append(PNEW InterfaceEntry(name, addr, mask, macAddr
 #if P_HAS_IPV6
                 , ip6Addr
 #endif


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