aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/isup.c15
-rw-r--r--src/isup_filter.c11
2 files changed, 22 insertions, 4 deletions
diff --git a/src/isup.c b/src/isup.c
index 31b4221..2827f21 100644
--- a/src/isup.c
+++ b/src/isup.c
@@ -21,10 +21,13 @@
#include <isup_types.h>
#include <cellmgr_debug.h>
#include <mtp_data.h>
+#include <mtp_level3.h>
#include <osmocom/core/msgb.h>
#include <osmocom/gsm/tlv.h>
+#include <endian.h>
+
static struct msgb *isup_status_alloc(int cic, int msg_type, uint8_t *extra, int range, int val)
{
struct isup_msg_hdr *hdr;
@@ -260,3 +263,15 @@ int mtp_link_set_isup(struct mtp_link_set *set, struct msgb *msg, int sls)
return rc;
}
+
+uint16_t isup_cic_to_local(const struct isup_msg_hdr *hdr)
+{
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ return hdr->cic;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ return c_swap_16(hdr->cic);
+#else
+ #error "Unknown endian"
+#endif
+}
+
diff --git a/src/isup_filter.c b/src/isup_filter.c
index 0e9a10c..b7c8e1a 100644
--- a/src/isup_filter.c
+++ b/src/isup_filter.c
@@ -61,6 +61,7 @@ int isup_scan_for_reset(struct ss7_application *app, struct msgb *msg)
{
struct isup_msg_hdr *hdr;
int range;
+ uint16_t cic;
/* too small for an isup message? */
if (msgb_l3len(msg) < sizeof(*hdr)) {
@@ -76,6 +77,8 @@ int isup_scan_for_reset(struct ss7_application *app, struct msgb *msg)
}
hdr = (struct isup_msg_hdr *) msg->l3h;
+ cic = isup_cic_to_local(hdr);
+
switch (hdr->msg_type) {
case ISUP_MSG_GRS:
range = isup_parse_status(&hdr->data[0],
@@ -88,14 +91,14 @@ int isup_scan_for_reset(struct ss7_application *app, struct msgb *msg)
LOGP(DISUP, LOGL_DEBUG,
"Going to reset ISUP for app %s, cic %d range %d\n",
- app->name, hdr->cic, range);
- reset_cics(app, hdr->cic, range);
+ app->name, cic, range);
+ reset_cics(app, cic, range);
break;
case ISUP_MSG_RSC:
LOGP(DISUP, LOGL_DEBUG,
"Going to reset single CIC %d on app %s\n",
- hdr->cic, app->name);
- reset_cic(app, hdr->cic);
+ cic, app->name);
+ reset_cic(app, cic);
break;
}