[osmo-bts PATCH 3/5] utils: Changed the function check_oml_message for returning message vendor type

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/OpenBSC@lists.osmocom.org/.

Alvaro Neira Ayuso anayuso at sysmocom.de
Tue May 20 05:42:24 UTC 2014


From: Álvaro Neira Ayuso <anayuso at sysmocom.de>

Added some changes for returning the vendor type of message that
we have checked. We are going to return OML, Manufacturer O&M
Ipaccess message or Manufacturer O&M osmocom message.

BTW, I have fixed a wrong use of sizeof in the code that I have modified.

Signed-off-by: Alvaro Neira Ayuso <anayuso at sysmocom.de>
---
 src/osmo-bts-sysmo/utils.c |   14 ++++++++------
 src/osmo-bts-sysmo/utils.h |    6 ++++++
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/osmo-bts-sysmo/utils.c b/src/osmo-bts-sysmo/utils.c
index 1fa5796..e676a3c 100644
--- a/src/osmo-bts-sysmo/utils.c
+++ b/src/osmo-bts-sysmo/utils.c
@@ -245,15 +245,17 @@ int check_oml_msg(struct msgb *msg)
 
 	if (omh->mdisc == ABIS_OM_MDISC_MANUF) {
 		strncpy(label_id, (const char *) msg->l3h + 1,
-			sizeof(ipaccess_magic) + 1);
+			sizeof(ipaccess_magic));
 
 		if (strncmp(ipaccess_magic, label_id,
-			    sizeof(ipaccess_magic) + 1) == 0)
+			    sizeof(ipaccess_magic)) == 0) {
 			msg->l3h = msg->l3h + sizeof(ipaccess_magic) + 1;
-		else if (strncmp(osmocom_magic, label_id,
-				 sizeof(osmocom_magic) + 1) == 0)
+			return MANUFACTURER_MSG_IPA_TYPE;
+		} else if (strncmp(osmocom_magic, label_id,
+				 sizeof(osmocom_magic)) == 0) {
 			msg->l3h = msg->l3h + sizeof(osmocom_magic) + 1;
-		else {
+			return MANUFACTURER_MSG_OSMO_TYPE;
+		} else {
 			msg->l3h = NULL;
 			LOGP(DL1C, LOGL_ERROR,
 			     "Manuf Label Unknown %s\n", label_id);
@@ -261,7 +263,7 @@ int check_oml_msg(struct msgb *msg)
 		}
 	}
 
-	return 0;
+	return OML_MSG_TYPE;
 }
 
 int check_ipa_header(struct msgb *msg)
diff --git a/src/osmo-bts-sysmo/utils.h b/src/osmo-bts-sysmo/utils.h
index 4f2293a..dbbe443 100644
--- a/src/osmo-bts-sysmo/utils.h
+++ b/src/osmo-bts-sysmo/utils.h
@@ -21,6 +21,12 @@ enum manuf_type_id {
 	OSMOCOM_MANUF_ID,
 };
 
+enum check_message_type {
+	OML_MSG_TYPE,
+	MANUFACTURER_MSG_IPA_TYPE,
+	MANUFACTURER_MSG_OSMO_TYPE,
+};
+
 static const char osmocom_magic[] = "org.osmocom";
 static const char ipaccess_magic[] = "com.ipaccess";
 
-- 
1.7.10.4





More information about the OpenBSC mailing list