gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r6411 - GNUnet/src/transports


From: gnunet
Subject: [GNUnet-SVN] r6411 - GNUnet/src/transports
Date: Thu, 21 Feb 2008 23:52:27 -0700 (MST)

Author: grothoff
Date: 2008-02-21 23:52:27 -0700 (Thu, 21 Feb 2008)
New Revision: 6411

Modified:
   GNUnet/src/transports/common.c
   GNUnet/src/transports/ip.c
Log:
show ipv6 addresses

Modified: GNUnet/src/transports/common.c
===================================================================
--- GNUnet/src/transports/common.c      2008-02-22 06:22:44 UTC (rev 6410)
+++ GNUnet/src/transports/common.c      2008-02-22 06:52:27 UTC (rev 6411)
@@ -345,6 +345,7 @@
 create_hello ()
 {
   static GNUNET_IPv4Address last_addrv4;
+  static GNUNET_IPv6Address last_addrv6;
   GNUNET_MessageHello *msg;
   HostAddress *haddr;
   unsigned short port;
@@ -379,11 +380,21 @@
       if (0 != memcmp (&haddr->ipv4,
                        &last_addrv4, sizeof (GNUNET_IPv4Address)))
         {
+         struct in_addr in4;
+         char dst[INET_ADDRSTRLEN];
+         
+         memcpy(&in4,
+                &haddr->ipv4,
+                sizeof(struct in_addr));
           GNUNET_GE_LOG (coreAPI->ectx,
                          GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
-                         "%s uses IPv4 address %u.%u.%u.%u.\n",
+                         "%s uses %s address %s.\n",
                          MY_TRANSPORT_NAME,
-                         GNUNET_PRIP (ntohl (*(int *) &haddr->ipv4)));
+                        "IPv4",
+                        inet_ntop(AF_INET,
+                                  &in4,
+                                  dst,
+                                  INET_ADDRSTRLEN));
           last_addrv4 = haddr->ipv4;
         }
       available |= VERSION_AVAILABLE_IPV4;
@@ -392,6 +403,26 @@
   if (GNUNET_SYSERR !=
       GNUNET_IP_get_public_ipv6_address (cfg, coreAPI->ectx, &haddr->ipv6))
     {
+      if (0 != memcmp (&haddr->ipv6,
+                       &last_addrv6, sizeof (GNUNET_IPv6Address)))
+        {
+         struct in6_addr in6;
+         char dst[INET6_ADDRSTRLEN];
+         
+         memcpy(&in6,
+                &haddr->ipv6,
+                sizeof(struct in6_addr));
+          GNUNET_GE_LOG (coreAPI->ectx,
+                         GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
+                         "%s uses %s address %s.\n",
+                         MY_TRANSPORT_NAME,
+                        "IPv6",
+                        inet_ntop(AF_INET6,
+                                  &in6,
+                                  dst,
+                                  INET6_ADDRSTRLEN));
+          last_addrv6 = haddr->ipv6;
+        }
       available |= VERSION_AVAILABLE_IPV6;
     }
   if (available == VERSION_AVAILABLE_NONE)

Modified: GNUnet/src/transports/ip.c
===================================================================
--- GNUnet/src/transports/ip.c  2008-02-22 06:22:44 UTC (rev 6410)
+++ GNUnet/src/transports/ip.c  2008-02-22 06:52:27 UTC (rev 6411)
@@ -250,7 +250,7 @@
   return GNUNET_OK;
 }
 
-#if HAVE_GETIFADDRS && HAVE_GNUNET_freeIFADDRS
+#if HAVE_GETIFADDRS && HAVE_FREEIFADDRS
 static int
 getAddress6FromGetIfAddrs (struct GNUNET_GC_Configuration *cfg,
                            struct GNUNET_GE_Context *ectx,
@@ -353,7 +353,7 @@
         }
       GNUNET_free (ipString);
     }
-#if HAVE_GETIFADDRS && HAVE_GNUNET_freeIFADDRS
+#if HAVE_GETIFADDRS && HAVE_FREEIFADDRS
   if (retval == GNUNET_SYSERR)
     if (GNUNET_OK == getAddress6FromGetIfAddrs (cfg, ectx, address))
       retval = GNUNET_OK;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]