daniel has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/37662?usp=email )
Change subject: osmo_bsc_sigtran: Don't try to decode ipaccess_head a second time
......................................................................
osmo_bsc_sigtran: Don't try to decode ipaccess_head a second time
osmo_io segmentation will already parse the ipaccess_header and set
msg->data to the payload of the control command.
Depends: Id91cddf9948ca49abf092850fae3a8f17e445b45 (libosmo-netif.git)
Related: OS#6422
Change-Id: I300bbab3c0215d52bc5f6232ace5c37a6613feb7
---
M src/osmo-bsc/osmo_bsc_sigtran.c
1 file changed, 16 insertions(+), 12 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
diff --git a/src/osmo-bsc/osmo_bsc_sigtran.c b/src/osmo-bsc/osmo_bsc_sigtran.c
index 224e2c6..cdc5785 100644
--- a/src/osmo-bsc/osmo_bsc_sigtran.c
+++ b/src/osmo-bsc/osmo_bsc_sigtran.c
@@ -38,6 +38,7 @@
#include <osmocom/bsc/paging.h>
#include <osmocom/bsc/bssmap_reset.h>
#include <osmocom/mgcp_client/mgcp_common.h>
+#include <osmocom/netif/ipa.h>
/* A pointer to a list with all involved MSCs
* (a copy of the pointer location submitted with osmo_bsc_sigtran_init() */
@@ -733,9 +734,6 @@
* libosmo-sigtran doesn't know about, such as piggy-backed CTRL and/or MGCP */
static int asp_rx_unknown(struct osmo_ss7_asp *asp, int ppid_mux, struct msgb *msg)
{
- struct ipaccess_head *iph;
- struct ipaccess_head_ext *iph_ext;
-
if (osmo_ss7_asp_get_proto(asp) != OSMO_SS7_ASP_PROT_IPA) {
msgb_free(msg);
return 0;
@@ -743,15 +741,7 @@
switch (ppid_mux) {
case IPAC_PROTO_OSMO:
- if (msg->len < sizeof(*iph) + sizeof(*iph_ext)) {
- LOGP(DMSC, LOGL_ERROR, "The message is too short.\n");
- msgb_free(msg);
- return -EINVAL;
- }
- iph = (struct ipaccess_head *) msg->data;
- iph_ext = (struct ipaccess_head_ext *) iph->data;
- msg->l2h = iph_ext->data;
- switch (iph_ext->proto) {
+ switch (osmo_ipa_msgb_cb_proto_ext(msg)) {
case IPAC_PROTO_EXT_CTRL:
return bsc_sccplite_rx_ctrl(asp, msg);
case IPAC_PROTO_EXT_MGCP:
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/37662?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I300bbab3c0215d52bc5f6232ace5c37a6613feb7
Gerrit-Change-Number: 37662
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
daniel has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/37661?usp=email )
Change subject: ipa: Ensure osmo_ipa_segmentation_cb sets msg->l2h to the payload data
......................................................................
ipa: Ensure osmo_ipa_segmentation_cb sets msg->l2h to the payload data
Previously if ih->proto was IPAC_PROTO_OSMO msg->l2h would still point
to the extension header byte which breaks assumptions in e.g. osmo-bsc.
Change-Id: Id91cddf9948ca49abf092850fae3a8f17e445b45
Related: OS#6422
---
M src/ipa.c
1 file changed, 16 insertions(+), 1 deletion(-)
Approvals:
pespin: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
diff --git a/src/ipa.c b/src/ipa.c
index 8720427..d43df00 100644
--- a/src/ipa.c
+++ b/src/ipa.c
@@ -375,7 +375,8 @@
#define MSG_CB_IPA_INFO_OFFSET 0
/* Check and remove headers (in case of p == IPAC_PROTO_OSMO, also the IPA extension header).
- * Returns a negative number on error, otherwise the number of octets removed */
+ * Returns a negative number on error, otherwise the number of octets removed.
+ * Both msg->data and msg->l2h point to the user data after the (extended) IPA header if this function is successful. */
static inline int ipa_check_pull_headers(struct msgb *msg)
{
int ret;
@@ -397,6 +398,7 @@
osmo_ipa_msgb_cb_proto_ext(msg) = msg->data[0];
msgb_pull(msg, sizeof(struct ipa_head_ext));
octets_removed += sizeof(struct ipa_head_ext);
+ msg->l2h = msg->data;
return octets_removed;
}
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/37661?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Id91cddf9948ca49abf092850fae3a8f17e445b45
Gerrit-Change-Number: 37661
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged