summaryrefslogtreecommitdiff
path: root/src/libcharon/network
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2016-07-16 15:19:53 +0200
committerYves-Alexis Perez <corsac@debian.org>2016-07-16 15:19:53 +0200
commitbf372706c469764d59e9f29c39e3ecbebd72b8d2 (patch)
tree0f0e296e2d50e4a7faf99ae6fa428d2681e81ea1 /src/libcharon/network
parent518dd33c94e041db0444c7d1f33da363bb8e3faf (diff)
downloadvyos-strongswan-bf372706c469764d59e9f29c39e3ecbebd72b8d2.tar.gz
vyos-strongswan-bf372706c469764d59e9f29c39e3ecbebd72b8d2.zip
Imported Upstream version 5.5.0
Diffstat (limited to 'src/libcharon/network')
-rw-r--r--src/libcharon/network/receiver.c32
-rw-r--r--src/libcharon/network/socket.h2
-rw-r--r--src/libcharon/network/socket_manager.c4
-rw-r--r--src/libcharon/network/socket_manager.h2
4 files changed, 20 insertions, 20 deletions
diff --git a/src/libcharon/network/receiver.c b/src/libcharon/network/receiver.c
index ee357ca4d..1bf93ad40 100644
--- a/src/libcharon/network/receiver.c
+++ b/src/libcharon/network/receiver.c
@@ -81,17 +81,17 @@ struct private_receiver_t {
/**
* how many times we have used "secret" so far
*/
- u_int32_t secret_used;
+ uint32_t secret_used;
/**
* time we did the cookie switch
*/
- u_int32_t secret_switch;
+ uint32_t secret_switch;
/**
* time offset to use, hides our system time
*/
- u_int32_t secret_offset;
+ uint32_t secret_offset;
/**
* the RNG to use for secret generation
@@ -106,7 +106,7 @@ struct private_receiver_t {
/**
* require cookies after this many half open IKE_SAs
*/
- u_int32_t cookie_threshold;
+ uint32_t cookie_threshold;
/**
* timestamp of last cookie requested
@@ -116,7 +116,7 @@ struct private_receiver_t {
/**
* how many half open IKE_SAs per peer before blocking
*/
- u_int32_t block_threshold;
+ uint32_t block_threshold;
/**
* Drop IKE_SA_INIT requests if processor job load exceeds this limit
@@ -192,9 +192,9 @@ static void send_notify(message_t *request, int major, exchange_type_t exchange,
* build a cookie
*/
static bool cookie_build(private_receiver_t *this, message_t *message,
- u_int32_t t, chunk_t secret, chunk_t *cookie)
+ uint32_t t, chunk_t secret, chunk_t *cookie)
{
- u_int64_t spi = message->get_initiator_spi(message);
+ uint64_t spi = message->get_initiator_spi(message);
host_t *ip = message->get_source(message);
chunk_t input, hash;
@@ -216,14 +216,14 @@ static bool cookie_build(private_receiver_t *this, message_t *message,
static bool cookie_verify(private_receiver_t *this, message_t *message,
chunk_t cookie)
{
- u_int32_t t, now;
+ uint32_t t, now;
chunk_t reference;
chunk_t secret;
now = time_monotonic(NULL);
- t = *(u_int32_t*)cookie.ptr;
+ t = *(uint32_t*)cookie.ptr;
- if (cookie.len != sizeof(u_int32_t) +
+ if (cookie.len != sizeof(uint32_t) +
this->hasher->get_hash_size(this->hasher) ||
t < now - this->secret_offset - COOKIE_LIFETIME)
{
@@ -269,15 +269,15 @@ static bool check_cookie(private_receiver_t *this, message_t *message)
data = message->get_packet_data(message);
if (data.len <
IKE_HEADER_LENGTH + NOTIFY_PAYLOAD_HEADER_LENGTH +
- sizeof(u_int32_t) + this->hasher->get_hash_size(this->hasher) ||
+ sizeof(uint32_t) + this->hasher->get_hash_size(this->hasher) ||
*(data.ptr + 16) != PLV2_NOTIFY ||
- *(u_int16_t*)(data.ptr + IKE_HEADER_LENGTH + 6) != htons(COOKIE))
+ *(uint16_t*)(data.ptr + IKE_HEADER_LENGTH + 6) != htons(COOKIE))
{
/* no cookie found */
return FALSE;
}
data.ptr += IKE_HEADER_LENGTH + NOTIFY_PAYLOAD_HEADER_LENGTH;
- data.len = sizeof(u_int32_t) + this->hasher->get_hash_size(this->hasher);
+ data.len = sizeof(uint32_t) + this->hasher->get_hash_size(this->hasher);
if (!cookie_verify(this, message, data))
{
DBG2(DBG_NET, "found cookie, but content invalid");
@@ -290,7 +290,7 @@ static bool check_cookie(private_receiver_t *this, message_t *message)
* Check if we currently require cookies
*/
static bool cookie_required(private_receiver_t *this,
- u_int half_open, u_int32_t now)
+ u_int half_open, uint32_t now)
{
if (this->cookie_threshold && half_open >= this->cookie_threshold)
{
@@ -322,7 +322,7 @@ static bool cookie_required(private_receiver_t *this,
static bool drop_ike_sa_init(private_receiver_t *this, message_t *message)
{
u_int half_open, half_open_r;
- u_int32_t now;
+ uint32_t now;
now = time_monotonic(NULL);
half_open = charon->ike_sa_manager->get_half_open_count(
@@ -620,7 +620,7 @@ METHOD(receiver_t, destroy, void,
receiver_t *receiver_create()
{
private_receiver_t *this;
- u_int32_t now = time_monotonic(NULL);
+ uint32_t now = time_monotonic(NULL);
INIT(this,
.public = {
diff --git a/src/libcharon/network/socket.h b/src/libcharon/network/socket.h
index e3cda3bea..b084d96a2 100644
--- a/src/libcharon/network/socket.h
+++ b/src/libcharon/network/socket.h
@@ -99,7 +99,7 @@ struct socket_t {
* @param nat_t TRUE to get the port used to float in case of NAT-T
* @return the port
*/
- u_int16_t (*get_port)(socket_t *this, bool nat_t);
+ uint16_t (*get_port)(socket_t *this, bool nat_t);
/**
* Get the address families this socket is listening on.
diff --git a/src/libcharon/network/socket_manager.c b/src/libcharon/network/socket_manager.c
index 2a07e503c..564608d77 100644
--- a/src/libcharon/network/socket_manager.c
+++ b/src/libcharon/network/socket_manager.c
@@ -89,10 +89,10 @@ METHOD(socket_manager_t, sender, status_t,
return status;
}
-METHOD(socket_manager_t, get_port, u_int16_t,
+METHOD(socket_manager_t, get_port, uint16_t,
private_socket_manager_t *this, bool nat_t)
{
- u_int16_t port = 0;
+ uint16_t port = 0;
this->lock->read_lock(this->lock);
if (this->socket)
{
diff --git a/src/libcharon/network/socket_manager.h b/src/libcharon/network/socket_manager.h
index a07d0804c..cde7859c2 100644
--- a/src/libcharon/network/socket_manager.h
+++ b/src/libcharon/network/socket_manager.h
@@ -58,7 +58,7 @@ struct socket_manager_t {
* @param nat_t TRUE to get the port used to float in case of NAT-T
* @return the port, or 0, if no socket is registered
*/
- u_int16_t (*get_port)(socket_manager_t *this, bool nat_t);
+ uint16_t (*get_port)(socket_manager_t *this, bool nat_t);
/**
* Get the address families the registered socket is listening on.