smp: Correctly return IKE SPIs stored in network order
authorTobias Brunner <tobias@strongswan.org>
Fri, 4 Mar 2016 09:28:00 +0000 (10:28 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 4 Mar 2016 17:43:26 +0000 (18:43 +0100)
src/libcharon/plugins/smp/smp.c

index 2aa061f..56b19c7 100644 (file)
@@ -229,8 +229,8 @@ static void request_query_ikesa(xmlTextReaderPtr reader, xmlTextWriterPtr writer
                local = ike_sa->get_my_host(ike_sa);
                xmlTextWriterStartElement(writer, "local");
                xmlTextWriterWriteFormatElement(writer, "spi", "%.16llx",
-                                                       id->is_initiator(id) ? id->get_initiator_spi(id)
-                                                                                                : id->get_responder_spi(id));
+                                       be64toh(id->is_initiator(id) ? id->get_initiator_spi(id)
+                                                                                                : id->get_responder_spi(id)));
                write_id(writer, "identification", ike_sa->get_my_id(ike_sa));
                write_address(writer, "address", local);
                xmlTextWriterWriteFormatElement(writer, "port", "%d",
@@ -246,8 +246,8 @@ static void request_query_ikesa(xmlTextReaderPtr reader, xmlTextWriterPtr writer
                remote = ike_sa->get_other_host(ike_sa);
                xmlTextWriterStartElement(writer, "remote");
                xmlTextWriterWriteFormatElement(writer, "spi", "%.16llx",
-                                                       id->is_initiator(id) ? id->get_responder_spi(id)
-                                                                                                : id->get_initiator_spi(id));
+                                       be64toh(id->is_initiator(id) ? id->get_responder_spi(id)
+                                                                                                : id->get_initiator_spi(id)));
                write_id(writer, "identification", ike_sa->get_other_id(ike_sa));
                write_address(writer, "address", remote);
                xmlTextWriterWriteFormatElement(writer, "port", "%d",