pack block, use big endian for time
authorChristian Grothoff <christian@grothoff.org>
Wed, 5 Oct 2011 08:42:12 +0000 (08:42 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 5 Oct 2011 08:42:12 +0000 (08:42 +0000)
src/block/plugin_block_dns.c
src/include/block_dns.h
src/vpn/gnunet-service-dns.c

index 22fae2c172b93a44b99f0793f40feb075d6884b7..8e8aa3047bc913f8ac8637215d479701af65759b 100644 (file)
@@ -86,7 +86,7 @@ block_plugin_dns_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
     }
 
     if (GNUNET_TIME_relative_get_zero ().rel_value ==
-        GNUNET_TIME_absolute_get_remaining (rec->expiration_time).rel_value)
+        GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh (rec->expiration_time)).rel_value)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "DNS-Block is invalid: Timeout\n");
       return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
index 6be82b126b83d1116dfb2bf7e5483824e4837dec..1c01754de8e0bc524841b1584d2c88a0f249d8ec 100644 (file)
@@ -39,23 +39,23 @@ struct GNUNET_DNS_Record
    * The descriptor for the service
    * (a peer may provide more than one service)
    */
-  GNUNET_HashCode service_descriptor;
+  GNUNET_HashCode service_descriptor GNUNET_PACKED;
 
   /**
    * When does this record expire?
    */
-  struct GNUNET_TIME_Absolute expiration_time;
+  struct GNUNET_TIME_AbsoluteNBO expiration_time;
 
   /**
    * Four TCP and UDP-Ports that are used by this service, big endian format
    */
-  uint64_t ports;
+  uint64_t ports GNUNET_PACKED;
 
   /**
    * What connection-types (UDP, TCP, ...) are supported by the service.
    * Contains an 'enum GNUNET_DNS_ServiceTypes' in big endian format.
    */
-  uint32_t service_type;
+  uint32_t service_type GNUNET_PACKED;
 };
 
 #endif
index fc65cf60892b9904cdc58801c916303300f2d951..cb018746c790a2ed0d0b0218deb09beb9d362021 100644 (file)
@@ -1238,8 +1238,8 @@ publish_name (const char *name, uint64_t ports, uint32_t service_type,
   GNUNET_CRYPTO_rsa_key_get_public (my_private_key, &data.peer);
 
   data.expiration_time =
-      GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply
-                                        (GNUNET_TIME_UNIT_HOURS, 2));
+    GNUNET_TIME_absolute_hton (GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply
+                                                                (GNUNET_TIME_UNIT_HOURS, 2)));
 
   /* Sign the block */
   if (GNUNET_OK !=