Change in libosmocore[master]: add support for ipaccess messages on the ctrl interface

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/.

Stefan Sperling gerrit-no-reply at lists.osmocom.org
Tue Oct 9 12:12:03 UTC 2018


Stefan Sperling has uploaded this change for review. ( https://gerrit.osmocom.org/11287


Change subject: add support for ipaccess messages on the ctrl interface
......................................................................

add support for ipaccess messages on the ctrl interface

In ctrl_handle_msg(), check for IPACCESS protocol messages and respond
to such messages in the same way as ipa_ccm_rcvmsg_base() does. This will
allow the TTCN3 IPA "chopped ping" test to pass on control interfaces.

Change-Id: I9d7137c830981ccad03806b30b776e2b1f1b4699
Related: OS#2010
---
M src/ctrl/control_if.c
1 file changed, 32 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/87/11287/1

diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c
index 5962f7e..ed18a2f 100644
--- a/src/ctrl/control_if.c
+++ b/src/ctrl/control_if.c
@@ -389,20 +389,44 @@
 	struct ipaccess_head_ext *iph_ext;
 	int result;
 
+	if (msg->len < sizeof(*iph)) {
+		LOGP(DLCTRL, LOGL_ERROR, "The message is too short.\n");
+		return -EINVAL;
+	}
+	iph = (struct ipaccess_head *) msg->data;
+	if (iph->proto == IPAC_PROTO_IPACCESS) {
+		uint8_t msg_type = *(msg->l2h);
+		switch (msg_type) {
+		case IPAC_MSGT_PING:
+			if (ipa_ccm_send_pong(ccon->write_queue.bfd.fd) < 0)
+				LOGP(DLINP, LOGL_ERROR, "Cannot send PONG message. Reason: %s\n", strerror(errno));
+			break;
+		case IPAC_MSGT_PONG:
+			break;
+		case IPAC_MSGT_ID_ACK:
+			if (ipa_ccm_send_id_ack(ccon->write_queue.bfd.fd) < 0)
+				LOGP(DLINP, LOGL_ERROR, "Cannot send ID_ACK message. Reason: %s\n", strerror(errno));
+			break;
+		default:
+			LOGP(DLCTRL, LOGL_DEBUG, "Received unhandled IPACCESS protocol message of type 0x%x: %s\n",
+			     msg_type, msgb_hexdump(msg));
+			break;
+		}
+		return 0;
+	}
+	if (iph->proto != IPAC_PROTO_OSMO) {
+		LOGP(DLCTRL, LOGL_ERROR, "Protocol mismatch. Received protocol 0x%x message: %s\n",
+		     iph->proto, msgb_hexdump(msg));
+		return -EINVAL;
+	}
 	if (msg->len < sizeof(*iph) + sizeof(*iph_ext)) {
 		LOGP(DLCTRL, LOGL_ERROR, "The message is too short.\n");
 		return -EINVAL;
 	}
-
-	iph = (struct ipaccess_head *) msg->data;
-	if (iph->proto != IPAC_PROTO_OSMO) {
-		LOGP(DLCTRL, LOGL_ERROR, "Protocol mismatch. We got 0x%x\n", iph->proto);
-		return -EINVAL;
-	}
-
 	iph_ext = (struct ipaccess_head_ext *) iph->data;
 	if (iph_ext->proto != IPAC_PROTO_EXT_CTRL) {
-		LOGP(DLCTRL, LOGL_ERROR, "Extended protocol mismatch. We got 0x%x\n", iph_ext->proto);
+		LOGP(DLCTRL, LOGL_ERROR, "Extended protocol mismatch. Received protocol 0x%x message: %s\n",
+		     iph_ext->proto, msgb_hexdump(msg));
 		return -EINVAL;
 	}
 

-- 
To view, visit https://gerrit.osmocom.org/11287
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9d7137c830981ccad03806b30b776e2b1f1b4699
Gerrit-Change-Number: 11287
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181009/12ebbd08/attachment.htm>


More information about the gerrit-log mailing list