aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-02-17 01:48:42 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-02-17 19:34:28 +0100
commit1b5d846b461a5e197646b6db35b49ceb0d867481 (patch)
tree3a9ed3959682481746dcf6bb4d303cb332cb0ad4
parentb27c9626e8e1c17e5100dab664d6d904ce2f65ac (diff)
mtp: Stop hardcoding the supported SSN inside the mtp_layer3.c
Stop hardcoding the supported ssn's inside the mtp_layer3.c and make it possible to allow to configure this in the future.
-rw-r--r--include/mtp_data.h3
-rw-r--r--src/links.c6
-rw-r--r--src/main_stp.c5
-rw-r--r--src/mtp_layer3.c3
4 files changed, 15 insertions, 2 deletions
diff --git a/include/mtp_data.h b/include/mtp_data.h
index 142c869..eed113f 100644
--- a/include/mtp_data.h
+++ b/include/mtp_data.h
@@ -66,6 +66,9 @@ struct mtp_link_set {
struct mtp_link *slc[16];
int sltm_once;
+ /* ssn map */
+ int supported_ssn[256];
+
int pcap_fd;
/* special handling */
diff --git a/src/links.c b/src/links.c
index 2db67bd..ccc8bfb 100644
--- a/src/links.c
+++ b/src/links.c
@@ -103,6 +103,12 @@ struct mtp_link_set *link_init(struct bsc_data *bsc)
set->spare = bsc->ni_spare;
set->pcap_fd = bsc->pcap_fd;
+ set->supported_ssn[1] = 1;
+ set->supported_ssn[7] = 1;
+ set->supported_ssn[8] = 1;
+ set->supported_ssn[146] = 1;
+ set->supported_ssn[254] = 1;
+
if (!bsc->src_port) {
LOGP(DINP, LOGL_ERROR, "You need to set a UDP address.\n");
return NULL;
diff --git a/src/main_stp.c b/src/main_stp.c
index 0a502b4..a4694b9 100644
--- a/src/main_stp.c
+++ b/src/main_stp.c
@@ -264,6 +264,11 @@ int main(int argc, char **argv)
m2ua_set->ni = 3;
m2ua_set->pcap_fd = bsc->pcap_fd;
m2ua_set->name = talloc_strdup(m2ua_set, "M2UA");
+ m2ua_set->supported_ssn[1] = 1;
+ m2ua_set->supported_ssn[7] = 1;
+ m2ua_set->supported_ssn[8] = 1;
+ m2ua_set->supported_ssn[146] = 1;
+ m2ua_set->supported_ssn[254] = 1;
/* setup things */
set->pass_all_isup = bsc->isup_pass;
diff --git a/src/mtp_layer3.c b/src/mtp_layer3.c
index aeb1866..83c8d63 100644
--- a/src/mtp_layer3.c
+++ b/src/mtp_layer3.c
@@ -402,8 +402,7 @@ static int mtp_link_sccp_data(struct mtp_link_set *link, struct mtp_level_3_hdr
LOGP(DINP, LOGL_ERROR, "Unknown APOC: %u/%u\n",
ntohs(prt->apoc), prt->apoc);
type = SCCP_SSP;
- } else if (prt->assn != 1 && prt->assn != 254 &&
- prt->assn != 7 && prt->assn != 8 && prt->assn != 146) {
+ } else if (!link->supported_ssn[prt->assn]) {
LOGP(DINP, LOGL_ERROR, "Unknown affected SSN assn: %u\n",
prt->assn);
type = SCCP_SSP;