fixing 2012: network structure alignment now forced to be correct even on W32 using...
[oweals/gnunet.git] / src / nat / nat.c
index 2040451d5c0306c0cd8dd67e43d892df95b85586..9f8fec9a022fc004eb018fe7f2ec6d5d4c649038 100644 (file)
@@ -629,12 +629,16 @@ process_hostname_ip (void *cls, const struct sockaddr *addr, socklen_t addrlen)
  * @param name name of the interface
  * @param isDefault do we think this may be our default interface
  * @param addr address of the interface
+ * @param broadcast_addr the broadcast address (can be NULL for unknown or unassigned)
+ * @param netmask the network mask (can be NULL for unknown or unassigned))
  * @param addrlen number of bytes in addr
  * @return GNUNET_OK to continue iterating
  */
 static int
 process_interfaces (void *cls, const char *name, int isDefault,
-                    const struct sockaddr *addr, socklen_t addrlen)
+                    const struct sockaddr *addr,
+                    const struct sockaddr *broadcast_addr,
+                    const struct sockaddr *netmask, socklen_t addrlen)
 {
   struct GNUNET_NAT_Handle *h = cls;
   const struct sockaddr_in *s4;
@@ -649,8 +653,9 @@ process_interfaces (void *cls, const char *name, int isDefault,
     ip = &s4->sin_addr;
 
     /* Check if address is in 127.0.0.0/8 */
-    uint32_t address = ntohl((in_addr_t)(s4->sin_addr.s_addr));
+    uint32_t address = ntohl ((uint32_t) (s4->sin_addr.s_addr));
     uint32_t value = (address & 0xFF000000) ^ 0x7F000000;
+
     if ((h->return_localaddress == GNUNET_NO) && (value == 0))
     {
       return GNUNET_OK;
@@ -1139,7 +1144,8 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, int is_tcp,
   h->use_localaddresses =
       GNUNET_CONFIGURATION_get_value_yesno (cfg, "nat", "USE_LOCALADDR");
   h->return_localaddress =
-      GNUNET_CONFIGURATION_get_value_yesno (cfg, "nat", "RETURN_LOCAL_ADDRESSES");
+      GNUNET_CONFIGURATION_get_value_yesno (cfg, "nat",
+                                            "RETURN_LOCAL_ADDRESSES");
 
   h->use_hostname =
       GNUNET_CONFIGURATION_get_value_yesno (cfg, "nat", "USE_HOSTNAME");