[PATCH] libosmo-sccp[master]: ipa: Fix endianness of pseud-M3UA header

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat Nov 11 19:26:35 UTC 2017


Review at  https://gerrit.osmocom.org/4784

ipa: Fix endianness of pseud-M3UA header

Change-Id: I70b420fc2105bb6e486adecf9285fed2fb471f73
---
M src/ipa.c
1 file changed, 7 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/84/4784/1

diff --git a/src/ipa.c b/src/ipa.c
index 11ff422..36fbd38 100644
--- a/src/ipa.c
+++ b/src/ipa.c
@@ -29,6 +29,7 @@
 #include <osmocom/core/logging.h>
 #include <osmocom/core/timer.h>
 #include <osmocom/core/socket.h>
+#include <osmocom/core/byteswap.h>
 #include <osmocom/gsm/ipa.h>
 #include <osmocom/gsm/protocol/ipaccess.h>
 
@@ -169,18 +170,18 @@
 	data_hdr.si = MTP_SI_SCCP;
 	if (asp->cfg.is_server) {
 		/* Source: the PC of the routing key */
-		data_hdr.opc = as->cfg.routing_key.pc;
+		data_hdr.opc = osmo_htonl(as->cfg.routing_key.pc);
 		/* Destination: Based on VTY config */
-		data_hdr.dpc = as->cfg.pc_override.dpc;
+		data_hdr.dpc = osmo_htonl(as->cfg.pc_override.dpc);
 	} else {
 		/* Source: Based on VTY config */
-		data_hdr.opc = as->cfg.pc_override.dpc;
+		data_hdr.opc = osmo_htonl(as->cfg.pc_override.dpc);
 		/* Destination: PC of the routing key */
-		data_hdr.dpc = as->cfg.routing_key.pc;
+		data_hdr.dpc = osmo_htonl(as->cfg.routing_key.pc);
 	}
 	xua = m3ua_xfer_from_data(&data_hdr, msgb_l2(msg), msgb_l2len(msg));
-	xua->mtp.opc = data_hdr.opc;
-	xua->mtp.dpc = data_hdr.dpc;
+	xua->mtp.opc = osmo_ntohl(data_hdr.opc);
+	xua->mtp.dpc = osmo_ntohl(data_hdr.dpc);
 
 	return m3ua_hmdc_rx_from_l2(asp->inst, xua);
 }

-- 
To view, visit https://gerrit.osmocom.org/4784
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I70b420fc2105bb6e486adecf9285fed2fb471f73
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list