From 9a8224b2739d203b4c3ecdd10cd4159d38cae28f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?= =?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= Date: Fri, 16 Dec 2011 09:17:06 +0400 Subject: [PATCH] Pack network structures --- src/arm/arm.h | 5 +++-- src/ats-test/test_transport_ats_multiple_peers.c | 3 +++ src/ats/ats.h | 5 +++-- src/chat/chat.h | 3 +++ src/core/core.h | 4 +++- src/core/gnunet-service-core_kx.c | 4 +++- src/datastore/datastore.h | 4 +++- src/dht/dht.h | 4 +++- src/dht/gnunet-service-dht_neighbours.c | 4 +++- src/dv/dv.h | 4 +++- src/dv/test_transport_api_dv.c | 3 +++ src/fragmentation/fragmentation.h | 4 +++- src/fs/fs.h | 4 +++- src/fs/gnunet-service-fs.h | 4 +++- src/hello/hello.c | 4 +++- src/hostlist/gnunet-daemon-hostlist.c | 4 +++- src/include/block_dns.h | 4 +++- src/include/block_fs.h | 4 +++- src/include/gnunet_ats_service.h | 4 +++- src/include/gnunet_bandwidth_lib.h | 4 +++- src/include/gnunet_common.h | 8 ++++++-- src/include/gnunet_crypto_lib.h | 4 +++- src/include/gnunet_time_lib.h | 5 +++-- src/mesh/mesh.h | 4 +++- src/mesh/mesh_protocol.h | 3 +++ src/nat/nat.h | 3 +++ src/nse/gnunet-service-nse.c | 4 +++- src/nse/nse.h | 4 +++- src/peerinfo/peerinfo.h | 4 +++- src/statistics/statistics.h | 4 +++- src/testing/test_testing_large_topology.c | 3 +++ src/testing/test_testing_topology.c | 3 +++ src/testing/test_testing_topology_blacklist.c | 4 +++- src/testing/test_testing_topology_churn.c | 3 +++ src/transport/gnunet-helper-transport-wlan.c | 5 +++-- .../gnunet-service-transport_neighbours.c | 4 +++- .../gnunet-service-transport_validation.c | 4 +++- src/transport/gnunet-transport-wlan-sender.c | 5 +++-- src/transport/plugin_transport_http.h | 4 +++- src/transport/plugin_transport_smtp.c | 3 +++ src/transport/plugin_transport_tcp.c | 8 ++++++-- src/transport/plugin_transport_udp.c | 5 +++-- src/transport/plugin_transport_udp_new.c | 4 +++- src/transport/plugin_transport_unix.c | 3 +++ src/transport/plugin_transport_wlan.c | 7 ++++++- src/transport/plugin_transport_wlan.h | 4 +++- src/transport/test_quota_compliance.c | 3 +++ src/transport/test_transport_api_reliability.c | 3 +++ src/transport/test_transport_api_unreliability.c | 3 +++ .../test_transport_api_unreliability_constant.c | 3 +++ src/transport/transport.h | 4 +++- src/util/crypto_ksk.c | 5 +++-- src/util/crypto_rsa.c | 4 +++- src/util/resolver.h | 3 +++ src/vpn/gnunet-service-dns-p.h | 3 +++ src/vpn/gnunet-service-dns.c | 3 +++ src/vpn/gnunet-vpn-packet.h | 6 ++++++ 57 files changed, 183 insertions(+), 48 deletions(-) diff --git a/src/arm/arm.h b/src/arm/arm.h index 615079b..a698cf2 100644 --- a/src/arm/arm.h +++ b/src/arm/arm.h @@ -33,7 +33,8 @@ */ #define DEBUG_ARM GNUNET_EXTRA_LOGGING - +#pragma pack(push) +#pragma pack(1) /** * Reply from ARM to client. */ @@ -50,6 +51,6 @@ struct GNUNET_ARM_ResultMessage */ uint32_t status; }; - +#pragma pack(pop) #endif diff --git a/src/ats-test/test_transport_ats_multiple_peers.c b/src/ats-test/test_transport_ats_multiple_peers.c index 51b8137..4501fce 100644 --- a/src/ats-test/test_transport_ats_multiple_peers.c +++ b/src/ats-test/test_transport_ats_multiple_peers.c @@ -68,11 +68,14 @@ struct TEST_result uint64_t state; }; +#pragma pack(push) +#pragma pack(1) struct TestMessage { struct GNUNET_MessageHeader header; uint32_t num; }; +#pragma pack(pop) static int count; diff --git a/src/ats/ats.h b/src/ats/ats.h index 5b9fa86..05d8583 100644 --- a/src/ats/ats.h +++ b/src/ats/ats.h @@ -39,7 +39,8 @@ enum StartFlag START_FLAG_PERFORMANCE_NO_PIC = 2 }; - +#pragma pack(push) +#pragma pack(1) struct ClientStartMessage { struct GNUNET_MessageHeader header; @@ -214,7 +215,6 @@ struct ReservationResultMessage struct GNUNET_TIME_RelativeNBO res_delay; }; - struct PreferenceInformation { @@ -236,6 +236,7 @@ struct ChangePreferenceMessage /* followed by 'num_preferences' * struct PreferenceInformation values */ }; +#pragma pack(pop) diff --git a/src/chat/chat.h b/src/chat/chat.h index 9a52a2d..e53818a 100644 --- a/src/chat/chat.h +++ b/src/chat/chat.h @@ -41,6 +41,8 @@ * Client-service messages */ +#pragma pack(push) +#pragma pack(1) /** * Notification sent by service to client indicating that we've received a chat * message. After this struct, the remaining bytes are the actual text message. @@ -476,6 +478,7 @@ struct P2PConfirmationReceiptMessage GNUNET_HashCode content; }; +#pragma pack(pop) #endif diff --git a/src/core/core.h b/src/core/core.h index b76528a..8a272d4 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -50,6 +50,8 @@ #define GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND 64 +#pragma pack(push) +#pragma pack(1) /** * Message transmitted core clients to gnunet-service-core * to start the interaction. This header is followed by @@ -373,6 +375,6 @@ struct ConnectMessage struct GNUNET_PeerIdentity peer; }; - +#pragma pack(pop) #endif /* end of core.h */ diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c index 63dd6b7..1e13bfd 100644 --- a/src/core/gnunet-service-core_kx.c +++ b/src/core/gnunet-service-core_kx.c @@ -62,6 +62,8 @@ #define MAX_SET_KEY_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) +#pragma pack(push) +#pragma pack(1) /** * We're sending an (encrypted) PING to the other peer to check if he * can decrypt. The other peer should respond with a PONG with the @@ -213,7 +215,7 @@ struct EncryptedMessage struct GNUNET_TIME_AbsoluteNBO timestamp; }; - +#pragma pack(pop) /** * Number of bytes (at the beginning) of "struct EncryptedMessage" * that are NOT encrypted. diff --git a/src/datastore/datastore.h b/src/datastore/datastore.h index fa8352d..5d437ae 100644 --- a/src/datastore/datastore.h +++ b/src/datastore/datastore.h @@ -31,6 +31,8 @@ #include "gnunet_util_lib.h" +#pragma pack(push) +#pragma pack(1) /** * Message from datastore service informing client about * the current size of the datastore. @@ -248,7 +250,7 @@ struct DataMessage GNUNET_HashCode key GNUNET_PACKED; }; - +#pragma pack(pop) diff --git a/src/dht/dht.h b/src/dht/dht.h index 2a67177..4631725 100644 --- a/src/dht/dht.h +++ b/src/dht/dht.h @@ -34,6 +34,8 @@ #define DHT_BLOOM_SIZE 128 +#pragma pack(push) +#pragma pack(1) /** * Message which indicates the DHT should cancel outstanding * requests and discard any state. @@ -191,6 +193,6 @@ struct GNUNET_DHT_ClientPutMessage /* DATA copied to end of this message */ }; - +#pragma pack(pop) #endif diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 9ebf164..9cbe963 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c @@ -90,6 +90,8 @@ #define GET_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 2) +#pragma pack(push) +#pragma pack(1) /** * P2P PUT message */ @@ -246,7 +248,7 @@ struct PeerGetMessage /* result bloomfilter */ }; - +#pragma pack(pop) /** * Linked list of messages to send to a particular other peer. diff --git a/src/dv/dv.h b/src/dv/dv.h index 5690cf6..e527eb7 100644 --- a/src/dv/dv.h +++ b/src/dv/dv.h @@ -44,6 +44,8 @@ typedef void (*GNUNET_DV_MessageReceivedHandler) (void *cls, char *sender_address, size_t sender_address_len); +#pragma pack(push) +#pragma pack(1) /** * DV Message, contains a message that was received * via DV for this peer! Internal. @@ -255,7 +257,7 @@ typedef struct uint32_t peer_id GNUNET_PACKED; } p2p_dv_MESSAGE_Disconnect; - +#pragma pack(pop) struct GNUNET_DV_Handle * GNUNET_DV_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, diff --git a/src/dv/test_transport_api_dv.c b/src/dv/test_transport_api_dv.c index 942ee07..c5f4572 100644 --- a/src/dv/test_transport_api_dv.c +++ b/src/dv/test_transport_api_dv.c @@ -108,6 +108,8 @@ struct GNUNET_CONTAINER_MultiHashMap *peer_daemon_hash; #define MTYPE 12345 +#pragma pack(push) +#pragma pack(1) struct GNUNET_TestMessage { /** @@ -120,6 +122,7 @@ struct GNUNET_TestMessage */ uint32_t uid; }; +#pragma pack(pop) struct PeerContext { diff --git a/src/fragmentation/fragmentation.h b/src/fragmentation/fragmentation.h index 3469dd2..e4f9d1b 100644 --- a/src/fragmentation/fragmentation.h +++ b/src/fragmentation/fragmentation.h @@ -27,6 +27,8 @@ #include "platform.h" #include "gnunet_fragmentation_lib.h" +#pragma pack(push) +#pragma pack(1) /** * Header for a message fragment. Followed by the * original message. @@ -82,6 +84,6 @@ struct FragmentAcknowledgement uint64_t bits; }; - +#pragma pack(pop) #endif diff --git a/src/fs/fs.h b/src/fs/fs.h index 90d32f4..3326bfb 100644 --- a/src/fs/fs.h +++ b/src/fs/fs.h @@ -64,6 +64,8 @@ struct ContentHashKey }; +#pragma pack(push) +#pragma pack(1) /** * Message sent from a GNUnet (fs) publishing activity to the * gnunet-fs-service to initiate indexing of a file. The service is @@ -288,7 +290,7 @@ struct PutMessage /* this is followed by the actual encrypted content */ }; - +#pragma pack(pop) #endif diff --git a/src/fs/gnunet-service-fs.h b/src/fs/gnunet-service-fs.h index 5a275c5..0af6ac9 100644 --- a/src/fs/gnunet-service-fs.h +++ b/src/fs/gnunet-service-fs.h @@ -82,6 +82,8 @@ #define GET_MESSAGE_BIT_TRANSMIT_TO 4 +#pragma pack(push) +#pragma pack(1) /** * Message sent between peers asking for FS-content. */ @@ -161,7 +163,7 @@ struct MigrationStopMessage struct GNUNET_TIME_RelativeNBO duration; }; - +#pragma pack(pop) /** * A connected peer. diff --git a/src/hello/hello.c b/src/hello/hello.c index f7d3423..05a8d69 100644 --- a/src/hello/hello.c +++ b/src/hello/hello.c @@ -28,6 +28,8 @@ #include "gnunet_protocols.h" #include "gnunet_util_lib.h" +#pragma pack(push) +#pragma pack(1) /** * A HELLO message is used to exchange information about * transports with other peers. This struct is always @@ -59,7 +61,7 @@ struct GNUNET_HELLO_Message struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded publicKey; }; - +#pragma pack(pop) /** * Copy the given address information into diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c index b10f124..7f4564e 100644 --- a/src/hostlist/gnunet-daemon-hostlist.c +++ b/src/hostlist/gnunet-daemon-hostlist.c @@ -99,6 +99,8 @@ static GNUNET_CORE_ConnectEventHandler client_ch; */ static GNUNET_CORE_DisconnectEventHandler client_dh; +#pragma pack(push) +#pragma pack(1) /** * A HOSTLIST_ADV message is used to exchange information about * hostlist advertisements. This struct is always @@ -123,7 +125,7 @@ struct GNUNET_HOSTLIST_ADV_Message */ uint32_t reserved GNUNET_PACKED; }; - +#pragma pack(pop) static struct GNUNET_PeerIdentity me; diff --git a/src/include/block_dns.h b/src/include/block_dns.h index 1c01754..3e30c3b 100644 --- a/src/include/block_dns.h +++ b/src/include/block_dns.h @@ -13,7 +13,8 @@ enum GNUNET_DNS_ServiceTypes GNUNET_DNS_SERVICE_TYPE_TCP = 2 }; - +#pragma pack(push) +#pragma pack(1) /** * This is the structure describing an dns-record such as www.gnunet. */ @@ -57,5 +58,6 @@ struct GNUNET_DNS_Record */ uint32_t service_type GNUNET_PACKED; }; +#pragma pack(pop) #endif diff --git a/src/include/block_fs.h b/src/include/block_fs.h index 9dc22e5..ab603e2 100644 --- a/src/include/block_fs.h +++ b/src/include/block_fs.h @@ -139,6 +139,8 @@ struct NBlock }; +#pragma pack(push) +#pragma pack(1) /** * @brief index block (indexing a DBlock that * can be obtained directly from reading @@ -160,6 +162,6 @@ struct OnDemandBlock uint64_t offset GNUNET_PACKED; }; - +#pragma pack(pop) #endif diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h index bd55b8c..24149a0 100644 --- a/src/include/gnunet_ats_service.h +++ b/src/include/gnunet_ats_service.h @@ -402,6 +402,8 @@ enum GNUNET_ATS_Property }; +#pragma pack(push) +#pragma pack(1) /** * struct used to communicate the transport's properties like cost and * quality of service as well as high-level constraints on resource @@ -432,7 +434,7 @@ struct GNUNET_ATS_Information */ uint32_t value GNUNET_PACKED; }; - +#pragma pack(pop) /* ******************************** Scheduling API ***************************** */ diff --git a/src/include/gnunet_bandwidth_lib.h b/src/include/gnunet_bandwidth_lib.h index 75f71b3..cd20361 100644 --- a/src/include/gnunet_bandwidth_lib.h +++ b/src/include/gnunet_bandwidth_lib.h @@ -38,6 +38,8 @@ extern "C" #include "gnunet_common.h" #include "gnunet_time_lib.h" +#pragma pack(push) +#pragma pack(1) /** * 32-bit bandwidth used for network exchange by GNUnet, in bytes per second. */ @@ -48,7 +50,7 @@ struct GNUNET_BANDWIDTH_Value32NBO */ uint32_t value__ GNUNET_PACKED; }; - +#pragma pack(pop) /** * Struct to track available bandwidth. Combines a time stamp with a diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index 665697a..a3c3427 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h @@ -119,6 +119,8 @@ /* ************************ super-general types *********************** */ +#pragma pack(push) +#pragma pack(1) /** * Header for all communications. */ @@ -137,7 +139,7 @@ struct GNUNET_MessageHeader uint16_t type GNUNET_PACKED; }; - +#pragma pack(pop) /** * @brief 512-bit hashcode @@ -149,6 +151,8 @@ typedef struct GNUNET_HashCode; +#pragma pack(push) +#pragma pack(1) /** * The identity of the host (basically the SHA-512 hashcode of * it's public key). @@ -157,7 +161,7 @@ struct GNUNET_PeerIdentity { GNUNET_HashCode hashPubKey GNUNET_PACKED; }; - +#pragma pack(pop) /** * Function called with a filename. diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index 53137c1..3610894 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h @@ -121,6 +121,8 @@ struct GNUNET_CRYPTO_RsaSignature }; +#pragma pack(push) +#pragma pack(1) /** * @brief header of what an RSA signature signs * this must be followed by "size - 8" bytes of @@ -197,7 +199,7 @@ struct GNUNET_CRYPTO_AesSessionKey */ uint32_t crc32 GNUNET_PACKED; }; - +#pragma pack(pop) /** * @brief IV for sym cipher diff --git a/src/include/gnunet_time_lib.h b/src/include/gnunet_time_lib.h index f8afdae..556f389 100644 --- a/src/include/gnunet_time_lib.h +++ b/src/include/gnunet_time_lib.h @@ -61,7 +61,8 @@ struct GNUNET_TIME_Relative uint64_t rel_value; }; - +#pragma pack(push) +#pragma pack(1) /** * Time for relative time used by GNUnet, in milliseconds and in network byte order. */ @@ -84,7 +85,7 @@ struct GNUNET_TIME_AbsoluteNBO */ uint64_t abs_value__ GNUNET_PACKED; }; - +#pragma pack(pop) /** * Relative time zero. diff --git a/src/mesh/mesh.h b/src/mesh/mesh.h index fcddb2e..da587eb 100644 --- a/src/mesh/mesh.h +++ b/src/mesh/mesh.h @@ -85,6 +85,8 @@ /************************** MESSAGES ******************************/ /******************************************************************************/ +#pragma pack(push) +#pragma pack(1) /** * Message for a client to register to the service */ @@ -209,7 +211,7 @@ struct GNUNET_MESH_ConnectPeerByType */ GNUNET_MESH_ApplicationType type GNUNET_PACKED; }; - +#pragma pack(pop) /******************************************************************************/ /************************ ENUMERATIONS ****************************/ diff --git a/src/mesh/mesh_protocol.h b/src/mesh/mesh_protocol.h index b6c7f1b..e2d0795 100644 --- a/src/mesh/mesh_protocol.h +++ b/src/mesh/mesh_protocol.h @@ -39,6 +39,8 @@ extern "C" /******************** MESH NETWORK MESSAGES **************************/ /******************************************************************************/ +#pragma pack(push) +#pragma pack(1) /** * Message for mesh path management */ @@ -276,6 +278,7 @@ struct GNUNET_MESH_SpeedNotify uint32_t speed_min; }; +#pragma pack(pop) #if 0 /* keep Emacsens' auto-indent happy */ { diff --git a/src/nat/nat.h b/src/nat/nat.h index a32fe09..83d48d5 100644 --- a/src/nat/nat.h +++ b/src/nat/nat.h @@ -30,6 +30,8 @@ #define DEBUG_NAT GNUNET_EXTRA_LOGGING +#pragma pack(push) +#pragma pack(1) /** * Request to test NAT traversal. */ @@ -61,5 +63,6 @@ struct GNUNET_NAT_TestMessage int32_t is_tcp; }; +#pragma pack(pop) #endif diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index 5bf320a..7059b64 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c @@ -128,6 +128,8 @@ struct NSEPeerEntry }; +#pragma pack(push) +#pragma pack(1) /** * Network size estimate reply; sent when "this" * peer's timer has run out before receiving a @@ -178,7 +180,7 @@ struct GNUNET_NSE_FloodMessage */ struct GNUNET_CRYPTO_RsaSignature signature; }; - +#pragma pack(pop) /** * Handle to our current configuration. diff --git a/src/nse/nse.h b/src/nse/nse.h index 91b6296..acbe031 100644 --- a/src/nse/nse.h +++ b/src/nse/nse.h @@ -35,6 +35,8 @@ */ #define DEBUG_NSE GNUNET_EXTRA_LOGGING +#pragma pack(push) +#pragma pack(1) /** * Network size estimate sent from the service * to clients. Contains the current size estimate @@ -71,6 +73,6 @@ struct GNUNET_NSE_ClientMessage */ double std_deviation GNUNET_PACKED; }; - +#pragma pack(pop) #endif diff --git a/src/peerinfo/peerinfo.h b/src/peerinfo/peerinfo.h index 992dde7..34ac4ec 100644 --- a/src/peerinfo/peerinfo.h +++ b/src/peerinfo/peerinfo.h @@ -29,6 +29,8 @@ #define DEBUG_PEERINFO GNUNET_EXTRA_LOGGING +#pragma pack(push) +#pragma pack(1) /** * Message requesting a listing of all known peers, * possibly restricted to the specified peer identity. @@ -81,6 +83,6 @@ struct InfoMessage struct GNUNET_PeerIdentity peer; }; - +#pragma pack(pop) /* end of peerinfo.h */ diff --git a/src/statistics/statistics.h b/src/statistics/statistics.h index a65dff1..9f9d46d 100644 --- a/src/statistics/statistics.h +++ b/src/statistics/statistics.h @@ -29,6 +29,8 @@ #define DEBUG_STATISTICS GNUNET_EXTRA_LOGGING +#pragma pack(push) +#pragma pack(1) /** * Statistics message. Contains how long the system is up * and one value. @@ -128,6 +130,6 @@ struct GNUNET_STATISTICS_WatchValueMessage uint64_t value GNUNET_PACKED; }; - +#pragma pack(pop) #endif diff --git a/src/testing/test_testing_large_topology.c b/src/testing/test_testing_large_topology.c index 08b1df5..587be62 100644 --- a/src/testing/test_testing_large_topology.c +++ b/src/testing/test_testing_large_topology.c @@ -107,6 +107,8 @@ static char *test_directory; #define MTYPE 12345 +#pragma pack(push) +#pragma pack(1) struct GNUNET_TestMessage { /** @@ -119,6 +121,7 @@ struct GNUNET_TestMessage */ uint32_t uid; }; +#pragma pack(pop) struct TestMessageContext { diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c index f60ac3a..9bb27a6 100644 --- a/src/testing/test_testing_topology.c +++ b/src/testing/test_testing_topology.c @@ -115,6 +115,8 @@ static char *test_directory; #define MTYPE 12345 +#pragma pack(push) +#pragma pack(1) struct GNUNET_TestMessage { /** @@ -127,6 +129,7 @@ struct GNUNET_TestMessage */ uint32_t uid; }; +#pragma pack(pop) struct TestMessageContext { diff --git a/src/testing/test_testing_topology_blacklist.c b/src/testing/test_testing_topology_blacklist.c index d45d1bb..1612ff1 100644 --- a/src/testing/test_testing_topology_blacklist.c +++ b/src/testing/test_testing_topology_blacklist.c @@ -85,6 +85,8 @@ static char *test_directory; #define MTYPE 12345 +#pragma pack(push) +#pragma pack(1) struct GNUNET_TestMessage { /** @@ -97,7 +99,7 @@ struct GNUNET_TestMessage */ uint32_t uid; }; - +#pragma pack(pop) /** * Check whether peers successfully shut down. diff --git a/src/testing/test_testing_topology_churn.c b/src/testing/test_testing_topology_churn.c index 5a34864..bf0c4f3 100644 --- a/src/testing/test_testing_topology_churn.c +++ b/src/testing/test_testing_topology_churn.c @@ -59,6 +59,8 @@ static char *test_directory; #define MTYPE 12345 +#pragma pack(push) +#pragma pack(1) struct GNUNET_TestMessage { /** @@ -71,6 +73,7 @@ struct GNUNET_TestMessage */ uint32_t uid; }; +#pragma pack(pop) /** * Check whether peers successfully shut down. diff --git a/src/transport/gnunet-helper-transport-wlan.c b/src/transport/gnunet-helper-transport-wlan.c index 0bc6d88..99bac43 100644 --- a/src/transport/gnunet-helper-transport-wlan.c +++ b/src/transport/gnunet-helper-transport-wlan.c @@ -328,7 +328,8 @@ struct SendBuffer char buf[MAXLINE * 2]; }; - +#pragma pack(push) +#pragma pack(1) /** * generic definitions for IEEE 802.11 frames */ @@ -343,7 +344,7 @@ struct ieee80211_frame /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ /* see below */ } GNUNET_PACKED; - +#pragma pack(pop) /** * struct for storing the information of the hardware diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 348378b..cfa973a 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c @@ -69,6 +69,8 @@ */ struct NeighbourMapEntry; +#pragma pack(push) +#pragma pack(1) /** * Message a peer sends to another to indicate its * preference for communicating via a particular @@ -133,7 +135,7 @@ struct SessionDisconnectMessage struct GNUNET_CRYPTO_RsaSignature signature; }; - +#pragma pack(pop) /** * For each neighbour we keep a list of messages diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index 5595895..a825dc2 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c @@ -92,6 +92,8 @@ #define PONG_PRIORITY 4 +#pragma pack(push) +#pragma pack(1) /** * Message used to ask a peer to validate receipt (to check an address * from a HELLO). Followed by the address we are trying to validate, @@ -166,7 +168,7 @@ struct TransportPongMessage uint32_t addrlen GNUNET_PACKED; }; - +#pragma pack(pop) /** * Information about an address under validation diff --git a/src/transport/gnunet-transport-wlan-sender.c b/src/transport/gnunet-transport-wlan-sender.c index 2096afa..0b8fd42 100644 --- a/src/transport/gnunet-transport-wlan-sender.c +++ b/src/transport/gnunet-transport-wlan-sender.c @@ -46,7 +46,8 @@ #define IEEE80211_FC0_TYPE_CTL 0x04 #define IEEE80211_FC0_TYPE_DATA 0x08 - +#pragma pack(push) +#pragma pack(1) /* * generic definitions for IEEE 802.11 frames */ @@ -60,7 +61,7 @@ struct ieee80211_frame u_int8_t i_seq[2]; u_int8_t llc[4]; } GNUNET_PACKED; - +#pragma pack(pop) /** * function to fill the radiotap header diff --git a/src/transport/plugin_transport_http.h b/src/transport/plugin_transport_http.h index 84a92c2..c57a610 100644 --- a/src/transport/plugin_transport_http.h +++ b/src/transport/plugin_transport_http.h @@ -260,6 +260,8 @@ struct Plugin }; +#pragma pack(push) +#pragma pack(1) /** * IPv4 addresses */ @@ -291,7 +293,7 @@ struct IPv6HttpAddress */ uint16_t u6_port GNUNET_PACKED; }; - +#pragma pack(pop) /** * Session handle for connections. diff --git a/src/transport/plugin_transport_smtp.c b/src/transport/plugin_transport_smtp.c index fa11a9b..1f699e5 100644 --- a/src/transport/plugin_transport_smtp.c +++ b/src/transport/plugin_transport_smtp.c @@ -72,6 +72,8 @@ typedef struct } EmailAddress; +#pragma pack(push) +#pragma pack(1) /** * Encapsulation of a GNUnet message in the SMTP mail body (before * base64 encoding). @@ -86,6 +88,7 @@ typedef struct GNUNET_PeerIdentity sender; } SMTPMessage; +#pragma pack(pop) /* *********** globals ************* */ diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 347ff8d..9f57a1a 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c @@ -43,6 +43,8 @@ #define DEBUG_TCP_NAT GNUNET_EXTRA_LOGGING +#pragma pack(push) +#pragma pack(1) /** * Initial handshake message for a session. */ @@ -78,7 +80,7 @@ struct TCP_NAT_ProbeMessage struct GNUNET_PeerIdentity clientIdentity; }; - +#pragma pack(pop) /** * Context for sending a NAT probe via TCP. @@ -118,6 +120,8 @@ struct TCPProbeContext }; +#pragma pack(push) +#pragma pack(1) /** * Network format for IPv4 addresses. */ @@ -152,7 +156,7 @@ struct IPv6TcpAddress uint16_t t6_port GNUNET_PACKED; }; - +#pragma pack(pop) /** * Encapsulation of all of the state of the plugin. diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 04ec108..8aaf7e1 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c @@ -70,6 +70,8 @@ #define UDP_MAX_SENDER_ADDRESSES_WITH_DEFRAG 128 +#pragma pack(push) +#pragma pack(1) /** * UDP Message-Packet header (after defragmentation). */ @@ -92,7 +94,6 @@ struct UDPMessage }; - /** * UDP ACK Message-Packet header (after defragmentation). */ @@ -162,7 +163,7 @@ struct IPv6UdpAddress */ uint16_t u6_port GNUNET_PACKED; }; - +#pragma pack(pop) /* Forward definition */ struct Plugin; diff --git a/src/transport/plugin_transport_udp_new.c b/src/transport/plugin_transport_udp_new.c index 7eb4cbe..fa8e739 100644 --- a/src/transport/plugin_transport_udp_new.c +++ b/src/transport/plugin_transport_udp_new.c @@ -70,6 +70,8 @@ #define UDP_MAX_SENDER_ADDRESSES_WITH_DEFRAG 128 +#pragma pack(push) +#pragma pack(1) /** * UDP Message-Packet header (after defragmentation). */ @@ -148,7 +150,7 @@ struct IPv6UdpAddress */ uint16_t u6_port GNUNET_PACKED; }; - +#pragma pack(pop) /* Forward definition */ struct Plugin; diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index 5f6c967..5c48c20 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c @@ -64,6 +64,8 @@ */ #define UNIX_NAT_DEFAULT_PORT 22086 +#pragma pack(push) +#pragma pack(1) /** * UNIX Message-Packet header. */ @@ -131,6 +133,7 @@ struct IPv6UdpAddress */ uint16_t u6_port GNUNET_PACKED; }; +#pragma pack(pop) /* Forward definition */ struct Plugin; diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index b741c97..8883130 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c @@ -120,6 +120,8 @@ #define IEEE80211_FC0_TYPE_CTL 0x04 #define IEEE80211_FC0_TYPE_DATA 0x08 +#pragma pack(push) +#pragma pack(1) /* * generic definitions for IEEE 802.11 frames */ @@ -133,6 +135,7 @@ struct ieee80211_frame u_int8_t i_seq[2]; u_int8_t llc[4]; } GNUNET_PACKED; +#pragma pack(pop) /** * Encapsulation of all of the state of the plugin. @@ -361,6 +364,8 @@ struct Plugin_Session_pair }; +#pragma pack(push) +#pragma pack(1) /** * Header for messages which need fragmentation */ @@ -388,7 +393,7 @@ struct WlanHeader // followed by payload }; - +#pragma pack(pop) /** * Information kept for each message that is yet to diff --git a/src/transport/plugin_transport_wlan.h b/src/transport/plugin_transport_wlan.h index 35b23fd..40287e8 100644 --- a/src/transport/plugin_transport_wlan.h +++ b/src/transport/plugin_transport_wlan.h @@ -43,6 +43,8 @@ struct MacAddress }; +#pragma pack(push) +#pragma pack(1) /** * Format of a WLAN Control Message. */ @@ -58,7 +60,7 @@ struct GNUNET_TRANSPORT_WLAN_HelperControlMessage */ struct MacAddress mac; }; - +#pragma pack(pop) /** * GNUnet bssid diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c index 1742dd0..88d5fe7 100644 --- a/src/transport/test_quota_compliance.c +++ b/src/transport/test_quota_compliance.c @@ -104,11 +104,14 @@ static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; #define MTYPE 12345 +#pragma pack(push) +#pragma pack(1) struct TestMessage { struct GNUNET_MessageHeader header; uint32_t num; }; +#pragma pack(pop) static int msg_scheduled; static int msg_sent; diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index 15fc4f6..2f2ba7d 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c @@ -97,11 +97,14 @@ static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; #define MTYPE 12345 +#pragma pack(push) +#pragma pack(1) struct TestMessage { struct GNUNET_MessageHeader header; uint32_t num; }; +#pragma pack(pop) static int msg_scheduled; static int msg_sent; diff --git a/src/transport/test_transport_api_unreliability.c b/src/transport/test_transport_api_unreliability.c index e52b20f..fe167b7 100644 --- a/src/transport/test_transport_api_unreliability.c +++ b/src/transport/test_transport_api_unreliability.c @@ -93,11 +93,14 @@ struct GNUNET_TRANSPORT_TESTING_handle *tth; #define MTYPE 12345 +#pragma pack(push) +#pragma pack(1) struct TestMessage { struct GNUNET_MessageHeader header; uint32_t num; }; +#pragma pack(pop) static char *test_name; diff --git a/src/transport/test_transport_api_unreliability_constant.c b/src/transport/test_transport_api_unreliability_constant.c index 414bca7..1c11dd4 100644 --- a/src/transport/test_transport_api_unreliability_constant.c +++ b/src/transport/test_transport_api_unreliability_constant.c @@ -97,11 +97,14 @@ static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; #define MSG_SIZE 10000 +#pragma pack(push) +#pragma pack(1) struct TestMessage { struct GNUNET_MessageHeader header; uint32_t num; }; +#pragma pack(pop) static char *test_name; diff --git a/src/transport/transport.h b/src/transport/transport.h index d2792b9..d34337c 100644 --- a/src/transport/transport.h +++ b/src/transport/transport.h @@ -61,6 +61,8 @@ */ #define CONNECTED_LATENCY_EVALUATION_MAX_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 1) +#pragma pack(push) +#pragma pack(1) /** * Message from the transport service to the library * asking to check if both processes agree about this @@ -430,7 +432,7 @@ struct BlacklistMessage struct GNUNET_PeerIdentity peer; }; - +#pragma pack(pop) /* end of transport.h */ #endif diff --git a/src/util/crypto_ksk.c b/src/util/crypto_ksk.c index 60639a7..497c2e1 100644 --- a/src/util/crypto_ksk.c +++ b/src/util/crypto_ksk.c @@ -463,7 +463,8 @@ generate_kblock_key (KBlock_secret_key *sk, unsigned int nbits, gcry_mpi_release (g); } - +#pragma pack(push) +#pragma pack(1) /** * Internal representation of the private key. */ @@ -482,7 +483,7 @@ struct KskRsaPrivateKeyBinaryEncoded uint16_t sizedmq1 GNUNET_PACKED; /* in big-endian! */ /* followed by the actual values */ }; - +#pragma pack(pop) /** * Deterministically (!) create a hostkey using only the diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c index d29566a..53ee041 100644 --- a/src/util/crypto_rsa.c +++ b/src/util/crypto_rsa.c @@ -53,6 +53,8 @@ struct GNUNET_CRYPTO_RsaPrivateKey }; +#pragma pack(push) +#pragma pack(1) /** * GNUnet mandates a certain format for the encoding * of private RSA key information that is provided @@ -75,7 +77,7 @@ struct RsaPrivateKeyBinaryEncoded uint16_t sizedmq1 GNUNET_PACKED; /* in big-endian! */ /* followed by the actual values */ }; - +#pragma pack(pop) #define HOSTKEY_LEN 2048 diff --git a/src/util/resolver.h b/src/util/resolver.h index 57cb686..d61b6a0 100644 --- a/src/util/resolver.h +++ b/src/util/resolver.h @@ -29,6 +29,8 @@ #define DEBUG_RESOLVER GNUNET_EXTRA_LOGGING +#pragma pack(push) +#pragma pack(1) /** * Request for the resolver. Followed by either * the "struct sockaddr" or the 0-terminated hostname. @@ -59,5 +61,6 @@ struct GNUNET_RESOLVER_GetMessage int32_t domain GNUNET_PACKED; }; +#pragma pack(pop) #endif diff --git a/src/vpn/gnunet-service-dns-p.h b/src/vpn/gnunet-service-dns-p.h index 0519b1f..a391660 100644 --- a/src/vpn/gnunet-service-dns-p.h +++ b/src/vpn/gnunet-service-dns-p.h @@ -3,6 +3,8 @@ #include "gnunet_common.h" +#pragma pack(push) +#pragma pack(1) struct query_packet { struct GNUNET_MessageHeader hdr; @@ -109,5 +111,6 @@ struct answer_packet_list struct GNUNET_SERVER_Client *client; struct answer_packet pkt; }; +#pragma pack(pop) #endif diff --git a/src/vpn/gnunet-service-dns.c b/src/vpn/gnunet-service-dns.c index 6ef621c..e896dee 100644 --- a/src/vpn/gnunet-service-dns.c +++ b/src/vpn/gnunet-service-dns.c @@ -287,12 +287,15 @@ send_answer (void *cls, size_t size, void *buf) return len; } +#pragma pack(push) +#pragma pack(1) struct tunnel_cls { struct GNUNET_MESH_Tunnel *tunnel GNUNET_PACKED; struct GNUNET_MessageHeader hdr; struct dns_pkt dns; }; +#pragma pack(pop) struct tunnel_cls *remote_pending[UINT16_MAX]; diff --git a/src/vpn/gnunet-vpn-packet.h b/src/vpn/gnunet-vpn-packet.h index e2082f9..0f8e37b 100644 --- a/src/vpn/gnunet-vpn-packet.h +++ b/src/vpn/gnunet-vpn-packet.h @@ -4,6 +4,8 @@ #include "platform.h" #include "gnunet_common.h" +#pragma pack(push) +#pragma pack(1) // Headers struct pkt_tun { @@ -100,6 +102,7 @@ struct dns_static uint16_t nscount GNUNET_PACKED; // number of authority-records uint16_t arcount GNUNET_PACKED; // number of additional records }; +#pragma pack(pop) struct dns_pkt { @@ -156,6 +159,8 @@ struct udp_dns struct dns_pkt data; }; +#pragma pack(push) +#pragma pack(1) // Complete Packets struct tun_pkt { @@ -246,5 +251,6 @@ struct ip_icmp struct ip_hdr ip_hdr; struct icmp_hdr icmp_hdr; }; +#pragma pack(pop) #endif -- 1.7.4