From b94f248ea967aef936db3a323134c030b4f05add Mon Sep 17 00:00:00 2001 From: Clavister OpenSource Date: Thu, 24 Nov 2011 16:48:41 +0100 Subject: IKEv1 XAuth: Added new MIGRATE status type to status_t. When a task returns this status from a build or process method, it is a signal to the task manager that it should treat it as if the task returned SUCCESS. Additionally it will migrate all remaining tasks from the current queue to a different one, calling swap_initiator for each applicable task. Finally, the task manager will call "initiate", if applicable, to kick off tasks in the "queued_tasks" queue. Task queue relocation mapping: passive_tasks moves to queued_tasks (which is then fed to active by the initiate call). active_tasks moves to passive_tasks --- src/libstrongswan/utils.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/libstrongswan/utils.h') diff --git a/src/libstrongswan/utils.h b/src/libstrongswan/utils.h index 0f06fec6a..f98de4139 100644 --- a/src/libstrongswan/utils.h +++ b/src/libstrongswan/utils.h @@ -299,6 +299,12 @@ enum status_t { * Another call to the method is required. */ NEED_MORE, + + /** + * For tasks only, same as SUCCESS, but also migrate all remaining tasks + * in the current queue to the opposite queue (passive->active or active->passive) + */ + MIGRATE, }; /** -- cgit v1.2.3 From 0ea77083bb61acc775f7704540ce9f67a89bc78d Mon Sep 17 00:00:00 2001 From: Clavister OpenSource Date: Tue, 29 Nov 2011 11:21:54 +0100 Subject: Revert "IKEv1 XAuth: Added new MIGRATE status type to status_t." This reverts commit b57df8310a867a0a65abf17279bf1b6e6bb2f5d3. Conflicts: src/libcharon/sa/task_manager_v1.c --- src/libstrongswan/utils.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/libstrongswan/utils.h') diff --git a/src/libstrongswan/utils.h b/src/libstrongswan/utils.h index f98de4139..0f06fec6a 100644 --- a/src/libstrongswan/utils.h +++ b/src/libstrongswan/utils.h @@ -299,12 +299,6 @@ enum status_t { * Another call to the method is required. */ NEED_MORE, - - /** - * For tasks only, same as SUCCESS, but also migrate all remaining tasks - * in the current queue to the opposite queue (passive->active or active->passive) - */ - MIGRATE, }; /** -- cgit v1.2.3 From cd419ae4466b458681c2d2547e683cef02beb553 Mon Sep 17 00:00:00 2001 From: Andreas Steffen Date: Thu, 27 Oct 2011 00:37:24 +0200 Subject: extended bio_reader and bio_writer to handle u_int64_t --- src/libstrongswan/utils.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src/libstrongswan/utils.h') diff --git a/src/libstrongswan/utils.h b/src/libstrongswan/utils.h index 0f06fec6a..5154a0f7f 100644 --- a/src/libstrongswan/utils.h +++ b/src/libstrongswan/utils.h @@ -482,6 +482,27 @@ static inline void htoun32(void *network, u_int32_t host) memcpy((char*)unaligned, &host, sizeof(host)); } +/** + * Write a 64-bit host order value in network order to an unaligned address. + * + * @param host host order 32-bit value + * @param network unaligned address to write network order value to + */ +static inline void htoun64(void *network, u_int64_t host) +{ + char *unaligned = (char*)network; + u_int32_t high_part, low_part; + + high_part = host >> 32; + high_part = htonl(high_part); + low_part = host & 0xFFFFFFFFLL; + low_part = htonl(low_part); + + memcpy(unaligned, &high_part, sizeof(high_part)); + unaligned += sizeof(high_part); + memcpy(unaligned, &low_part, sizeof(low_part)); +} + /** * Read a 16-bit value in network order from an unaligned address to host order. * @@ -512,6 +533,27 @@ static inline u_int32_t untoh32(void *network) return ntohl(tmp); } +/** + * Read a 64-bit value in network order from an unaligned address to host order. + * + * @param network unaligned address to read network order value from + * @return host order value + */ +static inline u_int64_t untoh64(void *network) +{ + char *unaligned = (char*)network; + u_int32_t high_part, low_part; + + memcpy(&high_part, unaligned, sizeof(high_part)); + unaligned += sizeof(high_part); + memcpy(&low_part, unaligned, sizeof(low_part)); + + high_part = ntohl(high_part); + low_part = ntohl(low_part); + + return (((u_int64_t)high_part) << 32) + low_part; +} + /** * Special type to count references */ -- cgit v1.2.3 From 65840cc4626673c477b9bdd198f06421b7137e98 Mon Sep 17 00:00:00 2001 From: Andreas Steffen Date: Sun, 4 Dec 2011 12:53:47 +0100 Subject: fixed copy-and-paste error --- src/libstrongswan/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libstrongswan/utils.h') diff --git a/src/libstrongswan/utils.h b/src/libstrongswan/utils.h index 5154a0f7f..3014e2f60 100644 --- a/src/libstrongswan/utils.h +++ b/src/libstrongswan/utils.h @@ -485,7 +485,7 @@ static inline void htoun32(void *network, u_int32_t host) /** * Write a 64-bit host order value in network order to an unaligned address. * - * @param host host order 32-bit value + * @param host host order 64-bit value * @param network unaligned address to write network order value to */ static inline void htoun64(void *network, u_int64_t host) -- cgit v1.2.3 From f4e25e602b44a98d581f4da2daa61c13aa06ad9a Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Mon, 5 Dec 2011 15:44:51 +0100 Subject: Implement htoun/untoh64 with potentially faster htobe64/be64toh macros, if available --- src/libstrongswan/utils.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/libstrongswan/utils.h') diff --git a/src/libstrongswan/utils.h b/src/libstrongswan/utils.h index 3014e2f60..e5e4a10c0 100644 --- a/src/libstrongswan/utils.h +++ b/src/libstrongswan/utils.h @@ -491,6 +491,11 @@ static inline void htoun32(void *network, u_int32_t host) static inline void htoun64(void *network, u_int64_t host) { char *unaligned = (char*)network; + +#ifdef be64toh + host = htobe64(host); + memcpy((char*)unaligned, &host, sizeof(host)); +#else u_int32_t high_part, low_part; high_part = host >> 32; @@ -501,6 +506,7 @@ static inline void htoun64(void *network, u_int64_t host) memcpy(unaligned, &high_part, sizeof(high_part)); unaligned += sizeof(high_part); memcpy(unaligned, &low_part, sizeof(low_part)); +#endif } /** @@ -542,6 +548,13 @@ static inline u_int32_t untoh32(void *network) static inline u_int64_t untoh64(void *network) { char *unaligned = (char*)network; + +#ifdef be64toh + u_int64_t tmp; + + memcpy(&tmp, unaligned, sizeof(tmp)); + return be64toh(tmp); +#else u_int32_t high_part, low_part; memcpy(&high_part, unaligned, sizeof(high_part)); @@ -552,6 +565,7 @@ static inline u_int64_t untoh64(void *network) low_part = ntohl(low_part); return (((u_int64_t)high_part) << 32) + low_part; +#endif } /** -- cgit v1.2.3 From 1390daae15b58848b75d3d7f2d44fc054f3da882 Mon Sep 17 00:00:00 2001 From: Clavister OpenSource Date: Fri, 9 Dec 2011 15:49:07 +0100 Subject: Added status code to status_t New status_t enum to allow packets to be sent to peer in task_manager->process --- src/libstrongswan/utils.h | 5 +++++ 1 file changed, 5 insertions(+) mode change 100644 => 100755 src/libstrongswan/utils.h (limited to 'src/libstrongswan/utils.h') diff --git a/src/libstrongswan/utils.h b/src/libstrongswan/utils.h old mode 100644 new mode 100755 index e5e4a10c0..826477c7f --- a/src/libstrongswan/utils.h +++ b/src/libstrongswan/utils.h @@ -299,6 +299,11 @@ enum status_t { * Another call to the method is required. */ NEED_MORE, + + /** + * Call failed, send error to other side. + */ + FAILED_SEND_ERROR, }; /** -- cgit v1.2.3 From 1477ab157c3305c1f8abef0fa93f30196a765e24 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Tue, 13 Dec 2011 09:42:16 +0100 Subject: Remove unused status type --- src/libstrongswan/utils.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/libstrongswan/utils.h') diff --git a/src/libstrongswan/utils.h b/src/libstrongswan/utils.h index 826477c7f..e5e4a10c0 100755 --- a/src/libstrongswan/utils.h +++ b/src/libstrongswan/utils.h @@ -299,11 +299,6 @@ enum status_t { * Another call to the method is required. */ NEED_MORE, - - /** - * Call failed, send error to other side. - */ - FAILED_SEND_ERROR, }; /** -- cgit v1.2.3 From 3ba15819edb44d00f5c9f8ad06ea7e78a48515c4 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Wed, 14 Dec 2011 16:46:29 +0100 Subject: Remove executable flag from source code files --- src/libstrongswan/utils.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 src/libstrongswan/utils.h (limited to 'src/libstrongswan/utils.h') diff --git a/src/libstrongswan/utils.h b/src/libstrongswan/utils.h old mode 100755 new mode 100644 -- cgit v1.2.3