From 19f38ae3d42baeb248892a781959803bc3441b74 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 5 Oct 2011 08:42:12 +0000 Subject: [PATCH] pack block, use big endian for time --- src/block/plugin_block_dns.c | 2 +- src/include/block_dns.h | 8 ++++---- src/vpn/gnunet-service-dns.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/block/plugin_block_dns.c b/src/block/plugin_block_dns.c index 22fae2c17..8e8aa3047 100644 --- a/src/block/plugin_block_dns.c +++ b/src/block/plugin_block_dns.c @@ -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; diff --git a/src/include/block_dns.h b/src/include/block_dns.h index 6be82b126..1c01754de 100644 --- a/src/include/block_dns.h +++ b/src/include/block_dns.h @@ -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 diff --git a/src/vpn/gnunet-service-dns.c b/src/vpn/gnunet-service-dns.c index fc65cf608..cb018746c 100644 --- a/src/vpn/gnunet-service-dns.c +++ b/src/vpn/gnunet-service-dns.c @@ -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 != -- 2.25.1