Nanda,

On 02/18/2016 03:37 PM, Noel Kuntze wrote:
> Hello Nanda,
> 
> Please always send the email to the mailing list, too.
> 
>> Hi Noel,
>>
>> Thank you. 
>> I could figure out that it is  at    
>> strongswan-5.2.2/src/libstrongswan/utils/utils.c + 925  that we print the 
>> bytes in the logs.
>> Could you please show me if there are any other endianness conversion done 
>> like here?
That's way off! Try the attached patch.

>> buffer is represented as a char array.
>> Any help appreciated
>>
>> Regards,
>> Nanda
> I don't work with the source code, so I can't tell you without looking at the 
> sources myself.

Cheers,
Thomas

>From 20332508bf5a688df9c7d3d820642e8980444819 Mon Sep 17 00:00:00 2001
From: Thomas Egerer <[email protected]>
Date: Thu, 18 Feb 2016 16:29:59 +0100
Subject: [PATCH 1/2] stroke: List IKE-SPIs in network byte order

Signed-off-by: Thomas Egerer <[email protected]>
---
 src/libcharon/plugins/stroke/stroke_list.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/libcharon/plugins/stroke/stroke_list.c b/src/libcharon/plugins/stroke/stroke_list.c
index 14233c9..a7ee6db 100644
--- a/src/libcharon/plugins/stroke/stroke_list.c
+++ b/src/libcharon/plugins/stroke/stroke_list.c
@@ -120,6 +120,7 @@ static void log_ike_sa(FILE *out, ike_sa_t *ike_sa, bool all)
 
 	if (all)
 	{
+		u_int64_t spi_i, spi_r;
 		proposal_t *ike_proposal;
 		identification_t *eap_id;
 
@@ -135,11 +136,13 @@ static void log_ike_sa(FILE *out, ike_sa_t *ike_sa, bool all)
 
 		ike_proposal = ike_sa->get_proposal(ike_sa);
 
+		htoun64(&spi_i, id->get_initiator_spi(id));
+		htoun64(&spi_r, id->get_responder_spi(id));
 		fprintf(out, "%12s[%d]: %N SPIs: %.16"PRIx64"_i%s %.16"PRIx64"_r%s",
 				ike_sa->get_name(ike_sa), ike_sa->get_unique_id(ike_sa),
 				ike_version_names, ike_sa->get_version(ike_sa),
-				id->get_initiator_spi(id), id->is_initiator(id) ? "*" : "",
-				id->get_responder_spi(id), id->is_initiator(id) ? "" : "*");
+				spi_i, id->is_initiator(id) ? "*" : "",
+				spi_r, id->is_initiator(id) ? "" : "*");
 
 
 		if (ike_sa->get_state(ike_sa) == IKE_ESTABLISHED)
-- 
2.6.4

_______________________________________________
Users mailing list
[email protected]
https://lists.strongswan.org/mailman/listinfo/users

Reply via email to