diff options
Diffstat (limited to 'src/libcharon/plugins')
93 files changed, 725 insertions, 725 deletions
diff --git a/src/libcharon/plugins/attr/attr_provider.c b/src/libcharon/plugins/attr/attr_provider.c index 1de571c3f..f4c143641 100644 --- a/src/libcharon/plugins/attr/attr_provider.c +++ b/src/libcharon/plugins/attr/attr_provider.c @@ -272,10 +272,10 @@ static void load_entries(private_attr_provider_t *this) { if (family == AF_INET) { /* IPv4 attributes contain a subnet mask */ - u_int32_t netmask = 0; + uint32_t netmask = 0; if (mask) - { /* shifting u_int32_t by 32 or more is undefined */ + { /* shifting uint32_t by 32 or more is undefined */ mask = 32 - mask; netmask = htonl((0xFFFFFFFF >> mask) << mask); } diff --git a/src/libcharon/plugins/connmark/connmark_listener.c b/src/libcharon/plugins/connmark/connmark_listener.c index 57a9d9e27..29f7cac42 100644 --- a/src/libcharon/plugins/connmark/connmark_listener.c +++ b/src/libcharon/plugins/connmark/connmark_listener.c @@ -57,7 +57,7 @@ struct private_connmark_listener_t { static bool ts2in(traffic_selector_t *ts, struct in_addr *addr, struct in_addr *mask) { - u_int8_t bits; + uint8_t bits; host_t *net; if (ts->get_type(ts) == TS_IPV4_ADDR_RANGE && @@ -120,15 +120,15 @@ static bool manage_rule(struct iptc_handle *ipth, const char *chain, */ static bool manage_pre_esp_in_udp(private_connmark_listener_t *this, struct iptc_handle *ipth, bool add, - u_int mark, u_int32_t spi, + u_int mark, uint32_t spi, host_t *dst, host_t *src) { - u_int16_t match_size = XT_ALIGN(sizeof(struct ipt_entry_match)) + + uint16_t match_size = XT_ALIGN(sizeof(struct ipt_entry_match)) + XT_ALIGN(sizeof(struct xt_udp)); - u_int16_t target_offset = XT_ALIGN(sizeof(struct ipt_entry)) + match_size; - u_int16_t target_size = XT_ALIGN(sizeof(struct ipt_entry_target)) + + uint16_t target_offset = XT_ALIGN(sizeof(struct ipt_entry)) + match_size; + uint16_t target_size = XT_ALIGN(sizeof(struct ipt_entry_target)) + XT_ALIGN(sizeof(struct xt_mark_tginfo2)); - u_int16_t entry_size = target_offset + target_size; + uint16_t entry_size = target_offset + target_size; u_char ipt[entry_size], *pos = ipt; struct ipt_entry *e; @@ -178,15 +178,15 @@ static bool manage_pre_esp_in_udp(private_connmark_listener_t *this, */ static bool manage_pre_esp(private_connmark_listener_t *this, struct iptc_handle *ipth, bool add, - u_int mark, u_int32_t spi, + u_int mark, uint32_t spi, host_t *dst, host_t *src) { - u_int16_t match_size = XT_ALIGN(sizeof(struct ipt_entry_match)) + + uint16_t match_size = XT_ALIGN(sizeof(struct ipt_entry_match)) + XT_ALIGN(sizeof(struct xt_esp)); - u_int16_t target_offset = XT_ALIGN(sizeof(struct ipt_entry)) + match_size; - u_int16_t target_size = XT_ALIGN(sizeof(struct ipt_entry_target)) + + uint16_t target_offset = XT_ALIGN(sizeof(struct ipt_entry)) + match_size; + uint16_t target_size = XT_ALIGN(sizeof(struct ipt_entry_target)) + XT_ALIGN(sizeof(struct xt_mark_tginfo2)); - u_int16_t entry_size = target_offset + target_size; + uint16_t entry_size = target_offset + target_size; u_char ipt[entry_size], *pos = ipt; struct ipt_entry *e; @@ -235,7 +235,7 @@ static bool manage_pre_esp(private_connmark_listener_t *this, */ static bool manage_pre(private_connmark_listener_t *this, struct iptc_handle *ipth, bool add, - u_int mark, u_int32_t spi, bool encap, + u_int mark, uint32_t spi, bool encap, host_t *dst, host_t *src) { if (encap) @@ -250,15 +250,15 @@ static bool manage_pre(private_connmark_listener_t *this, */ static bool manage_in(private_connmark_listener_t *this, struct iptc_handle *ipth, bool add, - u_int mark, u_int32_t spi, + u_int mark, uint32_t spi, traffic_selector_t *dst, traffic_selector_t *src) { - u_int16_t match_size = XT_ALIGN(sizeof(struct ipt_entry_match)) + + uint16_t match_size = XT_ALIGN(sizeof(struct ipt_entry_match)) + XT_ALIGN(sizeof(struct xt_policy_info)); - u_int16_t target_offset = XT_ALIGN(sizeof(struct ipt_entry)) + match_size; - u_int16_t target_size = XT_ALIGN(sizeof(struct ipt_entry_target)) + + uint16_t target_offset = XT_ALIGN(sizeof(struct ipt_entry)) + match_size; + uint16_t target_size = XT_ALIGN(sizeof(struct ipt_entry_target)) + XT_ALIGN(sizeof(struct xt_connmark_tginfo1)); - u_int16_t entry_size = target_offset + target_size; + uint16_t entry_size = target_offset + target_size; u_char ipt[entry_size], *pos = ipt; struct ipt_entry *e; @@ -316,12 +316,12 @@ static bool manage_out(private_connmark_listener_t *this, struct iptc_handle *ipth, bool add, traffic_selector_t *dst, traffic_selector_t *src) { - u_int16_t match_size = XT_ALIGN(sizeof(struct ipt_entry_match)) + + uint16_t match_size = XT_ALIGN(sizeof(struct ipt_entry_match)) + XT_ALIGN(sizeof(struct xt_mark_mtinfo1)); - u_int16_t target_offset = XT_ALIGN(sizeof(struct ipt_entry)) + match_size; - u_int16_t target_size = XT_ALIGN(sizeof(struct ipt_entry_target)) + + uint16_t target_offset = XT_ALIGN(sizeof(struct ipt_entry)) + match_size; + uint16_t target_size = XT_ALIGN(sizeof(struct ipt_entry_target)) + XT_ALIGN(sizeof(struct xt_connmark_tginfo1)); - u_int16_t entry_size = target_offset + target_size; + uint16_t entry_size = target_offset + target_size; u_char ipt[entry_size], *pos = ipt; struct ipt_entry *e; @@ -402,7 +402,7 @@ static bool manage_policies(private_connmark_listener_t *this, { traffic_selector_t *local, *remote; enumerator_t *enumerator; - u_int32_t spi; + uint32_t spi; u_int mark; bool done = TRUE; diff --git a/src/libcharon/plugins/dhcp/dhcp_socket.c b/src/libcharon/plugins/dhcp/dhcp_socket.c index 0fd1d33fd..807c68274 100644 --- a/src/libcharon/plugins/dhcp/dhcp_socket.c +++ b/src/libcharon/plugins/dhcp/dhcp_socket.c @@ -151,8 +151,8 @@ typedef enum { * DHCP option encoding, a TLV */ typedef struct __attribute__((packed)) { - u_int8_t type; - u_int8_t len; + uint8_t type; + uint8_t len; char data[]; } dhcp_option_t; @@ -160,22 +160,22 @@ typedef struct __attribute__((packed)) { * DHCP message format, with a maximum size options buffer */ typedef struct __attribute__((packed)) { - u_int8_t opcode; - u_int8_t hw_type; - u_int8_t hw_addr_len; - u_int8_t hop_count; - u_int32_t transaction_id; - u_int16_t number_of_seconds; - u_int16_t flags; - u_int32_t client_address; - u_int32_t your_address; - u_int32_t server_address; - u_int32_t gateway_address; + uint8_t opcode; + uint8_t hw_type; + uint8_t hw_addr_len; + uint8_t hop_count; + uint32_t transaction_id; + uint16_t number_of_seconds; + uint16_t flags; + uint32_t client_address; + uint32_t your_address; + uint32_t server_address; + uint32_t gateway_address; char client_hw_addr[6]; char client_hw_padding[10]; char server_hostname[64]; char boot_filename[128]; - u_int32_t magic_cookie; + uint32_t magic_cookie; char options[252]; } dhcp_t; @@ -191,7 +191,7 @@ static int prepare_dhcp(private_dhcp_socket_t *this, dhcp_option_t *option; int optlen = 0; host_t *src; - u_int32_t id; + uint32_t id; memset(dhcp, 0, sizeof(*dhcp)); dhcp->opcode = BOOTREQUEST; @@ -366,10 +366,10 @@ METHOD(dhcp_socket_t, enroll, dhcp_transaction_t*, private_dhcp_socket_t *this, identification_t *identity) { dhcp_transaction_t *transaction; - u_int32_t id; + uint32_t id; int try; - if (!this->rng->get_bytes(this->rng, sizeof(id), (u_int8_t*)&id)) + if (!this->rng->get_bytes(this->rng, sizeof(id), (uint8_t*)&id)) { DBG1(DBG_CFG, "DHCP DISCOVER failed, no transaction ID"); return NULL; diff --git a/src/libcharon/plugins/dhcp/dhcp_transaction.c b/src/libcharon/plugins/dhcp/dhcp_transaction.c index 22d3f3fdf..3ee88a698 100644 --- a/src/libcharon/plugins/dhcp/dhcp_transaction.c +++ b/src/libcharon/plugins/dhcp/dhcp_transaction.c @@ -32,7 +32,7 @@ struct private_dhcp_transaction_t { /** * DHCP transaction ID */ - u_int32_t id; + uint32_t id; /** * Peer identity @@ -63,7 +63,7 @@ typedef struct { chunk_t data; } attribute_entry_t; -METHOD(dhcp_transaction_t, get_id, u_int32_t, +METHOD(dhcp_transaction_t, get_id, uint32_t, private_dhcp_transaction_t *this) { return this->id; @@ -157,7 +157,7 @@ METHOD(dhcp_transaction_t, destroy, void, /** * See header */ -dhcp_transaction_t *dhcp_transaction_create(u_int32_t id, +dhcp_transaction_t *dhcp_transaction_create(uint32_t id, identification_t *identity) { private_dhcp_transaction_t *this; diff --git a/src/libcharon/plugins/dhcp/dhcp_transaction.h b/src/libcharon/plugins/dhcp/dhcp_transaction.h index 35f08e836..0c614f7b1 100644 --- a/src/libcharon/plugins/dhcp/dhcp_transaction.h +++ b/src/libcharon/plugins/dhcp/dhcp_transaction.h @@ -37,7 +37,7 @@ struct dhcp_transaction_t { * * @return DHCP transaction identifier */ - u_int32_t (*get_id)(dhcp_transaction_t *this); + uint32_t (*get_id)(dhcp_transaction_t *this); /** * Get the peer identity this transaction is used for. @@ -103,7 +103,7 @@ struct dhcp_transaction_t { * @param identity peer identity this transaction is used for * @return transaction instance */ -dhcp_transaction_t *dhcp_transaction_create(u_int32_t id, +dhcp_transaction_t *dhcp_transaction_create(uint32_t id, identification_t *identity); #endif /** DHCP_TRANSACTION_H_ @}*/ diff --git a/src/libcharon/plugins/dnscert/dnscert.c b/src/libcharon/plugins/dnscert/dnscert.c index 882ad9f0c..b360eac34 100644 --- a/src/libcharon/plugins/dnscert/dnscert.c +++ b/src/libcharon/plugins/dnscert/dnscert.c @@ -41,17 +41,17 @@ struct private_dnscert_t { /** * Certificate type */ - u_int16_t cert_type; + uint16_t cert_type; /** * Key tag */ - u_int16_t key_tag; + uint16_t key_tag; /** * Algorithm */ - u_int8_t algorithm; + uint8_t algorithm; /** * Certificate @@ -65,7 +65,7 @@ METHOD(dnscert_t, get_cert_type, dnscert_type_t, return this->cert_type; } -METHOD(dnscert_t, get_key_tag, u_int16_t, +METHOD(dnscert_t, get_key_tag, uint16_t, private_dnscert_t *this) { return this->key_tag; diff --git a/src/libcharon/plugins/dnscert/dnscert.h b/src/libcharon/plugins/dnscert/dnscert.h index 567a9dfac..31a26ff76 100644 --- a/src/libcharon/plugins/dnscert/dnscert.h +++ b/src/libcharon/plugins/dnscert/dnscert.h @@ -119,7 +119,7 @@ struct dnscert_t { * * @return keytag */ - u_int16_t (*get_key_tag)(dnscert_t *this); + uint16_t (*get_key_tag)(dnscert_t *this); /** * Get the algorithm. diff --git a/src/libcharon/plugins/duplicheck/duplicheck.c b/src/libcharon/plugins/duplicheck/duplicheck.c index 7c4cd5ce1..442fa4a99 100644 --- a/src/libcharon/plugins/duplicheck/duplicheck.c +++ b/src/libcharon/plugins/duplicheck/duplicheck.c @@ -71,7 +71,7 @@ int main(int argc, char *argv[]) { char buf[128]; int fd, len; - u_int16_t msglen; + uint16_t msglen; fd = make_connection(); if (fd < 0) diff --git a/src/libcharon/plugins/duplicheck/duplicheck_msg.h b/src/libcharon/plugins/duplicheck/duplicheck_msg.h index 99e297104..0f405746e 100644 --- a/src/libcharon/plugins/duplicheck/duplicheck_msg.h +++ b/src/libcharon/plugins/duplicheck/duplicheck_msg.h @@ -35,7 +35,7 @@ typedef struct duplicheck_msg_t duplicheck_msg_t; */ struct duplicheck_msg_t { /** length of the identity following, in network order (excluding len). */ - u_int16_t len; + uint16_t len; /** identity string, not null terminated */ char identity[]; } __attribute__((__packed__)); diff --git a/src/libcharon/plugins/duplicheck/duplicheck_notify.c b/src/libcharon/plugins/duplicheck/duplicheck_notify.c index f77b48b09..501d1229f 100644 --- a/src/libcharon/plugins/duplicheck/duplicheck_notify.c +++ b/src/libcharon/plugins/duplicheck/duplicheck_notify.c @@ -75,7 +75,7 @@ METHOD(duplicheck_notify_t, send_, void, { enumerator_t *enumerator; stream_t *stream; - u_int16_t nlen; + uint16_t nlen; char buf[512]; int len; diff --git a/src/libcharon/plugins/eap_aka/eap_aka_peer.c b/src/libcharon/plugins/eap_aka/eap_aka_peer.c index 810a19c55..3ab053ba6 100644 --- a/src/libcharon/plugins/eap_aka/eap_aka_peer.c +++ b/src/libcharon/plugins/eap_aka/eap_aka_peer.c @@ -62,7 +62,7 @@ struct private_eap_aka_peer_t { /** * EAP message identifier */ - u_int8_t identifier; + uint8_t identifier; /** * MSK @@ -77,7 +77,7 @@ struct private_eap_aka_peer_t { /** * Counter value if reauthentication is used */ - u_int16_t counter; + uint16_t counter; }; /** @@ -105,7 +105,7 @@ static bool create_client_error(private_eap_aka_peer_t *this, eap_payload_t **out) { simaka_message_t *message; - u_int16_t encoded; + uint16_t encoded; DBG1(DBG_IKE, "sending client error '%N'", simaka_client_error_names, AKA_UNABLE_TO_PROCESS); @@ -347,7 +347,7 @@ static status_t process_challenge(private_eap_aka_peer_t *this, */ static bool counter_too_small(private_eap_aka_peer_t *this, chunk_t chunk) { - u_int16_t counter; + uint16_t counter; memcpy(&counter, chunk.ptr, sizeof(counter)); counter = htons(counter); @@ -483,7 +483,7 @@ static status_t process_notification(private_eap_aka_peer_t *this, { if (type == AT_NOTIFICATION) { - u_int16_t code; + uint16_t code; memcpy(&code, data.ptr, sizeof(code)); code = ntohs(code); @@ -594,7 +594,7 @@ METHOD(eap_method_t, initiate, status_t, } METHOD(eap_method_t, get_type, eap_type_t, - private_eap_aka_peer_t *this, u_int32_t *vendor) + private_eap_aka_peer_t *this, uint32_t *vendor) { *vendor = 0; return EAP_AKA; @@ -611,14 +611,14 @@ METHOD(eap_method_t, get_msk, status_t, return FAILED; } -METHOD(eap_method_t, get_identifier, u_int8_t, +METHOD(eap_method_t, get_identifier, uint8_t, private_eap_aka_peer_t *this) { return this->identifier; } METHOD(eap_method_t, set_identifier, void, - private_eap_aka_peer_t *this, u_int8_t identifier) + private_eap_aka_peer_t *this, uint8_t identifier) { this->identifier = identifier; } diff --git a/src/libcharon/plugins/eap_aka/eap_aka_server.c b/src/libcharon/plugins/eap_aka/eap_aka_server.c index 04bfc170b..1ede56757 100644 --- a/src/libcharon/plugins/eap_aka/eap_aka_server.c +++ b/src/libcharon/plugins/eap_aka/eap_aka_server.c @@ -65,7 +65,7 @@ struct private_eap_aka_server_t { /** * EAP message identifier */ - u_int8_t identifier; + uint8_t identifier; /** * Expected Result XRES @@ -238,7 +238,7 @@ static status_t challenge(private_eap_aka_server_t *this, eap_payload_t **out) * Initiate EAP-AKA/Request/Re-authentication message */ static status_t reauthenticate(private_eap_aka_server_t *this, - char mk[HASH_SIZE_SHA1], u_int16_t counter, + char mk[HASH_SIZE_SHA1], uint16_t counter, eap_payload_t **out) { simaka_message_t *message; @@ -341,7 +341,7 @@ static status_t process_identity(private_eap_aka_server_t *this, if (this->use_reauth) { char mk[HASH_SIZE_SHA1]; - u_int16_t counter; + uint16_t counter; permanent = this->mgr->provider_is_reauth(this->mgr, id, mk, &counter); if (permanent) @@ -564,7 +564,7 @@ static status_t process_client_error(private_eap_aka_server_t *this, { if (type == AT_CLIENT_ERROR_CODE) { - u_int16_t code; + uint16_t code; memcpy(&code, data.ptr, sizeof(code)); DBG1(DBG_IKE, "received EAP-AKA client error '%N'", @@ -637,7 +637,7 @@ METHOD(eap_method_t, process, status_t, } METHOD(eap_method_t, get_type, eap_type_t, - private_eap_aka_server_t *this, u_int32_t *vendor) + private_eap_aka_server_t *this, uint32_t *vendor) { *vendor = 0; return EAP_AKA; @@ -654,14 +654,14 @@ METHOD(eap_method_t, get_msk, status_t, return FAILED; } -METHOD(eap_method_t, get_identifier, u_int8_t, +METHOD(eap_method_t, get_identifier, uint8_t, private_eap_aka_server_t *this) { return this->identifier; } METHOD(eap_method_t, set_identifier, void, - private_eap_aka_server_t *this, u_int8_t identifier) + private_eap_aka_server_t *this, uint8_t identifier) { this->identifier = identifier; } diff --git a/src/libcharon/plugins/eap_aka_3gpp2/eap_aka_3gpp2_functions.c b/src/libcharon/plugins/eap_aka_3gpp2/eap_aka_3gpp2_functions.c index 93ea8d08c..cfe6407b0 100644 --- a/src/libcharon/plugins/eap_aka_3gpp2/eap_aka_3gpp2_functions.c +++ b/src/libcharon/plugins/eap_aka_3gpp2/eap_aka_3gpp2_functions.c @@ -54,7 +54,7 @@ static chunk_t fmk = chunk_from_chars(0x41, 0x48, 0x41, 0x47); /** * Binary represnation of the polynom T^160 + T^5 + T^3 + T^2 + 1 */ -static u_int8_t g[] = { +static uint8_t g[] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2d @@ -63,7 +63,7 @@ static u_int8_t g[] = { /** * Predefined random bits from the RAND Corporation book */ -static u_int8_t a[] = { +static uint8_t a[] = { 0x9d, 0xe9, 0xc9, 0xc8, 0xef, 0xd5, 0x78, 0x11, 0x48, 0x23, 0x14, 0x01, 0x90, 0x1f, 0x2d, 0x49, 0x3f, 0x4c, 0x63, 0x65 @@ -72,7 +72,7 @@ static u_int8_t a[] = { /** * Predefined random bits from the RAND Corporation book */ -static u_int8_t b[] = { +static uint8_t b[] = { 0x75, 0xef, 0xd1, 0x5c, 0x4b, 0x8f, 0x8f, 0x51, 0x4e, 0xf3, 0xbc, 0xc3, 0x79, 0x4a, 0x76, 0x5e, 0x7e, 0xec, 0x45, 0xe0 @@ -171,7 +171,7 @@ static void mpz_mod_poly(mpz_t r, mpz_t a, mpz_t b) * XOR the key into the SHA1 IV */ static bool step3(prf_t *prf, u_char k[AKA_K_LEN], - u_char payload[AKA_PAYLOAD_LEN], u_int8_t h[HASH_SIZE_SHA1]) + u_char payload[AKA_PAYLOAD_LEN], uint8_t h[HASH_SIZE_SHA1]) { /* use the keyed hasher to build the hash */ return prf->set_key(prf, chunk_create(k, AKA_K_LEN)) && @@ -243,7 +243,7 @@ static bool fx(prf_t *prf, u_char f, u_char k[AKA_K_LEN], /** * Calculation function of f1() and f1star() */ -static bool f1x(prf_t *prf, u_int8_t f, u_char k[AKA_K_LEN], +static bool f1x(prf_t *prf, uint8_t f, u_char k[AKA_K_LEN], u_char rand[AKA_RAND_LEN], u_char sqn[AKA_SQN_LEN], u_char amf[AKA_AMF_LEN], u_char mac[AKA_MAC_LEN]) { diff --git a/src/libcharon/plugins/eap_dynamic/eap_dynamic.c b/src/libcharon/plugins/eap_dynamic/eap_dynamic.c index 3216446af..d0f0595de 100644 --- a/src/libcharon/plugins/eap_dynamic/eap_dynamic.c +++ b/src/libcharon/plugins/eap_dynamic/eap_dynamic.c @@ -73,7 +73,7 @@ static bool entry_matches(eap_vendor_type_t *item, eap_vendor_type_t *other) * Load the given EAP method */ static eap_method_t *load_method(private_eap_dynamic_t *this, - eap_type_t type, u_int32_t vendor) + eap_type_t type, uint32_t vendor) { eap_method_t *method; @@ -171,7 +171,7 @@ METHOD(eap_method_t, process, status_t, private_eap_dynamic_t *this, eap_payload_t *in, eap_payload_t **out) { eap_type_t received_type, type; - u_int32_t received_vendor, vendor; + uint32_t received_vendor, vendor; received_type = in->get_type(in, &received_vendor); if (received_vendor == 0 && received_type == EAP_NAK) @@ -225,7 +225,7 @@ METHOD(eap_method_t, process, status_t, } METHOD(eap_method_t, get_type, eap_type_t, - private_eap_dynamic_t *this, u_int32_t *vendor) + private_eap_dynamic_t *this, uint32_t *vendor) { if (this->method) { @@ -245,7 +245,7 @@ METHOD(eap_method_t, get_msk, status_t, return FAILED; } -METHOD(eap_method_t, get_identifier, u_int8_t, +METHOD(eap_method_t, get_identifier, uint8_t, private_eap_dynamic_t *this) { if (this->method) @@ -256,7 +256,7 @@ METHOD(eap_method_t, get_identifier, u_int8_t, } METHOD(eap_method_t, set_identifier, void, - private_eap_dynamic_t *this, u_int8_t identifier) + private_eap_dynamic_t *this, uint8_t identifier) { if (this->method) { @@ -335,7 +335,7 @@ static void get_supported_eap_types(private_eap_dynamic_t *this) { enumerator_t *enumerator; eap_type_t type; - u_int32_t vendor; + uint32_t vendor; enumerator = charon->eap->create_enumerator(charon->eap, EAP_SERVER); while (enumerator->enumerate(enumerator, &type, &vendor)) diff --git a/src/libcharon/plugins/eap_gtc/eap_gtc.c b/src/libcharon/plugins/eap_gtc/eap_gtc.c index 5fcd9ebc9..6f5c38edd 100644 --- a/src/libcharon/plugins/eap_gtc/eap_gtc.c +++ b/src/libcharon/plugins/eap_gtc/eap_gtc.c @@ -46,7 +46,7 @@ struct private_eap_gtc_t { /** * EAP message identififier */ - u_int8_t identifier; + uint8_t identifier; }; typedef struct eap_gtc_header_t eap_gtc_header_t; @@ -56,15 +56,15 @@ typedef struct eap_gtc_header_t eap_gtc_header_t; */ struct eap_gtc_header_t { /** EAP code (REQUEST/RESPONSE) */ - u_int8_t code; + uint8_t code; /** unique message identifier */ - u_int8_t identifier; + uint8_t identifier; /** length of whole message */ - u_int16_t length; + uint16_t length; /** EAP type */ - u_int8_t type; + uint8_t type; /** type data */ - u_int8_t data[]; + uint8_t data[]; } __attribute__((__packed__)); METHOD(eap_method_t, initiate_peer, status_t, @@ -186,7 +186,7 @@ METHOD(eap_method_t, process_server, status_t, } METHOD(eap_method_t, get_type, eap_type_t, - private_eap_gtc_t *this, u_int32_t *vendor) + private_eap_gtc_t *this, uint32_t *vendor) { *vendor = 0; return EAP_GTC; @@ -198,14 +198,14 @@ METHOD(eap_method_t, get_msk, status_t, return FAILED; } -METHOD(eap_method_t, get_identifier, u_int8_t, +METHOD(eap_method_t, get_identifier, uint8_t, private_eap_gtc_t *this) { return this->identifier; } METHOD(eap_method_t, set_identifier, void, - private_eap_gtc_t *this, u_int8_t identifier) + private_eap_gtc_t *this, uint8_t identifier) { this->identifier = identifier; } diff --git a/src/libcharon/plugins/eap_identity/eap_identity.c b/src/libcharon/plugins/eap_identity/eap_identity.c index 6ecde065c..7d6dc4add 100644 --- a/src/libcharon/plugins/eap_identity/eap_identity.c +++ b/src/libcharon/plugins/eap_identity/eap_identity.c @@ -43,7 +43,7 @@ struct private_eap_identity_t { /** * EAP identifier */ - u_int8_t identifier; + uint8_t identifier; }; typedef struct eap_identity_header_t eap_identity_header_t; @@ -53,15 +53,15 @@ typedef struct eap_identity_header_t eap_identity_header_t; */ struct eap_identity_header_t { /** EAP code (REQUEST/RESPONSE) */ - u_int8_t code; + uint8_t code; /** unique message identifier */ - u_int8_t identifier; + uint8_t identifier; /** length of whole message */ - u_int16_t length; + uint16_t length; /** EAP type */ - u_int8_t type; + uint8_t type; /** identity data */ - u_int8_t data[]; + uint8_t data[]; } __attribute__((__packed__)); METHOD(eap_method_t, process_peer, status_t, @@ -124,7 +124,7 @@ METHOD(eap_method_t, initiate_server, status_t, } METHOD(eap_method_t, get_type, eap_type_t, - private_eap_identity_t *this, u_int32_t *vendor) + private_eap_identity_t *this, uint32_t *vendor) { *vendor = 0; return EAP_IDENTITY; @@ -141,14 +141,14 @@ METHOD(eap_method_t, get_msk, status_t, return FAILED; } -METHOD(eap_method_t, get_identifier, u_int8_t, +METHOD(eap_method_t, get_identifier, uint8_t, private_eap_identity_t *this) { return this->identifier; } METHOD(eap_method_t, set_identifier, void, - private_eap_identity_t *this, u_int8_t identifier) + private_eap_identity_t *this, uint8_t identifier) { this->identifier = identifier; } diff --git a/src/libcharon/plugins/eap_md5/eap_md5.c b/src/libcharon/plugins/eap_md5/eap_md5.c index d314e7a9e..2cb0db466 100644 --- a/src/libcharon/plugins/eap_md5/eap_md5.c +++ b/src/libcharon/plugins/eap_md5/eap_md5.c @@ -49,7 +49,7 @@ struct private_eap_md5_t { /** * EAP message identifier */ - u_int8_t identifier; + uint8_t identifier; }; typedef struct eap_md5_header_t eap_md5_header_t; @@ -59,17 +59,17 @@ typedef struct eap_md5_header_t eap_md5_header_t; */ struct eap_md5_header_t { /** EAP code (REQUEST/RESPONSE) */ - u_int8_t code; + uint8_t code; /** unique message identifier */ - u_int8_t identifier; + uint8_t identifier; /** length of whole message */ - u_int16_t length; + uint16_t length; /** EAP type */ - u_int8_t type; + uint8_t type; /** length of value (challenge) */ - u_int8_t value_size; + uint8_t value_size; /** actual value */ - u_int8_t value[]; + uint8_t value[]; } __attribute__((__packed__)); #define CHALLENGE_LEN 16 @@ -204,7 +204,7 @@ METHOD(eap_method_t, process_server, status_t, } METHOD(eap_method_t, get_type, eap_type_t, - private_eap_md5_t *this, u_int32_t *vendor) + private_eap_md5_t *this, uint32_t *vendor) { *vendor = 0; return EAP_MD5; @@ -222,14 +222,14 @@ METHOD(eap_method_t, is_mutual, bool, return FALSE; } -METHOD(eap_method_t, get_identifier, u_int8_t, +METHOD(eap_method_t, get_identifier, uint8_t, private_eap_md5_t *this) { return this->identifier; } METHOD(eap_method_t, set_identifier, void, - private_eap_md5_t *this, u_int8_t identifier) + private_eap_md5_t *this, uint8_t identifier) { this->identifier = identifier; } diff --git a/src/libcharon/plugins/eap_mschapv2/eap_mschapv2.c b/src/libcharon/plugins/eap_mschapv2/eap_mschapv2.c index 16978f486..12f61f7f8 100644 --- a/src/libcharon/plugins/eap_mschapv2/eap_mschapv2.c +++ b/src/libcharon/plugins/eap_mschapv2/eap_mschapv2.c @@ -70,12 +70,12 @@ struct private_eap_mschapv2_t /** * EAP message identifier */ - u_int8_t identifier; + uint8_t identifier; /** * MS-CHAPv2-ID (session ID, increases with each retry) */ - u_int8_t mschapv2id; + uint8_t mschapv2id; /** * Number of retries @@ -179,21 +179,21 @@ typedef struct eap_mschapv2_response_t eap_mschapv2_response_t; struct eap_mschapv2_header_t { /** EAP code (REQUEST/RESPONSE) */ - u_int8_t code; + uint8_t code; /** unique message identifier */ - u_int8_t identifier; + uint8_t identifier; /** length of whole message */ - u_int16_t length; + uint16_t length; /** EAP type */ - u_int8_t type; + uint8_t type; /** MS-CHAPv2 OpCode */ - u_int8_t opcode; + uint8_t opcode; /** MS-CHAPv2-ID (equals identifier) */ - u_int8_t ms_chapv2_id; + uint8_t ms_chapv2_id; /** MS-Length (defined as length - 5) */ - u_int16_t ms_length; + uint16_t ms_length; /** packet data (determined by OpCode) */ - u_int8_t data[]; + uint8_t data[]; }__attribute__((__packed__)); /** @@ -202,11 +202,11 @@ struct eap_mschapv2_header_t struct eap_mschapv2_challenge_t { /** Value-Size */ - u_int8_t value_size; + uint8_t value_size; /** Challenge */ - u_int8_t challenge[CHALLENGE_LEN]; + uint8_t challenge[CHALLENGE_LEN]; /** Name */ - u_int8_t name[]; + uint8_t name[]; }__attribute__((__packed__)); /** @@ -215,21 +215,21 @@ struct eap_mschapv2_challenge_t struct eap_mschapv2_response_t { /** Value-Size */ - u_int8_t value_size; + uint8_t value_size; /** Response */ struct { /* Peer-Challenge*/ - u_int8_t peer_challenge[CHALLENGE_LEN]; + uint8_t peer_challenge[CHALLENGE_LEN]; /* Reserved (=zero) */ - u_int8_t peer_reserved[8]; + uint8_t peer_reserved[8]; /* NT-Response */ - u_int8_t nt_response[24]; + uint8_t nt_response[24]; /* Flags (=zero) */ - u_int8_t flags; + uint8_t flags; } response; /** Name */ - u_int8_t name[]; + uint8_t name[]; }__attribute__((__packed__)); /** @@ -597,10 +597,10 @@ static chunk_t extract_username(chunk_t id) /** * Set the ms_length field using aligned write */ -static void set_ms_length(eap_mschapv2_header_t *eap, u_int16_t len) +static void set_ms_length(eap_mschapv2_header_t *eap, uint16_t len) { len = htons(len - 5); - memcpy(&eap->ms_length, &len, sizeof(u_int16_t)); + memcpy(&eap->ms_length, &len, sizeof(uint16_t)); } METHOD(eap_method_t, initiate_peer, status_t, @@ -617,7 +617,7 @@ METHOD(eap_method_t, initiate_server, status_t, eap_mschapv2_header_t *eap; eap_mschapv2_challenge_t *cha; const char *name = MSCHAPV2_HOST_NAME; - u_int16_t len = CHALLENGE_PAYLOAD_LEN + sizeof(MSCHAPV2_HOST_NAME) - 1; + uint16_t len = CHALLENGE_PAYLOAD_LEN + sizeof(MSCHAPV2_HOST_NAME) - 1; rng = lib->crypto->create_rng(lib->crypto, RNG_WEAK); if (!rng || !rng->allocate_bytes(rng, CHALLENGE_LEN, &this->challenge)) @@ -690,7 +690,7 @@ static status_t process_peer_challenge(private_eap_mschapv2_t *this, eap_mschapv2_challenge_t *cha; eap_mschapv2_response_t *res; chunk_t data, peer_challenge, userid, username, nt_hash; - u_int16_t len = RESPONSE_PAYLOAD_LEN; + uint16_t len = RESPONSE_PAYLOAD_LEN; data = in->get_data(in); eap = (eap_mschapv2_header_t*)data.ptr; @@ -779,7 +779,7 @@ static status_t process_peer_success(private_eap_mschapv2_t *this, chunk_t data, auth_string = chunk_empty; char *message, *token, *msg = NULL; int message_len; - u_int16_t len = SHORT_HEADER_LEN; + uint16_t len = SHORT_HEADER_LEN; data = in->get_data(in); eap = (eap_mschapv2_header_t*)data.ptr; @@ -1011,7 +1011,7 @@ static status_t process_server_retry(private_eap_mschapv2_t *this, rng_t *rng; chunk_t hex; char msg[FAILURE_MESSAGE_LEN]; - u_int16_t len = HEADER_LEN + FAILURE_MESSAGE_LEN - 1; /* no null byte */ + uint16_t len = HEADER_LEN + FAILURE_MESSAGE_LEN - 1; /* no null byte */ if (++this->retries > MAX_RETRIES) { @@ -1127,7 +1127,7 @@ static status_t process_server_response(private_eap_mschapv2_t *this, { chunk_t hex; char msg[AUTH_RESPONSE_LEN + sizeof(SUCCESS_MESSAGE)]; - u_int16_t len = HEADER_LEN + AUTH_RESPONSE_LEN + sizeof(SUCCESS_MESSAGE); + uint16_t len = HEADER_LEN + AUTH_RESPONSE_LEN + sizeof(SUCCESS_MESSAGE); eap = alloca(len); eap->code = EAP_REQUEST; @@ -1213,7 +1213,7 @@ METHOD(eap_method_t, process_server, status_t, } METHOD(eap_method_t, get_type, eap_type_t, - private_eap_mschapv2_t *this, u_int32_t *vendor) + private_eap_mschapv2_t *this, uint32_t *vendor) { *vendor = 0; return EAP_MSCHAPV2; @@ -1230,14 +1230,14 @@ METHOD(eap_method_t, get_msk, status_t, return FAILED; } -METHOD(eap_method_t, get_identifier, u_int8_t, +METHOD(eap_method_t, get_identifier, uint8_t, private_eap_mschapv2_t *this) { return this->identifier; } METHOD(eap_method_t, set_identifier, void, - private_eap_mschapv2_t *this, u_int8_t identifier) + private_eap_mschapv2_t *this, uint8_t identifier) { this->identifier = identifier; } diff --git a/src/libcharon/plugins/eap_peap/eap_peap.c b/src/libcharon/plugins/eap_peap/eap_peap.c index c24dd578c..4778a0977 100644 --- a/src/libcharon/plugins/eap_peap/eap_peap.c +++ b/src/libcharon/plugins/eap_peap/eap_peap.c @@ -76,7 +76,7 @@ METHOD(eap_method_t, process, status_t, } METHOD(eap_method_t, get_type, eap_type_t, - private_eap_peap_t *this, u_int32_t *vendor) + private_eap_peap_t *this, uint32_t *vendor) { *vendor = 0; return EAP_PEAP; @@ -93,14 +93,14 @@ METHOD(eap_method_t, get_msk, status_t, return FAILED; } -METHOD(eap_method_t, get_identifier, u_int8_t, +METHOD(eap_method_t, get_identifier, uint8_t, private_eap_peap_t *this) { return this->tls_eap->get_identifier(this->tls_eap); } METHOD(eap_method_t, set_identifier, void, - private_eap_peap_t *this, u_int8_t identifier) + private_eap_peap_t *this, uint8_t identifier) { this->tls_eap->set_identifier(this->tls_eap, identifier); } diff --git a/src/libcharon/plugins/eap_peap/eap_peap_avp.c b/src/libcharon/plugins/eap_peap/eap_peap_avp.c index 3f541ba23..d5ce5fbc1 100644 --- a/src/libcharon/plugins/eap_peap/eap_peap_avp.c +++ b/src/libcharon/plugins/eap_peap/eap_peap_avp.c @@ -47,7 +47,7 @@ struct private_eap_peap_avp_t { METHOD(eap_peap_avp_t, build, void, private_eap_peap_avp_t *this, bio_writer_t *writer, chunk_t data) { - u_int8_t code; + uint8_t code; eap_packet_t *pkt; chunk_t avp_data; @@ -71,10 +71,10 @@ METHOD(eap_peap_avp_t, build, void, METHOD(eap_peap_avp_t, process, status_t, private_eap_peap_avp_t* this, bio_reader_t *reader, chunk_t *data, - u_int8_t identifier) + uint8_t identifier) { - u_int8_t code; - u_int16_t len; + uint8_t code; + uint16_t len; eap_packet_t *pkt; chunk_t avp_data; diff --git a/src/libcharon/plugins/eap_peap/eap_peap_avp.h b/src/libcharon/plugins/eap_peap/eap_peap_avp.h index 98c5f1912..cc5930b62 100644 --- a/src/libcharon/plugins/eap_peap/eap_peap_avp.h +++ b/src/libcharon/plugins/eap_peap/eap_peap_avp.h @@ -45,7 +45,7 @@ struct eap_peap_avp_t { * - NEED_MORE if another invocation of process/build needed */ status_t (*process)(eap_peap_avp_t *this, bio_reader_t *reader, - chunk_t *data, u_int8_t identifier); + chunk_t *data, uint8_t identifier); /** * Build EAP-PEAP Message AVP to send out. diff --git a/src/libcharon/plugins/eap_peap/eap_peap_peer.c b/src/libcharon/plugins/eap_peap/eap_peap_peer.c index f482c5b54..2668ac432 100644 --- a/src/libcharon/plugins/eap_peap/eap_peap_peer.c +++ b/src/libcharon/plugins/eap_peap/eap_peap_peer.c @@ -71,7 +71,7 @@ METHOD(tls_application_t, process, status_t, eap_payload_t *in; eap_code_t code; eap_type_t type, received_type; - u_int32_t vendor, received_vendor; + uint32_t vendor, received_vendor; status = this->avp->process(this->avp, reader, &data, this->ph1_method->get_identifier(this->ph1_method)); @@ -191,7 +191,7 @@ METHOD(tls_application_t, build, status_t, chunk_t data; eap_code_t code; eap_type_t type; - u_int32_t vendor; + uint32_t vendor; if (this->out) { diff --git a/src/libcharon/plugins/eap_peap/eap_peap_server.c b/src/libcharon/plugins/eap_peap/eap_peap_server.c index 33b01e95e..7f8348e06 100644 --- a/src/libcharon/plugins/eap_peap/eap_peap_server.c +++ b/src/libcharon/plugins/eap_peap/eap_peap_server.c @@ -167,7 +167,7 @@ METHOD(tls_application_t, process, status_t, eap_payload_t *in; eap_code_t code; eap_type_t type = EAP_NAK, received_type; - u_int32_t vendor, received_vendor; + uint32_t vendor, received_vendor; status = this->avp->process(this->avp, reader, &data, this->ph1_method->get_identifier(this->ph1_method)); @@ -336,7 +336,7 @@ METHOD(tls_application_t, build, status_t, chunk_t data; eap_code_t code; eap_type_t type; - u_int32_t vendor; + uint32_t vendor; if (this->ph2_method == NULL && this->start_phase2 && this->start_phase2_id) { diff --git a/src/libcharon/plugins/eap_radius/eap_radius.c b/src/libcharon/plugins/eap_radius/eap_radius.c index 237f065fa..a2530e653 100644 --- a/src/libcharon/plugins/eap_radius/eap_radius.c +++ b/src/libcharon/plugins/eap_radius/eap_radius.c @@ -55,12 +55,12 @@ struct private_eap_radius_t { /** * EAP vendor, if any */ - u_int32_t vendor; + uint32_t vendor; /** * EAP message identifier */ - u_int8_t identifier; + uint8_t identifier; /** * RADIUS client instance @@ -86,15 +86,15 @@ static void add_eap_identity(private_eap_radius_t *this, { struct { /** EAP code (REQUEST/RESPONSE) */ - u_int8_t code; + uint8_t code; /** unique message identifier */ - u_int8_t identifier; + uint8_t identifier; /** length of whole message */ - u_int16_t length; + uint16_t length; /** EAP type */ - u_int8_t type; + uint8_t type; /** identity data */ - u_int8_t data[]; + uint8_t data[]; } __attribute__((__packed__)) *hdr; chunk_t id, prefix; size_t len; @@ -156,7 +156,7 @@ void eap_radius_build_attributes(radius_message_t *request) ike_sa_t *ike_sa; host_t *host; char buf[40], *station_id_fmt;; - u_int32_t value; + uint32_t value; chunk_t chunk; /* virtual NAS-Port-Type */ @@ -314,8 +314,8 @@ static void process_filter_id(radius_message_t *msg) { enumerator_t *enumerator; int type; - u_int8_t tunnel_tag; - u_int32_t tunnel_type; + uint8_t tunnel_tag; + uint32_t tunnel_type; chunk_t filter_id = chunk_empty, data; bool is_esp_tunnel = FALSE; @@ -395,7 +395,7 @@ static void process_timeout(radius_message_t *msg) /** * Add a Cisco Unity configuration attribute */ -static void add_unity_attribute(eap_radius_provider_t *provider, u_int32_t id, +static void add_unity_attribute(eap_radius_provider_t *provider, uint32_t id, int type, chunk_t data) { switch (type) @@ -417,7 +417,7 @@ static void add_unity_attribute(eap_radius_provider_t *provider, u_int32_t id, * Add a DNS/NBNS configuration attribute */ static void add_nameserver_attribute(eap_radius_provider_t *provider, - u_int32_t id, int type, chunk_t data) + uint32_t id, int type, chunk_t data) { /* these are from different vendors, but there is currently no conflict */ switch (type) @@ -444,7 +444,7 @@ static void add_nameserver_attribute(eap_radius_provider_t *provider, * Add a UNITY_LOCAL_LAN or UNITY_SPLIT_INCLUDE attribute */ static void add_unity_split_attribute(eap_radius_provider_t *provider, - u_int32_t id, configuration_attribute_type_t type, + uint32_t id, configuration_attribute_type_t type, chunk_t data) { enumerator_t *enumerator; @@ -701,7 +701,7 @@ METHOD(eap_method_t, process, status_t, } METHOD(eap_method_t, get_type, eap_type_t, - private_eap_radius_t *this, u_int32_t *vendor) + private_eap_radius_t *this, uint32_t *vendor) { *vendor = this->vendor; return this->type; @@ -721,14 +721,14 @@ METHOD(eap_method_t, get_msk, status_t, return FAILED; } -METHOD(eap_method_t, get_identifier, u_int8_t, +METHOD(eap_method_t, get_identifier, uint8_t, private_eap_radius_t *this) { return this->identifier; } METHOD(eap_method_t, set_identifier, void, - private_eap_radius_t *this, u_int8_t identifier) + private_eap_radius_t *this, uint8_t identifier) { this->identifier = identifier; } diff --git a/src/libcharon/plugins/eap_radius/eap_radius_accounting.c b/src/libcharon/plugins/eap_radius/eap_radius_accounting.c index 4b7260349..0c302af51 100644 --- a/src/libcharon/plugins/eap_radius/eap_radius_accounting.c +++ b/src/libcharon/plugins/eap_radius/eap_radius_accounting.c @@ -54,7 +54,7 @@ struct private_eap_radius_accounting_t { /** * Session ID prefix */ - u_int32_t prefix; + uint32_t prefix; /** * Format string we use for Called/Calling-Station-Id for a host @@ -101,8 +101,8 @@ typedef enum { */ typedef struct { struct { - u_int64_t sent; - u_int64_t received; + uint64_t sent; + uint64_t received; } bytes, packets; } usage_t; @@ -133,7 +133,7 @@ static inline void sub_usage(usage_t *a, usage_t b) */ typedef struct { /** unique CHILD_SA identifier */ - u_int32_t id; + uint32_t id; /** usage stats for this SA */ usage_t usage; } sa_entry_t; @@ -172,7 +172,7 @@ typedef struct { radius_acct_terminate_cause_t cause; /* interim interval and timestamp of last update */ struct { - u_int32_t interval; + uint32_t interval; time_t last; } interim; /** did we send Accounting-Start */ @@ -237,7 +237,7 @@ static int sa_find(const void *a, const void *b) /** * Update or create usage counters of a cached SA */ -static void update_sa(entry_t *entry, u_int32_t id, usage_t usage) +static void update_sa(entry_t *entry, uint32_t id, usage_t usage) { sa_entry_t *sa, lookup; @@ -402,7 +402,7 @@ static void add_ike_sa_parameters(private_eap_radius_accounting_t *this, host_t *vip, *host; char buf[MAX_RADIUS_ATTRIBUTE_SIZE + 1]; chunk_t data; - u_int32_t value; + uint32_t value; /* virtual NAS-Port-Type */ value = htonl(5); @@ -461,7 +461,7 @@ static void add_ike_sa_parameters(private_eap_radius_accounting_t *this, * Get an existing or create a new entry from the locked session table */ static entry_t* get_or_create_entry(private_eap_radius_accounting_t *this, - ike_sa_id_t *id, u_int32_t unique) + ike_sa_id_t *id, uint32_t unique) { entry_t *entry; time_t now; @@ -520,7 +520,7 @@ static job_requeue_t send_interim(interim_data_t *data) enumerator_t *enumerator; ike_sa_t *ike_sa; entry_t *entry; - u_int32_t value; + uint32_t value; array_t *stats; sa_entry_t *sa, *found; @@ -681,7 +681,7 @@ static void send_start(private_eap_radius_accounting_t *this, ike_sa_t *ike_sa) { radius_message_t *message; entry_t *entry; - u_int32_t value; + uint32_t value; if (this->acct_req_vip && !has_vip(ike_sa)) { @@ -735,7 +735,7 @@ static void send_stop(private_eap_radius_accounting_t *this, ike_sa_t *ike_sa) enumerator_t *enumerator; entry_t *entry; sa_entry_t *sa; - u_int32_t value; + uint32_t value; this->mutex->lock(this->mutex); entry = this->sessions->remove(this->sessions, ike_sa->get_id(ike_sa)); @@ -931,7 +931,7 @@ METHOD(listener_t, child_rekey, bool, METHOD(listener_t, children_migrate, bool, private_eap_radius_accounting_t *this, ike_sa_t *ike_sa, ike_sa_id_t *new, - u_int32_t unique) + uint32_t unique) { enumerator_t *enumerator; sa_entry_t *sa, *sa_new, *cached; @@ -1020,7 +1020,7 @@ eap_radius_accounting_t *eap_radius_accounting_create() .destroy = _destroy, }, /* use system time as Session ID prefix */ - .prefix = (u_int32_t)time(NULL), + .prefix = (uint32_t)time(NULL), .sessions = hashtable_create((hashtable_hash_t)hash, (hashtable_equals_t)equals, 32), .mutex = mutex_create(MUTEX_TYPE_DEFAULT), @@ -1050,7 +1050,7 @@ eap_radius_accounting_t *eap_radius_accounting_create() /** * See header */ -void eap_radius_accounting_start_interim(ike_sa_t *ike_sa, u_int32_t interval) +void eap_radius_accounting_start_interim(ike_sa_t *ike_sa, uint32_t interval) { if (singleton) { diff --git a/src/libcharon/plugins/eap_radius/eap_radius_accounting.h b/src/libcharon/plugins/eap_radius/eap_radius_accounting.h index 8d4f9a0e1..f7a19c9b5 100644 --- a/src/libcharon/plugins/eap_radius/eap_radius_accounting.h +++ b/src/libcharon/plugins/eap_radius/eap_radius_accounting.h @@ -52,6 +52,6 @@ eap_radius_accounting_t *eap_radius_accounting_create(); * @param ike_sa IKE_SA to send updates for * @param interval interval for interim updates */ -void eap_radius_accounting_start_interim(ike_sa_t *ike_sa, u_int32_t interval); +void eap_radius_accounting_start_interim(ike_sa_t *ike_sa, uint32_t interval); #endif /** EAP_RADIUS_ACCOUNTING_H_ @}*/ diff --git a/src/libcharon/plugins/eap_radius/eap_radius_dae.c b/src/libcharon/plugins/eap_radius/eap_radius_dae.c index a0bf99efd..fc9b39c3e 100644 --- a/src/libcharon/plugins/eap_radius/eap_radius_dae.c +++ b/src/libcharon/plugins/eap_radius/eap_radius_dae.c @@ -293,7 +293,7 @@ static void process_disconnect(private_eap_radius_dae_t *this, * Apply a new lifetime to an IKE_SA */ static void apply_lifetime(private_eap_radius_dae_t *this, ike_sa_id_t *id, - u_int32_t lifetime) + uint32_t lifetime) { ike_sa_t *ike_sa; @@ -323,7 +323,7 @@ static void process_coa(private_eap_radius_dae_t *this, ike_sa_id_t *id; chunk_t data; int type; - u_int32_t lifetime = 0; + uint32_t lifetime = 0; bool lifetime_seen = FALSE; ids = get_matching_ike_sas(this, request, client); diff --git a/src/libcharon/plugins/eap_radius/eap_radius_forward.c b/src/libcharon/plugins/eap_radius/eap_radius_forward.c index 52ea84070..919e861be 100644 --- a/src/libcharon/plugins/eap_radius/eap_radius_forward.c +++ b/src/libcharon/plugins/eap_radius/eap_radius_forward.c @@ -63,9 +63,9 @@ struct private_eap_radius_forward_t { */ typedef struct { /** vendor ID, 0 for standard attributes */ - u_int32_t vendor; + uint32_t vendor; /** attribute type */ - u_int8_t type; + uint8_t type; } attr_t; /** @@ -132,7 +132,7 @@ static bool is_attribute_selected(linked_list_t *selector, radius_attribute_type_t type, chunk_t data) { enumerator_t *enumerator; - u_int32_t vendor = 0; + uint32_t vendor = 0; attr_t *sel; bool found = FALSE; diff --git a/src/libcharon/plugins/eap_radius/eap_radius_provider.c b/src/libcharon/plugins/eap_radius/eap_radius_provider.c index 0f207fbe6..9a87ad38d 100644 --- a/src/libcharon/plugins/eap_radius/eap_radius_provider.c +++ b/src/libcharon/plugins/eap_radius/eap_radius_provider.c @@ -469,7 +469,7 @@ METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*, } METHOD(eap_radius_provider_t, add_framed_ip, void, - private_eap_radius_provider_t *this, u_int32_t id, host_t *ip) + private_eap_radius_provider_t *this, uint32_t id, host_t *ip) { this->listener.mutex->lock(this->listener.mutex); add_addr(this, this->listener.unclaimed, id, ip); @@ -477,7 +477,7 @@ METHOD(eap_radius_provider_t, add_framed_ip, void, } METHOD(eap_radius_provider_t, add_attribute, void, - private_eap_radius_provider_t *this, u_int32_t id, + private_eap_radius_provider_t *this, uint32_t id, configuration_attribute_type_t type, chunk_t data) { attr_t *attr; diff --git a/src/libcharon/plugins/eap_radius/eap_radius_provider.h b/src/libcharon/plugins/eap_radius/eap_radius_provider.h index 5a62f4a38..80971bddb 100644 --- a/src/libcharon/plugins/eap_radius/eap_radius_provider.h +++ b/src/libcharon/plugins/eap_radius/eap_radius_provider.h @@ -42,7 +42,7 @@ struct eap_radius_provider_t { * @param id IKE_SA unique identifier * @param ip IP address received from RADIUS server, gets owned */ - void (*add_framed_ip)(eap_radius_provider_t *this, u_int32_t id, + void (*add_framed_ip)(eap_radius_provider_t *this, uint32_t id, host_t *ip); /** @@ -52,7 +52,7 @@ struct eap_radius_provider_t { * @param type attribute type * @param data attribute data */ - void (*add_attribute)(eap_radius_provider_t *this, u_int32_t id, + void (*add_attribute)(eap_radius_provider_t *this, uint32_t id, configuration_attribute_type_t type, chunk_t data); /** diff --git a/src/libcharon/plugins/eap_sim/eap_sim_peer.c b/src/libcharon/plugins/eap_sim/eap_sim_peer.c index 2637b4314..37f8a879e 100644 --- a/src/libcharon/plugins/eap_sim/eap_sim_peer.c +++ b/src/libcharon/plugins/eap_sim/eap_sim_peer.c @@ -64,7 +64,7 @@ struct private_eap_sim_peer_t { /** * EAP message identifier */ - u_int8_t identifier; + uint8_t identifier; /** * EAP-SIM crypto helper @@ -99,7 +99,7 @@ struct private_eap_sim_peer_t { /** * Counter value if reauthentication is used */ - u_int16_t counter; + uint16_t counter; }; /* version of SIM protocol we speak */ @@ -130,7 +130,7 @@ static bool create_client_error(private_eap_sim_peer_t *this, simaka_client_error_t code, eap_payload_t **out) { simaka_message_t *message; - u_int16_t encoded; + uint16_t encoded; DBG1(DBG_IKE, "sending client error '%N'", simaka_client_error_names, code); @@ -404,7 +404,7 @@ static status_t process_challenge(private_eap_sim_peer_t *this, */ static bool counter_too_small(private_eap_sim_peer_t *this, chunk_t chunk) { - u_int16_t counter; + uint16_t counter; memcpy(&counter, chunk.ptr, sizeof(counter)); counter = htons(counter); @@ -540,7 +540,7 @@ static status_t process_notification(private_eap_sim_peer_t *this, { if (type == AT_NOTIFICATION) { - u_int16_t code; + uint16_t code; memcpy(&code, data.ptr, sizeof(code)); code = ntohs(code); @@ -650,7 +650,7 @@ METHOD(eap_method_t, initiate, status_t, } METHOD(eap_method_t, get_type, eap_type_t, - private_eap_sim_peer_t *this, u_int32_t *vendor) + private_eap_sim_peer_t *this, uint32_t *vendor) { *vendor = 0; return EAP_SIM; @@ -667,14 +667,14 @@ METHOD(eap_method_t, get_msk, status_t, return FAILED; } -METHOD(eap_method_t, get_identifier, u_int8_t, +METHOD(eap_method_t, get_identifier, uint8_t, private_eap_sim_peer_t *this) { return this->identifier; } METHOD(eap_method_t, set_identifier, void, - private_eap_sim_peer_t *this, u_int8_t identifier) + private_eap_sim_peer_t *this, uint8_t identifier) { this->identifier = identifier; } diff --git a/src/libcharon/plugins/eap_sim/eap_sim_server.c b/src/libcharon/plugins/eap_sim/eap_sim_server.c index 5aa54db3e..3b413cfc6 100644 --- a/src/libcharon/plugins/eap_sim/eap_sim_server.c +++ b/src/libcharon/plugins/eap_sim/eap_sim_server.c @@ -67,7 +67,7 @@ struct private_eap_sim_server_t { /** * unique EAP identifier */ - u_int8_t identifier; + uint8_t identifier; /** * concatenated SRES values @@ -163,7 +163,7 @@ METHOD(eap_method_t, initiate, status_t, * Initiate EAP-SIM/Request/Re-authentication message */ static status_t reauthenticate(private_eap_sim_server_t *this, - char mk[HASH_SIZE_SHA1], u_int16_t counter, + char mk[HASH_SIZE_SHA1], uint16_t counter, eap_payload_t **out) { simaka_message_t *message; @@ -328,7 +328,7 @@ static status_t process_start(private_eap_sim_server_t *this, if (this->use_reauth && !nonce.len) { char mk[HASH_SIZE_SHA1]; - u_int16_t counter; + uint16_t counter; permanent = this->mgr->provider_is_reauth(this->mgr, id, mk, &counter); @@ -495,7 +495,7 @@ static status_t process_client_error(private_eap_sim_server_t *this, { if (type == AT_CLIENT_ERROR_CODE) { - u_int16_t code; + uint16_t code; memcpy(&code, data.ptr, sizeof(code)); DBG1(DBG_IKE, "received EAP-SIM client error '%N'", @@ -551,7 +551,7 @@ METHOD(eap_method_t, process, status_t, } METHOD(eap_method_t, get_type, eap_type_t, - private_eap_sim_server_t *this, u_int32_t *vendor) + private_eap_sim_server_t *this, uint32_t *vendor) { *vendor = 0; return EAP_SIM; @@ -568,14 +568,14 @@ METHOD(eap_method_t, get_msk, status_t, return FAILED; } -METHOD(eap_method_t, get_identifier, u_int8_t, +METHOD(eap_method_t, get_identifier, uint8_t, private_eap_sim_server_t *this) { return this->identifier; } METHOD(eap_method_t, set_identifier, void, - private_eap_sim_server_t *this, u_int8_t identifier) + private_eap_sim_server_t *this, uint8_t identifier) { this->identifier = identifier; } diff --git a/src/libcharon/plugins/eap_simaka_reauth/eap_simaka_reauth_card.c b/src/libcharon/plugins/eap_simaka_reauth/eap_simaka_reauth_card.c index 5bc5fd382..153ec0f0d 100644 --- a/src/libcharon/plugins/eap_simaka_reauth/eap_simaka_reauth_card.c +++ b/src/libcharon/plugins/eap_simaka_reauth/eap_simaka_reauth_card.c @@ -45,7 +45,7 @@ typedef struct { /** associated permanent identity */ identification_t *permanent; /** counter value */ - u_int16_t counter; + uint16_t counter; /** master key */ char mk[HASH_SIZE_SHA1]; } reauth_data_t; @@ -68,7 +68,7 @@ static bool equals(identification_t *key1, identification_t *key2) METHOD(simaka_card_t, get_reauth, identification_t*, private_eap_simaka_reauth_card_t *this, identification_t *id, - char mk[HASH_SIZE_SHA1], u_int16_t *counter) + char mk[HASH_SIZE_SHA1], uint16_t *counter) { reauth_data_t *data; identification_t *reauth; @@ -89,7 +89,7 @@ METHOD(simaka_card_t, get_reauth, identification_t*, METHOD(simaka_card_t, set_reauth, void, private_eap_simaka_reauth_card_t *this, identification_t *id, - identification_t* next, char mk[HASH_SIZE_SHA1], u_int16_t counter) + identification_t* next, char mk[HASH_SIZE_SHA1], uint16_t counter) { reauth_data_t *data; diff --git a/src/libcharon/plugins/eap_simaka_reauth/eap_simaka_reauth_provider.c b/src/libcharon/plugins/eap_simaka_reauth/eap_simaka_reauth_provider.c index 937095ec1..543b5579b 100644 --- a/src/libcharon/plugins/eap_simaka_reauth/eap_simaka_reauth_provider.c +++ b/src/libcharon/plugins/eap_simaka_reauth/eap_simaka_reauth_provider.c @@ -53,7 +53,7 @@ typedef struct { /** currently used reauthentication identity */ identification_t *id; /** counter value */ - u_int16_t counter; + uint16_t counter; /** master key */ char mk[HASH_SIZE_SHA1]; } reauth_data_t; @@ -92,7 +92,7 @@ static identification_t *gen_identity(private_eap_simaka_reauth_provider_t *this METHOD(simaka_provider_t, is_reauth, identification_t*, private_eap_simaka_reauth_provider_t *this, identification_t *id, - char mk[HASH_SIZE_SHA1], u_int16_t *counter) + char mk[HASH_SIZE_SHA1], uint16_t *counter) { identification_t *permanent; reauth_data_t *data; diff --git a/src/libcharon/plugins/eap_tls/eap_tls.c b/src/libcharon/plugins/eap_tls/eap_tls.c index bc01ba5df..79e87dc89 100644 --- a/src/libcharon/plugins/eap_tls/eap_tls.c +++ b/src/libcharon/plugins/eap_tls/eap_tls.c @@ -74,7 +74,7 @@ METHOD(eap_method_t, process, status_t, } METHOD(eap_method_t, get_type, eap_type_t, - private_eap_tls_t *this, u_int32_t *vendor) + private_eap_tls_t *this, uint32_t *vendor) { *vendor = 0; return EAP_TLS; @@ -91,14 +91,14 @@ METHOD(eap_method_t, get_msk, status_t, return FAILED; } -METHOD(eap_method_t, get_identifier, u_int8_t, +METHOD(eap_method_t, get_identifier, uint8_t, private_eap_tls_t *this) { return this->tls_eap->get_identifier(this->tls_eap); } METHOD(eap_method_t, set_identifier, void, - private_eap_tls_t *this, u_int8_t identifier) + private_eap_tls_t *this, uint8_t identifier) { this->tls_eap->set_identifier(this->tls_eap, identifier); } diff --git a/src/libcharon/plugins/eap_ttls/eap_ttls.c b/src/libcharon/plugins/eap_ttls/eap_ttls.c index c99d47f8d..9987c43d4 100644 --- a/src/libcharon/plugins/eap_ttls/eap_ttls.c +++ b/src/libcharon/plugins/eap_ttls/eap_ttls.c @@ -76,7 +76,7 @@ METHOD(eap_method_t, process, status_t, } METHOD(eap_method_t, get_type, eap_type_t, - private_eap_ttls_t *this, u_int32_t *vendor) + private_eap_ttls_t *this, uint32_t *vendor) { *vendor = 0; return EAP_TTLS; @@ -93,14 +93,14 @@ METHOD(eap_method_t, get_msk, status_t, return FAILED; } -METHOD(eap_method_t, get_identifier, u_int8_t, +METHOD(eap_method_t, get_identifier, uint8_t, private_eap_ttls_t *this) { return this->tls_eap->get_identifier(this->tls_eap); } METHOD(eap_method_t, set_identifier, void, - private_eap_ttls_t *this, u_int8_t identifier) + private_eap_ttls_t *this, uint8_t identifier) { this->tls_eap->set_identifier(this->tls_eap, identifier); } diff --git a/src/libcharon/plugins/eap_ttls/eap_ttls_avp.c b/src/libcharon/plugins/eap_ttls/eap_ttls_avp.c index 47e0f8afb..f75e3e0a6 100644 --- a/src/libcharon/plugins/eap_ttls/eap_ttls_avp.c +++ b/src/libcharon/plugins/eap_ttls/eap_ttls_avp.c @@ -58,8 +58,8 @@ METHOD(eap_ttls_avp_t, build, void, { char zero_padding[] = { 0x00, 0x00, 0x00 }; chunk_t avp_padding; - u_int8_t avp_flags; - u_int32_t avp_len; + uint8_t avp_flags; + uint32_t avp_len; avp_flags = 0x40; avp_len = 8 + data.len; @@ -81,9 +81,9 @@ METHOD(eap_ttls_avp_t, process, status_t, if (this->process_header) { bio_reader_t *header; - u_int32_t avp_code; - u_int8_t avp_flags; - u_int32_t avp_len; + uint32_t avp_code; + uint8_t avp_flags; + uint32_t avp_len; bool success; len = min(reader->remaining(reader), AVP_HEADER_LEN - this->inpos); diff --git a/src/libcharon/plugins/eap_ttls/eap_ttls_peer.c b/src/libcharon/plugins/eap_ttls/eap_ttls_peer.c index e0b59a681..be6a0812e 100644 --- a/src/libcharon/plugins/eap_ttls/eap_ttls_peer.c +++ b/src/libcharon/plugins/eap_ttls/eap_ttls_peer.c @@ -75,8 +75,8 @@ METHOD(tls_application_t, process, status_t, eap_packet_t *pkt; eap_code_t code; eap_type_t type, received_type; - u_int32_t vendor, received_vendor; - u_int16_t eap_len; + uint32_t vendor, received_vendor; + uint16_t eap_len; size_t eap_pos = 0; bool concatenated = FALSE; @@ -240,7 +240,7 @@ METHOD(tls_application_t, build, status_t, chunk_t data; eap_code_t code; eap_type_t type; - u_int32_t vendor; + uint32_t vendor; if (this->method == NULL && this->start_phase2) { diff --git a/src/libcharon/plugins/farp/farp_listener.c b/src/libcharon/plugins/farp/farp_listener.c index 87c84359c..e19fc5972 100644 --- a/src/libcharon/plugins/farp/farp_listener.c +++ b/src/libcharon/plugins/farp/farp_listener.c @@ -50,7 +50,7 @@ typedef struct { /** list of remote selectors */ linked_list_t *remote; /** reqid of CHILD_SA */ - u_int32_t reqid; + uint32_t reqid; } entry_t; METHOD(listener_t, child_updown, bool, diff --git a/src/libcharon/plugins/farp/farp_spoofer.c b/src/libcharon/plugins/farp/farp_spoofer.c index 9f66d7407..c2715bd5a 100644 --- a/src/libcharon/plugins/farp/farp_spoofer.c +++ b/src/libcharon/plugins/farp/farp_spoofer.c @@ -54,15 +54,15 @@ struct private_farp_spoofer_t { * IP over Ethernet ARP message */ typedef struct __attribute__((packed)) { - u_int16_t hardware_type; - u_int16_t protocol_type; - u_int8_t hardware_size; - u_int8_t protocol_size; - u_int16_t opcode; - u_int8_t sender_mac[6]; - u_int8_t sender_ip[4]; - u_int8_t target_mac[6]; - u_int8_t target_ip[4]; + uint16_t hardware_type; + uint16_t protocol_type; + uint8_t hardware_size; + uint8_t protocol_size; + uint16_t opcode; + uint8_t sender_mac[6]; + uint8_t sender_ip[4]; + uint8_t target_mac[6]; + uint8_t target_ip[4]; } arp_t; /** diff --git a/src/libcharon/plugins/forecast/forecast_forwarder.c b/src/libcharon/plugins/forecast/forecast_forwarder.c index 40aaa7f25..ce3909737 100644 --- a/src/libcharon/plugins/forecast/forecast_forwarder.c +++ b/src/libcharon/plugins/forecast/forecast_forwarder.c @@ -55,7 +55,7 @@ struct private_kernel_listener_t { /** * current broadcast address of internal network */ - u_int32_t broadcast; + uint32_t broadcast; /** * LAN interface index @@ -105,7 +105,7 @@ static void send_net(private_forecast_forwarder_t *this, /** * Send a broadcast/multicast packet to a peer */ -static void send_peer(private_forecast_forwarder_t *this, u_int32_t dst, +static void send_peer(private_forecast_forwarder_t *this, uint32_t dst, void *buf, size_t len, int mark) { struct sockaddr_in addr = { @@ -317,7 +317,7 @@ static void join_groups(private_kernel_listener_t *this, struct sockaddr *addr) /** * Attach the socket filter to the socket */ -static bool attach_filter(int fd, u_int32_t broadcast) +static bool attach_filter(int fd, uint32_t broadcast) { struct sock_filter filter_code[] = { /* destination address: is ... */ diff --git a/src/libcharon/plugins/forecast/forecast_listener.c b/src/libcharon/plugins/forecast/forecast_listener.c index 8f7f2600c..3f252db2d 100644 --- a/src/libcharon/plugins/forecast/forecast_listener.c +++ b/src/libcharon/plugins/forecast/forecast_listener.c @@ -67,7 +67,7 @@ struct private_forecast_listener_t { /** * Broadcast address on LAN interface, network order */ - u_int32_t broadcast; + uint32_t broadcast; }; /** @@ -85,13 +85,13 @@ typedef struct { /** remote IKE_SA endpoint */ host_t *rhost; /** inbound SPI */ - u_int32_t spi; + uint32_t spi; /** use UDP encapsulation */ bool encap; /** whether we should allow reencapsulation of IPsec received forecasts */ bool reinject; /** broadcast address used for that entry */ - u_int32_t broadcast; + uint32_t broadcast; } entry_t; /** @@ -115,7 +115,7 @@ static void entry_destroy(entry_t *entry) static bool ts2in(traffic_selector_t *ts, struct in_addr *addr, struct in_addr *mask) { - u_int8_t bits; + uint8_t bits; host_t *net; if (ts->get_type(ts) == TS_IPV4_ADDR_RANGE && @@ -179,12 +179,12 @@ static bool manage_rule(struct iptc_handle *ipth, const char *chain, static bool manage_pre_esp_in_udp(struct iptc_handle *ipth, entry_t *entry, bool add) { - u_int16_t match_size = XT_ALIGN(sizeof(struct ipt_entry_match)) + + uint16_t match_size = XT_ALIGN(sizeof(struct ipt_entry_match)) + XT_ALIGN(sizeof(struct xt_udp)); - u_int16_t target_offset = XT_ALIGN(sizeof(struct ipt_entry)) + match_size; - u_int16_t target_size = XT_ALIGN(sizeof(struct ipt_entry_target)) + + uint16_t target_offset = XT_ALIGN(sizeof(struct ipt_entry)) + match_size; + uint16_t target_size = XT_ALIGN(sizeof(struct ipt_entry_target)) + XT_ALIGN(sizeof(struct xt_mark_tginfo2)); - u_int16_t entry_size = target_offset + target_size; + uint16_t entry_size = target_offset + target_size; u_char ipt[entry_size], *pos = ipt; struct ipt_entry *e; @@ -240,12 +240,12 @@ static bool manage_pre_esp_in_udp(struct iptc_handle *ipth, */ static bool manage_pre_esp(struct iptc_handle *ipth, entry_t *entry, bool add) { - u_int16_t match_size = XT_ALIGN(sizeof(struct ipt_entry_match)) + + uint16_t match_size = XT_ALIGN(sizeof(struct ipt_entry_match)) + XT_ALIGN(sizeof(struct xt_esp)); - u_int16_t target_offset = XT_ALIGN(sizeof(struct ipt_entry)) + match_size; - u_int16_t target_size = XT_ALIGN(sizeof(struct ipt_entry_target)) + + uint16_t target_offset = XT_ALIGN(sizeof(struct ipt_entry)) + match_size; + uint16_t target_size = XT_ALIGN(sizeof(struct ipt_entry_target)) + XT_ALIGN(sizeof(struct xt_mark_tginfo2)); - u_int16_t entry_size = target_offset + target_size; + uint16_t entry_size = target_offset + target_size; u_char ipt[entry_size], *pos = ipt; struct ipt_entry *e; @@ -306,10 +306,10 @@ static bool manage_pre(struct iptc_handle *ipth, entry_t *entry, bool add) */ static bool manage_out(struct iptc_handle *ipth, entry_t *entry, bool add) { - u_int16_t target_offset = XT_ALIGN(sizeof(struct ipt_entry)); - u_int16_t target_size = XT_ALIGN(sizeof(struct ipt_entry_target)) + + uint16_t target_offset = XT_ALIGN(sizeof(struct ipt_entry)); + uint16_t target_size = XT_ALIGN(sizeof(struct ipt_entry_target)) + XT_ALIGN(sizeof(struct xt_mark_tginfo2)); - u_int16_t entry_size = target_offset + target_size; + uint16_t entry_size = target_offset + target_size; u_char ipt[entry_size], *pos = ipt; struct ipt_entry *e; @@ -617,7 +617,7 @@ METHOD(listener_t, ike_update, bool, * Filter to map entries to ts/mark */ static bool ts_filter(entry_t *entry, traffic_selector_t **ts, - traffic_selector_t **out, void *dummy, u_int32_t *mark, + traffic_selector_t **out, void *dummy, uint32_t *mark, void *dummy2, bool *reinject) { *out = *ts; diff --git a/src/libcharon/plugins/ha/ha_attribute.c b/src/libcharon/plugins/ha/ha_attribute.c index 2b271a8e7..b20ef876a 100644 --- a/src/libcharon/plugins/ha/ha_attribute.c +++ b/src/libcharon/plugins/ha/ha_attribute.c @@ -83,7 +83,7 @@ static host_t* offset2host(pool_t *pool, int offset) { chunk_t addr; host_t *host; - u_int32_t *pos; + uint32_t *pos; if (offset > pool->size) { @@ -93,11 +93,11 @@ static host_t* offset2host(pool_t *pool, int offset) addr = chunk_clone(pool->base->get_address(pool->base)); if (pool->base->get_family(pool->base) == AF_INET6) { - pos = (u_int32_t*)(addr.ptr + 12); + pos = (uint32_t*)(addr.ptr + 12); } else { - pos = (u_int32_t*)addr.ptr; + pos = (uint32_t*)addr.ptr; } *pos = htonl(offset + ntohl(*pos)); host = host_create_from_chunk(pool->base->get_family(pool->base), addr, 0); @@ -111,7 +111,7 @@ static host_t* offset2host(pool_t *pool, int offset) static int host2offset(pool_t *pool, host_t *addr) { chunk_t host, base; - u_int32_t hosti, basei; + uint32_t hosti, basei; if (addr->get_family(addr) != pool->base->get_family(pool->base)) { @@ -129,8 +129,8 @@ static int host2offset(pool_t *pool, host_t *addr) host = chunk_skip(host, 12); base = chunk_skip(base, 12); } - hosti = ntohl(*(u_int32_t*)(host.ptr)); - basei = ntohl(*(u_int32_t*)(base.ptr)); + hosti = ntohl(*(uint32_t*)(host.ptr)); + basei = ntohl(*(uint32_t*)(base.ptr)); if (hosti > basei + pool->size) { return -1; diff --git a/src/libcharon/plugins/ha/ha_cache.c b/src/libcharon/plugins/ha/ha_cache.c index 832dcf4ac..8394eb722 100644 --- a/src/libcharon/plugins/ha/ha_cache.c +++ b/src/libcharon/plugins/ha/ha_cache.c @@ -206,7 +206,7 @@ static status_t rekey_children(ike_sa_t *ike_sa) linked_list_t *children; struct { protocol_id_t protocol; - u_int32_t spi; + uint32_t spi; } *info; children = linked_list_create(); diff --git a/src/libcharon/plugins/ha/ha_child.c b/src/libcharon/plugins/ha/ha_child.c index 7dafb1693..8c9f66aa7 100644 --- a/src/libcharon/plugins/ha/ha_child.c +++ b/src/libcharon/plugins/ha/ha_child.c @@ -55,7 +55,7 @@ METHOD(listener_t, child_keys, bool, ha_message_t *m; chunk_t secret; proposal_t *proposal; - u_int16_t alg, len; + uint16_t alg, len; linked_list_t *local_ts, *remote_ts; enumerator_t *enumerator; traffic_selector_t *ts; @@ -69,7 +69,7 @@ METHOD(listener_t, child_keys, bool, m = ha_message_create(HA_CHILD_ADD); m->add_attribute(m, HA_IKE_ID, ike_sa->get_id(ike_sa)); - m->add_attribute(m, HA_INITIATOR, (u_int8_t)initiator); + m->add_attribute(m, HA_INITIATOR, (uint8_t)initiator); m->add_attribute(m, HA_INBOUND_SPI, child_sa->get_spi(child_sa, TRUE)); m->add_attribute(m, HA_OUTBOUND_SPI, child_sa->get_spi(child_sa, FALSE)); m->add_attribute(m, HA_INBOUND_CPI, child_sa->get_cpi(child_sa, TRUE)); diff --git a/src/libcharon/plugins/ha/ha_dispatcher.c b/src/libcharon/plugins/ha/ha_dispatcher.c index ce90f5bfe..ee66b8442 100644 --- a/src/libcharon/plugins/ha/ha_dispatcher.c +++ b/src/libcharon/plugins/ha/ha_dispatcher.c @@ -131,8 +131,8 @@ static void process_ike_add(private_ha_dispatcher_t *this, ha_message_t *message enumerator_t *enumerator; ike_sa_t *ike_sa = NULL, *old_sa = NULL; ike_version_t version = IKEV2; - u_int16_t encr = 0, len = 0, integ = 0, prf = 0, old_prf = PRF_UNDEFINED; - u_int16_t dh_grp = 0; + uint16_t encr = 0, len = 0, integ = 0, prf = 0, old_prf = PRF_UNDEFINED; + uint16_t dh_grp = 0; chunk_t nonce_i = chunk_empty, nonce_r = chunk_empty; chunk_t secret = chunk_empty, old_skd = chunk_empty; chunk_t dh_local = chunk_empty, dh_remote = chunk_empty, psk = chunk_empty; @@ -486,7 +486,7 @@ static void process_ike_mid(private_ha_dispatcher_t *this, ha_message_value_t value; enumerator_t *enumerator; ike_sa_t *ike_sa = NULL; - u_int32_t mid = 0; + uint32_t mid = 0; enumerator = message->create_attribute_enumerator(message); while (enumerator->enumerate(enumerator, &attribute, &value)) @@ -652,11 +652,11 @@ static void process_child_add(private_ha_dispatcher_t *this, child_sa_t *child_sa; proposal_t *proposal; bool initiator = FALSE, failed = FALSE, ok = FALSE; - u_int32_t inbound_spi = 0, outbound_spi = 0; - u_int16_t inbound_cpi = 0, outbound_cpi = 0; - u_int8_t mode = MODE_TUNNEL, ipcomp = 0; - u_int16_t encr = 0, integ = 0, len = 0, dh_grp = 0; - u_int16_t esn = NO_EXT_SEQ_NUMBERS; + uint32_t inbound_spi = 0, outbound_spi = 0; + uint16_t inbound_cpi = 0, outbound_cpi = 0; + uint8_t mode = MODE_TUNNEL, ipcomp = 0; + uint16_t encr = 0, integ = 0, len = 0, dh_grp = 0; + uint16_t esn = NO_EXT_SEQ_NUMBERS; u_int seg_i, seg_o; chunk_t nonce_i = chunk_empty, nonce_r = chunk_empty, secret = chunk_empty; chunk_t encr_i, integ_i, encr_r, integ_r; @@ -777,7 +777,7 @@ static void process_child_add(private_ha_dispatcher_t *this, if (ike_sa->get_version(ike_sa) == IKEV1) { keymat_v1_t *keymat_v1 = (keymat_v1_t*)ike_sa->get_keymat(ike_sa); - u_int32_t spi_i, spi_r; + uint32_t spi_i, spi_r; spi_i = initiator ? inbound_spi : outbound_spi; spi_r = initiator ? outbound_spi : inbound_spi; @@ -889,7 +889,7 @@ static void process_child_delete(private_ha_dispatcher_t *this, enumerator_t *enumerator; ike_sa_t *ike_sa = NULL; child_sa_t *child_sa; - u_int32_t spi = 0; + uint32_t spi = 0; enumerator = message->create_attribute_enumerator(message); while (enumerator->enumerate(enumerator, &attribute, &value)) diff --git a/src/libcharon/plugins/ha/ha_ike.c b/src/libcharon/plugins/ha/ha_ike.c index 3ffcaee6b..992ccb06c 100644 --- a/src/libcharon/plugins/ha/ha_ike.c +++ b/src/libcharon/plugins/ha/ha_ike.c @@ -78,7 +78,7 @@ METHOD(listener_t, ike_keys, bool, ha_message_t *m; chunk_t secret; proposal_t *proposal; - u_int16_t alg, len; + uint16_t alg, len; if (this->tunnel && this->tunnel->is_sa(this->tunnel, ike_sa)) { /* do not sync SA between nodes */ @@ -168,7 +168,7 @@ METHOD(listener_t, ike_updown, bool, { enumerator_t *enumerator; peer_cfg_t *peer_cfg; - u_int32_t extension, condition; + uint32_t extension, condition; host_t *addr; ike_sa_id_t *id; identification_t *eap_id; @@ -349,7 +349,7 @@ METHOD(listener_t, message_hook, bool, ha_message_t *m; notify_payload_t *notify; chunk_t data; - u_int32_t seq; + uint32_t seq; notify = message->get_notify(message, DPD_R_U_THERE); if (notify) diff --git a/src/libcharon/plugins/ha/ha_kernel.c b/src/libcharon/plugins/ha/ha_kernel.c index bd43dc351..061741eb7 100644 --- a/src/libcharon/plugins/ha/ha_kernel.c +++ b/src/libcharon/plugins/ha/ha_kernel.c @@ -15,8 +15,8 @@ #include "ha_kernel.h" -typedef u_int32_t u32; -typedef u_int8_t u8; +typedef uint32_t u32; +typedef uint8_t u8; #include <sys/utsname.h> #include <string.h> @@ -115,9 +115,9 @@ static jhash_version_t get_jhash_version() /** * jhash algorithm of two words, as used in kernel (using 0 as initval) */ -static u_int32_t jhash(jhash_version_t version, u_int32_t a, u_int32_t b) +static uint32_t jhash(jhash_version_t version, uint32_t a, uint32_t b) { - u_int32_t c = 0; + uint32_t c = 0; switch (version) { @@ -162,7 +162,7 @@ static u_int32_t jhash(jhash_version_t version, u_int32_t a, u_int32_t b) /** * Segmentate a calculated hash */ -static u_int hash2segment(private_ha_kernel_t *this, u_int64_t hash) +static u_int hash2segment(private_ha_kernel_t *this, uint64_t hash) { return ((hash * this->count) >> 32) + 1; } @@ -170,11 +170,11 @@ static u_int hash2segment(private_ha_kernel_t *this, u_int64_t hash) /** * Get a host as an integer for hashing */ -static u_int32_t host2int(host_t *host) +static uint32_t host2int(host_t *host) { if (host->get_family(host) == AF_INET) { - return *(u_int32_t*)host->get_address(host).ptr; + return *(uint32_t*)host->get_address(host).ptr; } return 0; } @@ -183,7 +183,7 @@ METHOD(ha_kernel_t, get_segment, u_int, private_ha_kernel_t *this, host_t *host) { unsigned long hash; - u_int32_t addr; + uint32_t addr; addr = host2int(host); hash = jhash(this->version, ntohl(addr), 0); @@ -192,10 +192,10 @@ METHOD(ha_kernel_t, get_segment, u_int, } METHOD(ha_kernel_t, get_segment_spi, u_int, - private_ha_kernel_t *this, host_t *host, u_int32_t spi) + private_ha_kernel_t *this, host_t *host, uint32_t spi) { unsigned long hash; - u_int32_t addr; + uint32_t addr; addr = host2int(host); hash = jhash(this->version, ntohl(addr), ntohl(spi)); diff --git a/src/libcharon/plugins/ha/ha_kernel.h b/src/libcharon/plugins/ha/ha_kernel.h index 7b56f1e3a..bd0a3825b 100644 --- a/src/libcharon/plugins/ha/ha_kernel.h +++ b/src/libcharon/plugins/ha/ha_kernel.h @@ -45,7 +45,7 @@ struct ha_kernel_t { * @param spi SPI to include in hash * @return segment number */ - u_int (*get_segment_spi)(ha_kernel_t *this, host_t *host, u_int32_t spi); + u_int (*get_segment_spi)(ha_kernel_t *this, host_t *host, uint32_t spi); /** * Get the segment an arbitrary integer is in. diff --git a/src/libcharon/plugins/ha/ha_message.c b/src/libcharon/plugins/ha/ha_message.c index b40219ce1..42dfaf0e2 100644 --- a/src/libcharon/plugins/ha/ha_message.c +++ b/src/libcharon/plugins/ha/ha_message.c @@ -67,10 +67,10 @@ typedef struct ike_sa_id_encoding_t ike_sa_id_encoding_t; * Encoding if an ike_sa_id_t */ struct ike_sa_id_encoding_t { - u_int8_t ike_version; - u_int64_t initiator_spi; - u_int64_t responder_spi; - u_int8_t initiator; + uint8_t ike_version; + uint64_t initiator_spi; + uint64_t responder_spi; + uint8_t initiator; } __attribute__((packed)); typedef struct identification_encoding_t identification_encoding_t; @@ -79,8 +79,8 @@ typedef struct identification_encoding_t identification_encoding_t; * Encoding of a identification_t */ struct identification_encoding_t { - u_int8_t type; - u_int8_t len; + uint8_t type; + uint8_t len; char encoding[]; } __attribute__((packed)); @@ -90,8 +90,8 @@ typedef struct host_encoding_t host_encoding_t; * encoding of a host_t */ struct host_encoding_t { - u_int16_t port; - u_int8_t family; + uint16_t port; + uint8_t family; char encoding[]; } __attribute__((packed)); @@ -101,11 +101,11 @@ typedef struct ts_encoding_t ts_encoding_t; * encoding of a traffic_selector_t */ struct ts_encoding_t { - u_int8_t type; - u_int8_t protocol; - u_int16_t from_port; - u_int16_t to_port; - u_int8_t dynamic; + uint8_t type; + uint8_t protocol; + uint16_t from_port; + uint16_t to_port; + uint8_t dynamic; char encoding[]; } __attribute__((packed)); @@ -139,9 +139,9 @@ METHOD(ha_message_t, add_attribute, void, size_t len; va_list args; - check_buf(this, sizeof(u_int8_t)); + check_buf(this, sizeof(uint8_t)); this->buf.ptr[this->buf.len] = attribute; - this->buf.len += sizeof(u_int8_t); + this->buf.len += sizeof(uint8_t); va_start(args, attribute); switch (attribute) @@ -215,13 +215,13 @@ METHOD(ha_message_t, add_attribute, void, this->buf.len += len; break; } - /* u_int8_t */ + /* uint8_t */ case HA_IKE_VERSION: case HA_INITIATOR: case HA_IPSEC_MODE: case HA_IPCOMP: { - u_int8_t val; + uint8_t val; val = va_arg(args, u_int); check_buf(this, sizeof(val)); @@ -229,7 +229,7 @@ METHOD(ha_message_t, add_attribute, void, this->buf.len += sizeof(val); break; } - /* u_int16_t */ + /* uint16_t */ case HA_ALG_DH: case HA_ALG_PRF: case HA_ALG_OLD_PRF: @@ -241,26 +241,26 @@ METHOD(ha_message_t, add_attribute, void, case HA_SEGMENT: case HA_ESN: { - u_int16_t val; + uint16_t val; val = va_arg(args, u_int); check_buf(this, sizeof(val)); - *(u_int16_t*)(this->buf.ptr + this->buf.len) = htons(val); + *(uint16_t*)(this->buf.ptr + this->buf.len) = htons(val); this->buf.len += sizeof(val); break; } - /** u_int32_t */ + /** uint32_t */ case HA_CONDITIONS: case HA_EXTENSIONS: case HA_INBOUND_SPI: case HA_OUTBOUND_SPI: case HA_MID: { - u_int32_t val; + uint32_t val; val = va_arg(args, u_int); check_buf(this, sizeof(val)); - *(u_int32_t*)(this->buf.ptr + this->buf.len) = htonl(val); + *(uint32_t*)(this->buf.ptr + this->buf.len) = htonl(val); this->buf.len += sizeof(val); break; } @@ -277,11 +277,11 @@ METHOD(ha_message_t, add_attribute, void, chunk_t chunk; chunk = va_arg(args, chunk_t); - check_buf(this, chunk.len + sizeof(u_int16_t)); - *(u_int16_t*)(this->buf.ptr + this->buf.len) = htons(chunk.len); - memcpy(this->buf.ptr + this->buf.len + sizeof(u_int16_t), + check_buf(this, chunk.len + sizeof(uint16_t)); + *(uint16_t*)(this->buf.ptr + this->buf.len) = htons(chunk.len); + memcpy(this->buf.ptr + this->buf.len + sizeof(uint16_t), chunk.ptr, chunk.len); - this->buf.len += chunk.len + sizeof(u_int16_t);; + this->buf.len += chunk.len + sizeof(uint16_t);; break; } /** traffic_selector_t */ @@ -309,7 +309,7 @@ METHOD(ha_message_t, add_attribute, void, default: { DBG1(DBG_CFG, "unable to encode, attribute %d unknown", attribute); - this->buf.len -= sizeof(u_int8_t); + this->buf.len -= sizeof(uint8_t); break; } } @@ -435,22 +435,22 @@ METHOD(enumerator_t, attribute_enumerate, bool, this->buf = chunk_skip(this->buf, len + 1); return TRUE; } - /* u_int8_t */ + /* uint8_t */ case HA_IKE_VERSION: case HA_INITIATOR: case HA_IPSEC_MODE: case HA_IPCOMP: { - if (this->buf.len < sizeof(u_int8_t)) + if (this->buf.len < sizeof(uint8_t)) { return FALSE; } - value->u8 = *(u_int8_t*)this->buf.ptr; + value->u8 = *(uint8_t*)this->buf.ptr; *attr_out = attr; - this->buf = chunk_skip(this->buf, sizeof(u_int8_t)); + this->buf = chunk_skip(this->buf, sizeof(uint8_t)); return TRUE; } - /** u_int16_t */ + /** uint16_t */ case HA_ALG_DH: case HA_ALG_PRF: case HA_ALG_OLD_PRF: @@ -462,29 +462,29 @@ METHOD(enumerator_t, attribute_enumerate, bool, case HA_SEGMENT: case HA_ESN: { - if (this->buf.len < sizeof(u_int16_t)) + if (this->buf.len < sizeof(uint16_t)) { return FALSE; } - value->u16 = ntohs(*(u_int16_t*)this->buf.ptr); + value->u16 = ntohs(*(uint16_t*)this->buf.ptr); *attr_out = attr; - this->buf = chunk_skip(this->buf, sizeof(u_int16_t)); + this->buf = chunk_skip(this->buf, sizeof(uint16_t)); return TRUE; } - /** u_int32_t */ + /** uint32_t */ case HA_CONDITIONS: case HA_EXTENSIONS: case HA_INBOUND_SPI: case HA_OUTBOUND_SPI: case HA_MID: { - if (this->buf.len < sizeof(u_int32_t)) + if (this->buf.len < sizeof(uint32_t)) { return FALSE; } - value->u32 = ntohl(*(u_int32_t*)this->buf.ptr); + value->u32 = ntohl(*(uint32_t*)this->buf.ptr); *attr_out = attr; - this->buf = chunk_skip(this->buf, sizeof(u_int32_t)); + this->buf = chunk_skip(this->buf, sizeof(uint32_t)); return TRUE; } /** chunk_t */ @@ -499,12 +499,12 @@ METHOD(enumerator_t, attribute_enumerate, bool, { size_t len; - if (this->buf.len < sizeof(u_int16_t)) + if (this->buf.len < sizeof(uint16_t)) { return FALSE; } - len = ntohs(*(u_int16_t*)this->buf.ptr); - this->buf = chunk_skip(this->buf, sizeof(u_int16_t)); + len = ntohs(*(uint16_t*)this->buf.ptr); + this->buf = chunk_skip(this->buf, sizeof(uint16_t)); if (this->buf.len < len) { return FALSE; diff --git a/src/libcharon/plugins/ha/ha_message.h b/src/libcharon/plugins/ha/ha_message.h index fe1786edf..630c8af8f 100644 --- a/src/libcharon/plugins/ha/ha_message.h +++ b/src/libcharon/plugins/ha/ha_message.h @@ -92,9 +92,9 @@ enum ha_message_attribute_t { HA_REMOTE_ADDR, /** char*, name of configuration */ HA_CONFIG_NAME, - /** u_int32_t, bitset of ike_condition_t */ + /** uint32_t, bitset of ike_condition_t */ HA_CONDITIONS, - /** u_int32_t, bitset of ike_extension_t */ + /** uint32_t, bitset of ike_extension_t */ HA_EXTENSIONS, /** host_t*, local virtual IP */ HA_LOCAL_VIP, @@ -102,7 +102,7 @@ enum ha_message_attribute_t { HA_REMOTE_VIP, /** host_t*, known peer addresses (used for MOBIKE) */ HA_PEER_ADDR, - /** u_int8_t, initiator of an exchange, TRUE for local */ + /** uint8_t, initiator of an exchange, TRUE for local */ HA_INITIATOR, /** chunk_t, initiators nonce */ HA_NONCE_I, @@ -112,41 +112,41 @@ enum ha_message_attribute_t { HA_SECRET, /** chunk_t, SKd of old SA if rekeying */ HA_OLD_SKD, - /** u_int16_t, pseudo random function */ + /** uint16_t, pseudo random function */ HA_ALG_PRF, - /** u_int16_t, old pseudo random function if rekeying */ + /** uint16_t, old pseudo random function if rekeying */ HA_ALG_OLD_PRF, - /** u_int16_t, encryption algorithm */ + /** uint16_t, encryption algorithm */ HA_ALG_ENCR, - /** u_int16_t, encryption key size in bytes */ + /** uint16_t, encryption key size in bytes */ HA_ALG_ENCR_LEN, - /** u_int16_t, integrity protection algorithm */ + /** uint16_t, integrity protection algorithm */ HA_ALG_INTEG, - /** u_int16_t, DH group */ + /** uint16_t, DH group */ HA_ALG_DH, - /** u_int8_t, IPsec mode, TUNNEL|TRANSPORT|... */ + /** uint8_t, IPsec mode, TUNNEL|TRANSPORT|... */ HA_IPSEC_MODE, - /** u_int8_t, IPComp protocol */ + /** uint8_t, IPComp protocol */ HA_IPCOMP, - /** u_int32_t, inbound security parameter index */ + /** uint32_t, inbound security parameter index */ HA_INBOUND_SPI, - /** u_int32_t, outbound security parameter index */ + /** uint32_t, outbound security parameter index */ HA_OUTBOUND_SPI, - /** u_int16_t, inbound security parameter index */ + /** uint16_t, inbound security parameter index */ HA_INBOUND_CPI, - /** u_int16_t, outbound security parameter index */ + /** uint16_t, outbound security parameter index */ HA_OUTBOUND_CPI, /** traffic_selector_t*, local traffic selector */ HA_LOCAL_TS, /** traffic_selector_t*, remote traffic selector */ HA_REMOTE_TS, - /** u_int32_t, message ID */ + /** uint32_t, message ID */ HA_MID, - /** u_int16_t, HA segment */ + /** uint16_t, HA segment */ HA_SEGMENT, - /** u_int16_t, Extended Sequence numbers */ + /** uint16_t, Extended Sequence numbers */ HA_ESN, - /** u_int8_t, IKE version */ + /** uint8_t, IKE version */ HA_IKE_VERSION, /** chunk_t, own DH public value */ HA_LOCAL_DH, @@ -162,9 +162,9 @@ enum ha_message_attribute_t { * Union to enumerate typed attributes in a message */ union ha_message_value_t { - u_int8_t u8; - u_int16_t u16; - u_int32_t u32; + uint8_t u8; + uint16_t u16; + uint32_t u32; char *str; chunk_t chunk; ike_sa_id_t *ike_sa_id; diff --git a/src/libcharon/plugins/ha/ha_segments.h b/src/libcharon/plugins/ha/ha_segments.h index 76da38082..31d47e371 100644 --- a/src/libcharon/plugins/ha/ha_segments.h +++ b/src/libcharon/plugins/ha/ha_segments.h @@ -25,7 +25,7 @@ typedef struct ha_segments_t ha_segments_t; -typedef u_int16_t segment_mask_t; +typedef uint16_t segment_mask_t; /** * maximum number of segments diff --git a/src/libcharon/plugins/ha/ha_tunnel.c b/src/libcharon/plugins/ha/ha_tunnel.c index dd2399366..fd8e6466a 100644 --- a/src/libcharon/plugins/ha/ha_tunnel.c +++ b/src/libcharon/plugins/ha/ha_tunnel.c @@ -79,7 +79,7 @@ struct private_ha_tunnel_t { /** * Reqid of installed trap */ - u_int32_t trap; + uint32_t trap; /** * backend for HA SA diff --git a/src/libcharon/plugins/ipseckey/ipseckey.c b/src/libcharon/plugins/ipseckey/ipseckey.c index ca126d772..5ca1e27bc 100644 --- a/src/libcharon/plugins/ipseckey/ipseckey.c +++ b/src/libcharon/plugins/ipseckey/ipseckey.c @@ -34,17 +34,17 @@ struct private_ipseckey_t { /** * Precedence */ - u_int8_t precedence; + uint8_t precedence; /** * Gateway type */ - u_int8_t gateway_type; + uint8_t gateway_type; /** * Algorithm */ - u_int8_t algorithm; + uint8_t algorithm; /** * Gateway @@ -57,7 +57,7 @@ struct private_ipseckey_t { chunk_t public_key; }; -METHOD(ipseckey_t, get_precedence, u_int8_t, +METHOD(ipseckey_t, get_precedence, uint8_t, private_ipseckey_t *this) { return this->precedence; @@ -102,7 +102,7 @@ ipseckey_t *ipseckey_create_frm_rr(rr_t *rr) { private_ipseckey_t *this; bio_reader_t *reader = NULL; - u_int8_t label; + uint8_t label; chunk_t tmp; INIT(this, diff --git a/src/libcharon/plugins/ipseckey/ipseckey.h b/src/libcharon/plugins/ipseckey/ipseckey.h index 5885daeee..b19ec8920 100644 --- a/src/libcharon/plugins/ipseckey/ipseckey.h +++ b/src/libcharon/plugins/ipseckey/ipseckey.h @@ -85,7 +85,7 @@ struct ipseckey_t { * * @return precedence */ - u_int8_t (*get_precedence)(ipseckey_t *this); + uint8_t (*get_precedence)(ipseckey_t *this); /** * Get the type of the gateway. diff --git a/src/libcharon/plugins/ipseckey/ipseckey_cred.c b/src/libcharon/plugins/ipseckey/ipseckey_cred.c index 3ff6dd87d..6c041ce26 100644 --- a/src/libcharon/plugins/ipseckey/ipseckey_cred.c +++ b/src/libcharon/plugins/ipseckey/ipseckey_cred.c @@ -136,7 +136,7 @@ METHOD(credential_set_t, create_cert_enumerator, enumerator_t*, rr_set_t *rrset; rr_t *rrsig; bio_reader_t *reader; - u_int32_t nBefore, nAfter; + uint32_t nBefore, nAfter; chunk_t ignore; char *fqdn; diff --git a/src/libcharon/plugins/kernel_iph/kernel_iph_net.c b/src/libcharon/plugins/kernel_iph/kernel_iph_net.c index 6a8a96821..3633213f3 100644 --- a/src/libcharon/plugins/kernel_iph/kernel_iph_net.c +++ b/src/libcharon/plugins/kernel_iph/kernel_iph_net.c @@ -617,7 +617,7 @@ METHOD(kernel_net_t, del_ip, status_t, * Add or remove a route */ static status_t manage_route(private_kernel_iph_net_t *this, bool add, - chunk_t dst, u_int8_t prefixlen, host_t *gtw, char *name) + chunk_t dst, uint8_t prefixlen, host_t *gtw, char *name) { MIB_IPFORWARD_ROW2 row = { .DestinationPrefix = { @@ -705,14 +705,14 @@ static status_t manage_route(private_kernel_iph_net_t *this, bool add, } METHOD(kernel_net_t, add_route, status_t, - private_kernel_iph_net_t *this, chunk_t dst, u_int8_t prefixlen, + private_kernel_iph_net_t *this, chunk_t dst, uint8_t prefixlen, host_t *gateway, host_t *src, char *name) { return manage_route(this, TRUE, dst, prefixlen, gateway, name); } METHOD(kernel_net_t, del_route, status_t, - private_kernel_iph_net_t *this, chunk_t dst, u_int8_t prefixlen, + private_kernel_iph_net_t *this, chunk_t dst, uint8_t prefixlen, host_t *gateway, host_t *src, char *name) { return manage_route(this, FALSE, dst, prefixlen, gateway, name); diff --git a/src/libcharon/plugins/kernel_libipsec/kernel_libipsec_ipsec.c b/src/libcharon/plugins/kernel_libipsec/kernel_libipsec_ipsec.c index 4c8771e96..e6274e846 100644 --- a/src/libcharon/plugins/kernel_libipsec/kernel_libipsec_ipsec.c +++ b/src/libcharon/plugins/kernel_libipsec/kernel_libipsec_ipsec.c @@ -108,7 +108,7 @@ struct route_entry_t { /** Destination net */ chunk_t dst_net; /** Destination net prefixlen */ - u_int8_t prefixlen; + uint8_t prefixlen; /** Reference to exclude route, if any */ exclude_route_t *exclude; }; @@ -151,15 +151,15 @@ typedef struct policy_entry_t policy_entry_t; */ struct policy_entry_t { /** Direction of this policy: in, out, forward */ - u_int8_t direction; + uint8_t direction; /** Parameters of installed policy */ struct { /** Subnet and port */ host_t *net; /** Subnet mask */ - u_int8_t mask; + uint8_t mask; /** Protocol */ - u_int8_t proto; + uint8_t proto; } src, dst; /** Associated route installed for this policy */ route_entry_t *route; @@ -222,7 +222,7 @@ static inline bool policy_entry_equals(policy_entry_t *a, /** * Expiration callback */ -static void expire(u_int8_t protocol, u_int32_t spi, host_t *dst, bool hard) +static void expire(uint8_t protocol, uint32_t spi, host_t *dst, bool hard) { charon->kernel->expire(charon->kernel, protocol, spi, dst, hard); } @@ -235,24 +235,24 @@ METHOD(kernel_ipsec_t, get_features, kernel_feature_t, METHOD(kernel_ipsec_t, get_spi, status_t, private_kernel_libipsec_ipsec_t *this, host_t *src, host_t *dst, - u_int8_t protocol, u_int32_t *spi) + uint8_t protocol, uint32_t *spi) { return ipsec->sas->get_spi(ipsec->sas, src, dst, protocol, spi); } METHOD(kernel_ipsec_t, get_cpi, status_t, private_kernel_libipsec_ipsec_t *this, host_t *src, host_t *dst, - u_int16_t *cpi) + uint16_t *cpi) { return NOT_SUPPORTED; } METHOD(kernel_ipsec_t, add_sa, status_t, private_kernel_libipsec_ipsec_t *this, host_t *src, host_t *dst, - u_int32_t spi, u_int8_t protocol, u_int32_t reqid, mark_t mark, - u_int32_t tfc, lifetime_cfg_t *lifetime, u_int16_t enc_alg, chunk_t enc_key, - u_int16_t int_alg, chunk_t int_key, ipsec_mode_t mode, - u_int16_t ipcomp, u_int16_t cpi, u_int32_t replay_window, + uint32_t spi, uint8_t protocol, uint32_t reqid, mark_t mark, + uint32_t tfc, lifetime_cfg_t *lifetime, uint16_t enc_alg, chunk_t enc_key, + uint16_t int_alg, chunk_t int_key, ipsec_mode_t mode, + uint16_t ipcomp, uint16_t cpi, uint32_t replay_window, bool initiator, bool encap, bool esn, bool inbound, bool update, linked_list_t *src_ts, linked_list_t *dst_ts) { @@ -263,8 +263,8 @@ METHOD(kernel_ipsec_t, add_sa, status_t, } METHOD(kernel_ipsec_t, update_sa, status_t, - private_kernel_libipsec_ipsec_t *this, u_int32_t spi, u_int8_t protocol, - u_int16_t cpi, host_t *src, host_t *dst, host_t *new_src, host_t *new_dst, + private_kernel_libipsec_ipsec_t *this, uint32_t spi, uint8_t protocol, + uint16_t cpi, host_t *src, host_t *dst, host_t *new_src, host_t *new_dst, bool encap, bool new_encap, mark_t mark) { return NOT_SUPPORTED; @@ -272,8 +272,8 @@ METHOD(kernel_ipsec_t, update_sa, status_t, METHOD(kernel_ipsec_t, query_sa, status_t, private_kernel_libipsec_ipsec_t *this, host_t *src, host_t *dst, - u_int32_t spi, u_int8_t protocol, mark_t mark, u_int64_t *bytes, - u_int64_t *packets, time_t *time) + uint32_t spi, uint8_t protocol, mark_t mark, uint64_t *bytes, + uint64_t *packets, time_t *time) { return ipsec->sas->query_sa(ipsec->sas, src, dst, spi, protocol, mark, bytes, packets, time); @@ -281,7 +281,7 @@ METHOD(kernel_ipsec_t, query_sa, status_t, METHOD(kernel_ipsec_t, del_sa, status_t, private_kernel_libipsec_ipsec_t *this, host_t *src, host_t *dst, - u_int32_t spi, u_int8_t protocol, u_int16_t cpi, mark_t mark) + uint32_t spi, uint8_t protocol, uint16_t cpi, mark_t mark) { return ipsec->sas->del_sa(ipsec->sas, src, dst, spi, protocol, cpi, mark); } @@ -641,7 +641,7 @@ METHOD(kernel_ipsec_t, bypass_socket, bool, } METHOD(kernel_ipsec_t, enable_udp_decap, bool, - private_kernel_libipsec_ipsec_t *this, int fd, int family, u_int16_t port) + private_kernel_libipsec_ipsec_t *this, int fd, int family, uint16_t port) { return NOT_SUPPORTED; } diff --git a/src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c b/src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c index 6d9d63a98..cbce0a57b 100644 --- a/src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c +++ b/src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c @@ -347,7 +347,7 @@ struct route_entry_t { chunk_t dst_net; /** Destination net prefixlen */ - u_int8_t prefixlen; + uint8_t prefixlen; }; /** @@ -470,7 +470,7 @@ typedef struct policy_sa_fwd_t policy_sa_fwd_t; */ struct policy_sa_t { /** Priority assigned to the policy when installed with this SA */ - u_int32_t priority; + uint32_t priority; /** Type of the policy */ policy_type_t type; @@ -546,13 +546,13 @@ typedef struct policy_entry_t policy_entry_t; struct policy_entry_t { /** Direction of this policy: in, out, forward */ - u_int8_t direction; + uint8_t direction; /** Parameters of installed policy */ struct xfrm_selector sel; /** Optional mark */ - u_int32_t mark; + uint32_t mark; /** Associated route installed for this policy */ route_entry_t *route; @@ -561,7 +561,7 @@ struct policy_entry_t { linked_list_t *used_by; /** reqid for this policy */ - u_int32_t reqid; + uint32_t reqid; }; /** @@ -606,10 +606,10 @@ static bool policy_equals(policy_entry_t *key, policy_entry_t *other_key) /** * Calculate the priority of a policy */ -static inline u_int32_t get_priority(policy_entry_t *policy, +static inline uint32_t get_priority(policy_entry_t *policy, policy_priority_t prio) { - u_int32_t priority = PRIO_BASE; + uint32_t priority = PRIO_BASE; switch (prio) { case POLICY_PRIORITY_FALLBACK: @@ -636,7 +636,7 @@ static inline u_int32_t get_priority(policy_entry_t *policy, /** * Convert the general ipsec mode to the one defined in xfrm.h */ -static u_int8_t mode2kernel(ipsec_mode_t mode) +static uint8_t mode2kernel(ipsec_mode_t mode) { switch (mode) { @@ -663,7 +663,7 @@ static void host2xfrm(host_t *host, xfrm_address_t *xfrm) /** * Convert a struct xfrm_address to a host_t */ -static host_t* xfrm2host(int family, xfrm_address_t *xfrm, u_int16_t port) +static host_t* xfrm2host(int family, xfrm_address_t *xfrm, uint16_t port) { chunk_t chunk; @@ -685,7 +685,7 @@ static host_t* xfrm2host(int family, xfrm_address_t *xfrm, u_int16_t port) * Convert a traffic selector address range to subnet and its mask. */ static void ts2subnet(traffic_selector_t* ts, - xfrm_address_t *net, u_int8_t *mask) + xfrm_address_t *net, uint8_t *mask) { host_t *net_host; chunk_t net_chunk; @@ -700,7 +700,7 @@ static void ts2subnet(traffic_selector_t* ts, * Convert a traffic selector port range to port/portmask */ static void ts2ports(traffic_selector_t* ts, - u_int16_t *port, u_int16_t *mask) + uint16_t *port, uint16_t *mask) { uint16_t from, to, bitmask; int bit; @@ -742,7 +742,7 @@ static struct xfrm_selector ts2selector(traffic_selector_t *src, traffic_selector_t *dst) { struct xfrm_selector sel; - u_int16_t port; + uint16_t port; memset(&sel, 0, sizeof(sel)); sel.family = (src->get_type(src) == TS_IPV4_ADDR_RANGE) ? AF_INET : AF_INET6; @@ -775,8 +775,8 @@ static struct xfrm_selector ts2selector(traffic_selector_t *src, static traffic_selector_t* selector2ts(struct xfrm_selector *sel, bool src) { u_char *addr; - u_int8_t prefixlen; - u_int16_t port = 0; + uint8_t prefixlen; + uint16_t port = 0; host_t *host = NULL; if (src) @@ -833,7 +833,7 @@ static void process_acquire(private_kernel_netlink_ipsec_t *this, struct rtattr *rta; size_t rtasize; traffic_selector_t *src_ts, *dst_ts; - u_int32_t reqid = 0; + uint32_t reqid = 0; int proto = 0; acquire = NLMSG_DATA(hdr); @@ -878,8 +878,8 @@ static void process_expire(private_kernel_netlink_ipsec_t *this, struct nlmsghdr *hdr) { struct xfrm_user_expire *expire; - u_int32_t spi; - u_int8_t protocol; + uint32_t spi; + uint8_t protocol; host_t *dst; expire = NLMSG_DATA(hdr); @@ -913,7 +913,7 @@ static void process_migrate(private_kernel_netlink_ipsec_t *this, host_t *local = NULL, *remote = NULL; host_t *old_src = NULL, *old_dst = NULL; host_t *new_src = NULL, *new_dst = NULL; - u_int32_t reqid = 0; + uint32_t reqid = 0; policy_dir_t dir; policy_id = NLMSG_DATA(hdr); @@ -981,7 +981,7 @@ static void process_mapping(private_kernel_netlink_ipsec_t *this, struct nlmsghdr *hdr) { struct xfrm_user_mapping *mapping; - u_int32_t spi; + uint32_t spi; mapping = NLMSG_DATA(hdr); spi = mapping->id.spi; @@ -1080,13 +1080,13 @@ METHOD(kernel_ipsec_t, get_features, kernel_feature_t, * Get an SPI for a specific protocol from the kernel. */ static status_t get_spi_internal(private_kernel_netlink_ipsec_t *this, - host_t *src, host_t *dst, u_int8_t proto, u_int32_t min, u_int32_t max, - u_int32_t *spi) + host_t *src, host_t *dst, uint8_t proto, uint32_t min, uint32_t max, + uint32_t *spi) { netlink_buf_t request; struct nlmsghdr *hdr, *out; struct xfrm_userspi_info *userspi; - u_int32_t received_spi = 0; + uint32_t received_spi = 0; size_t len; memset(&request, 0, sizeof(request)); @@ -1147,7 +1147,7 @@ static status_t get_spi_internal(private_kernel_netlink_ipsec_t *this, METHOD(kernel_ipsec_t, get_spi, status_t, private_kernel_netlink_ipsec_t *this, host_t *src, host_t *dst, - u_int8_t protocol, u_int32_t *spi) + uint8_t protocol, uint32_t *spi) { if (get_spi_internal(this, src, dst, protocol, 0xc0000000, 0xcFFFFFFF, spi) != SUCCESS) @@ -1162,9 +1162,9 @@ METHOD(kernel_ipsec_t, get_spi, status_t, METHOD(kernel_ipsec_t, get_cpi, status_t, private_kernel_netlink_ipsec_t *this, host_t *src, host_t *dst, - u_int16_t *cpi) + uint16_t *cpi) { - u_int32_t received_spi = 0; + uint32_t received_spi = 0; if (get_spi_internal(this, src, dst, IPPROTO_COMP, 0x100, 0xEFFF, &received_spi) != SUCCESS) @@ -1173,7 +1173,7 @@ METHOD(kernel_ipsec_t, get_cpi, status_t, return FAILED; } - *cpi = htons((u_int16_t)ntohl(received_spi)); + *cpi = htons((uint16_t)ntohl(received_spi)); DBG2(DBG_KNL, "got CPI %.4x", ntohs(*cpi)); return SUCCESS; @@ -1201,10 +1201,10 @@ static bool add_mark(struct nlmsghdr *hdr, int buflen, mark_t mark) METHOD(kernel_ipsec_t, add_sa, status_t, private_kernel_netlink_ipsec_t *this, host_t *src, host_t *dst, - u_int32_t spi, u_int8_t protocol, u_int32_t reqid, mark_t mark, - u_int32_t tfc, lifetime_cfg_t *lifetime, u_int16_t enc_alg, chunk_t enc_key, - u_int16_t int_alg, chunk_t int_key, ipsec_mode_t mode, - u_int16_t ipcomp, u_int16_t cpi, u_int32_t replay_window, + uint32_t spi, uint8_t protocol, uint32_t reqid, mark_t mark, + uint32_t tfc, lifetime_cfg_t *lifetime, uint16_t enc_alg, chunk_t enc_key, + uint16_t int_alg, chunk_t int_key, ipsec_mode_t mode, + uint16_t ipcomp, uint16_t cpi, uint32_t replay_window, bool initiator, bool encap, bool esn, bool inbound, bool update, linked_list_t* src_ts, linked_list_t* dst_ts) { @@ -1212,7 +1212,7 @@ METHOD(kernel_ipsec_t, add_sa, status_t, char *alg_name; struct nlmsghdr *hdr; struct xfrm_usersa_info *sa; - u_int16_t icv_size = 64; + uint16_t icv_size = 64; ipsec_mode_t original_mode = mode; traffic_selector_t *first_src_ts, *first_dst_ts; status_t status = FAILED; @@ -1483,7 +1483,7 @@ METHOD(kernel_ipsec_t, add_sa, status_t, if (tfc && protocol == IPPROTO_ESP && mode == MODE_TUNNEL) { /* the kernel supports TFC padding only for tunnel mode ESP SAs */ - u_int32_t *tfcpad; + uint32_t *tfcpad; tfcpad = netlink_reserve(hdr, sizeof(request), XFRMA_TFCPAD, sizeof(*tfcpad)); @@ -1501,9 +1501,9 @@ METHOD(kernel_ipsec_t, add_sa, status_t, /* for ESN or larger replay windows we need the new * XFRMA_REPLAY_ESN_VAL attribute to configure a bitmap */ struct xfrm_replay_state_esn *replay; - u_int32_t bmp_size; + uint32_t bmp_size; - bmp_size = round_up(replay_window, sizeof(u_int32_t) * 8) / 8; + bmp_size = round_up(replay_window, sizeof(uint32_t) * 8) / 8; replay = netlink_reserve(hdr, sizeof(request), XFRMA_REPLAY_ESN_VAL, sizeof(*replay) + bmp_size); if (!replay) @@ -1511,7 +1511,7 @@ METHOD(kernel_ipsec_t, add_sa, status_t, goto failed; } /* bmp_len contains number uf __u32's */ - replay->bmp_len = bmp_size / sizeof(u_int32_t); + replay->bmp_len = bmp_size / sizeof(uint32_t); replay->replay_window = replay_window; DBG2(DBG_KNL, " using replay window of %u packets", replay_window); @@ -1555,10 +1555,10 @@ failed: * Allocates into one the replay state structure we get from the kernel. */ static void get_replay_state(private_kernel_netlink_ipsec_t *this, - u_int32_t spi, u_int8_t protocol, + uint32_t spi, uint8_t protocol, host_t *dst, mark_t mark, struct xfrm_replay_state_esn **replay_esn, - u_int32_t *replay_esn_len, + uint32_t *replay_esn_len, struct xfrm_replay_state **replay, struct xfrm_lifetime_cur **lifetime) { @@ -1658,8 +1658,8 @@ static void get_replay_state(private_kernel_netlink_ipsec_t *this, METHOD(kernel_ipsec_t, query_sa, status_t, private_kernel_netlink_ipsec_t *this, host_t *src, host_t *dst, - u_int32_t spi, u_int8_t protocol, mark_t mark, - u_int64_t *bytes, u_int64_t *packets, time_t *time) + uint32_t spi, uint8_t protocol, mark_t mark, + uint64_t *bytes, uint64_t *packets, time_t *time) { netlink_buf_t request; struct nlmsghdr *out = NULL, *hdr; @@ -1759,7 +1759,7 @@ METHOD(kernel_ipsec_t, query_sa, status_t, METHOD(kernel_ipsec_t, del_sa, status_t, private_kernel_netlink_ipsec_t *this, host_t *src, host_t *dst, - u_int32_t spi, u_int8_t protocol, u_int16_t cpi, mark_t mark) + uint32_t spi, uint8_t protocol, uint16_t cpi, mark_t mark) { netlink_buf_t request; struct nlmsghdr *hdr; @@ -1816,8 +1816,8 @@ METHOD(kernel_ipsec_t, del_sa, status_t, } METHOD(kernel_ipsec_t, update_sa, status_t, - private_kernel_netlink_ipsec_t *this, u_int32_t spi, u_int8_t protocol, - u_int16_t cpi, host_t *src, host_t *dst, host_t *new_src, host_t *new_dst, + private_kernel_netlink_ipsec_t *this, uint32_t spi, uint8_t protocol, + uint16_t cpi, host_t *src, host_t *dst, host_t *new_src, host_t *new_dst, bool old_encap, bool new_encap, mark_t mark) { netlink_buf_t request; @@ -1831,7 +1831,7 @@ METHOD(kernel_ipsec_t, update_sa, status_t, struct xfrm_replay_state *replay = NULL; struct xfrm_replay_state_esn *replay_esn = NULL; struct xfrm_lifetime_cur *lifetime = NULL; - u_int32_t replay_esn_len = 0; + uint32_t replay_esn_len = 0; status_t status = FAILED; /* if IPComp is used, we first update the IPComp SA */ @@ -2032,7 +2032,7 @@ METHOD(kernel_ipsec_t, flush_sas, status_t, struct nlmsghdr *hdr; struct xfrm_usersa_flush *flush; struct { - u_int8_t proto; + uint8_t proto; char *name; } protos[] = { { IPPROTO_AH, "AH" }, @@ -2115,7 +2115,7 @@ static status_t add_policy_internal(private_kernel_netlink_ipsec_t *this, { struct xfrm_user_tmpl *tmpl; struct { - u_int8_t proto; + uint8_t proto; bool use; } protos[] = { { IPPROTO_COMP, ipsec->cfg.ipcomp.transform != IPCOMP_NONE }, @@ -2491,7 +2491,7 @@ METHOD(kernel_ipsec_t, del_policy, status_t, struct nlmsghdr *hdr; struct xfrm_userpolicy_id *policy_id; bool is_installed = TRUE; - u_int32_t priority; + uint32_t priority; ipsec_sa_t assigned_sa = { .src = src, .dst = dst, @@ -2699,7 +2699,7 @@ typedef struct { /** layer 4 protocol */ int proto; /** port number, network order */ - u_int16_t port; + uint16_t port; } bypass_t; /** @@ -2839,7 +2839,7 @@ METHOD(kernel_ipsec_t, bypass_socket, bool, } METHOD(kernel_ipsec_t, enable_udp_decap, bool, - private_kernel_netlink_ipsec_t *this, int fd, int family, u_int16_t port) + private_kernel_netlink_ipsec_t *this, int fd, int family, uint16_t port) { int type = UDP_ENCAP_ESPINUDP; diff --git a/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c b/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c index f4394a14f..e297e356a 100644 --- a/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c +++ b/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c @@ -278,7 +278,7 @@ struct route_entry_t { chunk_t dst_net; /** Destination net prefixlen */ - u_int8_t prefixlen; + uint8_t prefixlen; }; /** @@ -513,12 +513,12 @@ struct private_kernel_netlink_net_t { /** * MTU to set on installed routes */ - u_int32_t mtu; + uint32_t mtu; /** * MSS to set on installed routes */ - u_int32_t mss; + uint32_t mss; }; /** @@ -526,7 +526,7 @@ struct private_kernel_netlink_net_t { */ static status_t manage_srcroute(private_kernel_netlink_net_t *this, int nlmsg_type, int flags, chunk_t dst_net, - u_int8_t prefixlen, host_t *gateway, + uint8_t prefixlen, host_t *gateway, host_t *src_ip, char *if_name); /** @@ -1217,7 +1217,7 @@ static void process_route(private_kernel_netlink_net_t *this, struct nlmsghdr *h struct rtmsg* msg = NLMSG_DATA(hdr); struct rtattr *rta = RTM_RTA(msg); size_t rtasize = RTM_PAYLOAD(hdr); - u_int32_t rta_oif = 0; + uint32_t rta_oif = 0; host_t *host = NULL; /* ignore routes added by us or in the local routing table (local addrs) */ @@ -1243,7 +1243,7 @@ static void process_route(private_kernel_netlink_net_t *this, struct nlmsghdr *h case RTA_OIF: if (RTA_PAYLOAD(rta) == sizeof(rta_oif)) { - rta_oif = *(u_int32_t*)RTA_DATA(rta); + rta_oif = *(uint32_t*)RTA_DATA(rta); } break; } @@ -1545,10 +1545,10 @@ typedef struct { chunk_t src; chunk_t dst; host_t *src_host; - u_int8_t dst_len; - u_int32_t table; - u_int32_t oif; - u_int32_t priority; + uint8_t dst_len; + uint32_t table; + uint32_t oif; + uint32_t priority; } rt_entry_t; /** @@ -1630,20 +1630,20 @@ static rt_entry_t *parse_route(struct nlmsghdr *hdr, rt_entry_t *route) case RTA_OIF: if (RTA_PAYLOAD(rta) == sizeof(route->oif)) { - route->oif = *(u_int32_t*)RTA_DATA(rta); + route->oif = *(uint32_t*)RTA_DATA(rta); } break; case RTA_PRIORITY: if (RTA_PAYLOAD(rta) == sizeof(route->priority)) { - route->priority = *(u_int32_t*)RTA_DATA(rta); + route->priority = *(uint32_t*)RTA_DATA(rta); } break; #ifdef HAVE_RTA_TABLE case RTA_TABLE: if (RTA_PAYLOAD(rta) == sizeof(route->table)) { - route->table = *(u_int32_t*)RTA_DATA(rta); + route->table = *(uint32_t*)RTA_DATA(rta); } break; #endif /* HAVE_RTA_TABLE*/ @@ -2144,7 +2144,7 @@ METHOD(kernel_net_t, del_ip, status_t, */ static status_t manage_srcroute(private_kernel_netlink_net_t *this, int nlmsg_type, int flags, chunk_t dst_net, - u_int8_t prefixlen, host_t *gateway, + uint8_t prefixlen, host_t *gateway, host_t *src_ip, char *if_name) { netlink_buf_t request; @@ -2160,7 +2160,7 @@ static status_t manage_srcroute(private_kernel_netlink_net_t *this, if (this->routing_table == 0 && prefixlen == 0) { chunk_t half_net; - u_int8_t half_prefixlen; + uint8_t half_prefixlen; status_t status; half_net = chunk_alloca(dst_net.len); @@ -2206,22 +2206,22 @@ static status_t manage_srcroute(private_kernel_netlink_net_t *this, if (this->mtu || this->mss) { chunk = chunk_alloca(RTA_LENGTH((sizeof(struct rtattr) + - sizeof(u_int32_t)) * 2)); + sizeof(uint32_t)) * 2)); chunk.len = 0; rta = (struct rtattr*)chunk.ptr; if (this->mtu) { rta->rta_type = RTAX_MTU; - rta->rta_len = RTA_LENGTH(sizeof(u_int32_t)); - memcpy(RTA_DATA(rta), &this->mtu, sizeof(u_int32_t)); + rta->rta_len = RTA_LENGTH(sizeof(uint32_t)); + memcpy(RTA_DATA(rta), &this->mtu, sizeof(uint32_t)); chunk.len = rta->rta_len; } if (this->mss) { rta = (struct rtattr*)(chunk.ptr + RTA_ALIGN(chunk.len)); rta->rta_type = RTAX_ADVMSS; - rta->rta_len = RTA_LENGTH(sizeof(u_int32_t)); - memcpy(RTA_DATA(rta), &this->mss, sizeof(u_int32_t)); + rta->rta_len = RTA_LENGTH(sizeof(uint32_t)); + memcpy(RTA_DATA(rta), &this->mss, sizeof(uint32_t)); chunk.len = RTA_ALIGN(chunk.len) + rta->rta_len; } netlink_add_attribute(hdr, RTA_METRICS, chunk, sizeof(request)); @@ -2231,7 +2231,7 @@ static status_t manage_srcroute(private_kernel_netlink_net_t *this, } METHOD(kernel_net_t, add_route, status_t, - private_kernel_netlink_net_t *this, chunk_t dst_net, u_int8_t prefixlen, + private_kernel_netlink_net_t *this, chunk_t dst_net, uint8_t prefixlen, host_t *gateway, host_t *src_ip, char *if_name) { status_t status; @@ -2262,7 +2262,7 @@ METHOD(kernel_net_t, add_route, status_t, } METHOD(kernel_net_t, del_route, status_t, - private_kernel_netlink_net_t *this, chunk_t dst_net, u_int8_t prefixlen, + private_kernel_netlink_net_t *this, chunk_t dst_net, uint8_t prefixlen, host_t *gateway, host_t *src_ip, char *if_name) { status_t status; @@ -2384,7 +2384,7 @@ static status_t init_address_list(private_kernel_netlink_net_t *this) * create or delete a rule to use our routing table */ static status_t manage_rule(private_kernel_netlink_net_t *this, int nlmsg_type, - int family, u_int32_t table, u_int32_t prio) + int family, uint32_t table, uint32_t prio) { netlink_buf_t request; struct nlmsghdr *hdr; diff --git a/src/libcharon/plugins/kernel_pfkey/kernel_pfkey_ipsec.c b/src/libcharon/plugins/kernel_pfkey/kernel_pfkey_ipsec.c index d505f1c33..880f2dc46 100644 --- a/src/libcharon/plugins/kernel_pfkey/kernel_pfkey_ipsec.c +++ b/src/libcharon/plugins/kernel_pfkey/kernel_pfkey_ipsec.c @@ -149,9 +149,9 @@ #define SADB_X_EXT_NATT 0x002 struct sadb_sa_2 { struct sadb_sa sa; - u_int16_t sadb_sa_natt_port; - u_int16_t sadb_reserved0; - u_int32_t sadb_reserved1; + uint16_t sadb_sa_natt_port; + uint16_t sadb_reserved0; + uint32_t sadb_reserved1; }; #endif @@ -286,7 +286,7 @@ struct route_entry_t { chunk_t dst_net; /** destination net prefixlen */ - u_int8_t prefixlen; + uint8_t prefixlen; /** reference to exclude route, if any */ exclude_route_t *exclude; @@ -407,7 +407,7 @@ typedef struct policy_sa_in_t policy_sa_in_t; */ struct policy_sa_t { /** Priority assigned to the policy when installed with this SA */ - u_int32_t priority; + uint32_t priority; /** Type of the policy */ policy_type_t type; @@ -481,19 +481,19 @@ typedef struct policy_entry_t policy_entry_t; */ struct policy_entry_t { /** Index assigned by the kernel */ - u_int32_t index; + uint32_t index; /** Direction of this policy: in, out, forward */ - u_int8_t direction; + uint8_t direction; /** Parameters of installed policy */ struct { /** Subnet and port */ host_t *net; /** Subnet mask */ - u_int8_t mask; + uint8_t mask; /** Protocol */ - u_int8_t proto; + uint8_t proto; } src, dst; /** Associated route installed for this policy */ @@ -514,8 +514,8 @@ static policy_entry_t *create_policy_entry(traffic_selector_t *src_ts, INIT(policy, .direction = dir, ); - u_int16_t port; - u_int8_t proto; + uint16_t port; + uint8_t proto; src_ts->to_subnet(src_ts, &policy->src.net, &policy->src.mask); dst_ts->to_subnet(dst_ts, &policy->dst.net, &policy->dst.mask); @@ -583,7 +583,7 @@ static inline bool policy_entry_equals(policy_entry_t *current, * compare the given kernel index with that of a policy */ static inline bool policy_entry_match_byindex(policy_entry_t *current, - u_int32_t *index) + uint32_t *index) { return current->index == *index; } @@ -591,10 +591,10 @@ static inline bool policy_entry_match_byindex(policy_entry_t *current, /** * Calculate the priority of a policy */ -static inline u_int32_t get_priority(policy_entry_t *policy, +static inline uint32_t get_priority(policy_entry_t *policy, policy_priority_t prio) { - u_int32_t priority = PRIO_BASE; + uint32_t priority = PRIO_BASE; switch (prio) { case POLICY_PRIORITY_FALLBACK: @@ -697,7 +697,7 @@ ENUM(sadb_ext_type_names, SADB_EXT_RESERVED, SADB_EXT_MAX, /** * convert a protocol identifier to the PF_KEY sa type */ -static u_int8_t proto2satype(u_int8_t proto) +static uint8_t proto2satype(uint8_t proto) { switch (proto) { @@ -715,7 +715,7 @@ static u_int8_t proto2satype(u_int8_t proto) /** * convert a PF_KEY sa type to a protocol identifier */ -static u_int8_t satype2proto(u_int8_t satype) +static uint8_t satype2proto(uint8_t satype) { switch (satype) { @@ -733,7 +733,7 @@ static u_int8_t satype2proto(u_int8_t satype) /** * convert the general ipsec mode to the one defined in ipsec.h */ -static u_int8_t mode2kernel(ipsec_mode_t mode) +static uint8_t mode2kernel(ipsec_mode_t mode) { switch (mode) { @@ -753,7 +753,7 @@ static u_int8_t mode2kernel(ipsec_mode_t mode) /** * convert the general policy direction to the one defined in ipsec.h */ -static u_int8_t dir2kernel(policy_dir_t dir) +static uint8_t dir2kernel(policy_dir_t dir) { switch (dir) { @@ -773,7 +773,7 @@ static u_int8_t dir2kernel(policy_dir_t dir) /** * convert the policy type to the one defined in ipsec.h */ -static inline u_int16_t type2kernel(policy_type_t type) +static inline uint16_t type2kernel(policy_type_t type) { switch (type) { @@ -791,7 +791,7 @@ static inline u_int16_t type2kernel(policy_type_t type) /** * convert the policy direction in ipsec.h to the general one. */ -static policy_dir_t kernel2dir(u_int8_t dir) +static policy_dir_t kernel2dir(uint8_t dir) { switch (dir) { @@ -898,7 +898,7 @@ static kernel_algorithm_t compression_algs[] = { static int lookup_algorithm(transform_type_t type, int ikev2) { kernel_algorithm_t *list; - u_int16_t alg = 0; + uint16_t alg = 0; switch (type) { @@ -929,7 +929,7 @@ static int lookup_algorithm(transform_type_t type, int ikev2) /** * Helper to set a port in a sockaddr_t, the port has to be in host order */ -static void set_port(sockaddr_t *addr, u_int16_t port) +static void set_port(sockaddr_t *addr, uint16_t port) { switch (addr->sa_family) { @@ -971,8 +971,8 @@ static size_t hostcpy(void *dest, host_t *host, bool include_port) /** * add a host to the given sadb_msg */ -static void add_addr_ext(struct sadb_msg *msg, host_t *host, u_int16_t type, - u_int8_t proto, u_int8_t prefixlen, bool include_port) +static void add_addr_ext(struct sadb_msg *msg, host_t *host, uint16_t type, + uint8_t proto, uint8_t prefixlen, bool include_port) { struct sadb_address *addr = (struct sadb_address*)PFKEY_EXT_ADD_NEXT(msg); size_t len; @@ -988,7 +988,7 @@ static void add_addr_ext(struct sadb_msg *msg, host_t *host, u_int16_t type, /** * adds an empty address extension to the given sadb_msg */ -static void add_anyaddr_ext(struct sadb_msg *msg, int family, u_int8_t type) +static void add_anyaddr_ext(struct sadb_msg *msg, int family, uint8_t type) { socklen_t len = (family == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6); @@ -1039,7 +1039,7 @@ static traffic_selector_t* sadb_address2ts(struct sadb_address *address) { traffic_selector_t *ts; host_t *host; - u_int8_t proto; + uint8_t proto; proto = address->sadb_address_proto; proto = proto == IPSEC_PROTO_ANY ? 0 : proto; @@ -1240,7 +1240,7 @@ static void process_acquire(private_kernel_pfkey_ipsec_t *this, struct sadb_msg* msg) { pfkey_msg_t response; - u_int32_t index, reqid = 0; + uint32_t index, reqid = 0; traffic_selector_t *src_ts, *dst_ts; policy_entry_t *policy; policy_sa_t *sa; @@ -1292,8 +1292,8 @@ static void process_expire(private_kernel_pfkey_ipsec_t *this, struct sadb_msg* msg) { pfkey_msg_t response; - u_int8_t protocol; - u_int32_t spi; + uint8_t protocol; + uint32_t spi; host_t *dst; bool hard; @@ -1330,7 +1330,7 @@ static void process_migrate(private_kernel_pfkey_ipsec_t *this, pfkey_msg_t response; traffic_selector_t *src_ts, *dst_ts; policy_dir_t dir; - u_int32_t reqid = 0; + uint32_t reqid = 0; host_t *local = NULL, *remote = NULL; DBG2(DBG_KNL, "received an SADB_X_MIGRATE"); @@ -1350,13 +1350,13 @@ static void process_migrate(private_kernel_pfkey_ipsec_t *this, if (response.x_kmaddress) { sockaddr_t *local_addr, *remote_addr; - u_int32_t local_len; + uint32_t local_len; local_addr = (sockaddr_t*)&response.x_kmaddress[1]; local = host_create_from_sockaddr(local_addr); local_len = (local_addr->sa_family == AF_INET6)? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in); - remote_addr = (sockaddr_t*)((u_int8_t*)local_addr + local_len); + remote_addr = (sockaddr_t*)((uint8_t*)local_addr + local_len); remote = host_create_from_sockaddr(remote_addr); DBG2(DBG_KNL, " kmaddress: %H...%H", local, remote); } @@ -1384,7 +1384,7 @@ static void process_mapping(private_kernel_pfkey_ipsec_t *this, struct sadb_msg* msg) { pfkey_msg_t response; - u_int32_t spi; + uint32_t spi; sockaddr_t *sa; host_t *dst, *new; @@ -1517,14 +1517,14 @@ static bool receive_events(private_kernel_pfkey_ipsec_t *this, int fd, */ static status_t get_spi_internal(private_kernel_pfkey_ipsec_t *this, - host_t *src, host_t *dst, u_int8_t proto, u_int32_t min, u_int32_t max, - u_int32_t *spi) + host_t *src, host_t *dst, uint8_t proto, uint32_t min, uint32_t max, + uint32_t *spi) { unsigned char request[PFKEY_BUFFER_SIZE]; struct sadb_msg *msg, *out; struct sadb_spirange *range; pfkey_msg_t response; - u_int32_t received_spi = 0; + uint32_t received_spi = 0; size_t len; memset(&request, 0, sizeof(request)); @@ -1570,7 +1570,7 @@ static status_t get_spi_internal(private_kernel_pfkey_ipsec_t *this, METHOD(kernel_ipsec_t, get_spi, status_t, private_kernel_pfkey_ipsec_t *this, host_t *src, host_t *dst, - u_int8_t protocol, u_int32_t *spi) + uint8_t protocol, uint32_t *spi) { if (get_spi_internal(this, src, dst, protocol, 0xc0000000, 0xcFFFFFFF, spi) != SUCCESS) @@ -1585,9 +1585,9 @@ METHOD(kernel_ipsec_t, get_spi, status_t, METHOD(kernel_ipsec_t, get_cpi, status_t, private_kernel_pfkey_ipsec_t *this, host_t *src, host_t *dst, - u_int16_t *cpi) + uint16_t *cpi) { - u_int32_t received_spi = 0; + uint32_t received_spi = 0; DBG2(DBG_KNL, "getting CPI"); @@ -1598,18 +1598,18 @@ METHOD(kernel_ipsec_t, get_cpi, status_t, return FAILED; } - *cpi = htons((u_int16_t)ntohl(received_spi)); + *cpi = htons((uint16_t)ntohl(received_spi)); DBG2(DBG_KNL, "got CPI %.4x", ntohs(*cpi)); return SUCCESS; } METHOD(kernel_ipsec_t, add_sa, status_t, - private_kernel_pfkey_ipsec_t *this, host_t *src, host_t *dst, u_int32_t spi, - u_int8_t protocol, u_int32_t reqid, mark_t mark, u_int32_t tfc, - lifetime_cfg_t *lifetime, u_int16_t enc_alg, chunk_t enc_key, - u_int16_t int_alg, chunk_t int_key, ipsec_mode_t mode, - u_int16_t ipcomp, u_int16_t cpi, u_int32_t replay_window, + private_kernel_pfkey_ipsec_t *this, host_t *src, host_t *dst, uint32_t spi, + uint8_t protocol, uint32_t reqid, mark_t mark, uint32_t tfc, + lifetime_cfg_t *lifetime, uint16_t enc_alg, chunk_t enc_key, + uint16_t int_alg, chunk_t int_key, ipsec_mode_t mode, + uint16_t ipcomp, uint16_t cpi, uint32_t replay_window, bool initiator, bool encap, bool esn, bool inbound, bool update, linked_list_t *src_ts, linked_list_t *dst_ts) { @@ -1793,8 +1793,8 @@ METHOD(kernel_ipsec_t, add_sa, status_t, } METHOD(kernel_ipsec_t, update_sa, status_t, - private_kernel_pfkey_ipsec_t *this, u_int32_t spi, u_int8_t protocol, - u_int16_t cpi, host_t *src, host_t *dst, host_t *new_src, host_t *new_dst, + private_kernel_pfkey_ipsec_t *this, uint32_t spi, uint8_t protocol, + uint16_t cpi, host_t *src, host_t *dst, host_t *new_src, host_t *new_dst, bool encap, bool new_encap, mark_t mark) { unsigned char request[PFKEY_BUFFER_SIZE]; @@ -1936,8 +1936,8 @@ METHOD(kernel_ipsec_t, update_sa, status_t, METHOD(kernel_ipsec_t, query_sa, status_t, private_kernel_pfkey_ipsec_t *this, host_t *src, host_t *dst, - u_int32_t spi, u_int8_t protocol, mark_t mark, - u_int64_t *bytes, u_int64_t *packets, time_t *time) + uint32_t spi, uint8_t protocol, mark_t mark, + uint64_t *bytes, uint64_t *packets, time_t *time) { unsigned char request[PFKEY_BUFFER_SIZE]; struct sadb_msg *msg, *out; @@ -2014,7 +2014,7 @@ METHOD(kernel_ipsec_t, query_sa, status_t, METHOD(kernel_ipsec_t, del_sa, status_t, private_kernel_pfkey_ipsec_t *this, host_t *src, host_t *dst, - u_int32_t spi, u_int8_t protocol, u_int16_t cpi, mark_t mark) + uint32_t spi, uint8_t protocol, uint16_t cpi, mark_t mark) { unsigned char request[PFKEY_BUFFER_SIZE]; struct sadb_msg *msg, *out; @@ -2074,7 +2074,7 @@ METHOD(kernel_ipsec_t, flush_sas, status_t, unsigned char request[PFKEY_BUFFER_SIZE]; struct sadb_msg *msg, *out; struct { - u_int8_t proto; + uint8_t proto; char *name; } protos[] = { { SADB_SATYPE_AH, "AH" }, @@ -2698,7 +2698,7 @@ METHOD(kernel_ipsec_t, del_policy, status_t, policy_sa_t *mapping, *to_remove = NULL; enumerator_t *enumerator; bool first = TRUE, is_installed = TRUE; - u_int32_t priority; + uint32_t priority; size_t len; ipsec_sa_t assigned_sa = { .src = src, @@ -2876,7 +2876,7 @@ METHOD(kernel_ipsec_t, flush_policies, status_t, * Register a socket for ACQUIRE/EXPIRE messages */ static status_t register_pfkey_socket(private_kernel_pfkey_ipsec_t *this, - u_int8_t satype) + uint8_t satype) { unsigned char request[PFKEY_BUFFER_SIZE]; struct sadb_msg *msg, *out; @@ -2931,7 +2931,7 @@ METHOD(kernel_ipsec_t, bypass_socket, bool, } memset(&policy, 0, sizeof(policy)); - policy.sadb_x_policy_len = sizeof(policy) / sizeof(u_int64_t); + policy.sadb_x_policy_len = sizeof(policy) / sizeof(uint64_t); policy.sadb_x_policy_exttype = SADB_X_EXT_POLICY; policy.sadb_x_policy_type = IPSEC_POLICY_BYPASS; @@ -2953,7 +2953,7 @@ METHOD(kernel_ipsec_t, bypass_socket, bool, } METHOD(kernel_ipsec_t, enable_udp_decap, bool, - private_kernel_pfkey_ipsec_t *this, int fd, int family, u_int16_t port) + private_kernel_pfkey_ipsec_t *this, int fd, int family, uint16_t port) { #ifndef __APPLE__ int type = UDP_ENCAP_ESPINUDP; diff --git a/src/libcharon/plugins/kernel_pfroute/kernel_pfroute_net.c b/src/libcharon/plugins/kernel_pfroute/kernel_pfroute_net.c index 4eebdfdad..5ab39bbfe 100644 --- a/src/libcharon/plugins/kernel_pfroute/kernel_pfroute_net.c +++ b/src/libcharon/plugins/kernel_pfroute/kernel_pfroute_net.c @@ -209,7 +209,7 @@ struct route_entry_t { chunk_t dst_net; /** Destination net prefixlen */ - u_int8_t prefixlen; + uint8_t prefixlen; }; /** @@ -420,7 +420,7 @@ struct private_kernel_pfroute_net_t * Forward declaration */ static status_t manage_route(private_kernel_pfroute_net_t *this, int op, - chunk_t dst_net, u_int8_t prefixlen, + chunk_t dst_net, uint8_t prefixlen, host_t *gateway, char *if_name); /** @@ -1381,7 +1381,7 @@ static void add_rt_ifname(struct rt_msghdr *hdr, int type, char *name) * Add or remove a route */ static status_t manage_route(private_kernel_pfroute_net_t *this, int op, - chunk_t dst_net, u_int8_t prefixlen, + chunk_t dst_net, uint8_t prefixlen, host_t *gateway, char *if_name) { struct { @@ -1473,7 +1473,7 @@ static status_t manage_route(private_kernel_pfroute_net_t *this, int op, } METHOD(kernel_net_t, add_route, status_t, - private_kernel_pfroute_net_t *this, chunk_t dst_net, u_int8_t prefixlen, + private_kernel_pfroute_net_t *this, chunk_t dst_net, uint8_t prefixlen, host_t *gateway, host_t *src_ip, char *if_name) { status_t status; @@ -1502,7 +1502,7 @@ METHOD(kernel_net_t, add_route, status_t, } METHOD(kernel_net_t, del_route, status_t, - private_kernel_pfroute_net_t *this, chunk_t dst_net, u_int8_t prefixlen, + private_kernel_pfroute_net_t *this, chunk_t dst_net, uint8_t prefixlen, host_t *gateway, host_t *src_ip, char *if_name) { status_t status; diff --git a/src/libcharon/plugins/kernel_wfp/kernel_wfp_ipsec.c b/src/libcharon/plugins/kernel_wfp/kernel_wfp_ipsec.c index e1c429885..086d06e85 100644 --- a/src/libcharon/plugins/kernel_wfp/kernel_wfp_ipsec.c +++ b/src/libcharon/plugins/kernel_wfp/kernel_wfp_ipsec.c @@ -45,7 +45,7 @@ struct private_kernel_wfp_ipsec_t { /** * Mix value to distribute SPI allocation randomly */ - u_int32_t mixspi; + uint32_t mixspi; /** * IKE bypass filters, as UINT64 filter LUID @@ -103,16 +103,16 @@ struct private_kernel_wfp_ipsec_t { */ typedef struct { /** SPI for this SA */ - u_int32_t spi; + uint32_t spi; /** protocol, IPPROTO_ESP/IPPROTO_AH */ - u_int8_t protocol; + uint8_t protocol; /** hard lifetime of SA */ - u_int32_t lifetime; + uint32_t lifetime; /** destination host address for this SPI */ host_t *dst; struct { /** algorithm */ - u_int16_t alg; + uint16_t alg; /** key */ chunk_t key; } integ, encr; @@ -144,13 +144,13 @@ typedef struct { /** policy destinaiton addresses */ traffic_selector_t *dst; /** WFP allocated LUID for inbound filter ID */ - u_int64_t policy_in; + uint64_t policy_in; /** WFP allocated LUID for outbound filter ID */ - u_int64_t policy_out; + uint64_t policy_out; /** WFP allocated LUID for forward inbound filter ID, tunnel mode only */ - u_int64_t policy_fwd_in; + uint64_t policy_fwd_in; /** WFP allocated LUID for forward outbound filter ID, tunnel mode only */ - u_int64_t policy_fwd_out; + uint64_t policy_fwd_out; /** have installed a route for it? */ bool route; } sp_entry_t; @@ -170,7 +170,7 @@ static void sp_entry_destroy(sp_entry_t *sp) */ typedef struct { /** reqid of entry */ - u_int32_t reqid; + uint32_t reqid; /** outer address on local host */ host_t *local; /** outer address on remote host */ @@ -186,17 +186,17 @@ typedef struct { /** UDP encapsulation */ bool encap; /** provider context, for tunnel mode only */ - u_int64_t provider; + uint64_t provider; /** WFP allocated LUID for SA context */ - u_int64_t sa_id; + uint64_t sa_id; /** WFP allocated LUID for tunnel mode IP-IPv4 inbound filter */ - u_int64_t ip_ipv4_in; + uint64_t ip_ipv4_in; /** WFP allocated LUID for tunnel mode IP-IPv4 outbound filter */ - u_int64_t ip_ipv4_out; + uint64_t ip_ipv4_out; /** WFP allocated LUID for tunnel mode IP-IPv6 inbound filter */ - u_int64_t ip_ipv6_in; + uint64_t ip_ipv6_in; /** WFP allocated LUID for tunnel mode IP-IPv6 outbound filter */ - u_int64_t ip_ipv6_out; + uint64_t ip_ipv6_out; } entry_t; /** @@ -206,7 +206,7 @@ typedef struct { /** destination net of route */ host_t *dst; /** prefix length of dst */ - u_int8_t mask; + uint8_t mask; /** source address for route */ host_t *src; /** gateway of route, NULL if directly attached */ @@ -348,9 +348,9 @@ static FWPM_FILTER_CONDITION0 *append_condition(FWPM_FILTER_CONDITION0 *conds[], /** * Convert an IPv4 prefix to a host order subnet mask */ -static u_int32_t prefix2mask(u_int8_t prefix) +static uint32_t prefix2mask(uint8_t prefix) { - u_int8_t netmask[4] = {}; + uint8_t netmask[4] = {}; int i; for (i = 0; i < sizeof(netmask); i++) @@ -370,7 +370,7 @@ static u_int32_t prefix2mask(u_int8_t prefix) * Convert a 16-bit range to a WFP condition */ static void range2cond(FWPM_FILTER_CONDITION0 *cond, - u_int16_t from, u_int16_t to) + uint16_t from, uint16_t to) { if (from == to) { @@ -399,11 +399,11 @@ static bool ts2condition(traffic_selector_t *ts, const GUID *target, FWPM_FILTER_CONDITION0 *cond; FWP_BYTE_ARRAY16 *addr; FWP_RANGE0 *range; - u_int16_t from_port, to_port; + uint16_t from_port, to_port; void *from, *to; - u_int8_t proto; + uint8_t proto; host_t *net; - u_int8_t prefix; + uint8_t prefix; from = ts->get_from_address(ts).ptr; to = ts->get_to_address(ts).ptr; @@ -496,7 +496,7 @@ static bool ts2condition(traffic_selector_t *ts, const GUID *target, { if (target == &FWPM_CONDITION_IP_LOCAL_ADDRESS) { - u_int8_t from_type, to_type, from_code, to_code; + uint8_t from_type, to_type, from_code, to_code; from_type = traffic_selector_icmp_type(from_port); to_type = traffic_selector_icmp_type(to_port); @@ -736,7 +736,7 @@ static bool install_sp(private_kernel_wfp_ipsec_t *this, sp_entry_t *sp, */ static bool install_ipip_ale(private_kernel_wfp_ipsec_t *this, host_t *local, host_t *remote, GUID *context, - bool inbound, int proto, u_int64_t *filter_id) + bool inbound, int proto, uint64_t *filter_id) { traffic_selector_t *lts, *rts; FWPM_FILTER_CONDITION0 *conds = NULL; @@ -1013,7 +1013,7 @@ static bool install_sa(private_kernel_wfp_ipsec_t *this, entry_t *entry, .ipVersion = version, }; struct { - u_int16_t alg; + uint16_t alg; chunk_t key; } integ = {}, encr = {}; DWORD res; @@ -1099,9 +1099,9 @@ static bool install_sa(private_kernel_wfp_ipsec_t *this, entry_t *entry, */ static void host2address6(host_t *host, void *out) { - u_int32_t *src, *dst = out; + uint32_t *src, *dst = out; - src = (u_int32_t*)host->get_address(host).ptr; + src = (uint32_t*)host->get_address(host).ptr; dst[0] = untoh32(&src[3]); dst[1] = untoh32(&src[2]); @@ -1273,7 +1273,7 @@ static bool generate_guid(private_kernel_wfp_ipsec_t *this, GUID *guid) { return FALSE; } - ok = rng->get_bytes(rng, sizeof(GUID), (u_int8_t*)guid); + ok = rng->get_bytes(rng, sizeof(GUID), (uint8_t*)guid); rng->destroy(rng); return ok; } @@ -1379,7 +1379,7 @@ static bool install_tunnel_sps(private_kernel_wfp_ipsec_t *this, entry_t *entry) * Reduce refcount, or uninstall a route if all refs gone */ static bool uninstall_route(private_kernel_wfp_ipsec_t *this, - host_t *dst, u_int8_t mask, host_t *src, host_t *gtw) + host_t *dst, uint8_t mask, host_t *src, host_t *gtw) { route_t *route, key = { .dst = dst, @@ -1421,7 +1421,7 @@ static bool uninstall_route(private_kernel_wfp_ipsec_t *this, * Install a single route, or refcount if exists */ static bool install_route(private_kernel_wfp_ipsec_t *this, - host_t *dst, u_int8_t mask, host_t *src, host_t *gtw) + host_t *dst, uint8_t mask, host_t *src, host_t *gtw) { route_t *route, key = { .dst = dst, @@ -1476,7 +1476,7 @@ static bool manage_route(private_kernel_wfp_ipsec_t *this, bool add) { host_t *src, *dst, *gtw; - u_int8_t mask; + uint8_t mask; bool done; if (!dst_ts->to_subnet(dst_ts, &dst, &mask)) @@ -1578,7 +1578,7 @@ static bool install(private_kernel_wfp_ipsec_t *this, entry_t *entry) */ typedef struct { /** reqid this trap is installed for */ - u_int32_t reqid; + uint32_t reqid; /** is this a forward policy trap for tunnel mode? */ bool fwd; /** do we have installed a route for this trap policy? */ @@ -1629,7 +1629,7 @@ static u_int hash_trap(trap_t *trap) static void acquire(private_kernel_wfp_ipsec_t *this, UINT64 filter_id, traffic_selector_t *src, traffic_selector_t *dst) { - u_int32_t reqid = 0; + uint32_t reqid = 0; trap_t *trap, key = { .filter_id = filter_id, }; @@ -1654,7 +1654,7 @@ static void acquire(private_kernel_wfp_ipsec_t *this, UINT64 filter_id, * Create a single host traffic selector from an FWP address definition */ static traffic_selector_t *addr2ts(FWP_IP_VERSION version, void *data, - u_int8_t protocol, u_int16_t from_port, u_int16_t to_port) + uint8_t protocol, uint16_t from_port, uint16_t to_port) { ts_type_t type; UINT32 ints[4]; @@ -1689,9 +1689,9 @@ static void WINAPI event_callback(void *user, const FWPM_NET_EVENT1 *event) { private_kernel_wfp_ipsec_t *this = user; traffic_selector_t *local = NULL, *remote = NULL; - u_int8_t protocol = 0; - u_int16_t from_local = 0, to_local = 65535; - u_int16_t from_remote = 0, to_remote = 65535; + uint8_t protocol = 0; + uint16_t from_local = 0, to_local = 65535; + uint16_t from_remote = 0, to_remote = 65535; if ((event->header.flags & FWPM_NET_EVENT_FLAG_LOCAL_ADDR_SET) && (event->header.flags & FWPM_NET_EVENT_FLAG_REMOTE_ADDR_SET)) @@ -1861,7 +1861,7 @@ static bool uninstall_trap(private_kernel_wfp_ipsec_t *this, trap_t *trap) * Create and install a new trap entry */ static bool add_trap(private_kernel_wfp_ipsec_t *this, - u_int32_t reqid, bool fwd, host_t *local, host_t *remote, + uint32_t reqid, bool fwd, host_t *local, host_t *remote, traffic_selector_t *src, traffic_selector_t *dst) { trap_t *trap; @@ -1893,7 +1893,7 @@ static bool add_trap(private_kernel_wfp_ipsec_t *this, * Uninstall and remove a new trap entry */ static bool remove_trap(private_kernel_wfp_ipsec_t *this, - u_int32_t reqid, bool fwd, + uint32_t reqid, bool fwd, traffic_selector_t *src, traffic_selector_t *dst) { enumerator_t *enumerator; @@ -1949,10 +1949,10 @@ static bool init_spi(private_kernel_wfp_ipsec_t *this) { return FALSE; } - ok = rng->get_bytes(rng, sizeof(this->nextspi), (u_int8_t*)&this->nextspi); + ok = rng->get_bytes(rng, sizeof(this->nextspi), (uint8_t*)&this->nextspi); if (ok) { - ok = rng->get_bytes(rng, sizeof(this->mixspi), (u_int8_t*)&this->mixspi); + ok = rng->get_bytes(rng, sizeof(this->mixspi), (uint8_t*)&this->mixspi); } rng->destroy(rng); return ok; @@ -1966,7 +1966,7 @@ static u_int permute(u_int x, u_int p) u_int qr; x = x % p; - qr = ((u_int64_t)x * x) % p; + qr = ((uint64_t)x * x) % p; if (x <= p / 2) { return qr; @@ -1976,7 +1976,7 @@ static u_int permute(u_int x, u_int p) METHOD(kernel_ipsec_t, get_spi, status_t, private_kernel_wfp_ipsec_t *this, host_t *src, host_t *dst, - u_int8_t protocol, u_int32_t *spi) + uint8_t protocol, uint32_t *spi) { /* To avoid sequencial SPIs, we use a one-to-one permuation function on * an incrementing counter, that is a full period PRNG for the range we @@ -1993,7 +1993,7 @@ METHOD(kernel_ipsec_t, get_spi, status_t, METHOD(kernel_ipsec_t, get_cpi, status_t, private_kernel_wfp_ipsec_t *this, host_t *src, host_t *dst, - u_int16_t *cpi) + uint16_t *cpi) { return NOT_SUPPORTED; } @@ -2005,7 +2005,7 @@ typedef struct { /* backref to kernel backend */ private_kernel_wfp_ipsec_t *this; /* SPI of expiring SA */ - u_int32_t spi; + uint32_t spi; /* destination address of expiring SA */ host_t *dst; /* is this a hard expire, or a rekey request? */ @@ -2027,7 +2027,7 @@ static void expire_data_destroy(expire_data_t *data) static job_requeue_t expire_job(expire_data_t *data) { private_kernel_wfp_ipsec_t *this = data->this; - u_int8_t protocol; + uint8_t protocol; entry_t *entry = NULL; sa_entry_t key = { .spi = data->spi, @@ -2074,8 +2074,8 @@ static job_requeue_t expire_job(expire_data_t *data) /** * Schedule an expire event for an SA */ -static void schedule_expire(private_kernel_wfp_ipsec_t *this, u_int32_t spi, - host_t *dst, u_int32_t lifetime, bool hard) +static void schedule_expire(private_kernel_wfp_ipsec_t *this, uint32_t spi, + host_t *dst, uint32_t lifetime, bool hard) { expire_data_t *data; @@ -2094,10 +2094,10 @@ static void schedule_expire(private_kernel_wfp_ipsec_t *this, u_int32_t spi, METHOD(kernel_ipsec_t, add_sa, status_t, private_kernel_wfp_ipsec_t *this, host_t *src, host_t *dst, - u_int32_t spi, u_int8_t protocol, u_int32_t reqid, mark_t mark, - u_int32_t tfc, lifetime_cfg_t *lifetime, u_int16_t enc_alg, chunk_t enc_key, - u_int16_t int_alg, chunk_t int_key, ipsec_mode_t mode, - u_int16_t ipcomp, u_int16_t cpi, u_int32_t replay_window, + uint32_t spi, uint8_t protocol, uint32_t reqid, mark_t mark, + uint32_t tfc, lifetime_cfg_t *lifetime, uint16_t enc_alg, chunk_t enc_key, + uint16_t int_alg, chunk_t int_key, ipsec_mode_t mode, + uint16_t ipcomp, uint16_t cpi, uint32_t replay_window, bool initiator, bool encap, bool esn, bool inbound, bool update, linked_list_t *src_ts, linked_list_t *dst_ts) { @@ -2186,8 +2186,8 @@ METHOD(kernel_ipsec_t, add_sa, status_t, } METHOD(kernel_ipsec_t, update_sa, status_t, - private_kernel_wfp_ipsec_t *this, u_int32_t spi, u_int8_t protocol, - u_int16_t cpi, host_t *src, host_t *dst, host_t *new_src, host_t *new_dst, + private_kernel_wfp_ipsec_t *this, uint32_t spi, uint8_t protocol, + uint16_t cpi, host_t *src, host_t *dst, host_t *new_src, host_t *new_dst, bool encap, bool new_encap, mark_t mark) { entry_t *entry; @@ -2291,8 +2291,8 @@ METHOD(kernel_ipsec_t, update_sa, status_t, METHOD(kernel_ipsec_t, query_sa, status_t, private_kernel_wfp_ipsec_t *this, host_t *src, host_t *dst, - u_int32_t spi, u_int8_t protocol, mark_t mark, u_int64_t *bytes, - u_int64_t *packets, time_t *time) + uint32_t spi, uint8_t protocol, mark_t mark, uint64_t *bytes, + uint64_t *packets, time_t *time) { /* It does not seem that WFP provides any means of getting per-SA traffic * statistics. IPsecGetStatistics0/1() provides global stats, and @@ -2303,7 +2303,7 @@ METHOD(kernel_ipsec_t, query_sa, status_t, METHOD(kernel_ipsec_t, del_sa, status_t, private_kernel_wfp_ipsec_t *this, host_t *src, host_t *dst, - u_int32_t spi, u_int8_t protocol, u_int16_t cpi, mark_t mark) + uint32_t spi, uint8_t protocol, uint16_t cpi, mark_t mark) { entry_t *entry; sa_entry_t key = { @@ -2479,7 +2479,7 @@ METHOD(kernel_ipsec_t, flush_policies, status_t, * Add a bypass policy for a specific UDP port */ static bool add_bypass(private_kernel_wfp_ipsec_t *this, - int family, u_int16_t port, bool inbound, UINT64 *luid) + int family, uint16_t port, bool inbound, UINT64 *luid) { FWPM_FILTER_CONDITION0 *cond, *conds = NULL; int count = 0; @@ -2547,7 +2547,7 @@ METHOD(kernel_ipsec_t, bypass_socket, bool, } saddr; int addrlen = sizeof(saddr); UINT64 filter_out, filter_in = 0; - u_int16_t port; + uint16_t port; if (getsockname(fd, &saddr.sa, &addrlen) == SOCKET_ERROR) { @@ -2584,7 +2584,7 @@ METHOD(kernel_ipsec_t, bypass_socket, bool, } METHOD(kernel_ipsec_t, enable_udp_decap, bool, - private_kernel_wfp_ipsec_t *this, int fd, int family, u_int16_t port) + private_kernel_wfp_ipsec_t *this, int fd, int family, uint16_t port) { return FALSE; } diff --git a/src/libcharon/plugins/load_tester/load_tester_config.c b/src/libcharon/plugins/load_tester/load_tester_config.c index 8f6abde0c..9366556fc 100644 --- a/src/libcharon/plugins/load_tester/load_tester_config.c +++ b/src/libcharon/plugins/load_tester/load_tester_config.c @@ -124,7 +124,7 @@ struct private_load_tester_config_t { /** * Current port for unique initiator ports */ - u_int16_t unique_port; + uint16_t unique_port; /** * IKE_SA rekeying delay @@ -154,7 +154,7 @@ struct private_load_tester_config_t { /** * Dynamic source port, if used */ - u_int16_t port; + uint16_t port; /** * IKE version to use for load testing @@ -454,8 +454,8 @@ static void generate_auth_cfg(private_load_tester_config_t *this, char *str, /** * Parse a protoport specifier */ -static bool parse_protoport(char *token, u_int16_t *from_port, - u_int16_t *to_port, u_int8_t *protocol) +static bool parse_protoport(char *token, uint16_t *from_port, + uint16_t *to_port, uint8_t *protocol) { char *sep, *port = "", *endptr; struct protoent *proto; @@ -494,7 +494,7 @@ static bool parse_protoport(char *token, u_int16_t *from_port, { return FALSE; } - *protocol = (u_int8_t)p; + *protocol = (uint8_t)p; } } if (streq(port, "%any")) @@ -557,8 +557,8 @@ static void add_ts(private_load_tester_config_t *this, { enumerator_t *enumerator; char *subnet, *pos; - u_int16_t from_port, to_port; - u_int8_t proto; + uint16_t from_port, to_port; + uint8_t proto; enumerator = enumerator_create_token(string, ",", " "); while (enumerator->enumerate(enumerator, &subnet)) diff --git a/src/libcharon/plugins/load_tester/load_tester_creds.c b/src/libcharon/plugins/load_tester/load_tester_creds.c index d62c7295d..2f482962a 100644 --- a/src/libcharon/plugins/load_tester/load_tester_creds.c +++ b/src/libcharon/plugins/load_tester/load_tester_creds.c @@ -57,7 +57,7 @@ struct private_load_tester_creds_t { /** * serial number to issue certificates */ - u_int32_t serial; + uint32_t serial; /** * Preshared key for IKE @@ -307,7 +307,7 @@ METHOD(credential_set_t, create_cert_enumerator, enumerator_t*, identification_t *dn = NULL; linked_list_t *sans; char buf[128]; - u_int32_t serial; + uint32_t serial; time_t now; if (this->ca == NULL) diff --git a/src/libcharon/plugins/load_tester/load_tester_ipsec.c b/src/libcharon/plugins/load_tester/load_tester_ipsec.c index 6a86bb899..deca19088 100644 --- a/src/libcharon/plugins/load_tester/load_tester_ipsec.c +++ b/src/libcharon/plugins/load_tester/load_tester_ipsec.c @@ -36,7 +36,7 @@ struct private_load_tester_ipsec_t { METHOD(kernel_ipsec_t, get_spi, status_t, private_load_tester_ipsec_t *this, host_t *src, host_t *dst, - u_int8_t protocol, u_int32_t *spi) + uint8_t protocol, uint32_t *spi) { *spi = (uint32_t)ref_get(&this->spi); return SUCCESS; @@ -44,17 +44,17 @@ METHOD(kernel_ipsec_t, get_spi, status_t, METHOD(kernel_ipsec_t, get_cpi, status_t, private_load_tester_ipsec_t *this, host_t *src, host_t *dst, - u_int16_t *cpi) + uint16_t *cpi) { return FAILED; } METHOD(kernel_ipsec_t, add_sa, status_t, private_load_tester_ipsec_t *this, host_t *src, host_t *dst, - u_int32_t spi, u_int8_t protocol, u_int32_t reqid, mark_t mark, - u_int32_t tfc, lifetime_cfg_t *lifetime, u_int16_t enc_alg, chunk_t enc_key, - u_int16_t int_alg, chunk_t int_key, ipsec_mode_t mode, - u_int16_t ipcomp, u_int16_t cpi, u_int32_t replay_window, + uint32_t spi, uint8_t protocol, uint32_t reqid, mark_t mark, + uint32_t tfc, lifetime_cfg_t *lifetime, uint16_t enc_alg, chunk_t enc_key, + uint16_t int_alg, chunk_t int_key, ipsec_mode_t mode, + uint16_t ipcomp, uint16_t cpi, uint32_t replay_window, bool initiator, bool encap, bool esn, bool inbound, bool update, linked_list_t *src_ts, linked_list_t *dst_ts) { @@ -62,8 +62,8 @@ METHOD(kernel_ipsec_t, add_sa, status_t, } METHOD(kernel_ipsec_t, update_sa, status_t, - private_load_tester_ipsec_t *this, u_int32_t spi, u_int8_t protocol, - u_int16_t cpi, host_t *src, host_t *dst, host_t *new_src, + private_load_tester_ipsec_t *this, uint32_t spi, uint8_t protocol, + uint16_t cpi, host_t *src, host_t *dst, host_t *new_src, host_t *new_dst, bool encap, bool new_encap, mark_t mark) { return SUCCESS; @@ -71,15 +71,15 @@ METHOD(kernel_ipsec_t, update_sa, status_t, METHOD(kernel_ipsec_t, query_sa, status_t, private_load_tester_ipsec_t *this, host_t *src, host_t *dst, - u_int32_t spi, u_int8_t protocol, mark_t mark, - u_int64_t *bytes, u_int64_t *packets, time_t *time) + uint32_t spi, uint8_t protocol, mark_t mark, + uint64_t *bytes, uint64_t *packets, time_t *time) { return NOT_SUPPORTED; } METHOD(kernel_ipsec_t, del_sa, status_t, private_load_tester_ipsec_t *this, host_t *src, host_t *dst, - u_int32_t spi, u_int8_t protocol, u_int16_t cpi, mark_t mark) + uint32_t spi, uint8_t protocol, uint16_t cpi, mark_t mark) { return SUCCESS; } diff --git a/src/libcharon/plugins/smp/smp.c b/src/libcharon/plugins/smp/smp.c index 56b19c792..56891b263 100644 --- a/src/libcharon/plugins/smp/smp.c +++ b/src/libcharon/plugins/smp/smp.c @@ -374,7 +374,7 @@ static void request_control_terminate(xmlTextReaderPtr reader, xmlTextReaderNodeType(reader) == XML_READER_TYPE_TEXT) { const char *str; - u_int32_t id; + uint32_t id; status_t status; str = xmlTextReaderConstValue(reader); diff --git a/src/libcharon/plugins/socket_default/socket_default_socket.c b/src/libcharon/plugins/socket_default/socket_default_socket.c index 6e432d9cf..ba22b0c2b 100644 --- a/src/libcharon/plugins/socket_default/socket_default_socket.c +++ b/src/libcharon/plugins/socket_default/socket_default_socket.c @@ -84,12 +84,12 @@ struct private_socket_default_socket_t { /** * Configured port (or random, if initially 0) */ - u_int16_t port; + uint16_t port; /** * Configured port for NAT-T (or random, if initially 0) */ - u_int16_t natt; + uint16_t natt; /** * IPv4 socket (500 or port) @@ -114,22 +114,22 @@ struct private_socket_default_socket_t { /** * DSCP value set on IPv4 socket */ - u_int8_t dscp4; + uint8_t dscp4; /** * DSCP value set on IPv4 socket for NAT-T (4500 or natt) */ - u_int8_t dscp4_natt; + uint8_t dscp4_natt; /** * DSCP value set on IPv6 socket (500 or port) */ - u_int8_t dscp6; + uint8_t dscp6; /** * DSCP value set on IPv6 socket for NAT-T (4500 or natt) */ - u_int8_t dscp6_natt; + uint8_t dscp6_natt; /** * Maximum packet size to receive @@ -153,7 +153,7 @@ struct private_socket_default_socket_t { */ #ifdef IP_PKTINFO -static host_t *get_dst_v4(struct cmsghdr *cmsgptr, u_int16_t port) +static host_t *get_dst_v4(struct cmsghdr *cmsgptr, uint16_t port) { struct sockaddr_in dst = { .sin_family = AF_INET, @@ -174,7 +174,7 @@ static host_t *get_dst_v4(struct cmsghdr *cmsgptr, u_int16_t port) #elif defined(IP_RECVDSTADDR) -static host_t *get_dst_v4(struct cmsghdr *cmsgptr, u_int16_t port) +static host_t *get_dst_v4(struct cmsghdr *cmsgptr, uint16_t port) { struct sockaddr_in dst = { .sin_family = AF_INET, @@ -193,7 +193,7 @@ static host_t *get_dst_v4(struct cmsghdr *cmsgptr, u_int16_t port) #else /* IP_PKTINFO || IP_RECVDSTADDR */ -static host_t *get_dst_v4(struct cmsghdr *cmsgptr, u_int16_t port) +static host_t *get_dst_v4(struct cmsghdr *cmsgptr, uint16_t port) { return NULL; } @@ -206,7 +206,7 @@ static host_t *get_dst_v4(struct cmsghdr *cmsgptr, u_int16_t port) */ #ifdef HAVE_IN6_PKTINFO -static host_t *get_dst_v6(struct cmsghdr *cmsgptr, u_int16_t port) +static host_t *get_dst_v6(struct cmsghdr *cmsgptr, uint16_t port) { struct in6_pktinfo *pktinfo; struct sockaddr_in6 dst = { @@ -225,7 +225,7 @@ static host_t *get_dst_v6(struct cmsghdr *cmsgptr, u_int16_t port) #else /* HAVE_IN6_PKTINFO */ -static host_t *get_dst_v6(struct cmsghdr *cmsgptr, u_int16_t port) +static host_t *get_dst_v6(struct cmsghdr *cmsgptr, uint16_t port) { return NULL; } @@ -241,7 +241,7 @@ METHOD(socket_t, receiver, status_t, host_t *source = NULL, *dest = NULL; int i, rr, index, bytes_read = 0, selected = -1; bool oldstate; - u_int16_t port = 0; + uint16_t port = 0; struct pollfd pfd[] = { { .fd = this->ipv4, .events = POLLIN }, { .fd = this->ipv4_natt, .events = POLLIN }, @@ -464,7 +464,7 @@ METHOD(socket_t, sender, status_t, host_t *src, *dst; struct msghdr msg; struct iovec iov; - u_int8_t *dscp; + uint8_t *dscp; src = packet->get_source(packet); dst = packet->get_destination(packet); @@ -521,7 +521,7 @@ METHOD(socket_t, sender, status_t, { if (family == AF_INET) { - u_int8_t ds4; + uint8_t ds4; ds4 = packet->get_dscp(packet) << 2; if (setsockopt(skt, SOL_IP, IP_TOS, &ds4, sizeof(ds4)) == 0) @@ -584,7 +584,7 @@ METHOD(socket_t, sender, status_t, return SUCCESS; } -METHOD(socket_t, get_port, u_int16_t, +METHOD(socket_t, get_port, uint16_t, private_socket_default_socket_t *this, bool nat_t) { return nat_t ? this->natt : this->port; @@ -610,7 +610,7 @@ METHOD(socket_t, supported_families, socket_family_t, * open a socket to send and receive packets */ static int open_socket(private_socket_default_socket_t *this, - int family, u_int16_t *port) + int family, uint16_t *port) { int on = TRUE; union { diff --git a/src/libcharon/plugins/socket_dynamic/socket_dynamic_socket.c b/src/libcharon/plugins/socket_dynamic/socket_dynamic_socket.c index b89cae47b..ba92e10f2 100644 --- a/src/libcharon/plugins/socket_dynamic/socket_dynamic_socket.c +++ b/src/libcharon/plugins/socket_dynamic/socket_dynamic_socket.c @@ -107,7 +107,7 @@ struct dynsock_t { /** * Bound source port */ - u_int16_t port; + uint16_t port; }; /** @@ -324,7 +324,7 @@ METHOD(socket_t, receiver, status_t, /** * Get the port allocated dynamically using bind() */ -static bool get_dynamic_port(int fd, int family, u_int16_t *port) +static bool get_dynamic_port(int fd, int family, uint16_t *port) { union { struct sockaddr_storage ss; @@ -367,7 +367,7 @@ static bool get_dynamic_port(int fd, int family, u_int16_t *port) * open a socket to send and receive packets */ static int open_socket(private_socket_dynamic_socket_t *this, - int family, u_int16_t *port) + int family, uint16_t *port) { union { struct sockaddr_storage ss; @@ -481,7 +481,7 @@ static dynsock_t *get_any_socket(private_socket_dynamic_socket_t *this, * Find/Create a socket to send from host */ static dynsock_t *find_socket(private_socket_dynamic_socket_t *this, - int family, u_int16_t port) + int family, uint16_t port) { dynsock_t *skt, lookup = { .family = family, @@ -636,7 +636,7 @@ METHOD(socket_t, sender, status_t, return SUCCESS; } -METHOD(socket_t, get_port, u_int16_t, +METHOD(socket_t, get_port, uint16_t, private_socket_dynamic_socket_t *this, bool nat_t) { /* we return 0 here for users that have no explicit port configured, the diff --git a/src/libcharon/plugins/socket_win/socket_win_socket.c b/src/libcharon/plugins/socket_win/socket_win_socket.c index 94af08e80..c42783c77 100644 --- a/src/libcharon/plugins/socket_win/socket_win_socket.c +++ b/src/libcharon/plugins/socket_win/socket_win_socket.c @@ -51,7 +51,7 @@ struct private_socket_win_socket_t { /** * Port for each socket */ - u_int16_t ports[SOCKET_COUNT]; + uint16_t ports[SOCKET_COUNT]; /** * IPv4/IPv6 dual-use sockets @@ -205,7 +205,7 @@ METHOD(socket_t, receiver, status_t, METHOD(socket_t, sender, status_t, private_socket_win_socket_t *this, packet_t *packet) { - u_int16_t port; + uint16_t port; int i = -1, j; host_t *src, *dst; WSAMSG msg; @@ -316,7 +316,7 @@ METHOD(socket_t, sender, status_t, return SUCCESS; } -METHOD(socket_t, get_port, u_int16_t, +METHOD(socket_t, get_port, uint16_t, private_socket_win_socket_t *this, bool nat) { return this->ports[nat != 0]; diff --git a/src/libcharon/plugins/sql/sql_logger.c b/src/libcharon/plugins/sql/sql_logger.c index 0fa06eac5..46a894028 100644 --- a/src/libcharon/plugins/sql/sql_logger.c +++ b/src/libcharon/plugins/sql/sql_logger.c @@ -63,7 +63,7 @@ METHOD(logger_t, log_, void, chunk_t local_spi, remote_spi; host_t *local_host, *remote_host; identification_t *local_id, *remote_id; - u_int64_t ispi, rspi; + uint64_t ispi, rspi; ike_sa_id_t *id; id = ike_sa->get_id(ike_sa); diff --git a/src/libcharon/plugins/stroke/stroke_config.c b/src/libcharon/plugins/stroke/stroke_config.c index d0eb2aac3..0e6aee1b0 100644 --- a/src/libcharon/plugins/stroke/stroke_config.c +++ b/src/libcharon/plugins/stroke/stroke_config.c @@ -252,7 +252,7 @@ static void swap_ends(stroke_msg_t *msg) static ike_cfg_t *build_ike_cfg(private_stroke_config_t *this, stroke_msg_t *msg) { ike_cfg_t *ike_cfg; - u_int16_t ikeport; + uint16_t ikeport; char me[256], other[256]; swap_ends(msg); @@ -619,7 +619,7 @@ static peer_cfg_t *build_peer_cfg(private_stroke_config_t *this, identification_t *peer_id = NULL; peer_cfg_t *mediated_by = NULL; unique_policy_t unique; - u_int32_t rekey = 0, reauth = 0, over, jitter; + uint32_t rekey = 0, reauth = 0, over, jitter; peer_cfg_t *peer_cfg; auth_cfg_t *auth_cfg; @@ -883,8 +883,8 @@ static peer_cfg_t *build_peer_cfg(private_stroke_config_t *this, /** * Parse a protoport specifier */ -static bool parse_protoport(char *token, u_int16_t *from_port, - u_int16_t *to_port, u_int8_t *protocol) +static bool parse_protoport(char *token, uint16_t *from_port, + uint16_t *to_port, uint8_t *protocol) { char *sep, *port = "", *endptr; struct protoent *proto; @@ -923,7 +923,7 @@ static bool parse_protoport(char *token, u_int16_t *from_port, { return FALSE; } - *protocol = (u_int8_t)p; + *protocol = (uint8_t)p; } } if (streq(port, "%any")) @@ -1002,8 +1002,8 @@ static void add_ts(private_stroke_config_t *this, { enumerator_t *enumerator; char *subnet, *pos; - u_int16_t from_port, to_port; - u_int8_t proto; + uint16_t from_port, to_port; + uint8_t proto; enumerator = enumerator_create_token(end->subnets, ",", " "); while (enumerator->enumerate(enumerator, &subnet)) diff --git a/src/libcharon/plugins/stroke/stroke_control.c b/src/libcharon/plugins/stroke/stroke_control.c index 36da5ff21..fb60d3973 100644 --- a/src/libcharon/plugins/stroke/stroke_control.c +++ b/src/libcharon/plugins/stroke/stroke_control.c @@ -198,7 +198,7 @@ METHOD(stroke_control_t, initiate, void, /** * Parse a terminate/rekey specifier */ -static bool parse_specifier(char *string, u_int32_t *id, +static bool parse_specifier(char *string, uint32_t *id, char **name, bool *child, bool *all) { int len; @@ -266,7 +266,7 @@ static bool parse_specifier(char *string, u_int32_t *id, * Report the result of a terminate() call to console */ static void report_terminate_status(private_stroke_control_t *this, - status_t status, FILE *out, u_int32_t id, bool child) + status_t status, FILE *out, uint32_t id, bool child) { char *prefix, *postfix; @@ -300,7 +300,7 @@ static void report_terminate_status(private_stroke_control_t *this, /** * Call the charon controller to terminate a CHILD_SA */ -static void charon_terminate(private_stroke_control_t *this, u_int32_t id, +static void charon_terminate(private_stroke_control_t *this, uint32_t id, stroke_msg_t *msg, FILE *out, bool child) { if (msg->output_verbosity >= 0) @@ -336,7 +336,7 @@ METHOD(stroke_control_t, terminate, void, private_stroke_control_t *this, stroke_msg_t *msg, FILE *out) { char *name; - u_int32_t id; + uint32_t id; bool child, all; ike_sa_t *ike_sa; enumerator_t *enumerator; @@ -424,7 +424,7 @@ METHOD(stroke_control_t, rekey, void, private_stroke_control_t *this, stroke_msg_t *msg, FILE *out) { char *name; - u_int32_t id; + uint32_t id; bool child, all, finished = FALSE; ike_sa_t *ike_sa; enumerator_t *enumerator; @@ -591,13 +591,13 @@ METHOD(stroke_control_t, purge_ike, void, /** * Find an existing CHILD_SA/reqid */ -static u_int32_t find_reqid(child_cfg_t *child_cfg) +static uint32_t find_reqid(child_cfg_t *child_cfg) { enumerator_t *enumerator, *children; child_sa_t *child_sa; ike_sa_t *ike_sa; char *name; - u_int32_t reqid; + uint32_t reqid; reqid = charon->traps->find_reqid(charon->traps, child_cfg); if (reqid) @@ -636,7 +636,7 @@ static void charon_route(peer_cfg_t *peer_cfg, child_cfg_t *child_cfg, char *name, FILE *out) { ipsec_mode_t mode; - u_int32_t reqid; + uint32_t reqid; mode = child_cfg->get_mode(child_cfg); if (mode == MODE_PASS || mode == MODE_DROP) @@ -731,7 +731,7 @@ METHOD(stroke_control_t, unroute, void, { child_sa_t *child_sa; enumerator_t *enumerator; - u_int32_t id = 0; + uint32_t id = 0; if (charon->shunts->uninstall(charon->shunts, msg->unroute.name)) { diff --git a/src/libcharon/plugins/stroke/stroke_counter.c b/src/libcharon/plugins/stroke/stroke_counter.c index 5fa1fb165..e93fd4ef2 100644 --- a/src/libcharon/plugins/stroke/stroke_counter.c +++ b/src/libcharon/plugins/stroke/stroke_counter.c @@ -58,7 +58,7 @@ struct private_stroke_counter_t { /** * Global counter values */ - u_int64_t counter[COUNTER_MAX]; + uint64_t counter[COUNTER_MAX]; /** * Counters for specific connection names, char* => entry_t @@ -78,7 +78,7 @@ typedef struct { /** connection name */ char *name; /** counter values for connection */ - u_int64_t counter[COUNTER_MAX]; + uint64_t counter[COUNTER_MAX]; } entry_t; /** @@ -290,7 +290,7 @@ METHOD(listener_t, message_hook, bool, * Print a single counter value to out */ static void print_counter(FILE *out, stroke_counter_type_t type, - u_int64_t counter) + uint64_t counter) { fprintf(out, "%-18N %12llu\n", stroke_counter_type_names, type, counter); } @@ -300,7 +300,7 @@ static void print_counter(FILE *out, stroke_counter_type_t type, */ static void print_one(private_stroke_counter_t *this, FILE *out, char *name) { - u_int64_t counter[COUNTER_MAX]; + uint64_t counter[COUNTER_MAX]; entry_t *entry; int i; @@ -365,7 +365,7 @@ static void print_all(private_stroke_counter_t *this, FILE *out) */ static void print_global(private_stroke_counter_t *this, FILE *out) { - u_int64_t counter[COUNTER_MAX]; + uint64_t counter[COUNTER_MAX]; int i; this->lock->lock(this->lock); diff --git a/src/libcharon/plugins/stroke/stroke_list.c b/src/libcharon/plugins/stroke/stroke_list.c index 0371c7032..6c5703a16 100644 --- a/src/libcharon/plugins/stroke/stroke_list.c +++ b/src/libcharon/plugins/stroke/stroke_list.c @@ -206,7 +206,7 @@ static void log_ike_sa(FILE *out, ike_sa_t *ike_sa, bool all) static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all) { time_t use_in, use_out, rekey, now; - u_int64_t bytes_in, bytes_out, packets_in, packets_out; + uint64_t bytes_in, bytes_out, packets_in, packets_out; proposal_t *proposal; linked_list_t *my_ts, *other_ts; child_cfg_t *config; @@ -244,7 +244,7 @@ static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all) proposal = child_sa->get_proposal(child_sa); if (proposal) { - u_int16_t alg, ks; + uint16_t alg, ks; bool first = TRUE; if (proposal->get_algorithm(proposal, ENCRYPTION_ALGORITHM, @@ -286,7 +286,7 @@ static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all) { fprintf(out, " (%" PRIu64 " pkt%s, %" PRIu64 "s ago)", packets_in, (packets_in == 1) ? "": "s", - (u_int64_t)(now - use_in)); + (uint64_t)(now - use_in)); } child_sa->get_usestats(child_sa, FALSE, @@ -296,7 +296,7 @@ static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all) { fprintf(out, " (%" PRIu64 " pkt%s, %" PRIu64 "s ago)", packets_out, (packets_out == 1) ? "": "s", - (u_int64_t)(now - use_out)); + (uint64_t)(now - use_out)); } fprintf(out, ", rekeying "); @@ -474,7 +474,7 @@ METHOD(stroke_list_t, status, void, ike_version_t ike_version; char *pool; host_t *host; - u_int32_t dpd; + uint32_t dpd; time_t since, now; u_int size, online, offline, i; struct utsname utsname; diff --git a/src/libcharon/plugins/stroke/stroke_socket.c b/src/libcharon/plugins/stroke/stroke_socket.c index ee32dbca2..4f7483666 100644 --- a/src/libcharon/plugins/stroke/stroke_socket.c +++ b/src/libcharon/plugins/stroke/stroke_socket.c @@ -613,7 +613,7 @@ static void stroke_config(private_stroke_socket_t *this, static bool on_accept(private_stroke_socket_t *this, stream_t *stream) { stroke_msg_t *msg; - u_int16_t len; + uint16_t len; FILE *out; /* read length */ diff --git a/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_listener.c b/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_listener.c index 2bad4fab0..ad4f2f8c2 100644 --- a/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_listener.c +++ b/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_listener.c @@ -145,7 +145,7 @@ tnc_ifmap_listener_t *tnc_ifmap_listener_create(bool reload) { private_tnc_ifmap_listener_t *this; job_t *job; - u_int32_t reschedule; + uint32_t reschedule; INIT(this, .public = { diff --git a/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_renew_session_job.c b/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_renew_session_job.c index f2c00a528..ea48338cd 100644 --- a/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_renew_session_job.c +++ b/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_renew_session_job.c @@ -40,7 +40,7 @@ struct private_tnc_ifmap_renew_session_job_t { /** * Reschedule time interval in seconds */ - u_int32_t reschedule; + uint32_t reschedule; }; METHOD(job_t, destroy, void, @@ -83,7 +83,7 @@ METHOD(job_t, get_priority, job_priority_t, * Described in header */ tnc_ifmap_renew_session_job_t *tnc_ifmap_renew_session_job_create( - tnc_ifmap_soap_t *ifmap, u_int32_t reschedule) + tnc_ifmap_soap_t *ifmap, uint32_t reschedule) { private_tnc_ifmap_renew_session_job_t *this; diff --git a/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_renew_session_job.h b/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_renew_session_job.h index f1587a1f6..18a3d5734 100644 --- a/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_renew_session_job.h +++ b/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_renew_session_job.h @@ -46,6 +46,6 @@ struct tnc_ifmap_renew_session_job_t { * @param reschedule reschedule time in seconds */ tnc_ifmap_renew_session_job_t *tnc_ifmap_renew_session_job_create( - tnc_ifmap_soap_t *ifmap, u_int32_t reschedule); + tnc_ifmap_soap_t *ifmap, uint32_t reschedule); #endif /** TNC_IFMAP_RENEW_SESSION_JOB_H_ @}*/ diff --git a/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap.c b/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap.c index a652e7067..8e69de095 100644 --- a/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap.c +++ b/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap.c @@ -186,7 +186,7 @@ METHOD(tnc_ifmap_soap_t, purgePublisher, bool, * Create an access-request based on device_name and ike_sa_id */ static xmlNodePtr create_access_request(private_tnc_ifmap_soap_t *this, - u_int32_t id) + uint32_t id) { xmlNodePtr node; char buf[BUF_LEN]; @@ -415,7 +415,7 @@ METHOD(tnc_ifmap_soap_t, publish_ike_sa, bool, identification_t *id, *eap_id, *group; host_t *host; auth_cfg_t *auth; - u_int32_t ike_sa_id; + uint32_t ike_sa_id; bool is_user = FALSE, first = TRUE, success; /* extract relevant data from IKE_SA*/ @@ -584,7 +584,7 @@ METHOD(tnc_ifmap_soap_t, publish_virtual_ips, bool, { tnc_ifmap_soap_msg_t *soap_msg; xmlNodePtr request, node; - u_int32_t ike_sa_id; + uint32_t ike_sa_id; enumerator_t *enumerator; host_t *vip; bool success; diff --git a/src/libcharon/plugins/tnc_pdp/tnc_pdp.c b/src/libcharon/plugins/tnc_pdp/tnc_pdp.c index 91456f8da..17f0cd464 100644 --- a/src/libcharon/plugins/tnc_pdp/tnc_pdp.c +++ b/src/libcharon/plugins/tnc_pdp/tnc_pdp.c @@ -74,7 +74,7 @@ struct private_tnc_pdp_t { /** * PT-TLS port of the server */ - u_int16_t pt_tls_port; + uint16_t pt_tls_port; /** * PT-TLS IPv4 socket @@ -158,7 +158,7 @@ static void free_client_entry(client_entry_t *this) /** * Open IPv4 or IPv6 UDP socket */ -static int open_udp_socket(int family, u_int16_t port) +static int open_udp_socket(int family, uint16_t port) { int on = TRUE; struct sockaddr_storage addr; @@ -233,7 +233,7 @@ static int open_udp_socket(int family, u_int16_t port) /** * Open IPv4 or IPv6 TCP socket */ -static int open_tcp_socket(int family, u_int16_t port) +static int open_tcp_socket(int family, uint16_t port) { int on = TRUE; struct sockaddr_storage addr; @@ -339,8 +339,8 @@ static void send_message(private_tnc_pdp_t *this, radius_message_t *message, /** * Encrypt a MS-MPPE-Send/Recv-Key */ -static chunk_t encrypt_mppe_key(private_tnc_pdp_t *this, u_int8_t type, - chunk_t key, u_int16_t *salt, +static chunk_t encrypt_mppe_key(private_tnc_pdp_t *this, uint8_t type, + chunk_t key, uint16_t *salt, radius_message_t *request) { chunk_t a, r, seed, data; @@ -420,8 +420,8 @@ static void send_response(private_tnc_pdp_t *this, radius_message_t *request, { radius_message_t *response; chunk_t data, recv, send; - u_int32_t tunnel_type; - u_int16_t salt = 0; + uint32_t tunnel_type; + uint16_t salt = 0; response = radius_message_create(code); data = eap->get_data(eap); @@ -477,7 +477,7 @@ static void process_eap(private_tnc_pdp_t *this, radius_message_t *request, eap_payload_t *in, *out = NULL; eap_method_t *method; eap_type_t eap_type; - u_int32_t eap_vendor; + uint32_t eap_vendor; chunk_t data, message = chunk_empty, msk = chunk_empty; chunk_t user_name = chunk_empty, nas_id = chunk_empty; identification_t *group = NULL; diff --git a/src/libcharon/plugins/unity/unity_provider.c b/src/libcharon/plugins/unity/unity_provider.c index 1e297a39e..07f5f9b61 100644 --- a/src/libcharon/plugins/unity/unity_provider.c +++ b/src/libcharon/plugins/unity/unity_provider.c @@ -53,7 +53,7 @@ static void append_ts(bio_writer_t *writer, traffic_selector_t *ts) { host_t *net, *mask; chunk_t padding; - u_int8_t bits; + uint8_t bits; if (!ts->to_subnet(ts, &net, &bits)) { @@ -115,7 +115,7 @@ METHOD(enumerator_t, attribute_destroy, void, */ static bool use_ts(traffic_selector_t *ts) { - u_int8_t mask; + uint8_t mask; host_t *net; if (ts->get_type(ts) != TS_IPV4_ADDR_RANGE) diff --git a/src/libcharon/plugins/updown/updown_listener.c b/src/libcharon/plugins/updown/updown_listener.c index a9b0565a8..6a1581c85 100644 --- a/src/libcharon/plugins/updown/updown_listener.c +++ b/src/libcharon/plugins/updown/updown_listener.c @@ -55,7 +55,7 @@ typedef struct cache_entry_t cache_entry_t; */ struct cache_entry_t { /** requid of the CHILD_SA */ - u_int32_t reqid; + uint32_t reqid; /** cached interface name */ char *iface; }; @@ -63,7 +63,7 @@ struct cache_entry_t { /** * Insert an interface name to the cache */ -static void cache_iface(private_updown_listener_t *this, u_int32_t reqid, +static void cache_iface(private_updown_listener_t *this, uint32_t reqid, char *iface) { cache_entry_t *entry = malloc_thing(cache_entry_t); @@ -77,7 +77,7 @@ static void cache_iface(private_updown_listener_t *this, u_int32_t reqid, /** * Remove a cached interface name and return it. */ -static char* uncache_iface(private_updown_listener_t *this, u_int32_t reqid) +static char* uncache_iface(private_updown_listener_t *this, uint32_t reqid) { enumerator_t *enumerator; cache_entry_t *entry; @@ -257,7 +257,7 @@ static void invoke_once(private_updown_listener_t *this, ike_sa_t *ike_sa, { host_t *me, *other, *host; char *iface; - u_int8_t mask; + uint8_t mask; mark_t mark; bool is_host, is_ipv6; int out; diff --git a/src/libcharon/plugins/vici/libvici.c b/src/libcharon/plugins/vici/libvici.c index 7c98c8b69..0b549a511 100644 --- a/src/libcharon/plugins/vici/libvici.c +++ b/src/libcharon/plugins/vici/libvici.c @@ -123,7 +123,7 @@ static bool read_error(vici_conn_t *conn, int err) /** * Handle a command response message */ -static bool handle_response(vici_conn_t *conn, u_int32_t len) +static bool handle_response(vici_conn_t *conn, uint32_t len) { chunk_t buf; @@ -140,11 +140,11 @@ static bool handle_response(vici_conn_t *conn, u_int32_t len) /** * Dispatch received event message */ -static bool handle_event(vici_conn_t *conn, u_int32_t len) +static bool handle_event(vici_conn_t *conn, uint32_t len) { vici_message_t *message; event_t *event; - u_int8_t namelen; + uint8_t namelen; char name[257], *buf; if (len < sizeof(namelen)) @@ -198,8 +198,8 @@ static bool handle_event(vici_conn_t *conn, u_int32_t len) CALLBACK(on_read, bool, vici_conn_t *conn, stream_t *stream) { - u_int32_t len; - u_int8_t op; + uint32_t len; + uint8_t op; ssize_t hlen; hlen = stream->read(stream, &len, sizeof(len), FALSE); @@ -358,8 +358,8 @@ vici_res_t* vici_submit(vici_req_t *req, vici_conn_t *conn) vici_message_t *message; vici_res_t *res; chunk_t data; - u_int32_t len; - u_int8_t namelen, op; + uint32_t len; + uint8_t namelen, op; message = req->b->finalize(req->b); if (!message) @@ -678,8 +678,8 @@ void vici_free_res(vici_res_t *res) int vici_register(vici_conn_t *conn, char *name, vici_event_cb_t cb, void *user) { event_t *event; - u_int32_t len; - u_int8_t namelen, op; + uint32_t len; + uint8_t namelen, op; int ret = 1; op = cb ? VICI_EVENT_REGISTER : VICI_EVENT_UNREGISTER; diff --git a/src/libcharon/plugins/vici/suites/test_socket.c b/src/libcharon/plugins/vici/suites/test_socket.c index 8d545c6c1..d0c0fa76f 100644 --- a/src/libcharon/plugins/vici/suites/test_socket.c +++ b/src/libcharon/plugins/vici/suites/test_socket.c @@ -32,7 +32,7 @@ static void echo_inbound(void *user, u_int id, chunk_t buf) ck_assert_int_eq(data->id, id); /* count number of bytes, including the header */ - data->bytes += buf.len + sizeof(u_int32_t); + data->bytes += buf.len + sizeof(uint32_t); /* echo back data chunk */ data->s->send(data->s, id, chunk_clone(buf)); } @@ -81,7 +81,7 @@ START_TEST(test_echo) 0x00,0x00,0x00,0x0A, 0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x02A, ); char buf[m.len]; - u_int32_t len; + uint32_t len; lib->processor->set_threads(lib->processor, 4); diff --git a/src/libcharon/plugins/vici/vici_attribute.c b/src/libcharon/plugins/vici/vici_attribute.c index 9064d3d8c..e0d9b4ae8 100644 --- a/src/libcharon/plugins/vici/vici_attribute.c +++ b/src/libcharon/plugins/vici/vici_attribute.c @@ -233,7 +233,7 @@ static bool have_vips_from_pool(mem_pool_t *pool, linked_list_t *vips) enumerator_t *enumerator; host_t *host; chunk_t start, end, current; - u_int32_t size; + uint32_t size; bool found = FALSE; host = pool->get_base(pool); @@ -477,10 +477,10 @@ CALLBACK(pool_li, bool, { if (host->get_family(host) == AF_INET) { /* IPv4 attributes contain a subnet mask */ - u_int32_t netmask = 0; + uint32_t netmask = 0; if (mask) - { /* shifting u_int32_t by 32 or more is undefined */ + { /* shifting uint32_t by 32 or more is undefined */ mask = 32 - mask; netmask = htonl((0xFFFFFFFF >> mask) << mask); } diff --git a/src/libcharon/plugins/vici/vici_config.c b/src/libcharon/plugins/vici/vici_config.c index 6ebbedc47..f95d1571b 100644 --- a/src/libcharon/plugins/vici/vici_config.c +++ b/src/libcharon/plugins/vici/vici_config.c @@ -57,7 +57,7 @@ /** * Magic value for an undefined lifetime */ -#define LFT_UNDEFINED (~(u_int64_t)0) +#define LFT_UNDEFINED (~(uint64_t)0) /** * Default IKE rekey time @@ -72,7 +72,7 @@ /** * Undefined replay window */ -#define REPLAY_UNDEFINED (~(u_int32_t)0) +#define REPLAY_UNDEFINED (~(uint32_t)0) typedef struct private_vici_config_t private_vici_config_t; @@ -242,7 +242,7 @@ typedef struct { typedef struct { request_data_t *request; auth_cfg_t *cfg; - u_int32_t round; + uint32_t round; } auth_data_t; /** @@ -259,20 +259,20 @@ static void free_auth_data(auth_data_t *data) */ typedef struct { request_data_t *request; - u_int32_t version; + uint32_t version; bool aggressive; bool encap; bool mobike; bool send_certreq; bool pull; cert_policy_t send_cert; - u_int64_t dpd_delay; - u_int64_t dpd_timeout; + uint64_t dpd_delay; + uint64_t dpd_timeout; fragmentation_t fragmentation; unique_policy_t unique; - u_int32_t keyingtries; - u_int32_t local_port; - u_int32_t remote_port; + uint32_t keyingtries; + uint32_t local_port; + uint32_t remote_port; char *local_addrs; char *remote_addrs; linked_list_t *local; @@ -281,10 +281,10 @@ typedef struct { linked_list_t *children; linked_list_t *vips; char *pools; - u_int64_t reauth_time; - u_int64_t rekey_time; - u_int64_t over_time; - u_int64_t rand_time; + uint64_t reauth_time; + uint64_t rekey_time; + uint64_t over_time; + uint64_t rand_time; } peer_data_t; /** @@ -428,15 +428,15 @@ typedef struct { bool ipcomp; bool policies; ipsec_mode_t mode; - u_int32_t replay_window; + uint32_t replay_window; action_t dpd_action; action_t start_action; action_t close_action; - u_int32_t reqid; - u_int32_t tfc; + uint32_t reqid; + uint32_t tfc; mark_t mark_in; mark_t mark_out; - u_int64_t inactivity; + uint64_t inactivity; linked_list_t *proposals; linked_list_t *local_ts; linked_list_t *remote_ts; @@ -568,8 +568,8 @@ CALLBACK(parse_ts, bool, struct protoent *protoent; struct servent *svc; long int p; - u_int16_t from = 0, to = 0xffff; - u_int8_t proto = 0; + uint16_t from = 0, to = 0xffff; + uint8_t proto = 0; if (!vici_stringify(v, buf, sizeof(buf))) { @@ -613,7 +613,7 @@ CALLBACK(parse_ts, bool, { return FALSE; } - proto = (u_int8_t)p; + proto = (uint8_t)p; } } if (streq(port, "opaque")) @@ -809,10 +809,10 @@ CALLBACK(parse_action, bool, } /** - * Parse a u_int32_t + * Parse a uint32_t */ CALLBACK(parse_uint32, bool, - u_int32_t *out, chunk_t v) + uint32_t *out, chunk_t v) { char buf[16], *end; u_long l; @@ -831,10 +831,10 @@ CALLBACK(parse_uint32, bool, } /** - * Parse a u_int64_t + * Parse a uint64_t */ CALLBACK(parse_uint64, bool, - u_int64_t *out, chunk_t v) + uint64_t *out, chunk_t v) { char buf[16], *end; unsigned long long l; @@ -856,7 +856,7 @@ CALLBACK(parse_uint64, bool, * Parse a relative time */ CALLBACK(parse_time, bool, - u_int64_t *out, chunk_t v) + uint64_t *out, chunk_t v) { char buf[16], *end; u_long l; @@ -906,7 +906,7 @@ CALLBACK(parse_time, bool, * Parse byte volume */ CALLBACK(parse_bytes, bool, - u_int64_t *out, chunk_t v) + uint64_t *out, chunk_t v) { char buf[16], *end; unsigned long long l; @@ -968,7 +968,7 @@ CALLBACK(parse_mark, bool, * Parse TFC padding option */ CALLBACK(parse_tfc, bool, - u_int32_t *out, chunk_t v) + uint32_t *out, chunk_t v) { if (chunk_equals(v, chunk_from_str("mtu"))) { @@ -1649,12 +1649,12 @@ CALLBACK(peer_sn, bool, /** * Find reqid of an existing CHILD_SA */ -static u_int32_t find_reqid(child_cfg_t *cfg) +static uint32_t find_reqid(child_cfg_t *cfg) { enumerator_t *enumerator, *children; child_sa_t *child_sa; ike_sa_t *ike_sa; - u_int32_t reqid; + uint32_t reqid; reqid = charon->traps->find_reqid(charon->traps, cfg); if (reqid) @@ -1723,7 +1723,7 @@ static void clear_start_action(private_vici_config_t *this, char *peer_name, enumerator_t *enumerator, *children; child_sa_t *child_sa; ike_sa_t *ike_sa; - u_int32_t id = 0, others; + uint32_t id = 0, others; array_t *ids = NULL, *ikeids = NULL; char *name; diff --git a/src/libcharon/plugins/vici/vici_control.c b/src/libcharon/plugins/vici/vici_control.c index c526d2fda..44003819a 100644 --- a/src/libcharon/plugins/vici/vici_control.c +++ b/src/libcharon/plugins/vici/vici_control.c @@ -507,12 +507,12 @@ CALLBACK(redirect, vici_message_t*, /** * Find reqid of an existing CHILD_SA */ -static u_int32_t find_reqid(child_cfg_t *cfg) +static uint32_t find_reqid(child_cfg_t *cfg) { enumerator_t *enumerator, *children; child_sa_t *child_sa; ike_sa_t *ike_sa; - u_int32_t reqid; + uint32_t reqid; reqid = charon->traps->find_reqid(charon->traps, cfg); if (reqid) @@ -583,7 +583,7 @@ CALLBACK(uninstall, vici_message_t*, { child_sa_t *child_sa; enumerator_t *enumerator; - u_int32_t reqid = 0; + uint32_t reqid = 0; char *child; child = request->get_str(request, NULL, "child"); diff --git a/src/libcharon/plugins/vici/vici_dispatcher.c b/src/libcharon/plugins/vici/vici_dispatcher.c index 31292d6b3..ffe0d61e5 100644 --- a/src/libcharon/plugins/vici/vici_dispatcher.c +++ b/src/libcharon/plugins/vici/vici_dispatcher.c @@ -119,10 +119,10 @@ static void send_op(private_vici_dispatcher_t *this, u_int id, bio_writer_t *writer; u_int len; - len = sizeof(u_int8_t); + len = sizeof(uint8_t); if (name) { - len += sizeof(u_int8_t) + strlen(name); + len += sizeof(uint8_t) + strlen(name); } if (message) { @@ -308,7 +308,7 @@ CALLBACK(inbound, void, { bio_reader_t *reader; chunk_t chunk; - u_int8_t type; + uint8_t type; char name[257]; reader = bio_reader_create(data); diff --git a/src/libcharon/plugins/vici/vici_message.c b/src/libcharon/plugins/vici/vici_message.c index fb6e8a1ab..58b896773 100644 --- a/src/libcharon/plugins/vici/vici_message.c +++ b/src/libcharon/plugins/vici/vici_message.c @@ -137,7 +137,7 @@ typedef struct { METHOD(enumerator_t, parse_enumerate, bool, parse_enumerator_t *this, vici_type_t *out, char **name, chunk_t *value) { - u_int8_t type; + uint8_t type; chunk_t data; if (!this->reader->remaining(this->reader) || diff --git a/src/libcharon/plugins/vici/vici_query.c b/src/libcharon/plugins/vici/vici_query.c index 284c23ee0..3a005ea57 100644 --- a/src/libcharon/plugins/vici/vici_query.c +++ b/src/libcharon/plugins/vici/vici_query.c @@ -86,8 +86,8 @@ static void list_child(private_vici_query_t *this, vici_builder_t *b, child_sa_t *child, time_t now) { time_t t; - u_int64_t bytes, packets; - u_int16_t alg, ks; + uint64_t bytes, packets; + uint16_t alg, ks; proposal_t *proposal; enumerator_t *enumerator; traffic_selector_t *ts; @@ -152,7 +152,7 @@ static void list_child(private_vici_query_t *this, vici_builder_t *b, b->add_kv(b, "packets-in", "%" PRIu64, packets); if (t) { - b->add_kv(b, "use-in", "%"PRIu64, (u_int64_t)(now - t)); + b->add_kv(b, "use-in", "%"PRIu64, (uint64_t)(now - t)); } child->get_usestats(child, FALSE, &t, &bytes, &packets); @@ -160,7 +160,7 @@ static void list_child(private_vici_query_t *this, vici_builder_t *b, b->add_kv(b, "packets-out", "%"PRIu64, packets); if (t) { - b->add_kv(b, "use-out", "%"PRIu64, (u_int64_t)(now - t)); + b->add_kv(b, "use-out", "%"PRIu64, (uint64_t)(now - t)); } t = child->get_lifetime(child, FALSE); @@ -272,7 +272,7 @@ static void list_ike(private_vici_query_t *this, vici_builder_t *b, ike_sa_id_t *id; identification_t *eap; proposal_t *proposal; - u_int16_t alg, ks; + uint16_t alg, ks; host_t *host; b->add_kv(b, "uniqueid", "%u", ike_sa->get_unique_id(ike_sa)); diff --git a/src/libcharon/plugins/vici/vici_socket.c b/src/libcharon/plugins/vici/vici_socket.c index 67fd7e8e3..2a55fd061 100644 --- a/src/libcharon/plugins/vici/vici_socket.c +++ b/src/libcharon/plugins/vici/vici_socket.c @@ -95,11 +95,11 @@ typedef struct { /** bytes of length header sent/received */ u_char hdrlen; /** bytes of length header */ - char hdr[sizeof(u_int32_t)]; + char hdr[sizeof(uint32_t)]; /** send/receive buffer on heap */ chunk_t buf; /** bytes sent/received in buffer */ - u_int32_t done; + uint32_t done; } msg_buf_t; /** @@ -411,7 +411,7 @@ CALLBACK(on_write, bool, static bool do_read(private_vici_socket_t *this, entry_t *entry, stream_t *stream, char *errmsg, size_t errlen) { - u_int32_t msglen; + uint32_t msglen; ssize_t len; /* assemble the length header first */ diff --git a/src/libcharon/plugins/xauth_eap/xauth_eap.c b/src/libcharon/plugins/xauth_eap/xauth_eap.c index f21d02697..9e103be1c 100644 --- a/src/libcharon/plugins/xauth_eap/xauth_eap.c +++ b/src/libcharon/plugins/xauth_eap/xauth_eap.c @@ -113,7 +113,7 @@ static bool verify_eap(private_xauth_eap_t *this, eap_method_t *backend) eap_payload_t *request, *response; eap_method_t *frontend; eap_type_t type; - u_int32_t vendor; + uint32_t vendor; status_t status; if (backend->initiate(backend, &request) != NEED_MORE) |