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.orgHarald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/9439
Change subject: Introduce osmo_ss7_asp_rx_unknown() for handling unknown PPID/StreamID
......................................................................
Introduce osmo_ss7_asp_rx_unknown() for handling unknown PPID/StreamID
Applications may be interested in handling data for those SCTP PPID or
IPA StreamID which libosmo-sigtran doesn't implement
natively/internally.
Let's add a weak symbol osmo_ss7_asp_rx_unknown() which applications
can override to implement whatever behaviour they'd want for those
PPID/StreamIDs.
Change-Id: I8616f914192000df0ec6547ff4ada80e0f9042a2
---
M include/osmocom/sigtran/osmo_ss7.h
M src/ipa.c
M src/osmo_ss7.c
3 files changed, 30 insertions(+), 13 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/39/9439/1
diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index fd3f103..89bf437 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -408,6 +408,8 @@
int osmo_ss7_asp_restart(struct osmo_ss7_asp *asp);
int osmo_ss7_asp_use_default_lm(struct osmo_ss7_asp *asp, int log_level);
+int osmo_ss7_asp_rx_unknown(struct osmo_ss7_asp *asp, int ppid_mux, struct msgb *msg);
+
#define LOGPASP(asp, subsys, level, fmt, args ...) \
LOGP(subsys, level, "asp-%s: " fmt, (asp)->cfg.name, ## args)
diff --git a/src/ipa.c b/src/ipa.c
index 9f04746..d81f56d 100644
--- a/src/ipa.c
+++ b/src/ipa.c
@@ -288,9 +288,7 @@
rc = ipa_rx_msg_sccp(asp, msg);
break;
default:
- LOGPASP(asp, DLSS7, LOGL_DEBUG, "Unknown Stream ID 0x%02x: %s\n",
- hh->proto, msgb_hexdump(msg));
- rc = -1;
+ rc = osmo_ss7_asp_rx_unknown(asp, hh->proto, msg);
}
return rc;
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 275469e..1a554a8 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -1450,11 +1450,8 @@
rc = sua_rx_msg(asp, msg);
else if (ppid == M3UA_PPID && asp->cfg.proto == OSMO_SS7_ASP_PROT_M3UA)
rc = m3ua_rx_msg(asp, msg);
- else {
- LOGPASP(asp, DLSS7, LOGL_NOTICE, "SCTP chunk for unknown PPID %u "
- "received\n", ppid);
- rc = 0;
- }
+ else
+ rc = osmo_ss7_asp_rx_unknown(asp, ppid, msg);
out:
msgb_free(msg);
@@ -1591,11 +1588,8 @@
rc = sua_rx_msg(asp, msg);
else if (ppid == M3UA_PPID && asp->cfg.proto == OSMO_SS7_ASP_PROT_M3UA)
rc = m3ua_rx_msg(asp, msg);
- else {
- LOGPASP(asp, DLSS7, LOGL_NOTICE, "SCTP chunk for unknown PPID %u "
- "received\n", ppid);
- rc = 0;
- }
+ else
+ rc = osmo_ss7_asp_rx_unknown(asp, ppid, msg);
out:
msgb_free(msg);
@@ -1918,3 +1912,26 @@
return OSMO_SS7_AS_TMOD_BCAST;
}
}
+
+/*! Weak function to handle payload for unknown/unsupported PPID or IPA StreamID.
+ * This function can be overridden by application code to implement whatever handling
+ * it wants for such additional payloads/streams.
+ * \param[in] asp Application Server Process through which data was received
+ * \param[in] ppid_sid SCTP PPID (in sigtran case) or IPA Stream ID
+ * \param[in] msg Message buffer containing received data. Continues to be owned by caller!
+ * \return 0 on success; negative on error */
+__attribute__((weak))
+int osmo_ss7_asp_rx_unknown(struct osmo_ss7_asp *asp, int ppid_mux, struct msgb *msg)
+{
+ switch(asp->cfg.proto) {
+ case OSMO_SS7_ASP_PROT_IPA:
+ LOGPASP(asp, DLSS7, LOGL_NOTICE, "Rx IPA for unknown Stream ID 0x%02x: %s\n",
+ ppid_mux, msgb_hexdump(msg));
+ break;
+ default:
+ LOGPASP(asp, DLSS7, LOGL_NOTICE, "Rx SCTP chunk for unknown PPID %u: %s\n",
+ ppid_mux, msgb_hexdump(msg));
+ break;
+ }
+ return 0;
+}
--
To view, visit https://gerrit.osmocom.org/9439
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8616f914192000df0ec6547ff4ada80e0f9042a2
Gerrit-Change-Number: 9439
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180603/61729ca3/attachment.htm>