diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-05 08:42:12 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-05 08:42:12 +0000 |
commit | 19f38ae3d42baeb248892a781959803bc3441b74 (patch) | |
tree | d208de952910d54843e1713e40f2d68940c83e72 /src | |
parent | 2e1efb58832578c2460a5586181b0ba321a341c3 (diff) | |
download | gnunet-19f38ae3d42baeb248892a781959803bc3441b74.tar.gz gnunet-19f38ae3d42baeb248892a781959803bc3441b74.zip |
pack block, use big endian for time
Diffstat (limited to 'src')
-rw-r--r-- | src/block/plugin_block_dns.c | 2 | ||||
-rw-r--r-- | src/include/block_dns.h | 8 | ||||
-rw-r--r-- | 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, | |||
86 | } | 86 | } |
87 | 87 | ||
88 | if (GNUNET_TIME_relative_get_zero ().rel_value == | 88 | if (GNUNET_TIME_relative_get_zero ().rel_value == |
89 | GNUNET_TIME_absolute_get_remaining (rec->expiration_time).rel_value) | 89 | GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh (rec->expiration_time)).rel_value) |
90 | { | 90 | { |
91 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "DNS-Block is invalid: Timeout\n"); | 91 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "DNS-Block is invalid: Timeout\n"); |
92 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | 92 | 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 | |||
39 | * The descriptor for the service | 39 | * The descriptor for the service |
40 | * (a peer may provide more than one service) | 40 | * (a peer may provide more than one service) |
41 | */ | 41 | */ |
42 | GNUNET_HashCode service_descriptor; | 42 | GNUNET_HashCode service_descriptor GNUNET_PACKED; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * When does this record expire? | 45 | * When does this record expire? |
46 | */ | 46 | */ |
47 | struct GNUNET_TIME_Absolute expiration_time; | 47 | struct GNUNET_TIME_AbsoluteNBO expiration_time; |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Four TCP and UDP-Ports that are used by this service, big endian format | 50 | * Four TCP and UDP-Ports that are used by this service, big endian format |
51 | */ | 51 | */ |
52 | uint64_t ports; | 52 | uint64_t ports GNUNET_PACKED; |
53 | 53 | ||
54 | /** | 54 | /** |
55 | * What connection-types (UDP, TCP, ...) are supported by the service. | 55 | * What connection-types (UDP, TCP, ...) are supported by the service. |
56 | * Contains an 'enum GNUNET_DNS_ServiceTypes' in big endian format. | 56 | * Contains an 'enum GNUNET_DNS_ServiceTypes' in big endian format. |
57 | */ | 57 | */ |
58 | uint32_t service_type; | 58 | uint32_t service_type GNUNET_PACKED; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | #endif | 61 | #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, | |||
1238 | GNUNET_CRYPTO_rsa_key_get_public (my_private_key, &data.peer); | 1238 | GNUNET_CRYPTO_rsa_key_get_public (my_private_key, &data.peer); |
1239 | 1239 | ||
1240 | data.expiration_time = | 1240 | data.expiration_time = |
1241 | GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply | 1241 | GNUNET_TIME_absolute_hton (GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply |
1242 | (GNUNET_TIME_UNIT_HOURS, 2)); | 1242 | (GNUNET_TIME_UNIT_HOURS, 2))); |
1243 | 1243 | ||
1244 | /* Sign the block */ | 1244 | /* Sign the block */ |
1245 | if (GNUNET_OK != | 1245 | if (GNUNET_OK != |