lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

September 2024

  • 1 participants
  • 1983 discussions
[XS] Change in osmo-msc[master]: Remove dependency on libosmo-sccp
by laforge 09 Sep '24

09 Sep '24
Attention is currently required from: osmith. laforge has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/osmo-msc/+/38057?usp=email ) Change subject: Remove dependency on libosmo-sccp ...................................................................... Patch Set 1: (1 comment) File contrib/jenkins.sh: https://gerrit.osmocom.org/c/osmo-msc/+/38057/comment/d359b120_493d1dcd?usp… : PS1, Line 46: osmo-build-dep.sh libosmo-sccp this must not be removed. libosmo-sccp.git must be built as it contains libosmo-sigtran! -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/38057?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I46d8e48aabca69cd0d10896da4be8d35d3cedbd8 Gerrit-Change-Number: 38057 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Mon, 09 Sep 2024 07:44:31 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No
1 0
0 0
[XS] Change in osmo-msc[master]: Remove dependency on libosmo-sccp
by osmith 09 Sep '24

09 Sep '24
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/38057?usp=email ) Change subject: Remove dependency on libosmo-sccp ...................................................................... Remove dependency on libosmo-sccp OsmoMSC already depends on and uses libosmo-sigtran. Remove the dependency on libosmo-sccp, which has been removed in the related commit. Fix for: configure: error: Package requirements (libosmo-sccp >= 1.9.0) were not met: Related: libosmo-sccp d258a59432364634d8cec1359ca821aae1950bcc Change-Id: I46d8e48aabca69cd0d10896da4be8d35d3cedbd8 --- M configure.ac M contrib/jenkins.sh M debian/control M doc/manuals/chapters/overview.adoc M src/libmsc/neighbor_ident.c M src/osmo-msc/msc_main.c 6 files changed, 3 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/57/38057/1 diff --git a/configure.ac b/configure.ac index c0ab55e..49afb7b 100644 --- a/configure.ac +++ b/configure.ac @@ -44,7 +44,6 @@ PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.6.0) PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 1.5.0) PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 1.9.0) -PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 1.9.0) PKG_CHECK_MODULES(LIBOSMOMGCPCLIENT, libosmo-mgcp-client >= 1.13.0) PKG_CHECK_MODULES(LIBOSMOGSUPCLIENT, libosmo-gsup-client >= 1.8.0) diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index c5161ef..74f9ee9 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -43,7 +43,6 @@ osmo-build-dep.sh libosmo-abis osmo-build-dep.sh libosmo-netif -osmo-build-dep.sh libosmo-sccp osmo-build-dep.sh libsmpp34 osmo-build-dep.sh osmo-mgw osmo-build-dep.sh osmo-hlr diff --git a/debian/control b/debian/control index 76cfd7a..43a6334 100644 --- a/debian/control +++ b/debian/control @@ -15,7 +15,6 @@ libsmpp34-dev (>= 1.14.0), libasn1c-dev (>= 0.9.30), libosmocore-dev (>= 1.10.0), - libosmo-sccp-dev (>= 1.9.0), libosmo-sigtran-dev (>= 1.9.0), libosmo-abis-dev (>= 1.6.0), libosmo-mgcp-client-dev (>= 1.13.0), diff --git a/doc/manuals/chapters/overview.adoc b/doc/manuals/chapters/overview.adoc index 0bb47d7..ab09022 100644 --- a/doc/manuals/chapters/overview.adoc +++ b/doc/manuals/chapters/overview.adoc @@ -42,7 +42,7 @@ had an SCCPlite based _A_ interface towards 3rd party MSC implementations. OsmoMSC features a true SCCP/M3UA _A_ interface, which allows running OsmoBSC against this Osmocom based MSC implementation. The new SCCP/M3UA SIGTRAN for - the _A_ interface is implemented in libosmo-sccp, which is used by OsmoMSC + the _A_ interface is implemented in libosmo-sigtran, which is used by OsmoMSC and OsmoBSC (and others), to establish a link via an STP (e.g. OsmoSTP). - Addition of an _IuCS_ interface to allow operating 3G voice services, also diff --git a/src/libmsc/neighbor_ident.c b/src/libmsc/neighbor_ident.c index b3cdf17..e7d34fa 100644 --- a/src/libmsc/neighbor_ident.c +++ b/src/libmsc/neighbor_ident.c @@ -35,7 +35,7 @@ #include <osmocom/msc/sccp_ran.h> #include <osmocom/msc/cell_id_list.h> -/* XXX greater than or equal to IPA_STRING_MAX (libosmocore) and MAX_PC_STR_LEN (libosmo-sccp). */ +/* XXX greater than or equal to IPA_STRING_MAX (libosmocore) and MAX_PC_STR_LEN (libosmo-sigtran). */ #define NEIGHBOR_IDENT_ADDR_STRING_MAX 64 static struct gsm_network *gsmnet; diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c index 913bd21..a4b2ded 100644 --- a/src/osmo-msc/msc_main.c +++ b/src/osmo-msc/msc_main.c @@ -356,7 +356,7 @@ static int msc_vty_is_config_node(struct vty *vty, int node) { - /* Check if libosmo-sccp declares the node in + /* Check if libosmo-sigtran declares the node in * question as config node */ if (osmo_ss7_is_config_node(vty, node)) return 1; -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/38057?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I46d8e48aabca69cd0d10896da4be8d35d3cedbd8 Gerrit-Change-Number: 38057 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de>
1 0
0 0
[XS] Change in osmo-msc[master]: configure.ac: Remove ibosmo-sccp dependency
by laforge 09 Sep '24

09 Sep '24
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/38056?usp=email ) Change subject: configure.ac: Remove ibosmo-sccp dependency ...................................................................... configure.ac: Remove ibosmo-sccp dependency osmo-msc had probably forever contained a configure.ac dependency to libosmo-sccp (that's the old static library libsccp.a), which was only added to use a single header file (sccp_types.h). This file has recently been migrated to libosmo-sigtran, as libsccp.a has been removed. Change-Id: Ifcdad8684614c95982b6b471a5585dd42a7fb897 --- M TODO-RELEASE M configure.ac 2 files changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/56/38056/1 diff --git a/TODO-RELEASE b/TODO-RELEASE index 0ed7189..02843d4 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -7,3 +7,4 @@ # If any interfaces have been added since the last public release: c:r:a + 1. # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line +libosmo-sigtran bump dependency to > 1.9.0 / libosmo-sccp package removal diff --git a/configure.ac b/configure.ac index c0ab55e..49afb7b 100644 --- a/configure.ac +++ b/configure.ac @@ -44,7 +44,6 @@ PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.6.0) PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 1.5.0) PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 1.9.0) -PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 1.9.0) PKG_CHECK_MODULES(LIBOSMOMGCPCLIENT, libosmo-mgcp-client >= 1.13.0) PKG_CHECK_MODULES(LIBOSMOGSUPCLIENT, libosmo-gsup-client >= 1.8.0) -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/38056?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: Ifcdad8684614c95982b6b471a5585dd42a7fb897 Gerrit-Change-Number: 38056 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org>
1 0
0 0
[XL] Change in docker-playground[master]: Remove ttcn3 testsuites ported to testenv, part 1
by osmith 09 Sep '24

09 Sep '24
osmith has submitted this change. ( https://gerrit.osmocom.org/c/docker-playground/+/37714?usp=email ) Change subject: Remove ttcn3 testsuites ported to testenv, part 1 ...................................................................... Remove ttcn3 testsuites ported to testenv, part 1 Related: OS#6494 Depends: osmo-ci I6c7f88bb268a9f339b3af1d31d665e4376b34e48 Depends: osmo-ci Iac626d0c7c87c49ee6ba540ae1894abdb2336642 Change-Id: I7182c7e8eb00a9323fe1b6d27f630d253b4d34f6 --- M README.md D ttcn3-cbc-test/CBC_Tests.cfg D ttcn3-cbc-test/Dockerfile D ttcn3-cbc-test/Makefile D ttcn3-cbc-test/jenkins.sh D ttcn3-cbc-test/osmo-cbc.cfg D ttcn3-dia2gsup-test/DIA2GSUP_Tests.cfg D ttcn3-dia2gsup-test/Dockerfile D ttcn3-dia2gsup-test/Makefile D ttcn3-dia2gsup-test/jenkins.sh D ttcn3-dia2gsup-test/osmo_dia2gsup.config D ttcn3-hlr-test/Dockerfile D ttcn3-hlr-test/HLR_Tests.cfg D ttcn3-hlr-test/Makefile D ttcn3-hlr-test/jenkins.sh D ttcn3-hlr-test/osmo-hlr.cfg D ttcn3-hnodeb-test/Dockerfile D ttcn3-hnodeb-test/HNB_Tests.cfg D ttcn3-hnodeb-test/Makefile D ttcn3-hnodeb-test/jenkins.sh D ttcn3-hnodeb-test/osmo-hnodeb.cfg D ttcn3-hss-test-ogs/Dockerfile D ttcn3-hss-test-ogs/Makefile D ttcn3-hss-test-ogs/jenkins.sh D ttcn3-hss-test-ogs/ogs/HSS_Tests.cfg D ttcn3-hss-test-ogs/ogs/freediameter.conf D ttcn3-hss-test-ogs/ogs/mongod.conf D ttcn3-hss-test-ogs/ogs/open5gs-hss-latest.yaml D ttcn3-hss-test-ogs/ogs/open5gs-hss-master.yaml D ttcn3-mgw-test/Dockerfile D ttcn3-mgw-test/MGCP_Test.cfg D ttcn3-mgw-test/Makefile D ttcn3-mgw-test/jenkins.sh D ttcn3-mgw-test/osmo-mgw.cfg D ttcn3-mme-test-ogs/Dockerfile D ttcn3-mme-test-ogs/Makefile D ttcn3-mme-test-ogs/jenkins.sh D ttcn3-mme-test-ogs/ogs/MME_Tests.cfg D ttcn3-mme-test-ogs/ogs/freediameter.conf D ttcn3-mme-test-ogs/ogs/mme.sh D ttcn3-mme-test-ogs/ogs/open5gs-mme-latest.yaml D ttcn3-mme-test-ogs/ogs/open5gs-mme-master.yaml D ttcn3-s1gw-test/Dockerfile D ttcn3-s1gw-test/Makefile D ttcn3-s1gw-test/S1GW_Tests.cfg D ttcn3-s1gw-test/jenkins.sh D ttcn3-s1gw-test/osmo-s1gw.config D ttcn3-s1gw-test/s1gw.sh D ttcn3-sgsn-test-sns/jenkins.sh D ttcn3-sgsn-test-sns/osmo-stp.cfg D ttcn3-sgsn-test-sns/sns D ttcn3-sgsn-test/Dockerfile D ttcn3-sgsn-test/Makefile D ttcn3-sgsn-test/SGSN_Tests.cfg D ttcn3-sgsn-test/jenkins-sns.sh D ttcn3-sgsn-test/jenkins.sh D ttcn3-sgsn-test/osmo-sgsn.cfg D ttcn3-sgsn-test/osmo-stp.cfg D ttcn3-sgsn-test/sns/SGSN_Tests.cfg D ttcn3-sgsn-test/sns/osmo-sgsn.cfg D ttcn3-sgsn-test/ttcn3.sh D ttcn3-sip-test/Dockerfile D ttcn3-sip-test/Makefile D ttcn3-sip-test/SIP_Tests.cfg D ttcn3-sip-test/jenkins.sh D ttcn3-sip-test/osmo-sip-connector.cfg D ttcn3-smlc-test/Dockerfile D ttcn3-smlc-test/Makefile D ttcn3-smlc-test/SMLC_Tests.cfg D ttcn3-smlc-test/jenkins.sh D ttcn3-smlc-test/osmo-smlc.cfg D ttcn3-smlc-test/osmo-stp.cfg D ttcn3-upf-test/Dockerfile D ttcn3-upf-test/Makefile D ttcn3-upf-test/UPF_Tests.cfg D ttcn3-upf-test/jenkins.sh D ttcn3-upf-test/osmo-upf.cfg 77 files changed, 9 insertions(+), 2,616 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/README.md b/README.md index 6c2c989..3139f07 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,15 @@ ========================= This repository contains some humble attempts at creating some Docker -containers + related stacks around Osmocom. So far, the main focus is -test automation. +containers + related stacks around Osmocom. + +Historically this repository had all containers for running the TTCN3 +testsuites. We are porting them over to the new testenv configurations +inside `osmo-ttcn3-hacks.git` and removing them afterwards from +`docker-playground.git`. See +[_testenv/README.md](https://gitea.osmocom.org/ttcn3/osmo-ttcn3-hacks/src/branch/master/_testenv/README.md) +for more information, and [OS#6494](https://osmocom.org/issues/6494) +for reasoning. ## Running a testsuite All testsuite folders start with `ttcn3` or `nplab`. Run the following diff --git a/ttcn3-cbc-test/CBC_Tests.cfg b/ttcn3-cbc-test/CBC_Tests.cfg deleted file mode 100644 index 6e7ab21..0000000 --- a/ttcn3-cbc-test/CBC_Tests.cfg +++ /dev/null @@ -1,18 +0,0 @@ -[ORDERED_INCLUDE] -"/osmo-ttcn3-hacks/Common.cfg" -"/osmo-ttcn3-hacks/cbc/CBC_Tests.default" - -# Local configuration below - -[LOGGING] - -[TESTPORT_PARAMETERS] - -[MODULE_PARAMETERS] -CBC_Tests.mp_local_host := "172.18.27.100"; -CBC_Tests.mp_cbc_host := "172.18.27.20"; - -[MAIN_CONTROLLER] - -[EXECUTE] -CBC_Tests.control diff --git a/ttcn3-cbc-test/Dockerfile b/ttcn3-cbc-test/Dockerfile deleted file mode 100644 index 784eb25..0000000 --- a/ttcn3-cbc-test/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -ARG REGISTRY -ARG USER -FROM $REGISTRY/$USER/debian-bookworm-titan -ARG OSMO_TTCN3_BRANCH="master" - -ADD https://gerrit.osmocom.org/plugins/gitiles/osmo-ttcn3-hacks/+/$OSMO_TTCN3_B… /tmp/commit -RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" cbc - -VOLUME /data - -COPY CBC_Tests.cfg /data/CBC_Tests.cfg - -CMD ttcn3-docker-run cbc CBC_Tests diff --git a/ttcn3-cbc-test/Makefile b/ttcn3-cbc-test/Makefile deleted file mode 100644 index 45d5a8d..0000000 --- a/ttcn3-cbc-test/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -RUN_ARGS?=-it --sysctl net.ipv6.conf.all.disable_ipv6=0 --network sigtran --ip 172.18.23.202 - -include ../make/Makefile diff --git a/ttcn3-cbc-test/jenkins.sh b/ttcn3-cbc-test/jenkins.sh deleted file mode 100755 index 584d0b7..0000000 --- a/ttcn3-cbc-test/jenkins.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -. ../jenkins-common.sh -IMAGE_SUFFIX="${IMAGE_SUFFIX:-master}" -docker_images_require \ - "osmo-cbc-$IMAGE_SUFFIX" \ - "ttcn3-cbc-test" - -set_clean_up_trap -set -e - -mkdir $VOL_BASE_DIR/cbc-tester -cp CBC_Tests.cfg $VOL_BASE_DIR/cbc-tester/ -write_mp_osmo_repo "$VOL_BASE_DIR/cbc-tester/CBC_Tests.cfg" - -mkdir $VOL_BASE_DIR/cbc -cp osmo-cbc.cfg $VOL_BASE_DIR/cbc/ - -network_create -network_replace_subnet_in_configs - -echo Starting container with CBC -docker run --rm \ - $(docker_network_params $SUBNET 20) \ - --ulimit core=-1 \ - -v $VOL_BASE_DIR/cbc:/data \ - --name ${BUILD_TAG}-cbc -d \ - $DOCKER_ARGS \ - $REPO_USER/osmo-cbc-$IMAGE_SUFFIX - -echo Starting container with CBC testsuite -docker run --rm \ - $(docker_network_params $SUBNET 100) \ - --ulimit core=-1 \ - -e "TTCN3_PCAP_PATH=/data" \ - -e "OSMO_SUT_HOST=$SUB4_PREFIX.$SUBNET.20" \ - -e "OSMO_SUT_PORT=4264" \ - -v $VOL_BASE_DIR/cbc-tester:/data \ - --name ${BUILD_TAG}-ttcn3-cbc-test \ - $DOCKER_ARGS \ - $REPO_USER/ttcn3-cbc-test diff --git a/ttcn3-cbc-test/osmo-cbc.cfg b/ttcn3-cbc-test/osmo-cbc.cfg deleted file mode 100644 index fdb2011..0000000 --- a/ttcn3-cbc-test/osmo-cbc.cfg +++ /dev/null @@ -1,50 +0,0 @@ -! -log gsmtap 172.18.27.100 - logging level set-all debug - logging level asn1c info - logging filter all 1 -! -log stderr - logging filter all 1 - logging color 1 - logging print category-hex 0 - logging print category 1 - logging print extended-timestamp 1 - logging print level 1 - logging print file 1 last - logging level set-all info - logging level cbsp debug - logging level sbcap debug - logging level rest debug -! -line vty - no login - bind 172.18.27.20 -! -cbc - unknown-peers reject - ecbe - local-ip 172.18.27.20 - local-port 12345 - cbsp - local-ip 172.18.27.20 - local-port 48049 - sbcap - local-ip 172.18.27.20 - local-port 29168 - peer cbsp ttcn3-bsc-client - mode server - remote-port 15000 - remote-ip 172.18.27.100 - peer cbsp ttcn3-bsc-server - mode client - remote-port 15001 - remote-ip 172.18.27.100 - peer sbcap ttcn3-mme-client - mode server - remote-port 16000 - remote-ip 172.18.27.100 - peer sbcap ttcn3-mme-server - mode client - remote-port 16001 - remote-ip 172.18.27.100 diff --git a/ttcn3-dia2gsup-test/DIA2GSUP_Tests.cfg b/ttcn3-dia2gsup-test/DIA2GSUP_Tests.cfg deleted file mode 100644 index ce68c1f..0000000 --- a/ttcn3-dia2gsup-test/DIA2GSUP_Tests.cfg +++ /dev/null @@ -1,17 +0,0 @@ -[ORDERED_INCLUDE] -"/osmo-ttcn3-hacks/Common.cfg" -"/osmo-ttcn3-hacks/dia2gsup/DIA2GSUP_Tests.default" - -[LOGGING] - -[TESTPORT_PARAMETERS] - -[MODULE_PARAMETERS] -DIA2GSUP_Tests.mp_hlr_ip := "172.18.10.103" -DIA2GSUP_Tests.mp_s6_local_ip := "172.18.10.103" -DIA2GSUP_Tests.mp_hss_ip := "172.18.10.20" - -[MAIN_CONTROLLER] - -[EXECUTE] -DIA2GSUP_Tests.control diff --git a/ttcn3-dia2gsup-test/Dockerfile b/ttcn3-dia2gsup-test/Dockerfile deleted file mode 100644 index ff93371..0000000 --- a/ttcn3-dia2gsup-test/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -ARG REGISTRY -ARG USER -FROM $REGISTRY/$USER/debian-bookworm-titan - -ARG OSMO_TTCN3_BRANCH="master" - -ADD https://gerrit.osmocom.org/plugins/gitiles/osmo-ttcn3-hacks/+/$OSMO_TTCN3_B… /tmp/commit -RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" dia2gsup - -VOLUME /data - -COPY DIA2GSUP_Tests.cfg /data/DIA2GSUP_Tests.cfg - -CMD ttcn3-docker-run dia2gsup DIA2GSUP_Tests diff --git a/ttcn3-dia2gsup-test/Makefile b/ttcn3-dia2gsup-test/Makefile deleted file mode 100644 index 8d0e10b..0000000 --- a/ttcn3-dia2gsup-test/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../make/Makefile diff --git a/ttcn3-dia2gsup-test/jenkins.sh b/ttcn3-dia2gsup-test/jenkins.sh deleted file mode 100755 index 87eea24..0000000 --- a/ttcn3-dia2gsup-test/jenkins.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh - -. ../jenkins-common.sh -IMAGE_SUFFIX="${IMAGE_SUFFIX:-master}" -docker_images_require \ - "osmo_dia2gsup-$IMAGE_SUFFIX" \ - "ttcn3-dia2gsup-test" - -set_clean_up_trap -set -e - -mkdir $VOL_BASE_DIR/dia2gsup-tester -cp DIA2GSUP_Tests.cfg $VOL_BASE_DIR/dia2gsup-tester/ -write_mp_osmo_repo "$VOL_BASE_DIR/dia2gsup-tester/DIA2GSUP_Tests.cfg" - -mkdir $VOL_BASE_DIR/dia2gsup -cp osmo_dia2gsup.config $VOL_BASE_DIR/dia2gsup/ - -network_create -network_replace_subnet_in_configs - -echo Starting container with osmo_dia2gsup -docker run --rm \ - $(docker_network_params $SUBNET 20) \ - --ulimit core=-1 \ - -v $VOL_BASE_DIR/dia2gsup:/data \ - --name ${BUILD_TAG}-dia2gsup -d \ - $DOCKER_ARGS \ - $REPO_USER/osmo_dia2gsup-$IMAGE_SUFFIX - -echo Starting container with DIA2GSUP testsuite -docker run --rm \ - $(docker_network_params $SUBNET 103) \ - --ulimit core=-1 \ - -e "TTCN3_PCAP_PATH=/data" \ - -v $VOL_BASE_DIR/dia2gsup-tester:/data \ - --name ${BUILD_TAG}-ttcn3-dia2gsup-test \ - $DOCKER_ARGS \ - $REPO_USER/ttcn3-dia2gsup-test diff --git a/ttcn3-dia2gsup-test/osmo_dia2gsup.config b/ttcn3-dia2gsup-test/osmo_dia2gsup.config deleted file mode 100644 index 4403935..0000000 --- a/ttcn3-dia2gsup-test/osmo_dia2gsup.config +++ /dev/null @@ -1,13 +0,0 @@ -[{osmo_dia2gsup, [ - {hlr_ip, "172.18.10.103"}, - {hlr_port, 4222}, - - {diameter_ip, "172.18.10.20"}, - {diameter_port, 3868}, - {diameter_proto, sctp}, - {diameter_connect_timer, 200}, - - {origin_host, "hss.localdomain"}, - {origin_realm, "localdomain"}, - {vendor_id, 0} -]}]. diff --git a/ttcn3-hlr-test/Dockerfile b/ttcn3-hlr-test/Dockerfile deleted file mode 100644 index df3396d..0000000 --- a/ttcn3-hlr-test/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -ARG REGISTRY -ARG USER -FROM $REGISTRY/$USER/debian-bookworm-titan -ARG OSMO_TTCN3_BRANCH="master" - -ADD https://gerrit.osmocom.org/plugins/gitiles/osmo-ttcn3-hacks/+/$OSMO_TTCN3_B… /tmp/commit -RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" hlr - -VOLUME /data - -COPY HLR_Tests.cfg /data/HLR_Tests.cfg - -CMD ttcn3-docker-run hlr HLR_Tests diff --git a/ttcn3-hlr-test/HLR_Tests.cfg b/ttcn3-hlr-test/HLR_Tests.cfg deleted file mode 100644 index b8aa886..0000000 --- a/ttcn3-hlr-test/HLR_Tests.cfg +++ /dev/null @@ -1,16 +0,0 @@ -[ORDERED_INCLUDE] -"/osmo-ttcn3-hacks/Common.cfg" -"/osmo-ttcn3-hacks/hlr/HLR_Tests.default" - -[LOGGING] - -[TESTPORT_PARAMETERS] -*.VTY.CTRL_HOSTNAME := "172.18.10.20" - -[MODULE_PARAMETERS] -HLR_Tests.mp_hlr_ip := "172.18.10.20" - -[MAIN_CONTROLLER] - -[EXECUTE] -HLR_Tests.control diff --git a/ttcn3-hlr-test/Makefile b/ttcn3-hlr-test/Makefile deleted file mode 100644 index 0895788..0000000 --- a/ttcn3-hlr-test/Makefile +++ /dev/null @@ -1,2 +0,0 @@ - -include ../make/Makefile diff --git a/ttcn3-hlr-test/jenkins.sh b/ttcn3-hlr-test/jenkins.sh deleted file mode 100755 index c716add..0000000 --- a/ttcn3-hlr-test/jenkins.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -. ../jenkins-common.sh -IMAGE_SUFFIX="${IMAGE_SUFFIX:-master}" -docker_images_require \ - "osmo-hlr-$IMAGE_SUFFIX" \ - "ttcn3-hlr-test" - -set_clean_up_trap -set -e - -mkdir $VOL_BASE_DIR/hlr-tester -cp HLR_Tests.cfg $VOL_BASE_DIR/hlr-tester/ -write_mp_osmo_repo "$VOL_BASE_DIR/hlr-tester/HLR_Tests.cfg" - -mkdir $VOL_BASE_DIR/hlr -cp osmo-hlr.cfg $VOL_BASE_DIR/hlr/ - -network_create -network_replace_subnet_in_configs - -echo Starting container with HLR -docker run --rm \ - $(docker_network_params $SUBNET 20) \ - --ulimit core=-1 \ - -v $VOL_BASE_DIR/hlr:/data \ - --name ${BUILD_TAG}-hlr -d \ - $DOCKER_ARGS \ - $REPO_USER/osmo-hlr-$IMAGE_SUFFIX \ - /bin/sh -c "osmo-hlr -c /data/osmo-hlr.cfg >/data/osmo-hlr.log 2>&1" - -echo Starting container with HLR testsuite -docker run --rm \ - $(docker_network_params $SUBNET 103) \ - --ulimit core=-1 \ - -e "TTCN3_PCAP_PATH=/data" \ - -e "OSMO_SUT_HOST=$SUB4_PREFIX.$SUBNET.20" \ - -e "OSMO_SUT_PORT=4258" \ - -v $VOL_BASE_DIR/hlr-tester:/data \ - --name ${BUILD_TAG}-ttcn3-hlr-test \ - $DOCKER_ARGS \ - $REPO_USER/ttcn3-hlr-test diff --git a/ttcn3-hlr-test/osmo-hlr.cfg b/ttcn3-hlr-test/osmo-hlr.cfg deleted file mode 100644 index 5cda49e..0000000 --- a/ttcn3-hlr-test/osmo-hlr.cfg +++ /dev/null @@ -1,28 +0,0 @@ -! -! OsmoHLR example configuration -! -log gsmtap 172.18.10.103 - logging level set-all debug - logging filter all 1 -! -log stderr - logging filter all 1 - logging color 1 - logging print level 1 - logging print category 1 - logging print category-hex 0 - logging print file basename last - logging print extended-timestamp 1 - logging level set-all debug -! -line vty - bind 0.0.0.0 -ctrl - bind 0.0.0.0 -hlr - gsup - bind ip 0.0.0.0 - euse foobar - ussd route prefix *#100 internal own-msisdn - ussd route prefix *#101 internal own-imsi - ussd route prefix *100 external foobar diff --git a/ttcn3-hnodeb-test/Dockerfile b/ttcn3-hnodeb-test/Dockerfile deleted file mode 100644 index df6cb94..0000000 --- a/ttcn3-hnodeb-test/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -ARG REGISTRY -ARG USER -FROM $REGISTRY/$USER/debian-bookworm-titan -ARG OSMO_TTCN3_BRANCH="master" - -ADD https://gerrit.osmocom.org/plugins/gitiles/osmo-ttcn3-hacks/+/$OSMO_TTCN3_B… /tmp/commit -RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" hnodeb - -VOLUME /data - -COPY HNB_Tests.cfg /data/HNB_Tests.cfg - -CMD ttcn3-docker-run hnodeb HNB_Tests diff --git a/ttcn3-hnodeb-test/HNB_Tests.cfg b/ttcn3-hnodeb-test/HNB_Tests.cfg deleted file mode 100644 index 677e12b..0000000 --- a/ttcn3-hnodeb-test/HNB_Tests.cfg +++ /dev/null @@ -1,20 +0,0 @@ -[ORDERED_INCLUDE] -"/osmo-ttcn3-hacks/Common.cfg" -"/osmo-ttcn3-hacks/hnodeb/HNB_Tests.default" - -[LOGGING] -*.JUnitLogger.testsuite_name := "HNB_Tests" - -[TESTPORT_PARAMETERS] -*.HNBVTY.CTRL_HOSTNAME := "172.18.33.20"; -*.STATSVTY.CTRL_HOSTNAME := "172.18.33.20"; - -[MODULE_PARAMETERS] -HNB_Tests.mp_hnodeb_ip := "172.18.33.20"; -HNB_Tests.mp_hnbgw_iuh_ip := "172.18.33.203"; -HNB_Tests.mp_hnbllif_sk_path := "/data/unix/ll_sock"; - -[MAIN_CONTROLLER] - -[EXECUTE] -HNB_Tests.control diff --git a/ttcn3-hnodeb-test/Makefile b/ttcn3-hnodeb-test/Makefile deleted file mode 100644 index 397f597..0000000 --- a/ttcn3-hnodeb-test/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -RUN_ARGS?=-it --sysctl net.ipv6.conf.all.disable_ipv6=0 --network sigtran --ip 172.18.33.202 -v ggsn-test-vol:/data - -include ../make/Makefile diff --git a/ttcn3-hnodeb-test/jenkins.sh b/ttcn3-hnodeb-test/jenkins.sh deleted file mode 100755 index d3ae816..0000000 --- a/ttcn3-hnodeb-test/jenkins.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh - -. ../jenkins-common.sh -IMAGE_SUFFIX="${IMAGE_SUFFIX:-master}" -docker_images_require \ - "osmo-hnodeb-$IMAGE_SUFFIX" \ - "ttcn3-hnodeb-test" - -set_clean_up_trap -set -e - -mkdir $VOL_BASE_DIR/hnodeb-tester -mkdir $VOL_BASE_DIR/hnodeb-tester/unix -cp HNB_Tests.cfg $VOL_BASE_DIR/hnodeb-tester/ -write_mp_osmo_repo "$VOL_BASE_DIR/hnodeb-tester/HNB_Tests.cfg" - -mkdir $VOL_BASE_DIR/hnodeb -mkdir $VOL_BASE_DIR/hnodeb/unix -cp osmo-hnodeb.cfg $VOL_BASE_DIR/hnodeb/ - -mkdir $VOL_BASE_DIR/unix - -network_create -network_replace_subnet_in_configs - -echo Starting container with HNodeB -docker run --rm \ - $(docker_network_params $SUBNET 20) \ - --ulimit core=-1 \ - -v $VOL_BASE_DIR/hnodeb:/data \ - -v $VOL_BASE_DIR/unix:/data/unix \ - --name ${BUILD_TAG}-hnodeb -d \ - $DOCKER_ARGS \ - $REPO_USER/osmo-hnodeb-$IMAGE_SUFFIX - -echo Starting container with HNodeB testsuite -docker run --rm \ - $(docker_network_params $SUBNET 203) \ - --ulimit core=-1 \ - -e "TTCN3_PCAP_PATH=/data" \ - -e "OSMO_SUT_HOST=$SUB4_PREFIX.$SUBNET.20" \ - -e "OSMO_SUT_PORT=4273" \ - -v $VOL_BASE_DIR/hnodeb-tester:/data \ - -v $VOL_BASE_DIR/unix:/data/unix \ - --name ${BUILD_TAG}-ttcn3-hnodeb-test \ - $DOCKER_ARGS \ - $REPO_USER/ttcn3-hnodeb-test - -echo Stopping containers -docker_kill_wait ${BUILD_TAG}-hnodeb diff --git a/ttcn3-hnodeb-test/osmo-hnodeb.cfg b/ttcn3-hnodeb-test/osmo-hnodeb.cfg deleted file mode 100644 index 7d24700..0000000 --- a/ttcn3-hnodeb-test/osmo-hnodeb.cfg +++ /dev/null @@ -1,29 +0,0 @@ -! -log gsmtap 172.18.33.203 - logging level set-all debug - logging filter all 1 -! -log stderr - logging filter all 1 - logging color 1 - logging print category 1 - logging timestamp 1 - logging print extended-timestamp 1 - logging level set-all debug -! -line vty - no login - bind 172.18.33.20 -! -hnodeb - cell_identity 1 - location_area_code 2 - routing_area_code 3 - service_area_code 4 - iuh - local-ip 172.18.33.20 - remote-ip 172.18.33.203 - ll-socket - path /data/unix/ll_sock - gtp - local-ip 172.18.33.20 diff --git a/ttcn3-hss-test-ogs/Dockerfile b/ttcn3-hss-test-ogs/Dockerfile deleted file mode 100644 index f8ae830..0000000 --- a/ttcn3-hss-test-ogs/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -ARG REGISTRY -ARG USER -FROM $REGISTRY/$USER/debian-bookworm-titan - -RUN apt-get update && \ - apt-get upgrade -y && \ - DEBIAN_FRONTEND='noninteractive' apt-get install -y --no-install-recommends --no-install-suggests \ - libgnutls28-dev \ - && \ - apt-get clean - -ARG OSMO_TTCN3_BRANCH="master" - -ADD https://gerrit.osmocom.org/plugins/gitiles/osmo-ttcn3-hacks/+/$OSMO_TTCN3_B… /tmp/commit -RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" hss - -VOLUME /data - -COPY ogs/HSS_Tests.cfg /data/HSS_Tests.cfg - -CMD ttcn3-docker-run hss HSS_Tests diff --git a/ttcn3-hss-test-ogs/Makefile b/ttcn3-hss-test-ogs/Makefile deleted file mode 100644 index 8d0e10b..0000000 --- a/ttcn3-hss-test-ogs/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../make/Makefile diff --git a/ttcn3-hss-test-ogs/jenkins.sh b/ttcn3-hss-test-ogs/jenkins.sh deleted file mode 100755 index d8932aa..0000000 --- a/ttcn3-hss-test-ogs/jenkins.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/sh - -. ../jenkins-common.sh - -IMAGE_SUFFIX="${IMAGE_SUFFIX:-master}" -docker_images_require \ - "open5gs-$IMAGE_SUFFIX" \ - "ttcn3-hss-test-ogs" - -set_clean_up_trap -set -e - -mkdir -p $VOL_BASE_DIR/mongo/db -cp ogs/mongod.conf $VOL_BASE_DIR/mongo/ - -mkdir $VOL_BASE_DIR/hss-tester -cp ogs/HSS_Tests.cfg $VOL_BASE_DIR/hss-tester/ -write_mp_osmo_repo "$VOL_BASE_DIR/hss-tester/HSS_Tests.cfg" - -mkdir $VOL_BASE_DIR/hss -cp ogs/open5gs-*-$IMAGE_SUFFIX.yaml $VOL_BASE_DIR/hss/ -cp ogs/freediameter.conf $VOL_BASE_DIR/hss/ - -network_create -network_replace_subnet_in_configs - -MONGOD_ADDR="$SUB4_PREFIX.$SUBNET.103" -DBCTL="open5gs-dbctl --db_uri=mongodb://$MONGOD_ADDR/open5gs" - -# start container with mongod in background -docker run --rm --user $(id -u) \ - $(docker_network_params $SUBNET 103) \ - --ulimit core=-1 \ - -v $VOL_BASE_DIR/mongo:/data \ - --name ${BUILD_TAG}-mongo -d \ - $DOCKER_ARGS \ - $REPO_USER/open5gs-$IMAGE_SUFFIX \ - /bin/sh -c "mongod -f /data/mongod.conf >/data/mongod.out 2>&1" - -# mongod needs some time to bootstrap... -while ! nc -z $MONGOD_ADDR 27017; do sleep 1; done - -# create a test subscriber with IMSI=001010000000000 -docker run --rm \ - $(docker_network_params $SUBNET 8) \ - $REPO_USER/open5gs-$IMAGE_SUFFIX \ - $DBCTL add 001010000000000 3c6e0b8a9c15224a8228b9a98ca1531d 762a2206fe0b4151ace403c86a11e479 - -# Mark test subscriber with IMSI=001010000000001 as: -# Subscriber-Status=OPERATOR_DETERMINED_BARRING (1) -# Operator-Determined-Barring="Barring of all outgoing inter-zonal calls except those directed to the home PLMN country" (7) -docker run --rm \ - $(docker_network_params $SUBNET 8) \ - $REPO_USER/open5gs-$IMAGE_SUFFIX \ - /bin/sh -c "$DBCTL add 001010000000001 3c6e0b8a9c15224a8228b9a98ca1531d 762a2206fe0b4151ace403c86a11e479 && - $DBCTL subscriber_status 001010000000001 1 7" - -# start container with hss in background -docker run --sysctl net.ipv6.conf.all.disable_ipv6=0 \ - --rm \ - --ulimit core=-1 \ - -v $VOL_BASE_DIR/hss:/data \ - --name ${BUILD_TAG}-ogs-hss -d \ - $DOCKER_ARGS \ - $(docker_network_params $SUBNET 201) \ - $REPO_USER/open5gs-$IMAGE_SUFFIX \ - /bin/sh -c "open5gs-hssd -c /data/open5gs-hss-$IMAGE_SUFFIX.yaml >/data/open5gs-hssd.out 2>&1" - -# start docker container with testsuite in foreground -docker run --rm \ - --sysctl net.ipv6.conf.all.disable_ipv6=0 \ - $(docker_network_params $SUBNET 202) \ - --ulimit core=-1 \ - -v $VOL_BASE_DIR/hss-tester:/data \ - -e "TTCN3_PCAP_PATH=/data" \ - --name ${BUILD_TAG}-hss-test \ - $DOCKER_ARGS \ - $REPO_USER/ttcn3-hss-test-ogs - -# remove mongodb's database -rm -rf $VOL_BASE_DIR/mongo/db/ diff --git a/ttcn3-hss-test-ogs/ogs/HSS_Tests.cfg b/ttcn3-hss-test-ogs/ogs/HSS_Tests.cfg deleted file mode 100644 index 17fa1a5..0000000 --- a/ttcn3-hss-test-ogs/ogs/HSS_Tests.cfg +++ /dev/null @@ -1,26 +0,0 @@ -[ORDERED_INCLUDE] -# Common configuration, shared between test suites -"/osmo-ttcn3-hacks/Common.cfg" -# testsuite specific configuration, not expected to change -"/osmo-ttcn3-hacks/hss/HSS_Tests.default" - -# Local configuration below - -[LOGGING] - -[TESTPORT_PARAMETERS] - -[MODULE_PARAMETERS] -mp_hss_hostname := "172.18.3.201"; -mp_hss_port := 3868; -mp_diam_local_hostname := "172.18.3.202"; -mp_diam_local_port := 3868; -mp_diam_orig_realm := "localdomain"; -mp_diam_orig_host := "mme.localdomain"; -mp_diam_dest_realm := "localdomain"; -mp_diam_dest_host := "hss.localdomain"; - -[MAIN_CONTROLLER] - -[EXECUTE] -HSS_Tests.control diff --git a/ttcn3-hss-test-ogs/ogs/freediameter.conf b/ttcn3-hss-test-ogs/ogs/freediameter.conf deleted file mode 100644 index 2678592..0000000 --- a/ttcn3-hss-test-ogs/ogs/freediameter.conf +++ /dev/null @@ -1,265 +0,0 @@ -# This is a sample configuration file for freeDiameter daemon. - -# Most of the options can be omitted, as they default to reasonable values. -# Only TLS-related options must be configured properly in usual setups. - -# It is possible to use "include" keyword to import additional files -# e.g.: include "/etc/freeDiameter.d/*.conf" -# This is exactly equivalent as copy & paste the content of the included file(s) -# where the "include" keyword is found. - - -############################################################## -## Peer identity and realm - -# The Diameter Identity of this daemon. -# This must be a valid FQDN that resolves to the local host. -# Default: hostname's FQDN -#Identity = "aaa.koganei.freediameter.net"; -Identity = "hss.localdomain"; - -# The Diameter Realm of this daemon. -# Default: the domain part of Identity (after the first dot). -#Realm = "koganei.freediameter.net"; -Realm = "localdomain"; - -############################################################## -## Transport protocol configuration - -# The port this peer is listening on for incoming connections (TCP and SCTP). -# Default: 3868. Use 0 to disable. -Port = 3868; - -# The port this peer is listening on for incoming TLS-protected connections (TCP and SCTP). -# See TLS_old_method for more information about TLS flavours. -# Note: we use TLS/SCTP instead of DTLS/SCTP at the moment. This will change in future version of freeDiameter. -# Default: 5868. Use 0 to disable. -SecPort = 0; - -# Use RFC3588 method for TLS protection, where TLS is negociated after CER/CEA exchange is completed -# on the unsecure connection. The alternative is RFC6733 mechanism, where TLS protects also the -# CER/CEA exchange on a dedicated secure port. -# This parameter only affects outgoing connections. -# The setting can be also defined per-peer (see Peers configuration section). -# Default: use RFC6733 method with separate port for TLS. -#TLS_old_method; - -# Disable use of TCP protocol (only listen and connect over SCTP) -# Default : TCP enabled -#No_TCP; - -# Disable use of SCTP protocol (only listen and connect over TCP) -# Default : SCTP enabled -#No_SCTP; -# This option is ignored if freeDiameter is compiled with DISABLE_SCTP option. - -# Prefer TCP instead of SCTP for establishing new connections. -# This setting may be overwritten per peer in peer configuration blocs. -# Default : SCTP is attempted first. -#Prefer_TCP; - -# Default number of streams per SCTP associations. -# This setting may be overwritten per peer basis. -# Default : 30 streams -#SCTP_streams = 30; - -############################################################## -## Endpoint configuration - -# Disable use of IP addresses (only IPv6) -# Default : IP enabled -#No_IP; - -# Disable use of IPv6 addresses (only IP) -# Default : IPv6 enabled -#No_IPv6; - -# Specify local addresses the server must bind to -# Default : listen on all addresses available. -#ListenOn = "202.249.37.5"; -#ListenOn = "2001:200:903:2::202:1"; -#ListenOn = "fe80::21c:5ff:fe98:7d62%eth0"; -ListenOn = "172.18.3.201"; - - -############################################################## -## Server configuration - -# How many Diameter peers are allowed to be connecting at the same time ? -# This parameter limits the number of incoming connections from the time -# the connection is accepted until the first CER is received. -# Default: 5 unidentified clients in paralel. -#ThreadsPerServer = 5; - -############################################################## -## TLS Configuration - -# TLS is managed by the GNUTLS library in the freeDiameter daemon. -# You may find more information about parameters and special behaviors -# in the relevant documentation. -# http://www.gnu.org/software/gnutls/manual/ - -# Credentials of the local peer -# The X509 certificate and private key file to use for the local peer. -# The files must contain PKCS-1 encoded RSA key, in PEM format. -# (These parameters are passed to gnutls_certificate_set_x509_key_file function) -# Default : NO DEFAULT -#TLS_Cred = "<x509 certif file.PEM>" , "<x509 private key file.PEM>"; -#TLS_Cred = "/etc/ssl/certs/freeDiameter.pem", "/etc/ssl/private/freeDiameter.key"; - -# Certificate authority / trust anchors -# The file containing the list of trusted Certificate Authorities (PEM list) -# (This parameter is passed to gnutls_certificate_set_x509_trust_file function) -# The directive can appear several times to specify several files. -# Default : GNUTLS default behavior -#TLS_CA = "<file.PEM>"; - -# Certificate Revocation List file -# The information about revoked certificates. -# The file contains a list of trusted CRLs in PEM format. They should have been verified before. -# (This parameter is passed to gnutls_certificate_set_x509_crl_file function) -# Note: openssl CRL format might have interoperability issue with GNUTLS format. -# Default : GNUTLS default behavior -#TLS_CRL = "<file.PEM>"; - -# GNU TLS Priority string -# This string allows to configure the behavior of GNUTLS key exchanges -# algorithms. See gnutls_priority_init function documentation for information. -# You should also refer to the Diameter required TLS support here: -# http://tools.ietf.org/html/rfc6733#section-13.1 -# Default : "NORMAL" -# Example: TLS_Prio = "NONE:+VERS-TLS1.1:+AES-128-CBC:+RSA:+SHA1:+COMP-NULL"; -#TLS_Prio = "NORMAL"; - -# Diffie-Hellman parameters size -# Set the number of bits for generated DH parameters -# Valid value should be 768, 1024, 2048, 3072 or 4096. -# (This parameter is passed to gnutls_dh_params_generate2 function, -# it usually should match RSA key size) -# Default : 1024 -#TLS_DH_Bits = 1024; - -# Alternatively, you can specify a file to load the PKCS#3 encoded -# DH parameters directly from. This accelerates the daemon start -# but is slightly less secure. If this file is provided, the -# TLS_DH_Bits parameters has no effect. -# Default : no default. -#TLS_DH_File = "<file.PEM>"; - - -############################################################## -## Timers configuration - -# The Tc timer of this peer. -# It is the delay before a new attempt is made to reconnect a disconnected peer. -# The value is expressed in seconds. The recommended value is 30 seconds. -# Default: 30 -#TcTimer = 30; - -# The Tw timer of this peer. -# It is the delay before a watchdog message is sent, as described in RFC 3539. -# The value is expressed in seconds. The default value is 30 seconds. Value must -# be greater or equal to 6 seconds. See details in the RFC. -# Default: 30 -#TwTimer = 30; - -############################################################## -## Applications configuration - -# Disable the relaying of Diameter messages? -# For messages not handled locally, the default behavior is to forward the -# message to another peer if any is available, according to the routing -# algorithms. In addition the "0xffffff" application is advertised in CER/CEA -# exchanges. -# Default: Relaying is enabled. -#NoRelay; -NoRelay; - -# Number of server threads that can handle incoming messages at the same time. -# Default: 4 -#AppServThreads = 4; - -# Other applications are configured by loaded extensions. - -############################################################## -## Extensions configuration - -# The freeDiameter framework merely provides support for -# Diameter Base Protocol. The specific application behaviors, -# as well as advanced functions, are provided -# by loadable extensions (plug-ins). -# These extensions may in addition receive the name of a -# configuration file, the format of which is extension-specific. -# -# Format: -#LoadExtension = "/path/to/extension" [ : "/optional/configuration/file" ] ; -# -# Examples: -#LoadExtension = "extensions/sample.fdx"; -#LoadExtension = "extensions/sample.fdx":"conf/sample.conf"; - -# Extensions are named as follow: -# dict_* for extensions that add content to the dictionary definitions. -# dbg_* for extensions useful only to retrieve more information on the framework execution. -# acl_* : Access control list, to control which peers are allowed to connect. -# rt_* : routing extensions that impact how messages are forwarded to other peers. -# app_* : applications, these extensions usually register callbacks to handle specific messages. -# test_* : dummy extensions that are useful only in testing environments. - - -# The dbg_msg_dump.fdx extension allows you to tweak the way freeDiameter displays some -# information about some events. This extension does not actually use a configuration file -# but receives directly a parameter in the string passed to the extension. Here are some examples: -## LoadExtension = "dbg_msg_dumps.fdx" : "0x1111"; # Removes all default hooks, very quiet even in case of errors. -## LoadExtension = "dbg_msg_dumps.fdx" : "0x2222"; # Display all events with few details. -## LoadExtension = "dbg_msg_dumps.fdx" : "0x0080"; # Dump complete information about sent and received messages. -# The four digits respectively control: connections, routing decisions, sent/received messages, errors. -# The values for each digit are: -# 0 - default - keep the default behavior -# 1 - quiet - remove any specific log -# 2 - compact - display only a summary of the information -# 4 - full - display the complete information on a single long line -# 8 - tree - display the complete information in an easier to read format spanning several lines. - -LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dbg_msg_dumps.fdx" : "0x8888"; -LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dict_rfc5777.fdx"; -LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dict_mip6i.fdx"; -LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dict_nasreq.fdx"; -LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dict_nas_mipv6.fdx"; -LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dict_dcca.fdx"; -LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dict_dcca_3gpp.fdx"; - - -############################################################## -## Peers configuration - -# The local server listens for incoming connections. By default, -# all unknown connecting peers are rejected. Extensions can override this behavior (e.g., acl_wl). -# -# In addition to incoming connections, the local peer can -# be configured to establish and maintain connections to some -# Diameter nodes and allow connections from these nodes. -# This is achieved with the ConnectPeer directive described below. -# -# Note that the configured Diameter Identity MUST match -# the information received inside CEA, or the connection will be aborted. -# -# Format: -#ConnectPeer = "diameterid" [ { parameter1; parameter2; ...} ] ; -# Parameters that can be specified in the peer's parameter list: -# No_TCP; No_SCTP; No_IP; No_IPv6; Prefer_TCP; TLS_old_method; -# No_TLS; # assume transparent security instead of TLS. DTLS is not supported yet (will change in future versions). -# Port = 5868; # The port to connect to -# TcTimer = 30; -# TwTimer = 30; -# ConnectTo = "202.249.37.5"; -# ConnectTo = "2001:200:903:2::202:1"; -# TLS_Prio = "NORMAL"; -# Realm = "realm.net"; # Reject the peer if it does not advertise this realm. -# Examples: -#ConnectPeer = "aaa.wide.ad.jp"; -#ConnectPeer = "old.diameter.serv" { TcTimer = 60; TLS_old_method; No_SCTP; Port=3868; } ; -ConnectPeer = "mme.localdomain" { ConnectTo = "172.18.3.202"; Port = 3868; No_TLS; TcTimer = 2; }; - - -############################################################## diff --git a/ttcn3-hss-test-ogs/ogs/mongod.conf b/ttcn3-hss-test-ogs/ogs/mongod.conf deleted file mode 100644 index 65beb4e..0000000 --- a/ttcn3-hss-test-ogs/ogs/mongod.conf +++ /dev/null @@ -1,44 +0,0 @@ -# mongod.conf - -# for documentation of all options, see: -# http://docs.mongodb.org/manual/reference/configuration-options/ - -# Where and how to store data. -storage: - dbPath: /data/db - journal: - enabled: true -# engine: -# mmapv1: -# wiredTiger: - -# where to write logging data. -systemLog: - destination: file - logAppend: true - path: /data/mongod.log - -# network interfaces -net: - port: 27017 - bindIp: 172.18.16.103 - - -# how the process runs -processManagement: - timeZoneInfo: /usr/share/zoneinfo - -#security: - -#operationProfiling: - -#replication: - -#sharding: - -## Enterprise-Only Options: - -#auditLog: - -#snmp: - diff --git a/ttcn3-hss-test-ogs/ogs/open5gs-hss-latest.yaml b/ttcn3-hss-test-ogs/ogs/open5gs-hss-latest.yaml deleted file mode 100644 index 8d1f42e..0000000 --- a/ttcn3-hss-test-ogs/ogs/open5gs-hss-latest.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# See https://github.com/open5gs/open5gs/blob/main/configs/open5gs/hss.yaml.in - -db_uri: mongodb://172.18.3.103/open5gs - -logger: - level: trace - -hss: - freeDiameter: /data/freediameter.conf - -parameter: - -max: diff --git a/ttcn3-hss-test-ogs/ogs/open5gs-hss-master.yaml b/ttcn3-hss-test-ogs/ogs/open5gs-hss-master.yaml deleted file mode 100644 index df92b6f..0000000 --- a/ttcn3-hss-test-ogs/ogs/open5gs-hss-master.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# See https://github.com/open5gs/open5gs/blob/main/configs/open5gs/hss.yaml.in - -db_uri: mongodb://172.18.3.103/open5gs - -logger: - level: trace - -global: - max: - ue: 1024 - -hss: - freeDiameter: /data/freediameter.conf - -parameter: - -max: diff --git a/ttcn3-mgw-test/Dockerfile b/ttcn3-mgw-test/Dockerfile deleted file mode 100644 index e8aad68..0000000 --- a/ttcn3-mgw-test/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -ARG REGISTRY -ARG USER -FROM $REGISTRY/$USER/debian-bookworm-titan -ARG OSMO_TTCN3_BRANCH="master" - -ADD https://gerrit.osmocom.org/plugins/gitiles/osmo-ttcn3-hacks/+/$OSMO_TTCN3_B… /tmp/commit -RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" mgw - -VOLUME /data - -COPY MGCP_Test.cfg /data/MGCP_Test.cfg - -CMD ttcn3-docker-run mgw MGCP_Test diff --git a/ttcn3-mgw-test/MGCP_Test.cfg b/ttcn3-mgw-test/MGCP_Test.cfg deleted file mode 100644 index 5a9d9e6..0000000 --- a/ttcn3-mgw-test/MGCP_Test.cfg +++ /dev/null @@ -1,21 +0,0 @@ -[ORDERED_INCLUDE] -"/osmo-ttcn3-hacks/Common.cfg" -"/osmo-ttcn3-hacks/mgw/MGCP_Test.default" - -[LOGGING] - -[TESTPORT_PARAMETERS] -*.MGWVTY.CTRL_HOSTNAME := "172.18.4.180" -*.STATSVTY.CTRL_HOSTNAME := "172.18.4.180" - -[MODULE_PARAMETERS] -mp_local_ipv4 := "172.18.4.181"; -mp_local_ipv6 := "fd02:db8:4::181"; -mp_remote_ipv4 := "172.18.4.180"; -mp_remote_ipv6 := "fd02:db8:4::180"; -mp_num_endpoints := 300; - -[MAIN_CONTROLLER] - -[EXECUTE] -MGCP_Test.control diff --git a/ttcn3-mgw-test/Makefile b/ttcn3-mgw-test/Makefile deleted file mode 100644 index 8d0e10b..0000000 --- a/ttcn3-mgw-test/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../make/Makefile diff --git a/ttcn3-mgw-test/jenkins.sh b/ttcn3-mgw-test/jenkins.sh deleted file mode 100755 index 4add209..0000000 --- a/ttcn3-mgw-test/jenkins.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -. ../jenkins-common.sh -IMAGE_SUFFIX="${IMAGE_SUFFIX:-master}" -docker_images_require \ - "osmo-mgw-$IMAGE_SUFFIX" \ - "ttcn3-mgw-test" - -set_clean_up_trap -set -e - -mkdir $VOL_BASE_DIR/mgw-tester -cp MGCP_Test.cfg $VOL_BASE_DIR/mgw-tester/ -write_mp_osmo_repo "$VOL_BASE_DIR/mgw-tester/MGCP_Test.cfg" - -mkdir $VOL_BASE_DIR/mgw -cp osmo-mgw.cfg $VOL_BASE_DIR/mgw/ - -network_create -network_replace_subnet_in_configs - -# start container with mgw in background -docker run --rm \ - $(docker_network_params $SUBNET 180) \ - --ulimit core=-1 \ - -v $VOL_BASE_DIR/mgw:/data \ - --name ${BUILD_TAG}-mgw -d \ - $DOCKER_ARGS \ - $REPO_USER/osmo-mgw-$IMAGE_SUFFIX - -# start docker container with testsuite in foreground -docker run --rm \ - $(docker_network_params $SUBNET 181) \ - --ulimit core=-1 \ - -v $VOL_BASE_DIR/mgw-tester:/data \ - -e "TTCN3_PCAP_PATH=/data" \ - -e "OSMO_SUT_HOST=$SUB4_PREFIX.$SUBNET.180" \ - -e "OSMO_SUT_PORT=4243" \ - --name ${BUILD_TAG}-ttcn3-mgw-test \ - $DOCKER_ARGS \ - $REPO_USER/ttcn3-mgw-test diff --git a/ttcn3-mgw-test/osmo-mgw.cfg b/ttcn3-mgw-test/osmo-mgw.cfg deleted file mode 100644 index f009bef..0000000 --- a/ttcn3-mgw-test/osmo-mgw.cfg +++ /dev/null @@ -1,71 +0,0 @@ -! -! OsmoMGW (1.2.0.17-52e3) configuration saved from vty -!! -! -log gsmtap 172.18.4.181 - logging level set-all debug - logging filter all 1 -! -log stderr - logging filter all 1 - logging color 1 - logging print level 1 - logging print category 1 - logging timestamp 1 - logging print file basename last - logging print extended-timestamp 1 - logging level set-all notice - logging level lmgcp debug -! -stats interval 5 -! -line vty - no login - bind 0.0.0.0 -ctrl - bind 0.0.0.0 -! -stats interval 0 -stats reporter statsd - prefix TTCN3 - level global - remote-ip 172.18.4.181 - remote-port 8125 - flush-period 1 - mtu 1024 - enable -! -e1_input - e1_line 0 driver ipa -! -mgcp - bind ip 172.18.4.180 - bind port 2427 - rtp port-range 4002 16000 - rtp bind-ip 172.18.4.180 - rtp bind-ip-v6 fd02:db8:4::180 - rtp ip-probing - rtp ip-dscp 46 - no rtp keep-alive - no rtcp-omit - no rtp-patch - sdp audio-payload number 98 - sdp audio-payload name GSM - sdp audio-payload send-ptime - sdp audio-payload send-name - conn-timeout 0 - loop 0 - number endpoints 300 - allow-transcoding - osmux off - osmux bind-ip 172.18.4.180 - osmux bind-ip-v6 fd02:db8:4::180 - trunk 1 - sdp audio-payload send-ptime - sdp audio-payload send-name - no rtp keep-alive - loop 0 - no rtcp-omit - no rtp-patch - allow-transcoding - line 0 diff --git a/ttcn3-mme-test-ogs/Dockerfile b/ttcn3-mme-test-ogs/Dockerfile deleted file mode 100644 index 0f9d688..0000000 --- a/ttcn3-mme-test-ogs/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -ARG REGISTRY -ARG USER -FROM $REGISTRY/$USER/debian-bookworm-titan - -RUN apt-get update && \ - apt-get upgrade -y && \ - DEBIAN_FRONTEND='noninteractive' apt-get install -y --no-install-recommends --no-install-suggests \ - libgnutls28-dev \ - && \ - apt-get clean - -ARG OSMO_TTCN3_BRANCH="master" - -ADD https://gerrit.osmocom.org/plugins/gitiles/osmo-ttcn3-hacks/+/$OSMO_TTCN3_B… /tmp/commit -RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" mme - -VOLUME /data - -COPY ogs/MME_Tests.cfg /data/MME_Tests.cfg - -CMD ttcn3-docker-run mme MME_Tests diff --git a/ttcn3-mme-test-ogs/Makefile b/ttcn3-mme-test-ogs/Makefile deleted file mode 100644 index 8d0e10b..0000000 --- a/ttcn3-mme-test-ogs/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../make/Makefile diff --git a/ttcn3-mme-test-ogs/jenkins.sh b/ttcn3-mme-test-ogs/jenkins.sh deleted file mode 100755 index 069b990..0000000 --- a/ttcn3-mme-test-ogs/jenkins.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -. ../jenkins-common.sh - -IMAGE_SUFFIX="${IMAGE_SUFFIX:-master}" -docker_images_require \ - "open5gs-$IMAGE_SUFFIX" \ - "ttcn3-mme-test-ogs" - -set_clean_up_trap -set -e - -mkdir $VOL_BASE_DIR/mme-tester -cp ogs/MME_Tests.cfg $VOL_BASE_DIR/mme-tester/ -write_mp_osmo_repo "$VOL_BASE_DIR/mme-tester/MME_Tests.cfg" - -mkdir $VOL_BASE_DIR/mme -cp ogs/open5gs-*-$IMAGE_SUFFIX.yaml $VOL_BASE_DIR/mme/ -cp ogs/freediameter.conf $VOL_BASE_DIR/mme/ -cp ogs/mme.sh $VOL_BASE_DIR/mme/ - -network_create -network_replace_subnet_in_configs - -# start container with mme in background -docker run --sysctl net.ipv6.conf.all.disable_ipv6=0 \ - --rm \ - --ulimit core=-1 \ - -v $VOL_BASE_DIR/mme:/data \ - --name ${BUILD_TAG}-ogs-mme -d \ - $DOCKER_ARGS \ - $(docker_network_params $SUBNET 201) \ - $REPO_USER/open5gs-$IMAGE_SUFFIX \ - /bin/sh -c "open5gs-mmed -c /data/open5gs-mme-$IMAGE_SUFFIX.yaml >/data/open5gs-mmed.out 2>&1" - -# start docker container with testsuite in foreground -docker run --rm \ - --sysctl net.ipv6.conf.all.disable_ipv6=0 \ - $(docker_network_params $SUBNET 202) \ - --ulimit core=-1 \ - -v $VOL_BASE_DIR/mme-tester:/data \ - -e "TTCN3_PCAP_PATH=/data" \ - --name ${BUILD_TAG}-mme-test \ - $DOCKER_ARGS \ - $REPO_USER/ttcn3-mme-test-ogs diff --git a/ttcn3-mme-test-ogs/ogs/MME_Tests.cfg b/ttcn3-mme-test-ogs/ogs/MME_Tests.cfg deleted file mode 100644 index 6e727f5..0000000 --- a/ttcn3-mme-test-ogs/ogs/MME_Tests.cfg +++ /dev/null @@ -1,45 +0,0 @@ -[ORDERED_INCLUDE] -# Common configuration, shared between test suites -"/osmo-ttcn3-hacks/Common.cfg" -# testsuite specific configuration, not expected to change -"/osmo-ttcn3-hacks/mme/MME_Tests.default" - -# Local configuration below - -[LOGGING] - -[TESTPORT_PARAMETERS] - -[MODULE_PARAMETERS] -# S1 interface -mp_mme_ip := "172.18.3.201"; -mp_mme_s1ap_port := 36412; -mp_s1_local_ip := "172.18.3.202"; -mp_s1_local_port := 50000; - -# S6 interface -mp_s6_local_ip := "172.18.3.202"; -mp_s6_local_port := 3868; - -# SGs interface -mp_sgs_local_ip := "172.18.3.202"; -mp_sgs_local_port := 29118; -mp_vlr_name := "vlr.example.net"; -mp_mme_name := "mmec01.mmegi0001.mme.epc.mnc070.mcc901.3gppnetwork.org"; - -# Gn interface -mp_gn_local_ip := "172.18.3.202"; -mp_gn_local_port := 2124; -mp_gn_remote_ip := "172.18.3.201"; -mp_gn_remote_port := 2123; - -# S11 interface (GTPv2C, interface between MME and SGW) -mp_s11_local_ip := "172.18.3.202"; -mp_s11_local_port := 2123; -mp_s11_remote_ip := "172.18.3.201"; -mp_s11_remote_port := 2123; - -[MAIN_CONTROLLER] - -[EXECUTE] -MME_Tests.control diff --git a/ttcn3-mme-test-ogs/ogs/freediameter.conf b/ttcn3-mme-test-ogs/ogs/freediameter.conf deleted file mode 100644 index d149aa3..0000000 --- a/ttcn3-mme-test-ogs/ogs/freediameter.conf +++ /dev/null @@ -1,265 +0,0 @@ -# This is a sample configuration file for freeDiameter daemon. - -# Most of the options can be omitted, as they default to reasonable values. -# Only TLS-related options must be configured properly in usual setups. - -# It is possible to use "include" keyword to import additional files -# e.g.: include "/etc/freeDiameter.d/*.conf" -# This is exactly equivalent as copy & paste the content of the included file(s) -# where the "include" keyword is found. - - -############################################################## -## Peer identity and realm - -# The Diameter Identity of this daemon. -# This must be a valid FQDN that resolves to the local host. -# Default: hostname's FQDN -#Identity = "aaa.koganei.freediameter.net"; -Identity = "mme.localdomain"; - -# The Diameter Realm of this daemon. -# Default: the domain part of Identity (after the first dot). -#Realm = "koganei.freediameter.net"; -Realm = "localdomain"; - -############################################################## -## Transport protocol configuration - -# The port this peer is listening on for incoming connections (TCP and SCTP). -# Default: 3868. Use 0 to disable. -Port = 3868; - -# The port this peer is listening on for incoming TLS-protected connections (TCP and SCTP). -# See TLS_old_method for more information about TLS flavours. -# Note: we use TLS/SCTP instead of DTLS/SCTP at the moment. This will change in future version of freeDiameter. -# Default: 5868. Use 0 to disable. -SecPort = 0; - -# Use RFC3588 method for TLS protection, where TLS is negociated after CER/CEA exchange is completed -# on the unsecure connection. The alternative is RFC6733 mechanism, where TLS protects also the -# CER/CEA exchange on a dedicated secure port. -# This parameter only affects outgoing connections. -# The setting can be also defined per-peer (see Peers configuration section). -# Default: use RFC6733 method with separate port for TLS. -#TLS_old_method; - -# Disable use of TCP protocol (only listen and connect over SCTP) -# Default : TCP enabled -#No_TCP; - -# Disable use of SCTP protocol (only listen and connect over TCP) -# Default : SCTP enabled -#No_SCTP; -# This option is ignored if freeDiameter is compiled with DISABLE_SCTP option. - -# Prefer TCP instead of SCTP for establishing new connections. -# This setting may be overwritten per peer in peer configuration blocs. -# Default : SCTP is attempted first. -#Prefer_TCP; - -# Default number of streams per SCTP associations. -# This setting may be overwritten per peer basis. -# Default : 30 streams -#SCTP_streams = 30; - -############################################################## -## Endpoint configuration - -# Disable use of IP addresses (only IPv6) -# Default : IP enabled -#No_IP; - -# Disable use of IPv6 addresses (only IP) -# Default : IPv6 enabled -#No_IPv6; - -# Specify local addresses the server must bind to -# Default : listen on all addresses available. -#ListenOn = "202.249.37.5"; -#ListenOn = "2001:200:903:2::202:1"; -#ListenOn = "fe80::21c:5ff:fe98:7d62%eth0"; -ListenOn = "172.18.3.201"; - - -############################################################## -## Server configuration - -# How many Diameter peers are allowed to be connecting at the same time ? -# This parameter limits the number of incoming connections from the time -# the connection is accepted until the first CER is received. -# Default: 5 unidentified clients in paralel. -#ThreadsPerServer = 5; - -############################################################## -## TLS Configuration - -# TLS is managed by the GNUTLS library in the freeDiameter daemon. -# You may find more information about parameters and special behaviors -# in the relevant documentation. -# http://www.gnu.org/software/gnutls/manual/ - -# Credentials of the local peer -# The X509 certificate and private key file to use for the local peer. -# The files must contain PKCS-1 encoded RSA key, in PEM format. -# (These parameters are passed to gnutls_certificate_set_x509_key_file function) -# Default : NO DEFAULT -#TLS_Cred = "<x509 certif file.PEM>" , "<x509 private key file.PEM>"; -#TLS_Cred = "/etc/ssl/certs/freeDiameter.pem", "/etc/ssl/private/freeDiameter.key"; - -# Certificate authority / trust anchors -# The file containing the list of trusted Certificate Authorities (PEM list) -# (This parameter is passed to gnutls_certificate_set_x509_trust_file function) -# The directive can appear several times to specify several files. -# Default : GNUTLS default behavior -#TLS_CA = "<file.PEM>"; - -# Certificate Revocation List file -# The information about revoked certificates. -# The file contains a list of trusted CRLs in PEM format. They should have been verified before. -# (This parameter is passed to gnutls_certificate_set_x509_crl_file function) -# Note: openssl CRL format might have interoperability issue with GNUTLS format. -# Default : GNUTLS default behavior -#TLS_CRL = "<file.PEM>"; - -# GNU TLS Priority string -# This string allows to configure the behavior of GNUTLS key exchanges -# algorithms. See gnutls_priority_init function documentation for information. -# You should also refer to the Diameter required TLS support here: -# http://tools.ietf.org/html/rfc6733#section-13.1 -# Default : "NORMAL" -# Example: TLS_Prio = "NONE:+VERS-TLS1.1:+AES-128-CBC:+RSA:+SHA1:+COMP-NULL"; -#TLS_Prio = "NORMAL"; - -# Diffie-Hellman parameters size -# Set the number of bits for generated DH parameters -# Valid value should be 768, 1024, 2048, 3072 or 4096. -# (This parameter is passed to gnutls_dh_params_generate2 function, -# it usually should match RSA key size) -# Default : 1024 -#TLS_DH_Bits = 1024; - -# Alternatively, you can specify a file to load the PKCS#3 encoded -# DH parameters directly from. This accelerates the daemon start -# but is slightly less secure. If this file is provided, the -# TLS_DH_Bits parameters has no effect. -# Default : no default. -#TLS_DH_File = "<file.PEM>"; - - -############################################################## -## Timers configuration - -# The Tc timer of this peer. -# It is the delay before a new attempt is made to reconnect a disconnected peer. -# The value is expressed in seconds. The recommended value is 30 seconds. -# Default: 30 -#TcTimer = 30; - -# The Tw timer of this peer. -# It is the delay before a watchdog message is sent, as described in RFC 3539. -# The value is expressed in seconds. The default value is 30 seconds. Value must -# be greater or equal to 6 seconds. See details in the RFC. -# Default: 30 -#TwTimer = 30; - -############################################################## -## Applications configuration - -# Disable the relaying of Diameter messages? -# For messages not handled locally, the default behavior is to forward the -# message to another peer if any is available, according to the routing -# algorithms. In addition the "0xffffff" application is advertised in CER/CEA -# exchanges. -# Default: Relaying is enabled. -#NoRelay; -NoRelay; - -# Number of server threads that can handle incoming messages at the same time. -# Default: 4 -#AppServThreads = 4; - -# Other applications are configured by loaded extensions. - -############################################################## -## Extensions configuration - -# The freeDiameter framework merely provides support for -# Diameter Base Protocol. The specific application behaviors, -# as well as advanced functions, are provided -# by loadable extensions (plug-ins). -# These extensions may in addition receive the name of a -# configuration file, the format of which is extension-specific. -# -# Format: -#LoadExtension = "/path/to/extension" [ : "/optional/configuration/file" ] ; -# -# Examples: -#LoadExtension = "extensions/sample.fdx"; -#LoadExtension = "extensions/sample.fdx":"conf/sample.conf"; - -# Extensions are named as follow: -# dict_* for extensions that add content to the dictionary definitions. -# dbg_* for extensions useful only to retrieve more information on the framework execution. -# acl_* : Access control list, to control which peers are allowed to connect. -# rt_* : routing extensions that impact how messages are forwarded to other peers. -# app_* : applications, these extensions usually register callbacks to handle specific messages. -# test_* : dummy extensions that are useful only in testing environments. - - -# The dbg_msg_dump.fdx extension allows you to tweak the way freeDiameter displays some -# information about some events. This extension does not actually use a configuration file -# but receives directly a parameter in the string passed to the extension. Here are some examples: -## LoadExtension = "dbg_msg_dumps.fdx" : "0x1111"; # Removes all default hooks, very quiet even in case of errors. -## LoadExtension = "dbg_msg_dumps.fdx" : "0x2222"; # Display all events with few details. -## LoadExtension = "dbg_msg_dumps.fdx" : "0x0080"; # Dump complete information about sent and received messages. -# The four digits respectively control: connections, routing decisions, sent/received messages, errors. -# The values for each digit are: -# 0 - default - keep the default behavior -# 1 - quiet - remove any specific log -# 2 - compact - display only a summary of the information -# 4 - full - display the complete information on a single long line -# 8 - tree - display the complete information in an easier to read format spanning several lines. - -LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dbg_msg_dumps.fdx" : "0x8888"; -LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dict_rfc5777.fdx"; -LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dict_mip6i.fdx"; -LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dict_nasreq.fdx"; -LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dict_nas_mipv6.fdx"; -LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dict_dcca.fdx"; -LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dict_dcca_3gpp.fdx"; - - -############################################################## -## Peers configuration - -# The local server listens for incoming connections. By default, -# all unknown connecting peers are rejected. Extensions can override this behavior (e.g., acl_wl). -# -# In addition to incoming connections, the local peer can -# be configured to establish and maintain connections to some -# Diameter nodes and allow connections from these nodes. -# This is achieved with the ConnectPeer directive described below. -# -# Note that the configured Diameter Identity MUST match -# the information received inside CEA, or the connection will be aborted. -# -# Format: -#ConnectPeer = "diameterid" [ { parameter1; parameter2; ...} ] ; -# Parameters that can be specified in the peer's parameter list: -# No_TCP; No_SCTP; No_IP; No_IPv6; Prefer_TCP; TLS_old_method; -# No_TLS; # assume transparent security instead of TLS. DTLS is not supported yet (will change in future versions). -# Port = 5868; # The port to connect to -# TcTimer = 30; -# TwTimer = 30; -# ConnectTo = "202.249.37.5"; -# ConnectTo = "2001:200:903:2::202:1"; -# TLS_Prio = "NORMAL"; -# Realm = "realm.net"; # Reject the peer if it does not advertise this realm. -# Examples: -#ConnectPeer = "aaa.wide.ad.jp"; -#ConnectPeer = "old.diameter.serv" { TcTimer = 60; TLS_old_method; No_SCTP; Port=3868; } ; -ConnectPeer = "hss.localdomain" { ConnectTo = "172.18.3.202"; Port = 3868; No_TLS; TcTimer = 2; }; - - -############################################################## diff --git a/ttcn3-mme-test-ogs/ogs/mme.sh b/ttcn3-mme-test-ogs/ogs/mme.sh deleted file mode 100755 index ae417fd..0000000 --- a/ttcn3-mme-test-ogs/ogs/mme.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -set -e -set -x -/data/mmed-setup.sh -mmed_bin="$(command -v open5gs-mmed)" -su - osmocom -c "$mmed_bin $*" diff --git a/ttcn3-mme-test-ogs/ogs/open5gs-mme-latest.yaml b/ttcn3-mme-test-ogs/ogs/open5gs-mme-latest.yaml deleted file mode 100644 index af5d96e..0000000 --- a/ttcn3-mme-test-ogs/ogs/open5gs-mme-latest.yaml +++ /dev/null @@ -1,64 +0,0 @@ -# See https://github.com/open5gs/open5gs/blob/main/configs/open5gs/mme.yaml.in - -logger: - level: debug - -mme: - freeDiameter: /data/freediameter.conf - s1ap: - - addr: 172.18.3.201 - gtpc: - - addr: 172.18.3.201 - metrics: - - addr: 172.18.3.201 - port: 9090 - gummei: - plmn_id: - mcc: 001 - mnc: 01 - mme_gid: 2 - mme_code: 1 - tai: - plmn_id: - mcc: 001 - mnc: 01 - tac: 12345 - security: - integrity_order : [ EIA2, EIA1, EIA0 ] - ciphering_order : [ EEA0, EEA1, EEA2 ] - network_name: - full: Open5GS - mme_name: open5gs-mme0 - -sgwc: - gtpc: - - addr: 172.18.3.202 - -smf: - gtpc: - - addr: - - 172.18.3.201 - - ::1 - -sgsn: - - gtpc: - addr: - - 172.18.3.202 - port: 2124 - routes: - - rai: - lai: - plmn_id: - mcc: 262 - mnc: 42 - lac: 39594 - rac: 187 - ci: 1223 - -parameter: - -max: - -usrsctp: - -time: diff --git a/ttcn3-mme-test-ogs/ogs/open5gs-mme-master.yaml b/ttcn3-mme-test-ogs/ogs/open5gs-mme-master.yaml deleted file mode 100644 index 66c9b66..0000000 --- a/ttcn3-mme-test-ogs/ogs/open5gs-mme-master.yaml +++ /dev/null @@ -1,65 +0,0 @@ -# See https://github.com/open5gs/open5gs/blob/main/configs/open5gs/mme.yaml.in - -logger: - level: debug - -global: - max: - ue: 1024 - -mme: - freeDiameter: /data/freediameter.conf - s1ap: - server: - - address: 172.18.3.201 - gtpc: - server: - - address: 172.18.3.201 - client: - sgwc: - - address: 172.18.3.202 - smf: - - address: 172.18.3.201 - - address: ::1 - sgsn: - - address: - - 172.18.3.202 - port: 2124 - routes: - - rai: - lai: - plmn_id: - mcc: 262 - mnc: 42 - lac: 39594 - rac: 187 - ci: 1223 - metrics: - server: - - address: 172.18.3.201 - port: 9090 - gummei: - - plmn_id: - mcc: 001 - mnc: 01 - mme_gid: 2 - mme_code: 1 - tai: - - plmn_id: - mcc: 001 - mnc: 01 - tac: 12345 - security: - integrity_order : [ EIA2, EIA1, EIA0 ] - ciphering_order : [ EEA0, EEA1, EEA2 ] - network_name: - full: Open5GS - mme_name: open5gs-mme0 - -parameter: - -max: - -usrsctp: - -time: diff --git a/ttcn3-s1gw-test/Dockerfile b/ttcn3-s1gw-test/Dockerfile deleted file mode 100644 index 296cd02..0000000 --- a/ttcn3-s1gw-test/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -ARG REGISTRY -ARG USER -FROM $REGISTRY/$USER/debian-bookworm-titan - -ARG OSMO_TTCN3_BRANCH="master" - -ADD https://gerrit.osmocom.org/plugins/gitiles/osmo-ttcn3-hacks/+/$OSMO_TTCN3_B… /tmp/commit -RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" s1gw - -VOLUME /data - -COPY S1GW_Tests.cfg /data/S1GW_Tests.cfg - -CMD ttcn3-docker-run s1gw S1GW_Tests diff --git a/ttcn3-s1gw-test/Makefile b/ttcn3-s1gw-test/Makefile deleted file mode 100644 index 8d0e10b..0000000 --- a/ttcn3-s1gw-test/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../make/Makefile diff --git a/ttcn3-s1gw-test/S1GW_Tests.cfg b/ttcn3-s1gw-test/S1GW_Tests.cfg deleted file mode 100644 index a81c95e..0000000 --- a/ttcn3-s1gw-test/S1GW_Tests.cfg +++ /dev/null @@ -1,17 +0,0 @@ -[ORDERED_INCLUDE] -"/osmo-ttcn3-hacks/Common.cfg" -"/osmo-ttcn3-hacks/s1gw/S1GW_Tests.default" - -[LOGGING] - -[TESTPORT_PARAMETERS] - -[MODULE_PARAMETERS] -S1GW_Tests.mp_s1gw_enb_ip := "172.18.10.200"; -S1GW_Tests.mp_s1gw_mme_ip := "172.18.10.100"; -S1GW_Tests.mp_mme_bind_ip := "172.18.10.101"; - -[MAIN_CONTROLLER] - -[EXECUTE] -S1GW_Tests.control diff --git a/ttcn3-s1gw-test/jenkins.sh b/ttcn3-s1gw-test/jenkins.sh deleted file mode 100755 index f00987d..0000000 --- a/ttcn3-s1gw-test/jenkins.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -. ../jenkins-common.sh -IMAGE_SUFFIX="${IMAGE_SUFFIX:-master}" -docker_images_require \ - "osmo-s1gw-$IMAGE_SUFFIX" \ - "ttcn3-s1gw-test" - -set_clean_up_trap -set -e - -mkdir $VOL_BASE_DIR/s1gw-tester -cp S1GW_Tests.cfg $VOL_BASE_DIR/s1gw-tester/ -write_mp_osmo_repo "$VOL_BASE_DIR/s1gw-tester/S1GW_Tests.cfg" - -mkdir $VOL_BASE_DIR/s1gw -cp s1gw.sh $VOL_BASE_DIR/s1gw/ -cp osmo-s1gw.config $VOL_BASE_DIR/s1gw/ - -network_create -network_replace_subnet_in_configs - -echo "Starting container with osmo-s1gw" -docker run --rm \ - $(docker_network_params $SUBNET 100) \ - --user=root \ - --ulimit core=-1 \ - --cap-add=NET_ADMIN \ - -e "ERL_FLAGS=-config /data/osmo-s1gw.config" \ - -v $VOL_BASE_DIR/s1gw:/data \ - --name ${BUILD_TAG}-s1gw -d \ - $DOCKER_ARGS \ - $REPO_USER/osmo-s1gw-$IMAGE_SUFFIX \ - /bin/sh -c "/data/s1gw.sh > /data/osmo-s1gw.log 2>&1" - -# Give some time to osmo-s1gw to be fully started; it's a bit slow... -sleep 2 - -echo "Starting container with the S1GW testsuite" -docker run --rm \ - $(docker_network_params $SUBNET 101) \ - --ulimit core=-1 \ - -e "TTCN3_PCAP_PATH=/data" \ - -v $VOL_BASE_DIR/s1gw-tester:/data \ - --name ${BUILD_TAG}-ttcn3-s1gw-test \ - $DOCKER_ARGS \ - $REPO_USER/ttcn3-s1gw-test diff --git a/ttcn3-s1gw-test/osmo-s1gw.config b/ttcn3-s1gw-test/osmo-s1gw.config deleted file mode 100644 index b621ef9..0000000 --- a/ttcn3-s1gw-test/osmo-s1gw.config +++ /dev/null @@ -1,35 +0,0 @@ -%% -*- erlang -*- - -[%% ================================================================================ - %% application config - %% - %% eNB S1GW - %% +-----+ +----------------+ - %% | ... | --> | s1gw_bind_addr | MME - %% +-----+ +----------------+ +-----------------+ - %% | mme_loc_addr | --> | mme_rem_addr | - %% +----------------+ +-----------------+ - %% ================================================================================ - {osmo_s1gw, - [{s1gw_bind_addr, "172.18.10.200"}, %% S1GW bind address for incoming eNB connections - {mme_loc_addr, "172.18.10.100"}, %% local address for outgoing connections to the MME - {mme_rem_addr, "172.18.10.101"} %% remote address for outgoing connections to the MME - ]}, - %% ================================================================================ - %% kernel config - %% ================================================================================ - {kernel, - [{logger_level, debug}, - {logger, - [{handler, default, logger_std_h, - #{level => debug, - formatter => {logger_formatter, - #{template => [time, " ", - "[", level, "]", - {pid, [" ", pid, ""], ""}, - {prefix, [" ", prefix, " ::"], ""}, - " ", msg, - {mfa, [" (", mfa, ":", line, ")"], ""}, - "\n"]}}}}]}]}]. - -%% vim:set ts=2 sw=2 et: diff --git a/ttcn3-s1gw-test/s1gw.sh b/ttcn3-s1gw-test/s1gw.sh deleted file mode 100755 index e212aa2..0000000 --- a/ttcn3-s1gw-test/s1gw.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -ex - -# the subnet prefix is to be modified by network_replace_subnet_in_configs() -ip addr add 172.18.10.100/24 dev eth0 || true # primary address already set by docker_network_params() -ip addr add 172.18.10.200/24 dev eth0 # secondary address for eNB -> S1GW connections - -# drop the root privileges and finally start osmo-s1gw -su build -c "/tmp/osmo-s1gw/_build/default/bin/osmo-s1gw" diff --git a/ttcn3-sgsn-test-sns/jenkins.sh b/ttcn3-sgsn-test-sns/jenkins.sh deleted file mode 120000 index 4c1f7b3..0000000 --- a/ttcn3-sgsn-test-sns/jenkins.sh +++ /dev/null @@ -1 +0,0 @@ -../ttcn3-sgsn-test/jenkins-sns.sh \ No newline at end of file diff --git a/ttcn3-sgsn-test-sns/osmo-stp.cfg b/ttcn3-sgsn-test-sns/osmo-stp.cfg deleted file mode 120000 index 6760339..0000000 --- a/ttcn3-sgsn-test-sns/osmo-stp.cfg +++ /dev/null @@ -1 +0,0 @@ -../ttcn3-sgsn-test/osmo-stp.cfg \ No newline at end of file diff --git a/ttcn3-sgsn-test-sns/sns b/ttcn3-sgsn-test-sns/sns deleted file mode 120000 index 95cdae2..0000000 --- a/ttcn3-sgsn-test-sns/sns +++ /dev/null @@ -1 +0,0 @@ -../ttcn3-sgsn-test/sns \ No newline at end of file diff --git a/ttcn3-sgsn-test/Dockerfile b/ttcn3-sgsn-test/Dockerfile deleted file mode 100644 index eba4ddd..0000000 --- a/ttcn3-sgsn-test/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -ARG REGISTRY -ARG USER -FROM $REGISTRY/$USER/debian-bookworm-titan -ARG OSMO_TTCN3_BRANCH="master" - -ADD https://gerrit.osmocom.org/plugins/gitiles/osmo-ttcn3-hacks/+/$OSMO_TTCN3_B… /tmp/commit -RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" sgsn - -VOLUME /data - -COPY SGSN_Tests.cfg /data/SGSN_Tests.cfg - -CMD ttcn3-docker-run sgsn SGSN_Tests diff --git a/ttcn3-sgsn-test/Makefile b/ttcn3-sgsn-test/Makefile deleted file mode 100644 index 1e5903f..0000000 --- a/ttcn3-sgsn-test/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -RUN_ARGS?=-it --network sigtran --ip 172.19.1.202 -v sgsn-test-vol:/data - -include ../make/Makefile diff --git a/ttcn3-sgsn-test/SGSN_Tests.cfg b/ttcn3-sgsn-test/SGSN_Tests.cfg deleted file mode 100644 index 40694ee..0000000 --- a/ttcn3-sgsn-test/SGSN_Tests.cfg +++ /dev/null @@ -1,77 +0,0 @@ -[ORDERED_INCLUDE] -# Common configuration, shared between test suites -"/osmo-ttcn3-hacks/Common.cfg" -# testsuite specific configuration, not expected to change -"/osmo-ttcn3-hacks/sgsn/SGSN_Tests.default" - -# Local configuration below - -[LOGGING] - -[TESTPORT_PARAMETERS] -*.SGSNVTY.CTRL_HOSTNAME := "172.18.8.10" - -[MODULE_PARAMETERS] -SGSN_Tests.mp_nsconfig := { - { - nsvc := { - { - provider := { - ip := { - address_family := AF_INET, - local_ip := "172.18.8.103", - remote_ip := "172.18.8.10", - data_weight := 1, - signalling_weight := 1 - } - } - } - } - }, - { - nsvc := { - { - provider := { - ip := { - address_family := AF_INET, - local_ip := "172.18.8.103", - remote_ip := "172.18.8.10", - data_weight := 1, - signalling_weight := 1 - } - } - } - } - }, - { - nsvc := { - { - provider := { - ip := { - address_family := AF_INET, - local_ip := "172.18.8.103", - remote_ip := "172.18.8.10", - data_weight := 1, - signalling_weight := 1 - } - } - } - } - } -} -SGSN_Tests.mp_ranap_cfg := { - { - sctp_addr := { 23908, "172.18.8.104", 2905, "172.18.8.200" } - } -} -SGSN_Tests.mp_hlr_ip := "172.18.8.103" -SGSN_Tests.mp_ggsn_ip := "172.18.8.103" -SGSN_Tests.mp_sgsn_gtp_ip := "172.18.8.10" - - -[MAIN_CONTROLLER] - -[EXECUTE] -SGSN_Tests.control -SGSN_Tests_Iu.control -SGSN_Tests_NS.control diff --git a/ttcn3-sgsn-test/jenkins-sns.sh b/ttcn3-sgsn-test/jenkins-sns.sh deleted file mode 100755 index 027244d..0000000 --- a/ttcn3-sgsn-test/jenkins-sns.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh - -. ../jenkins-common.sh -IMAGE_SUFFIX="${IMAGE_SUFFIX:-master}" -docker_images_require \ - "osmo-stp-$IMAGE_SUFFIX" \ - "osmo-sgsn-$IMAGE_SUFFIX" \ - "ttcn3-sgsn-test" - -set_clean_up_trap -set -e - -mkdir $VOL_BASE_DIR/sgsn-tester -cp sns/SGSN_Tests.cfg $VOL_BASE_DIR/sgsn-tester/ -write_mp_osmo_repo "$VOL_BASE_DIR/sgsn-tester/SGSN_Tests.cfg" - -mkdir $VOL_BASE_DIR/sgsn -cp sns/osmo-sgsn.cfg $VOL_BASE_DIR/sgsn/ - -mkdir $VOL_BASE_DIR/stp -cp osmo-stp.cfg $VOL_BASE_DIR/stp/ - -mkdir $VOL_BASE_DIR/unix - -network_create -network_replace_subnet_in_configs - -echo Starting container with STP -docker run --rm \ - $(docker_network_params $SUBNET 200) \ - --ulimit core=-1 \ - -v $VOL_BASE_DIR/stp:/data \ - --name ${BUILD_TAG}-stp -d \ - $DOCKER_ARGS \ - $REPO_USER/osmo-stp-$IMAGE_SUFFIX - -echo Starting container with SGSN -docker run --rm \ - $(docker_network_params $SUBNET 10) \ - --ulimit core=-1 \ - -v $VOL_BASE_DIR/sgsn:/data \ - --name ${BUILD_TAG}-sgsn-sns -d \ - $DOCKER_ARGS \ - $REPO_USER/osmo-sgsn-$IMAGE_SUFFIX \ - /bin/sh -c "osmo-sgsn -c /data/osmo-sgsn.cfg >/data/osmo-sgsn.log 2>&1" - -echo Starting container with SGSN testsuite -docker run --rm \ - $(docker_network_params $SUBNET 103) \ - --ulimit core=-1 \ - -e "TTCN3_PCAP_PATH=/data" \ - -e "OSMO_SUT_HOST=172.18.$SUBNET.10" \ - -e "OSMO_SUT_PORT=4245" \ - -v $VOL_BASE_DIR/sgsn-tester:/data \ - --name ${BUILD_TAG}-ttcn3-sgsn-test-sns \ - $DOCKER_ARGS \ - $REPO_USER/ttcn3-sgsn-test diff --git a/ttcn3-sgsn-test/jenkins.sh b/ttcn3-sgsn-test/jenkins.sh deleted file mode 100755 index b047d80..0000000 --- a/ttcn3-sgsn-test/jenkins.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh - -. ../jenkins-common.sh -IMAGE_SUFFIX="${IMAGE_SUFFIX:-master}" -docker_images_require \ - "osmo-stp-$IMAGE_SUFFIX" \ - "osmo-sgsn-$IMAGE_SUFFIX" \ - "ttcn3-sgsn-test" - -set_clean_up_trap -set -e - -mkdir $VOL_BASE_DIR/sgsn-tester -cp "ttcn3.sh" "$VOL_BASE_DIR/sgsn-tester/" -cp SGSN_Tests.cfg $VOL_BASE_DIR/sgsn-tester/ -write_mp_osmo_repo "$VOL_BASE_DIR/sgsn-tester/SGSN_Tests.cfg" - -mkdir $VOL_BASE_DIR/sgsn -cp osmo-sgsn.cfg $VOL_BASE_DIR/sgsn/ - -mkdir $VOL_BASE_DIR/stp -cp osmo-stp.cfg $VOL_BASE_DIR/stp/ - -mkdir $VOL_BASE_DIR/unix - -network_create -network_replace_subnet_in_configs -TTCN3_RAN_IPADDR="$SUB4_PREFIX.$SUBNET.104" - -echo Starting container with STP -docker run --rm \ - $(docker_network_params $SUBNET 200) \ - --ulimit core=-1 \ - -v $VOL_BASE_DIR/stp:/data \ - --name ${BUILD_TAG}-stp -d \ - $DOCKER_ARGS \ - $REPO_USER/osmo-stp-$IMAGE_SUFFIX - -echo Starting container with SGSN -docker run --rm \ - $(docker_network_params $SUBNET 10) \ - --ulimit core=-1 \ - -v $VOL_BASE_DIR/sgsn:/data \ - --name ${BUILD_TAG}-sgsn -d \ - $DOCKER_ARGS \ - $REPO_USER/osmo-sgsn-$IMAGE_SUFFIX \ - /bin/sh -c "osmo-sgsn -c /data/osmo-sgsn.cfg >/data/osmo-sgsn.log 2>&1" - -echo Starting container with SGSN testsuite -docker run --rm \ - --cap-add=NET_ADMIN \ - $(docker_network_params $SUBNET 103) \ - --ulimit core=-1 \ - -e "TTCN3_PCAP_PATH=/data" \ - -e "OSMO_SUT_HOST=$SUB4_PREFIX.$SUBNET.10" \ - -e "OSMO_SUT_PORT=4245" \ - -e "EXTRA_IPADDR=${TTCN3_RAN_IPADDR}" \ - -v $VOL_BASE_DIR/sgsn-tester:/data \ - --name ${BUILD_TAG}-ttcn3-sgsn-test \ - $DOCKER_ARGS \ - $REPO_USER/ttcn3-sgsn-test \ - /data/ttcn3.sh diff --git a/ttcn3-sgsn-test/osmo-sgsn.cfg b/ttcn3-sgsn-test/osmo-sgsn.cfg deleted file mode 100644 index 0fb826a..0000000 --- a/ttcn3-sgsn-test/osmo-sgsn.cfg +++ /dev/null @@ -1,105 +0,0 @@ -! -! OsmoSGSN (1.2.0.46-e77e-dirty) configuration saved from vty -!! -! -log gsmtap 172.18.8.103 - logging level set-all debug - logging filter all 1 -! -log stderr - logging filter all 1 - logging color 1 - logging print category 1 - logging timestamp 1 - logging print extended-timestamp 1 - logging print file 1 - logging level mm debug - logging level pag notice - logging level meas notice - logging level ref notice - logging level gprs debug - logging level llc debug - logging level sndcp debug - logging level slhc notice - logging level ranap info - logging level sua info - logging level v42bis info - logging level lglobal info - logging level llapd notice - logging level linp notice - logging level lmux notice - logging level lmi notice - logging level lmib notice - logging level lsms notice - logging level lctrl notice - logging level lgtp debug - logging level lstats notice - logging level lgsup debug - logging level loap notice - logging level lss7 notice - logging level lsccp info - logging level lsua notice - logging level lm3ua notice - logging level lmgcp notice -! -stats interval 5 -! -line vty - no login - bind 0.0.0.0 -ctrl - bind 0.0.0.0 -! -cs7 instance 0 - point-code 0.23.4 - asp asp-clnt-OsmoSGSN-A 2905 0 m3ua - local-ip 172.18.8.10 - local-ip fd02:db8:8::10 - remote-ip 172.18.8.200 - remote-ip fd02:db8:8::200 - role asp - sctp-role client - as as-clnt-OsmoSGSN-A m3ua - asp asp-clnt-OsmoSGSN-A - routing-key 3 0.23.4 -ns - timer tns-block 3 - timer tns-block-retries 3 - timer tns-reset 3 - timer tns-reset-retries 3 - timer tns-test 30 - timer tns-alive 3 - timer tns-alive-retries 10 - bind udp local - listen 172.18.8.10 23000 - accept-ipaccess -bssgp -sgsn - gtp local-ip 172.18.8.10 - ggsn 0 remote-ip 172.18.8.103 - ggsn 0 gtp-version 1 - gsup remote-ip 172.18.8.103 - gsup remote-port 4222 - auth-policy remote - gsup oap-id 0 - ! apn * ggsn 0 - no cdr filename - no cdr trap - cdr interval 600 - timer t3312 600 - timer t3322 6 - timer t3350 6 - timer t3360 6 - timer t3370 6 - timer t3313 30 - timer t3314 44 - timer t3316 44 - timer t3385 8 - timer t3386 8 - timer t3395 8 - timer t3397 8 - no compression rfc1144 - no compression v42bis - mme test-mme0 - gtp remote-ip 172.18.8.103 - gtp ran-info-relay 262 42 3 diff --git a/ttcn3-sgsn-test/osmo-stp.cfg b/ttcn3-sgsn-test/osmo-stp.cfg deleted file mode 100644 index 3a7d0ab..0000000 --- a/ttcn3-sgsn-test/osmo-stp.cfg +++ /dev/null @@ -1,40 +0,0 @@ -! -! OsmoSTP (0.8.1) configuration saved from vty -!! -! -log gsmtap 172.18.1.103 - logging level set-all debug - logging filter all 1 -! -log stderr - logging filter all 1 - logging color 1 - logging print category 1 - logging timestamp 1 - logging print extended-timestamp 1 - logging level set-all debug -! -line vty - no login -! -cs7 instance 0 - xua rkm routing-key-allocation dynamic-permitted - asp virt-rnc0-0 23908 2905 m3ua - local-ip 172.18.8.200 - local-ip fd02:db8:8::200 - remote-ip 172.18.8.104 - remote-ip fd02:db8:8::104 - role sg - sctp-role server - as virt-rnc0 m3ua - asp virt-rnc0-0 - routing-key 2 0.24.3 - route-table system - update route 0.24.3 7.255.7 linkset virt-rnc0 - listen m3ua 2905 - accept-asp-connections dynamic-permitted - local-ip 172.18.8.200 - local-ip fd02:db8:8::200 - listen ipa 5000 - accept-asp-connections dynamic-permitted - local-ip 172.18.8.200 diff --git a/ttcn3-sgsn-test/sns/SGSN_Tests.cfg b/ttcn3-sgsn-test/sns/SGSN_Tests.cfg deleted file mode 100644 index e3ee59f..0000000 --- a/ttcn3-sgsn-test/sns/SGSN_Tests.cfg +++ /dev/null @@ -1,46 +0,0 @@ -[ORDERED_INCLUDE] -# Common configuration, shared between test suites -"/osmo-ttcn3-hacks/Common.cfg" -# testsuite specific configuration, not expected to change -"/osmo-ttcn3-hacks/sgsn/SGSN_Tests.default" - -# Local configuration below - -[LOGGING] - -[TESTPORT_PARAMETERS] -*.SGSNVTY.CTRL_HOSTNAME := "172.18.8.10" - -[MODULE_PARAMETERS] -SGSN_Tests.mp_nsconfig := { - { - handle_sns := true, - nsvc := { - { - provider := { - ip := { - address_family := AF_INET, - local_ip := "172.18.8.103", - remote_ip := "172.18.8.10", - data_weight := 1, - signalling_weight := 1 - } - } - } - } - } -} -SGSN_Tests.mp_ranap_cfg := { - { - sctp_addr := { 23908, "172.18.8.103", 2905, "172.18.8.200" } - } -} -SGSN_Tests.mp_hlr_ip := "172.18.8.103" -SGSN_Tests.mp_ggsn_ip := "172.18.8.103" -SGSN_Tests.mp_sgsn_gtp_ip := "172.18.8.10" - - -[MAIN_CONTROLLER] - -[EXECUTE] -SGSN_Tests_NS.control diff --git a/ttcn3-sgsn-test/sns/osmo-sgsn.cfg b/ttcn3-sgsn-test/sns/osmo-sgsn.cfg deleted file mode 100644 index f2a4def..0000000 --- a/ttcn3-sgsn-test/sns/osmo-sgsn.cfg +++ /dev/null @@ -1,105 +0,0 @@ -! -! OsmoSGSN (1.2.0.46-e77e-dirty) configuration saved from vty -!! -! -log gsmtap 172.18.8.103 - logging level set-all debug - logging filter all 1 -! -log stderr - logging filter all 1 - logging color 1 - logging print category 1 - logging timestamp 1 - logging print extended-timestamp 1 - logging print file 1 - logging level mm debug - logging level pag notice - logging level meas notice - logging level ref notice - logging level gprs debug - logging level llc debug - logging level sndcp debug - logging level slhc notice - logging level ranap info - logging level sua info - logging level v42bis info - logging level lglobal info - logging level llapd notice - logging level linp notice - logging level lmux notice - logging level lmi notice - logging level lmib notice - logging level lsms notice - logging level lctrl notice - logging level lgtp debug - logging level lstats notice - logging level lgsup debug - logging level loap notice - logging level lss7 notice - logging level lsccp info - logging level lsua notice - logging level lm3ua notice - logging level lmgcp notice -! -stats interval 5 -! -line vty - no login - bind 0.0.0.0 -ctrl - bind 0.0.0.0 -! -cs7 instance 0 - point-code 0.23.4 - asp asp-clnt-OsmoSGSN-A 2905 0 m3ua - local-ip 172.18.8.10 - local-ip fd02:db8:8::10 - remote-ip 172.18.8.200 - remote-ip fd02:db8:8::200 - role asp - sctp-role client - as as-clnt-OsmoSGSN-A m3ua - asp asp-clnt-OsmoSGSN-A - routing-key 3 0.23.4 -ns - timer tns-block 3 - timer tns-block-retries 3 - timer tns-reset 3 - timer tns-reset-retries 3 - timer tns-test 30 - timer tns-alive 3 - timer tns-alive-retries 10 - bind udp local - listen 172.18.8.10 23000 - accept-dynamic-ip-sns -bssgp -sgsn - gtp local-ip 172.18.8.10 - ggsn 0 remote-ip 172.18.8.103 - ggsn 0 gtp-version 1 - gsup remote-ip 172.18.8.103 - gsup remote-port 4222 - auth-policy remote - gsup oap-id 0 - ! apn * ggsn 0 - no cdr filename - no cdr trap - cdr interval 600 - timer t3312 600 - timer t3322 6 - timer t3350 6 - timer t3360 6 - timer t3370 6 - timer t3313 30 - timer t3314 44 - timer t3316 44 - timer t3385 8 - timer t3386 8 - timer t3395 8 - timer t3397 8 - no compression rfc1144 - no compression v42bis - mme test-mme0 - gtp remote-ip 172.18.8.103 - gtp ran-info-relay 262 42 3 diff --git a/ttcn3-sgsn-test/ttcn3.sh b/ttcn3-sgsn-test/ttcn3.sh deleted file mode 100755 index 9100bfa..0000000 --- a/ttcn3-sgsn-test/ttcn3.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -set +e -set -x - -if [[ -z "${EXTRA_IPADDR}" ]]; then - echo "env var EXTRA_IPADDR undefined!" - exit 1 -fi - -ip addr add "${EXTRA_IPADDR}" dev eth0 - -# https://bugzilla.redhat.com/show_bug.cgi?id=782042 -# IPv6 addresses may take an extra while to be available ('tentative' state): -while [ -n "$(ip -6 addr show tentative)" ]; do sleep 1; done - -ttcn3-docker-run sgsn SGSN_Tests diff --git a/ttcn3-sip-test/Dockerfile b/ttcn3-sip-test/Dockerfile deleted file mode 100644 index 7418ea6..0000000 --- a/ttcn3-sip-test/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -ARG REGISTRY -ARG USER -FROM $REGISTRY/$USER/debian-bookworm-titan -ARG OSMO_TTCN3_BRANCH="master" - -ADD https://gerrit.osmocom.org/plugins/gitiles/osmo-ttcn3-hacks/+/$OSMO_TTCN3_B… /tmp/commit -RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" sip - -VOLUME /data - -COPY SIP_Tests.cfg /data/SIP_Tests.cfg - -CMD ttcn3-docker-run sip SIP_Tests diff --git a/ttcn3-sip-test/Makefile b/ttcn3-sip-test/Makefile deleted file mode 100644 index 8d0e10b..0000000 --- a/ttcn3-sip-test/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../make/Makefile diff --git a/ttcn3-sip-test/SIP_Tests.cfg b/ttcn3-sip-test/SIP_Tests.cfg deleted file mode 100644 index 2904e76..0000000 --- a/ttcn3-sip-test/SIP_Tests.cfg +++ /dev/null @@ -1,20 +0,0 @@ -[ORDERED_INCLUDE] -"/osmo-ttcn3-hacks/Common.cfg" -"/osmo-ttcn3-hacks/sip/SIP_Tests.default" - -[LOGGING] - -[TESTPORT_PARAMETERS] -*.SIPVTY.CTRL_HOSTNAME := "172.18.11.10" -*.SIP.default_local_address := "172.18.11.103" -*.SIP.default_dest_address := "172.18.11.10" - -[MODULE_PARAMETERS] -SIP_Tests.mp_local_host := "172.18.11.103" -SIP_Tests.mp_osmosip_host := "172.18.11.10" -SIP_Tests.mp_mncc := "/data/unix/mncc" - -[MAIN_CONTROLLER] - -[EXECUTE] -SIP_Tests.control diff --git a/ttcn3-sip-test/jenkins.sh b/ttcn3-sip-test/jenkins.sh deleted file mode 100755 index 6558875..0000000 --- a/ttcn3-sip-test/jenkins.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh - -. ../jenkins-common.sh -IMAGE_SUFFIX="${IMAGE_SUFFIX:-master}" -docker_images_require \ - "osmo-sip-$IMAGE_SUFFIX" \ - "ttcn3-sip-test" - -set_clean_up_trap -set -e - -mkdir $VOL_BASE_DIR/sip-tester -mkdir $VOL_BASE_DIR/sip-tester/unix -cp SIP_Tests.cfg $VOL_BASE_DIR/sip-tester/ -write_mp_osmo_repo "$VOL_BASE_DIR/sip-tester/SIP_Tests.cfg" - -mkdir $VOL_BASE_DIR/sip -mkdir $VOL_BASE_DIR/sip/unix -cp osmo-sip-connector.cfg $VOL_BASE_DIR/sip/ - -mkdir $VOL_BASE_DIR/unix - -network_create -network_replace_subnet_in_configs - -echo Starting container with osmo-sip-connector -docker run --rm \ - $(docker_network_params $SUBNET 10) \ - --ulimit core=-1 \ - -v $VOL_BASE_DIR/sip:/data \ - -v $VOL_BASE_DIR/unix:/data/unix \ - --name ${BUILD_TAG}-sip-connector -d \ - $DOCKER_ARGS \ - $REPO_USER/osmo-sip-$IMAGE_SUFFIX \ - /bin/sh -c "osmo-sip-connector -c /data/osmo-sip-connector.cfg >>/data/osmo-sip-connector.log 2>&1" - -echo Starting container with SIP testsuite -docker run --rm \ - $(docker_network_params $SUBNET 103) \ - --ulimit core=-1 \ - -e "TTCN3_PCAP_PATH=/data" \ - -e "OSMO_SUT_HOST=$SUB4_PREFIX.$SUBNET.10" \ - -e "OSMO_SUT_PORT=4256" \ - -v $VOL_BASE_DIR/sip-tester:/data \ - -v $VOL_BASE_DIR/unix:/data/unix \ - --name ${BUILD_TAG}-ttcn3-sip-test \ - $DOCKER_ARGS \ - $REPO_USER/ttcn3-sip-test diff --git a/ttcn3-sip-test/osmo-sip-connector.cfg b/ttcn3-sip-test/osmo-sip-connector.cfg deleted file mode 100644 index 5d0a451..0000000 --- a/ttcn3-sip-test/osmo-sip-connector.cfg +++ /dev/null @@ -1,50 +0,0 @@ -! -! OsmoMNCC (1.1.0-dirty) configuration saved from vty -!! -! -log gsmtap 172.18.11.103 - logging level set-all debug - logging filter all 1 -! -log stderr - logging filter all 1 - logging color 1 - logging print category 1 - logging timestamp 1 - logging print extended-timestamp 1 - logging print file basename - logging level sip debug - logging level mncc debug - logging level app debug - logging level call notice - logging level lglobal notice - logging level llapd notice - logging level linp notice - logging level lmux notice - logging level lmi notice - logging level lmib notice - logging level lsms notice - logging level lctrl notice - logging level lgtp notice - logging level lstats notice - logging level lgsup notice - logging level loap notice - logging level lss7 notice - logging level lsccp notice - logging level lsua notice - logging level lm3ua notice - logging level lmgcp notice - logging level ljibuf notice -! -stats interval 5 -! -line vty - no login - bind 0.0.0.0 -! -sip - local 172.18.11.10 5060 - remote 172.18.11.103 5060 -mncc - socket-path /data/unix/mncc -app diff --git a/ttcn3-smlc-test/Dockerfile b/ttcn3-smlc-test/Dockerfile deleted file mode 100644 index 6c41c1c..0000000 --- a/ttcn3-smlc-test/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -ARG REGISTRY -ARG USER -FROM $REGISTRY/$USER/debian-bookworm-titan -ARG OSMO_TTCN3_BRANCH="master" - -ADD https://gerrit.osmocom.org/plugins/gitiles/osmo-ttcn3-hacks/+/$OSMO_TTCN3_B… /tmp/commit -RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" smlc - -VOLUME /data - -COPY SMLC_Tests.cfg /data/SMLC_Tests.cfg - -CMD ttcn3-docker-run smlc SMLC_Tests diff --git a/ttcn3-smlc-test/Makefile b/ttcn3-smlc-test/Makefile deleted file mode 100644 index 45d5a8d..0000000 --- a/ttcn3-smlc-test/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -RUN_ARGS?=-it --sysctl net.ipv6.conf.all.disable_ipv6=0 --network sigtran --ip 172.18.23.202 - -include ../make/Makefile diff --git a/ttcn3-smlc-test/SMLC_Tests.cfg b/ttcn3-smlc-test/SMLC_Tests.cfg deleted file mode 100644 index 34bcb75..0000000 --- a/ttcn3-smlc-test/SMLC_Tests.cfg +++ /dev/null @@ -1,31 +0,0 @@ -[ORDERED_INCLUDE] -"/osmo-ttcn3-hacks/Common.cfg" -"/osmo-ttcn3-hacks/smlc/SMLC_Tests.default" - -[LOGGING] -*.JUnitLogger.testsuite_name := "SMLC_Tests" - -[TESTPORT_PARAMETERS] -*.SMLCVTY.CTRL_HOSTNAME := "172.18.23.20" -*.STATSVTY.CTRL_HOSTNAME := "172.18.23.20" - -[MODULE_PARAMETERS] -SMLC_Tests.mp_smlc_ip := "172.18.23.20"; -SMLC_Tests.mp_test_ip := "172.18.23.203"; -SMLC_Tests.mp_bssap_le_cfg := { - { - sccp_service_type := "mtp3_itu", - sctp_addr := { 23905, "172.18.23.203", 2905, "172.18.23.200" }, - own_pc := 187, /* 0.23.3 first BSC emulation */ - own_ssn := 250, /* BSC side SSN */ - peer_pc := 190, /* 0.23.6 osmo-smlc */ - peer_ssn := 252, /* SMLC side SSN */ - sio := '83'O, - rctx := 1 - } -}; - -[MAIN_CONTROLLER] - -[EXECUTE] -SMLC_Tests.control diff --git a/ttcn3-smlc-test/jenkins.sh b/ttcn3-smlc-test/jenkins.sh deleted file mode 100755 index 5bcdcbe..0000000 --- a/ttcn3-smlc-test/jenkins.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh - -. ../jenkins-common.sh -IMAGE_SUFFIX="${IMAGE_SUFFIX:-master}" -docker_images_require \ - "osmo-stp-$IMAGE_SUFFIX" \ - "osmo-smlc-$IMAGE_SUFFIX" \ - "ttcn3-smlc-test" - -set_clean_up_trap -set -e - -mkdir $VOL_BASE_DIR/smlc-tester -cp SMLC_Tests.cfg $VOL_BASE_DIR/smlc-tester/ -write_mp_osmo_repo "$VOL_BASE_DIR/smlc-tester/SMLC_Tests.cfg" - -mkdir $VOL_BASE_DIR/stp -cp osmo-stp.cfg $VOL_BASE_DIR/stp/ - -mkdir $VOL_BASE_DIR/smlc -cp osmo-smlc.cfg $VOL_BASE_DIR/smlc/ - -network_create -network_replace_subnet_in_configs - -echo Starting container with STP -docker run --rm \ - $(docker_network_params $SUBNET 200) \ - --ulimit core=-1 \ - -v $VOL_BASE_DIR/stp:/data \ - --name ${BUILD_TAG}-stp -d \ - --ulimit core=-1 \ - $DOCKER_ARGS \ - $REPO_USER/osmo-stp-$IMAGE_SUFFIX - -echo Starting container with SMLC -docker run --rm \ - $(docker_network_params $SUBNET 20) \ - --ulimit core=-1 \ - -v $VOL_BASE_DIR/smlc:/data \ - --name ${BUILD_TAG}-smlc -d \ - $DOCKER_ARGS \ - $REPO_USER/osmo-smlc-$IMAGE_SUFFIX - -echo Starting container with SMLC testsuite -docker run --rm \ - $(docker_network_params $SUBNET 203) \ - --ulimit core=-1 \ - -e "TTCN3_PCAP_PATH=/data" \ - -e "OSMO_SUT_HOST=$SUB4_PREFIX.$SUBNET.20" \ - -e "OSMO_SUT_PORT=4271" \ - -v $VOL_BASE_DIR/smlc-tester:/data \ - --name ${BUILD_TAG}-ttcn3-smlc-test \ - $DOCKER_ARGS \ - $REPO_USER/ttcn3-smlc-test diff --git a/ttcn3-smlc-test/osmo-smlc.cfg b/ttcn3-smlc-test/osmo-smlc.cfg deleted file mode 100644 index 7da2163..0000000 --- a/ttcn3-smlc-test/osmo-smlc.cfg +++ /dev/null @@ -1,29 +0,0 @@ -log gsmtap 172.18.23.203 - logging level set-all debug - logging filter all 1 -log stderr - logging filter all 1 - logging color 1 - logging print level 1 - logging print category 1 - logging print category-hex 0 - logging print extended-timestamp 1 - logging print file basename last - logging level set-all debug - -line vty - no login - bind 0.0.0.0 - -cs7 instance 0 - asp asp-clnt-msc-0 2905 2905 m3ua - local-ip 172.18.23.20 - local-ip fd02:db8:23::20 - remote-ip 172.18.23.200 - remote-ip fd02:db8:23::200 - role asp - sctp-role client -cells - lac-ci 23 42 lat 23.23 lon 42.42 - cgi 001 02 3 4 lat 5.678 lon 6.789 - cgi 001 02 1 17 lat 7.890123 lon 8.90123 diff --git a/ttcn3-smlc-test/osmo-stp.cfg b/ttcn3-smlc-test/osmo-stp.cfg deleted file mode 100644 index fb87a9c..0000000 --- a/ttcn3-smlc-test/osmo-stp.cfg +++ /dev/null @@ -1,44 +0,0 @@ -! -! OsmoSTP (0.8.1) configuration saved from vty -!! -! -log gsmtap 172.18.23.203 - logging level set-all debug - logging filter all 1 -! -log stderr - logging filter all 1 - logging color 1 - logging print level 1 - logging print category 1 - logging print category-hex 0 - logging print extended-timestamp 1 - logging print file basename last - logging level set-all notice - logging level lss7 debug - logging level lsccp debug - logging level lsua debug - logging level lm3ua debug -! -line vty - no login -! -cs7 instance 0 - xua rkm routing-key-allocation dynamic-permitted - asp virt-bsc0-0 23905 2905 m3ua - local-ip 172.18.23.200 - local-ip fd02:db8:23::200 - remote-ip 172.18.23.203 - remote-ip fd02:db8:23::203 - role sg - sctp-role server - as virt-bsc0 m3ua - asp virt-bsc0-0 - routing-key 1 0.23.3 - - route-table system - update route 0.23.3 7.255.7 linkset virt-bsc0 - listen m3ua 2905 - accept-asp-connections dynamic-permitted - local-ip 172.18.23.200 - local-ip fd02:db8:23::200 diff --git a/ttcn3-upf-test/Dockerfile b/ttcn3-upf-test/Dockerfile deleted file mode 100644 index 665d818..0000000 --- a/ttcn3-upf-test/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -ARG REGISTRY -ARG USER -FROM $REGISTRY/$USER/debian-bookworm-titan -ARG OSMO_TTCN3_BRANCH="master" - -ADD https://gerrit.osmocom.org/plugins/gitiles/osmo-ttcn3-hacks/+/$OSMO_TTCN3_B… /tmp/commit -RUN ttcn3-docker-prepare "$OSMO_TTCN3_BRANCH" upf - -VOLUME /data - -COPY UPF_Tests.cfg /data/UPF_Tests.cfg - -CMD ttcn3-docker-run upf UPF_Tests diff --git a/ttcn3-upf-test/Makefile b/ttcn3-upf-test/Makefile deleted file mode 100644 index 207d0f1..0000000 --- a/ttcn3-upf-test/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -RUN_ARGS?=-it --sysctl net.ipv6.conf.all.disable_ipv6=0 --network sigtran --ip 172.18.34.202 - -include ../make/Makefile diff --git a/ttcn3-upf-test/UPF_Tests.cfg b/ttcn3-upf-test/UPF_Tests.cfg deleted file mode 100644 index 0b794e7..0000000 --- a/ttcn3-upf-test/UPF_Tests.cfg +++ /dev/null @@ -1,25 +0,0 @@ -[ORDERED_INCLUDE] -"/osmo-ttcn3-hacks/Common.cfg" -"/osmo-ttcn3-hacks/upf/UPF_Tests.default" - -[LOGGING] -*.JUnitLogger.testsuite_name := "UPF_Tests" - -# Local configuration below - -[LOGGING] - -[TESTPORT_PARAMETERS] -*.UPFVTY.CTRL_HOSTNAME := "172.18.34.20"; -*.STATSVTY.CTRL_HOSTNAME := "172.18.34.20"; - -[MODULE_PARAMETERS] -UPF_Tests.mp_pfcp_ip_upf := "172.18.34.20"; -UPF_Tests.mp_pfcp_ip_local := "172.18.34.203"; - -UPF_Tests.mp_verify_gtp_actions := false; - -[MAIN_CONTROLLER] - -[EXECUTE] -UPF_Tests.control diff --git a/ttcn3-upf-test/jenkins.sh b/ttcn3-upf-test/jenkins.sh deleted file mode 100755 index 47b892c..0000000 --- a/ttcn3-upf-test/jenkins.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -. ../jenkins-common.sh -IMAGE_SUFFIX="${IMAGE_SUFFIX:-master}" -docker_images_require \ - "osmo-upf-$IMAGE_SUFFIX" \ - "ttcn3-upf-test" - -set_clean_up_trap -set -e - -mkdir $VOL_BASE_DIR/upf-tester -cp UPF_Tests.cfg $VOL_BASE_DIR/upf-tester/ -write_mp_osmo_repo "$VOL_BASE_DIR/upf-tester/UPF_Tests.cfg" - -mkdir $VOL_BASE_DIR/upf -cp osmo-upf.cfg $VOL_BASE_DIR/upf/ - -network_create -network_replace_subnet_in_configs - -echo Starting container with UPF -docker run --rm \ - $(docker_network_params $SUBNET 20) \ - --ulimit core=-1 \ - -v $VOL_BASE_DIR/upf:/data \ - --name ${BUILD_TAG}-upf -d \ - $DOCKER_ARGS \ - $REPO_USER/osmo-upf-$IMAGE_SUFFIX - -echo Starting container with UPF testsuite -docker run --rm \ - $(docker_network_params $SUBNET 203) \ - --ulimit core=-1 \ - -e "TTCN3_PCAP_PATH=/data" \ - -e "OSMO_SUT_HOST=$SUB4_PREFIX.$SUBNET.20" \ - -e "OSMO_SUT_PORT=4275" \ - -v $VOL_BASE_DIR/upf-tester:/data \ - --name ${BUILD_TAG}-ttcn3-upf-test \ - $DOCKER_ARGS \ - $REPO_USER/ttcn3-upf-test diff --git a/ttcn3-upf-test/osmo-upf.cfg b/ttcn3-upf-test/osmo-upf.cfg deleted file mode 100644 index 39aaeb7..0000000 --- a/ttcn3-upf-test/osmo-upf.cfg +++ /dev/null @@ -1,24 +0,0 @@ -log stderr - logging filter all 1 - logging color 1 - logging print category-hex 0 - logging print category 1 - logging print thread-id 0 - logging print extended-timestamp 1 - logging print level 1 - logging print file basename last - logging level set-all debug -log gsmtap 172.18.34.203 - logging level set-all debug - logging filter all 1 -line vty - no login - bind 0.0.0.0 -ctrl - bind 0.0.0.0 -pfcp - local-addr 172.18.34.20 -gtp - mockup -nft - mockup -- To view, visit https://gerrit.osmocom.org/c/docker-playground/+/37714?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: docker-playground Gerrit-Branch: master Gerrit-Change-Id: I7182c7e8eb00a9323fe1b6d27f630d253b4d34f6 Gerrit-Change-Number: 37714 Gerrit-PatchSet: 3 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-bsc[master]: Initial support for >256 BTS
by laforge 09 Sep '24

09 Sep '24
Attention is currently required from: fixeria, pespin. laforge has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-bsc/+/38052?usp=email ) Change subject: Initial support for >256 BTS ...................................................................... Patch Set 2: (1 comment) Commit Message: https://gerrit.osmocom.org/c/osmo-bsc/+/38052/comment/ee0bce60_372bc236?usp… : PS1, Line 14: The ipaccess OML bts_nr is still kept as uint8_t so nothing changes over : the wire. That's because in ipaccess OML, in general each BTS is : bt > Which other BTSs are we speaking about which are not ip.access connecting to osmo-bsc? […] we have to check how the bts->nr gets used in other abis dialects. In E1 based bts uaing 12.21 (like Siemens) you can for sure have multiple daisy-chained and then the OML header bts-nr can be non-zero. but it is unrealistic to have more than a handful at one link. -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/38052?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I607a68efeb5f4a50cce107d11d3c5126b7d8f81a Gerrit-Change-Number: 38052 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Mon, 09 Sep 2024 07:02:06 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-bsc[master]: Convert bts->depends_on from bitmask to llist
by laforge 09 Sep '24

09 Sep '24
Attention is currently required from: fixeria, pespin. laforge has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-bsc/+/38050?usp=email ) Change subject: Convert bts->depends_on from bitmask to llist ...................................................................... Patch Set 2: Code-Review+1 (1 comment) Patchset: PS2: we usually Chek. for (of assert on) tallow returning NULL. in this case I think it's better to keep the BSC running and failing to add that one dependent record. -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/38050?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I59e37d6baa020aeafdffc2c3538e988effd37620 Gerrit-Change-Number: 38050 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Mon, 09 Sep 2024 06:59:29 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in libosmo-sccp[master]: remove obsolete sccp.h
by laforge 09 Sep '24

09 Sep '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/38042?usp=email ) Change subject: remove obsolete sccp.h ...................................................................... remove obsolete sccp.h The sccp.h file was part of the just-removed libsccp.a static library, but there was one reamining user in this repository. However, that user (sccp2sua.c) should actually include sccp_types.h - and with that, we can remove the sccp.h header file. Change-Id: Ica59d2044a221d1f05a2c6f3fb48a71341f9b128 --- M include/osmocom/sccp/Makefile.am D include/osmocom/sccp/sccp.h M src/sccp2sua.c 3 files changed, 2 insertions(+), 202 deletions(-) Approvals: neels: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/sccp/Makefile.am b/include/osmocom/sccp/Makefile.am index 25e65da..6bbeec4 100644 --- a/include/osmocom/sccp/Makefile.am +++ b/include/osmocom/sccp/Makefile.am @@ -1,2 +1,2 @@ -sccp_HEADERS = sccp.h sccp_types.h +sccp_HEADERS = sccp_types.h sccpdir = $(includedir)/osmocom/sccp diff --git a/include/osmocom/sccp/sccp.h b/include/osmocom/sccp/sccp.h deleted file mode 100644 index fd911da..0000000 --- a/include/osmocom/sccp/sccp.h +++ /dev/null @@ -1,200 +0,0 @@ -/* - * SCCP management code - * - * (C) 2009, 2010, 2013 by Holger Hans Peter Freyther <zecke(a)selfish.org> - * (C) 2009, 2010, 2013 by On-Waves - * - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#ifndef SCCP_H -#define SCCP_H - -#include <stdlib.h> - -#include <sys/socket.h> -#include <sys/types.h> - -#include <osmocom/core/linuxlist.h> - -#include "sccp_types.h" - -struct msgb; -struct sccp_system; - -enum { - SCCP_CONNECTION_STATE_NONE, - SCCP_CONNECTION_STATE_REQUEST, - SCCP_CONNECTION_STATE_CONFIRM, - SCCP_CONNECTION_STATE_ESTABLISHED, - SCCP_CONNECTION_STATE_RELEASE, - SCCP_CONNECTION_STATE_RELEASE_COMPLETE, - SCCP_CONNECTION_STATE_REFUSED, - SCCP_CONNECTION_STATE_SETUP_ERROR, -}; - -struct sockaddr_sccp { - sa_family_t sccp_family; /* AF_SCCP in the future??? */ - uint8_t sccp_ssn; /* subssystem number for routing */ - - /* TODO fill in address indicator... if that is ever needed */ - - /* optional gti information */ - uint8_t *gti; - int gti_len; - - /* any of SCCP_TITLE_IND_* */ - uint8_t gti_ind; - - int use_poi; - uint8_t poi[2]; - - /* not sure about these */ - /* uint8_t sccp_class; */ -}; - -/* - * parsed structure of an address - */ -struct sccp_address { - struct sccp_called_party_address address; - uint8_t ssn; - uint8_t poi[2]; - - uint8_t *gti_data; - int gti_len; -}; - -struct sccp_optional_data { - uint8_t data_len; - uint8_t data_start; -}; - -struct sccp_connection { - /* public */ - void *data_ctx; - void (*data_cb)(struct sccp_connection *conn, struct msgb *msg, unsigned int len); - - void *state_ctx; - void (*state_cb)(struct sccp_connection *, int old_state); - - struct sccp_source_reference source_local_reference; - struct sccp_source_reference destination_local_reference; - - int connection_state; - - /* private */ - /* list of active connections */ - struct llist_head list; - struct sccp_system *system; - int incoming; -}; - -/** - * system functionality to implement on top of any other transport layer: - * call sccp_system_incoming for incoming data (from the network) - * sccp will call outgoing whenever outgoing data exists - * The conn is NULL for UDT and other messages without a connection - */ -int sccp_system_init(void (*outgoing)(struct sccp_connection *conn, struct msgb *data, void *gctx, void *ctx), void *context); -int sccp_system_incoming_ctx(struct msgb *data, void *ctx); -int sccp_system_incoming(struct msgb *data); - -/** - * Send data on an existing connection - */ -int sccp_connection_write(struct sccp_connection *connection, struct msgb *data); -int sccp_connection_send_it(struct sccp_connection *connection); -int sccp_connection_close(struct sccp_connection *connection, int cause); -int sccp_connection_free(struct sccp_connection *connection); - -/** - * internal.. - */ -int sccp_connection_force_free(struct sccp_connection *conn); - -/** - * Create a new socket. Set your callbacks and then call bind to open - * the connection. - */ -struct sccp_connection *sccp_connection_socket(void); - -/** - * Open the connection and send additional data - */ -int sccp_connection_connect(struct sccp_connection *conn, - const struct sockaddr_sccp *sccp_called, - struct msgb *data); - -/** - * mostly for testing purposes only. Set the accept callback. - * TODO: add true routing information... in analogy to socket, bind, accept - */ -int sccp_connection_set_incoming(const struct sockaddr_sccp *sock, - int (*accept_cb)(struct sccp_connection *connection, void *data), - void *user_data); - -/** - * Send data in terms of unit data. A fixed address indicator will be used. - */ -int sccp_write(struct msgb *data, - const struct sockaddr_sccp *sock_sender, - const struct sockaddr_sccp *sock_target, - int class, void *ctx); -int sccp_set_read(const struct sockaddr_sccp *sock, - int (*read_cb)(struct msgb *msgb, unsigned int, void *user_data), - void *user_data); - -/* generic sock addresses */ -extern const struct sockaddr_sccp sccp_ssn_bssap; - -/* helpers */ -uint32_t sccp_src_ref_to_int(struct sccp_source_reference *ref); -struct sccp_source_reference sccp_src_ref_from_int(uint32_t); - -struct msgb *sccp_create_cr(const struct sccp_source_reference *src_ref, const struct sockaddr_sccp *called, const uint8_t *data, size_t length); -struct msgb *sccp_create_refuse(struct sccp_source_reference *src_ref, int cause, uint8_t *data, int length); -struct msgb *sccp_create_cc(struct sccp_source_reference *src_ref, struct sccp_source_reference *dst_ref); -struct msgb *sccp_create_rlsd(struct sccp_source_reference *src_ref, struct sccp_source_reference *dst_ref, int cause); -struct msgb *sccp_create_dt1(struct sccp_source_reference *dst_ref, uint8_t *data, uint8_t len); -struct msgb *sccp_create_udt(int _class, const struct sockaddr_sccp *sock_sender, - const struct sockaddr_sccp *sock_target, uint8_t *data, int len); - -/** - * Below this are helper functions and structs for parsing SCCP messages - */ -struct sccp_parse_result { - struct sccp_address called; - struct sccp_address calling; - - /* point to the msg packet */ - struct sccp_source_reference *source_local_reference; - struct sccp_source_reference *destination_local_reference; - - /* data pointer */ - int data_len; -}; - -/* - * helper functions for the nat code - */ -int sccp_determine_msg_type(struct msgb *msg); -int sccp_parse_header(struct msgb *msg, struct sccp_parse_result *result); - -/* - * osmocore logging features - */ -void sccp_set_log_area(int log_area); - -#endif diff --git a/src/sccp2sua.c b/src/sccp2sua.c index 811cc55..930b837 100644 --- a/src/sccp2sua.c +++ b/src/sccp2sua.c @@ -28,7 +28,7 @@ #include <errno.h> #include <inttypes.h> -#include <osmocom/sccp/sccp.h> +#include <osmocom/sccp/sccp_types.h> #include <osmocom/core/linuxlist.h> #include <osmocom/core/logging.h> #include <osmocom/sigtran/sccp_sap.h> -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/38042?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: Ica59d2044a221d1f05a2c6f3fb48a71341f9b128 Gerrit-Change-Number: 38042 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
1 0
0 0
[XL] Change in libosmo-sccp[master]: remove old static libsccp.a, libmtp.a, libxua.a
by laforge 09 Sep '24

09 Sep '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/38041?usp=email ) Change subject: remove old static libsccp.a, libmtp.a, libxua.a ...................................................................... remove old static libsccp.a, libmtp.a, libxua.a Those static libraries were not used or maintained a long time ago. We have a much more complete implementation of SCCP and xUA in libosmo-sigtran. That has been the basis of osmo-stp, as well as in osmo-sgsn.git, osmo-bsc.git, osmo-msc.git. The only user of the old static libraries was osmo-bsc-sccplite from openbsc.git, which is unsupported for many years. Change-Id: I299a32a2f8f61477cf49c8126567fef2092d5407 --- M Makefile.am M TODO-RELEASE M configure.ac M debian/control D debian/libosmo-sccp-dev.install M debian/libosmo-sigtran-dev.install M include/osmocom/Makefile.am D include/osmocom/mtp/Makefile.am D include/osmocom/mtp/mtp_level3.h D include/osmocom/mtp/mtp_pcap.h M include/osmocom/sccp/Makefile.am D libosmo-mtp.pc.in D libosmo-sccp.pc.in D libosmo-xua.pc.in M src/Makefile.am D src/mtp_pcap.c D src/sccp.c M tests/Makefile.am D tests/mtp/Makefile.am D tests/mtp/mtp_parse_test.c D tests/mtp/mtp_parse_test.ok D tests/sccp/Makefile.am D tests/sccp/sccp_test.c D tests/sccp/sccp_test.ok M tests/testsuite.at 25 files changed, 9 insertions(+), 3,760 deletions(-) Approvals: Jenkins Builder: Verified neels: Looks good to me, approved diff --git a/Makefile.am b/Makefile.am index 5a2cad4..051f3c3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,7 +4,7 @@ SUBDIRS = include src tests examples stp doc contrib pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libosmo-sccp.pc libosmo-mtp.pc libosmo-sigtran.pc libosmo-xua.pc +pkgconfig_DATA = libosmo-sigtran.pc EXTRA_DIST = \ .version \ diff --git a/TODO-RELEASE b/TODO-RELEASE index 0ed7189..2f0dcec 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -7,3 +7,6 @@ # If any interfaces have been added since the last public release: c:r:a + 1. # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line +libsccp.a removed ancient library not used for decades +libmtp.a removed ancient library not used for decades +libsccp.a removed ancient library not used for decades diff --git a/configure.ac b/configure.ac index 7311ffa..189f08e 100644 --- a/configure.ac +++ b/configure.ac @@ -183,18 +183,12 @@ AC_OUTPUT( libosmo-sigtran.pc - libosmo-sccp.pc - libosmo-mtp.pc - libosmo-xua.pc include/osmocom/Makefile include/osmocom/sccp/Makefile - include/osmocom/mtp/Makefile include/osmocom/sigtran/Makefile include/Makefile src/Makefile tests/Makefile - tests/sccp/Makefile - tests/mtp/Makefile tests/m2ua/Makefile tests/xua/Makefile tests/ss7/Makefile diff --git a/debian/control b/debian/control index de425de..68abbe8 100644 --- a/debian/control +++ b/debian/control @@ -21,19 +21,6 @@ Vcs-Browser: https://gitea.osmocom.org/osmocom/libosmo-sccp Homepage: https://projects.osmocom.org/projects/libosmo-sccp -Package: libosmo-sccp-dev -Architecture: any -Depends: ${misc:Depends} -Multi-Arch: same -Section: libdevel -Description: Development files for libsccp, libmtp and libxua - SCCP is a network layer protocol that provides extended routing, flow control, - segmentation, connection-orientation, and error correction facilities in - Signaling System 7 telecommunications networks. - It is heavily used in cellular networks such as GSM. - . - This package contains the development files for the library. - Package: libosmo-sigtran10 Section: libs Architecture: any diff --git a/debian/libosmo-sccp-dev.install b/debian/libosmo-sccp-dev.install deleted file mode 100644 index 0404a9c..0000000 --- a/debian/libosmo-sccp-dev.install +++ /dev/null @@ -1,7 +0,0 @@ -usr/include/osmocom/sccp -usr/lib/*/libsccp.a -usr/lib/*/libmtp.a -usr/lib/*/libxua.a -usr/lib/*/pkgconfig/libosmo-sccp.pc -usr/lib/*/pkgconfig/libosmo-mtp.pc -usr/lib/*/pkgconfig/libosmo-xua.pc diff --git a/debian/libosmo-sigtran-dev.install b/debian/libosmo-sigtran-dev.install index a556f90..b4628e2 100644 --- a/debian/libosmo-sigtran-dev.install +++ b/debian/libosmo-sigtran-dev.install @@ -1,4 +1,5 @@ usr/include/osmocom/sigtran +usr/include/osmocom/sccp usr/lib/*/libosmo-sigtran*.a usr/lib/*/libosmo-sigtran*.so usr/lib/*/libosmo-sigtran*.la diff --git a/include/osmocom/Makefile.am b/include/osmocom/Makefile.am index c4535f3..a08ab02 100644 --- a/include/osmocom/Makefile.am +++ b/include/osmocom/Makefile.am @@ -1 +1 @@ -SUBDIRS = mtp sccp sigtran +SUBDIRS = sccp sigtran diff --git a/include/osmocom/mtp/Makefile.am b/include/osmocom/mtp/Makefile.am deleted file mode 100644 index dbd0e79..0000000 --- a/include/osmocom/mtp/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -mtp_HEADERS = mtp_level3.h mtp_pcap.h -mtpdir = $(includedir)/osmocom/mtp diff --git a/include/osmocom/mtp/mtp_level3.h b/include/osmocom/mtp/mtp_level3.h deleted file mode 100644 index 8ea54a9..0000000 --- a/include/osmocom/mtp/mtp_level3.h +++ /dev/null @@ -1,177 +0,0 @@ -/* Q.701-Q.704, Q.706, Q.707 handling code */ -/* - * (C) 2010 by Holger Hans Peter Freyther <zecke(a)selfish.org> - * (C) 2010 by On-Waves - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#pragma once - -#include <osmocom/core/endian.h> - -#include <stdint.h> -#include <sys/types.h> - - -/* - * pssible service information octets.. - */ -#define MTP_NI_NATION_NET 0x02 - -#define MTP_SI_MNT_SNM_MSG 0x00 -#define MTP_SI_MNT_REG_MSG 0x01 -#define MTP_SI_MNT_SCCP 0x03 -#define MTP_SI_MNT_ISUP 0x05 - -/* - * h0 contains the group, h1 the semantic of it - */ - -#define MTP_TST_MSG_GRP 0x01 -#define MTP_PROHIBIT_MSG_GRP 0x04 -#define MTP_SROUTE_MSG_GRP 0x05 -#define MTP_TRF_RESTR_MSG_GRP 0x07 - -/* h1 values for different groups */ -#define MTP_TST_MSG_SLTM 0x01 -#define MTP_TST_MSG_SLTA 0x02 - -#define MTP_RESTR_MSG_ALLWED 0x01 - -/* For the prohibit group */ -#define MTP_PROHIBIT_MSG_SIG 0x01 -#define MTP_PROHIBIT_MSG_TFA 0x05 - -/* For the Signalling-route-set-test */ -#define MTP_SROUTE_MSG_TEST 0x01 - - -#define SCCP_SST 0x03 -#define SCCP_SSP 0x02 -#define SCCP_SSA 0x01 - -#define MTP_LINK_MASK 0x0F -#define MTP_ADDR_MASK 0x3FFF -#define MTP_APOC_MASK 0x3f - - -#if OSMO_IS_LITTLE_ENDIAN -#define MTP_LINK_SLS(addr) ((addr >>28) & MTP_LINK_MASK) -#define MTP_ADDR(link, dpc, opc) \ - (((dpc) & MTP_ADDR_MASK) << 0 | \ - ((opc) & MTP_ADDR_MASK) << 14| \ - ((link) & MTP_LINK_MASK) << 28) -#define MTP_MAKE_APOC(apoc) \ - (apoc & 0x3fff) -#define MTP_READ_DPC(addr) \ - (((addr) >> 0) & MTP_ADDR_MASK) -#define MTP_READ_OPC(addr) \ - (((addr) >> 14) & MTP_ADDR_MASK) -#elif OSMO_IS_BIG_ENDIAN -static inline uint32_t c_swap_32(uint32_t in) -{ - return (((in & 0x000000ff) << 24) | - ((in & 0x0000ff00) << 8) | - ((in & 0x00ff0000) >> 8) | - ((in & 0xff000000) >> 24)); -} -static inline uint16_t c_swap_16(uint16_t in) -{ - return (((in & 0x00ff) << 8) | - (in & 0xff00) >> 8); -} -#define MTP_LINK_SLS(addr) ((c_swap_32(addr)>>28) & MTP_LINK_MASK) -#define MTP_ADDR(link, dpc, opc) \ - c_swap_32(((dpc) & MTP_ADDR_MASK) << 0 | \ - ((opc) & MTP_ADDR_MASK) << 14| \ - ((link) & MTP_LINK_MASK) << 28) -#define MTP_MAKE_APOC(apoc) \ - c_swap_16((apoc & 0x3fff)) -#define MTP_READ_DPC(addr) \ - (c_swap_32(addr) & MTP_ADDR_MASK) -#define MTP_READ_OPC(addr) \ - ((c_swap_32(addr) >> 14) & MTP_ADDR_MASK) -#else -#error "Unknown endian" -#endif - - - -/* - * not the on wire address... - */ -struct mtp_addr { - uint16_t dpc; - uint16_t opc; - uint8_t link; -} __attribute__((packed)); - -/* - * the struct is defined in Q.704 and can be seen in the - * wireshark dissectors too - */ -struct mtp_level_3_hdr { -#if OSMO_IS_LITTLE_ENDIAN - uint8_t ser_ind : 4, - spare : 2, - ni : 2; -#elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ - uint8_t ni:2, spare:2, ser_ind:4; -#endif - uint32_t addr; - uint8_t data[0]; -} __attribute__((packed)); - -struct mtp_level_3_cmn { -#if OSMO_IS_LITTLE_ENDIAN - uint8_t h0 : 4, - h1 : 4; -#elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ - uint8_t h1:4, h0:4; -#endif -} __attribute__((packed)); - -struct mtp_level_3_mng { - struct mtp_level_3_cmn cmn; -#if OSMO_IS_LITTLE_ENDIAN - uint8_t spare : 4, - length : 4; -#elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ - uint8_t length:4, spare:4; -#endif - uint8_t data[0]; -} __attribute__((packed)); - -struct mtp_level_3_prohib { - struct mtp_level_3_cmn cmn; - - uint16_t apoc; -} __attribute__((packed)); - -struct sccp_con_ctrl_prt_mgt { - uint8_t sst; - uint8_t assn; /* affected sub system number */ - uint16_t apoc; -#if OSMO_IS_LITTLE_ENDIAN - uint8_t mul_ind : 2, - spare : 6; -#elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ - uint8_t spare:6, mul_ind:2; -#endif -} __attribute__((packed)); - diff --git a/include/osmocom/mtp/mtp_pcap.h b/include/osmocom/mtp/mtp_pcap.h deleted file mode 100644 index 4e400e2..0000000 --- a/include/osmocom/mtp/mtp_pcap.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * (C) 2010 by Holger Hans Peter Freyther <zecke(a)selfish.org> - * (C) 2010 by On-Waves - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ -#ifndef mtp_pcap_h -#define mtp_pcap_h - -#include <stdint.h> - -int mtp_pcap_write_header(int fd); -int mtp_pcap_write_msu(int fd, const uint8_t *data, int length); - -#endif diff --git a/include/osmocom/sccp/Makefile.am b/include/osmocom/sccp/Makefile.am index c64db26..25e65da 100644 --- a/include/osmocom/sccp/Makefile.am +++ b/include/osmocom/sccp/Makefile.am @@ -1,2 +1,2 @@ -sccp_HEADERS = sccp_types.h sccp.h +sccp_HEADERS = sccp.h sccp_types.h sccpdir = $(includedir)/osmocom/sccp diff --git a/libosmo-mtp.pc.in b/libosmo-mtp.pc.in deleted file mode 100644 index 675d0d3..0000000 --- a/libosmo-mtp.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: Osmo MTP Lib -Description: Osmo MTP Lib -Version: @VERSION@ -Libs: -L${libdir} -lmtp -Cflags: -I${includedir}/ diff --git a/libosmo-sccp.pc.in b/libosmo-sccp.pc.in deleted file mode 100644 index eda8d49..0000000 --- a/libosmo-sccp.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: OpenBSC SCCP Lib -Description: OpenBSC SCCP Lib -Version: @VERSION@ -Libs: -L${libdir} -lsccp -Cflags: -I${includedir}/ diff --git a/libosmo-xua.pc.in b/libosmo-xua.pc.in deleted file mode 100644 index 28f8285..0000000 --- a/libosmo-xua.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: Osmo XUA Lib -Description: Osmo XUA Lib -Version: @VERSION@ -Libs: -L${libdir} -losmo-xua -Cflags: -I${includedir}/ diff --git a/src/Makefile.am b/src/Makefile.am index 40a0ed1..ab3e56e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -10,22 +10,14 @@ xua_internal.h \ $(NULL) -# Legacy static libs +noinst_LIBRARIES = libxua.a -sccpdir = $(libdir) -sccp_LIBRARIES = libsccp.a libmtp.a libxua.a - -libsccp_a_SOURCES = sccp.c -libmtp_a_SOURCES = mtp_pcap.c libxua_a_SOURCES = xua_msg.c # ensure that the file for the static lib is built with different C # flags, working around automake complaining that xua_msg.o is built # both with libtool (below) and without (here) libxua_a_CPPFLAGS = $(AM_CPPFLAGS) -DDUMMY -UDUMMY - -# New shared lib - lib_LTLIBRARIES = libosmo-sigtran.la # This is _NOT_ the library release version, it's an API version. diff --git a/src/mtp_pcap.c b/src/mtp_pcap.c deleted file mode 100644 index f677581..0000000 --- a/src/mtp_pcap.c +++ /dev/null @@ -1,82 +0,0 @@ -/* PCAP code from OpenBSC done by Holger Freyther */ -/* - * (C) 2010 by Holger Hans Peter Freyther <zecke(a)selfish.org> - * (C) 2010 by On-Waves - * All Rights Reserved - * - * SPDX-License-Identifier: GPL-2.0+ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include <osmocom/mtp/mtp_pcap.h> - -#include <sys/time.h> - -#include <unistd.h> - -/* - * pcap writing of the misdn load - * pcap format is from http://wiki.wireshark.org/Development/LibpcapFileFormat - */ -struct pcap_hdr { - uint32_t magic_number; - uint16_t version_major; - uint16_t version_minor; - int32_t thiszone; - uint32_t sigfigs; - uint32_t snaplen; - uint32_t network; -} __attribute__((packed)); - -struct pcaprec_hdr { - uint32_t ts_sec; - uint32_t ts_usec; - uint32_t incl_len; - uint32_t orig_len; -} __attribute__((packed)); - -int mtp_pcap_write_header(int fd) -{ - static struct pcap_hdr hdr = { - .magic_number = 0xa1b2c3d4, - .version_major = 2, - .version_minor = 4, - .thiszone = 0, - .sigfigs = 0, - .snaplen = 65535, - .network = 141, - }; - - return write(fd, &hdr, sizeof(hdr)); -} - -int mtp_pcap_write_msu(int fd, const uint8_t *data, int length) -{ - int rc_h, rc_d; - struct timeval tv; - struct pcaprec_hdr payload_header = { - .ts_sec = 0, - .ts_usec = 0, - .incl_len = length, - .orig_len = length, - }; - - gettimeofday(&tv, NULL); - payload_header.ts_sec = tv.tv_sec; - payload_header.ts_usec = tv.tv_usec; - - rc_h = write(fd, &payload_header, sizeof(payload_header)); - rc_d = write(fd, data, length); - - return rc_h == sizeof(payload_header) && rc_d == length; -} diff --git a/src/sccp.c b/src/sccp.c deleted file mode 100644 index 85bea6d..0000000 --- a/src/sccp.c +++ /dev/null @@ -1,1572 +0,0 @@ -/* - * SCCP management code - * - * (C) 2009, 2010, 2013 by Holger Hans Peter Freyther <zecke(a)selfish.org> - * (C) 2009, 2010, 2013 by On-Waves - * - * All Rights Reserved - * - * SPDX-License-Identifier: GPL-2.0+ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include <errno.h> -#include <string.h> - -#include <osmocom/core/msgb.h> -#include <osmocom/core/talloc.h> -#include <osmocom/core/logging.h> -#include <osmocom/core/endian.h> -#include <osmocom/gsm/tlv.h> -#include <osmocom/sccp/sccp_types.h> -#include <osmocom/sccp/sccp.h> - -// Unassigned debug area -static int DSCCP = 0; - -static void *tall_sccp_ctx; -static LLIST_HEAD(sccp_connections); - -#define SCCP_MSG_SIZE 4096 -#define SCCP_MSG_HEADROOM 128 - -/* global data */ -const struct sockaddr_sccp sccp_ssn_bssap = { - .sccp_family = 0, - .sccp_ssn = SCCP_SSN_BSSAP, -}; - -struct sccp_system { - /* layer3 -> layer2 */ - void (*write_data)(struct sccp_connection *conn, struct msgb *data, - void *gctx, void *ctx); - void *write_context; -}; - - -static struct sccp_system sccp_system = { - .write_data = NULL, -}; - -struct sccp_data_callback { - /* connection based */ - int (*accept_cb)(struct sccp_connection *, void *); - void *accept_context; - - /* connection less */ - int (*read_cb)(struct msgb *, unsigned int, void *); - void *read_context; - - uint8_t ssn; - struct llist_head callback; -}; - -static LLIST_HEAD(sccp_callbacks); - -static struct sccp_data_callback *_find_ssn(uint8_t ssn) -{ - struct sccp_data_callback *cb; - - llist_for_each_entry(cb, &sccp_callbacks, callback) { - if (cb->ssn == ssn) - return cb; - } - - /* need to add one */ - cb = talloc_zero(tall_sccp_ctx, struct sccp_data_callback); - if (!cb) { - LOGP(DSCCP, LOGL_ERROR, "Failed to allocate sccp callback.\n"); - return NULL; - } - - cb->ssn = ssn; - llist_add_tail(&cb->callback, &sccp_callbacks); - return cb; -} - - -static void _send_msg(struct sccp_connection *conn, struct msgb *msg, void *ctx) -{ - sccp_system.write_data(conn, msg, sccp_system.write_context, ctx); -} - -/* - * parsing routines - */ -static int copy_address(struct sccp_address *addr, uint8_t offset, struct msgb *msgb) -{ - struct sccp_called_party_address *party; - - int room = msgb_l2len(msgb) - offset; - uint8_t read = 0; - uint8_t length; - - if (room <= 0) { - LOGP(DSCCP, LOGL_ERROR, "Not enough room for an address: %u\n", room); - return -1; - } - - length = msgb->l2h[offset]; - if (room <= length) { - LOGP(DSCCP, LOGL_ERROR, "Not enough room for optional data %u %u\n", room, length); - return -1; - } - - - party = (struct sccp_called_party_address *)(msgb->l2h + offset + 1); - if (party->point_code_indicator) { - if (length <= read + 2) { - LOGP(DSCCP, LOGL_ERROR, "POI does not fit %u\n", length); - return -1; - } - - - memcpy(&addr->poi, &party->data[read], 2); - read += 2; - } - - if (party->ssn_indicator) { - if (length <= read + 1) { - LOGP(DSCCP, LOGL_ERROR, "SSN does not fit %u\n", length); - return -1; - } - - addr->ssn = party->data[read]; - read += 1; - } - - /* copy the GTI over */ - if (party->global_title_indicator) { - addr->gti_len = length - read - 1; - addr->gti_data = &party->data[read]; - } - - addr->address = *party; - return 0; -} - -static int _sccp_parse_optional_data(const int offset, - struct msgb *msgb, struct sccp_optional_data *data) -{ - uint16_t room = msgb_l2len(msgb) - offset; - uint16_t read = 0; - - while (room > read) { - uint8_t type = msgb->l2h[offset + read]; - if (type == SCCP_PNC_END_OF_OPTIONAL) - return 0; - - if (read + 1 >= room) { - LOGP(DSCCP, LOGL_ERROR, "no place for length\n"); - return 0; - } - - uint8_t length = msgb->l2h[offset + read + 1]; - read += 2 + length; - - - if (room <= read) { - LOGP(DSCCP, LOGL_ERROR, - "no space for the data: type: %d read: %d room: %d l2: %d\n", - type, read, room, msgb_l2len(msgb)); - return 0; - } - - if (type == SCCP_PNC_DATA) { - data->data_len = length; - data->data_start = offset + read - length; - } - - } - - return -1; -} - -int _sccp_parse_connection_request(struct msgb *msgb, struct sccp_parse_result *result) -{ - static const uint32_t header_size = - sizeof(struct sccp_connection_request); - static const uint32_t optional_offset = - offsetof(struct sccp_connection_request, optional_start); - static const uint32_t called_offset = - offsetof(struct sccp_connection_request, variable_called); - - struct sccp_connection_request *req = (struct sccp_connection_request *)msgb->l2h; - struct sccp_optional_data optional_data; - - /* header check */ - if (msgb_l2len(msgb) < header_size) { - LOGP(DSCCP, LOGL_ERROR, "msgb < header_size %u %u\n", - msgb_l2len(msgb), header_size); - return -1; - } - - /* copy out the calling and called address. Add the offset */ - if (copy_address(&result->called, called_offset + req->variable_called, msgb) != 0) - return -1; - - result->source_local_reference = &req->source_local_reference; - - /* - * parse optional data. - */ - memset(&optional_data, 0, sizeof(optional_data)); - if (_sccp_parse_optional_data(optional_offset + req->optional_start, msgb, &optional_data) != 0) { - LOGP(DSCCP, LOGL_ERROR, "parsing of optional data failed.\n"); - return -1; - } - - if (optional_data.data_len != 0) { - if (optional_data.data_len > SCCP_MAX_OPTIONAL_DATA) { - LOGP(DSCCP, LOGL_ERROR, - "optional data has length %u exceeding max of %u according to ITU-T Rec. Q.713 §4.2\n", - optional_data.data_len, SCCP_MAX_OPTIONAL_DATA); - return -EMSGSIZE; - } - msgb->l3h = &msgb->l2h[optional_data.data_start]; - result->data_len = optional_data.data_len; - } else { - result->data_len = 0; - } - - return 0; -} - -int _sccp_parse_connection_released(struct msgb *msgb, struct sccp_parse_result *result) -{ - static size_t header_size = sizeof(struct sccp_connection_released); - static size_t optional_offset = offsetof(struct sccp_connection_released, optional_start); - - struct sccp_optional_data optional_data; - struct sccp_connection_released *rls = (struct sccp_connection_released *) msgb->l2h; - - /* we don't have enough size for the struct */ - if (msgb_l2len(msgb) < header_size) { - LOGP(DSCCP, LOGL_ERROR, "msgb > header_size %u %zu\n", - msgb_l2len(msgb), header_size); - return -1; - } - - memset(&optional_data, 0, sizeof(optional_data)); - if (_sccp_parse_optional_data(optional_offset + rls->optional_start, msgb, &optional_data) != 0) { - LOGP(DSCCP, LOGL_ERROR, "parsing of optional data failed.\n"); - return -1; - } - - result->source_local_reference = &rls->source_local_reference; - result->destination_local_reference = &rls->destination_local_reference; - - if (optional_data.data_len != 0) { - if (optional_data.data_len > SCCP_MAX_OPTIONAL_DATA) { - LOGP(DSCCP, LOGL_ERROR, - "optional data has length %u exceeding max of %u according to ITU-T Rec. Q.713 §4.5\n", - optional_data.data_len, SCCP_MAX_OPTIONAL_DATA); - return -EMSGSIZE; - } - msgb->l3h = &msgb->l2h[optional_data.data_start]; - result->data_len = optional_data.data_len; - } else { - result->data_len = 0; - } - - return 0; -} - -int _sccp_parse_connection_refused(struct msgb *msgb, struct sccp_parse_result *result) -{ - static const uint32_t header_size = - sizeof(struct sccp_connection_refused); - static int optional_offset = offsetof(struct sccp_connection_refused, optional_start); - - struct sccp_optional_data optional_data; - struct sccp_connection_refused *ref; - - /* header check */ - if (msgb_l2len(msgb) < header_size) { - LOGP(DSCCP, LOGL_ERROR, "msgb < header_size %u %u\n", - msgb_l2len(msgb), header_size); - return -1; - } - - ref = (struct sccp_connection_refused *) msgb->l2h; - - result->destination_local_reference = &ref->destination_local_reference; - - memset(&optional_data, 0, sizeof(optional_data)); - if (_sccp_parse_optional_data(optional_offset + ref->optional_start, msgb, &optional_data) != 0) { - LOGP(DSCCP, LOGL_ERROR, "parsing of optional data failed.\n"); - return -1; - } - - /* optional data */ - if (optional_data.data_len != 0) { - if (optional_data.data_len > SCCP_MAX_OPTIONAL_DATA) { - LOGP(DSCCP, LOGL_ERROR, - "optional data has length %u exceeding max of %u according to ITU-T Rec. Q.713 §4.4\n", - optional_data.data_len, SCCP_MAX_OPTIONAL_DATA); - return -EMSGSIZE; - } - msgb->l3h = &msgb->l2h[optional_data.data_start]; - result->data_len = optional_data.data_len; - } else { - result->data_len = 0; - } - - return 0; -} - -int _sccp_parse_connection_confirm(struct msgb *msgb, struct sccp_parse_result *result) -{ - static uint32_t header_size = - sizeof(struct sccp_connection_confirm); - static const uint32_t optional_offset = - offsetof(struct sccp_connection_confirm, optional_start); - - struct sccp_optional_data optional_data; - struct sccp_connection_confirm *con; - - /* header check */ - if (msgb_l2len(msgb) < header_size) { - LOGP(DSCCP, LOGL_ERROR, "msgb < header_size %u %u\n", - msgb_l2len(msgb), header_size); - return -1; - } - - con = (struct sccp_connection_confirm *) msgb->l2h; - result->destination_local_reference = &con->destination_local_reference; - result->source_local_reference = &con->source_local_reference; - - memset(&optional_data, 0, sizeof(optional_data)); - if (_sccp_parse_optional_data(optional_offset + con->optional_start, msgb, &optional_data) != 0) { - LOGP(DSCCP, LOGL_ERROR, "parsing of optional data failed.\n"); - return -1; - } - - if (optional_data.data_len != 0) { - if (optional_data.data_len > SCCP_MAX_OPTIONAL_DATA) { - LOGP(DSCCP, LOGL_ERROR, - "optional data has length %u exceeding max of %u according to ITU-T Rec. Q.713 §4.3\n", - optional_data.data_len, SCCP_MAX_OPTIONAL_DATA); - return -EMSGSIZE; - } - msgb->l3h = &msgb->l2h[optional_data.data_start]; - result->data_len = optional_data.data_len; - } else { - result->data_len = 0; - } - - return 0; -} - -int _sccp_parse_connection_release_complete(struct msgb *msgb, struct sccp_parse_result *result) -{ - static size_t header_size = sizeof(struct sccp_connection_release_complete); - - struct sccp_connection_release_complete *cmpl; - - /* header check */ - if (msgb_l2len(msgb) < header_size) { - LOGP(DSCCP, LOGL_ERROR, "msgb < header_size %u %zu\n", - msgb_l2len(msgb), header_size); - return -1; - } - - cmpl = (struct sccp_connection_release_complete *) msgb->l2h; - result->source_local_reference = &cmpl->source_local_reference; - result->destination_local_reference = &cmpl->destination_local_reference; - - return 0; -} - -int _sccp_parse_connection_dt1(struct msgb *msgb, struct sccp_parse_result *result) -{ - static size_t header_size = sizeof(struct sccp_data_form1); - static size_t variable_offset = offsetof(struct sccp_data_form1, variable_start); - - struct sccp_data_form1 *dt1 = (struct sccp_data_form1 *)msgb->l2h; - - /* we don't have enough size for the struct */ - if (msgb_l2len(msgb) < header_size) { - LOGP(DSCCP, LOGL_ERROR, "msgb > header_size %u %zu\n", - msgb_l2len(msgb), header_size); - return -1; - } - - if (dt1->segmenting != 0) { - LOGP(DSCCP, LOGL_ERROR, "This packet has segmenting, not supported: %d\n", dt1->segmenting); - return -1; - } - - result->destination_local_reference = &dt1->destination_local_reference; - - /* some more size checks in here */ - if (msgb_l2len(msgb) < variable_offset + dt1->variable_start + 1) { - LOGP(DSCCP, LOGL_ERROR, "Not enough space for variable start: %u %u\n", - msgb_l2len(msgb), dt1->variable_start); - return -1; - } - - result->data_len = msgb->l2h[variable_offset + dt1->variable_start]; - msgb->l3h = &msgb->l2h[dt1->variable_start + variable_offset + 1]; - - if (msgb_l3len(msgb) < result->data_len) { - LOGP(DSCCP, LOGL_ERROR, "Not enough room for the payload: %u %u\n", - msgb_l3len(msgb), result->data_len); - return -1; - } - - return 0; -} - -struct udt_offsets { - uint32_t header_size; - uint32_t called_offset; - uint32_t calling_offset; - uint32_t data_offset; -}; - -static int _sccp_parse_unitdata(struct msgb *msgb, struct sccp_parse_result *result, - const struct udt_offsets *offs) -{ - uint8_t variable_called; - uint8_t variable_calling; - uint8_t variable_data; - - if (msgb_l2len(msgb) < offs->header_size) { - LOGP(DSCCP, LOGL_ERROR, "msgb < header_size %u %u\n", - msgb_l2len(msgb), offs->header_size); - return -1; - } - - variable_called = msgb->l2h[offs->called_offset]; - variable_calling = msgb->l2h[offs->calling_offset]; - variable_data = msgb->l2h[offs->data_offset]; - - /* copy out the calling and called address. Add the off */ - if (copy_address(&result->called, offs->called_offset + variable_called, msgb) != 0) - return -1; - - if (copy_address(&result->calling, offs->calling_offset + variable_calling, msgb) != 0) - return -1; - - /* we don't have enough size for the data */ - if (msgb_l2len(msgb) < offs->data_offset + variable_data + 1) { - LOGP(DSCCP, LOGL_ERROR, "msgb < header + offset %u %u %u\n", - msgb_l2len(msgb), offs->header_size, variable_data); - return -1; - } - - - msgb->l3h = &msgb->l2h[offs->data_offset + variable_data + 1]; - result->data_len = msgb_l3len(msgb); - - if (msgb_l3len(msgb) < msgb->l3h[-1]) { - LOGP(DSCCP, LOGL_ERROR, "msgb is truncated is: %u should: %u\n", - msgb_l3len(msgb), msgb->l3h[-1]); - return -1; - } - - return 0; -} - -int _sccp_parse_udt(struct msgb *msgb, struct sccp_parse_result *result) -{ - static const struct udt_offsets offsets = { - .header_size = sizeof(struct sccp_data_unitdata), - .called_offset = offsetof(struct sccp_data_unitdata, variable_called), - .calling_offset = offsetof(struct sccp_data_unitdata, variable_calling), - .data_offset = offsetof(struct sccp_data_unitdata, variable_data), - }; - - return _sccp_parse_unitdata(msgb, result, &offsets); -} - -int _sccp_parse_udts(struct msgb *msgb, struct sccp_parse_result *result) -{ - static const struct udt_offsets offsets = { - .header_size = sizeof(struct sccp_data_unitdata_service), - .called_offset = offsetof(struct sccp_data_unitdata_service, variable_called), - .calling_offset = offsetof(struct sccp_data_unitdata_service, variable_calling), - .data_offset = offsetof(struct sccp_data_unitdata_service, variable_data), - }; - - return _sccp_parse_unitdata(msgb, result, &offsets); -} - -static int _sccp_parse_xudt(struct msgb *msgb, struct sccp_parse_result *result) -{ - static const struct udt_offsets offsets = { - .header_size = sizeof(struct sccp_data_ext_unitdata), - .called_offset = offsetof(struct sccp_data_ext_unitdata, variable_called), - .calling_offset = offsetof(struct sccp_data_ext_unitdata, variable_calling), - .data_offset = offsetof(struct sccp_data_ext_unitdata, variable_data), - }; - - return _sccp_parse_unitdata(msgb, result, &offsets); -} - -static int _sccp_parse_xudts(struct msgb *msgb, struct sccp_parse_result *result) -{ - static const struct udt_offsets offsets = { - .header_size = sizeof(struct sccp_data_ext_unitdata_service), - .called_offset = offsetof(struct sccp_data_ext_unitdata_service, variable_called), - .calling_offset = offsetof(struct sccp_data_ext_unitdata_service, variable_calling), - .data_offset = offsetof(struct sccp_data_ext_unitdata_service, variable_data), - }; - - return _sccp_parse_unitdata(msgb, result, &offsets); -} - -static int _sccp_parse_it(struct msgb *msgb, struct sccp_parse_result *result) -{ - static const uint32_t header_size = sizeof(struct sccp_data_it); - - struct sccp_data_it *it; - - if (msgb_l2len(msgb) < header_size) { - LOGP(DSCCP, LOGL_ERROR, "msgb < header_size %u %u\n", - msgb_l2len(msgb), header_size); - return -1; - } - - it = (struct sccp_data_it *) msgb->l2h; - result->data_len = 0; - result->source_local_reference = &it->source_local_reference; - result->destination_local_reference = &it->destination_local_reference; - return 0; -} - -static int _sccp_parse_err(struct msgb *msgb, struct sccp_parse_result *result) -{ - static const uint32_t header_size = sizeof(struct sccp_proto_err); - - struct sccp_proto_err *err; - - if (msgb_l2len(msgb) < header_size) { - LOGP(DSCCP, LOGL_ERROR, "msgb < header_size %u %u\n", - msgb_l2len(msgb), header_size); - return -1; - } - - err = (struct sccp_proto_err *) msgb->l2h; - result->data_len = 0; - result->destination_local_reference = &err->destination_local_reference; - return 0; -} - -int sccp_create_sccp_addr(struct msgb *msg, const struct sockaddr_sccp *sock) -{ - uint8_t *len, *ai, *gti; - - len = msgb_put(msg, 1); - ai = msgb_put(msg, 1); - - - if (sock->gti) - ai[0] = 0 << 6 | (sock->gti_ind & 0x0f) << 2 | 1 << 1; - else - ai[0] = 1 << 6 | 1 << 1; - - /* store a point code */ - if (sock->use_poi) { - uint8_t *poi; - - ai[0] |= 0x01; - poi = msgb_put(msg, 2); - poi[0] = sock->poi[0]; - poi[1] = sock->poi[1]; - } - - /* copy the SSN */ - msgb_v_put(msg, sock->sccp_ssn); - - /* copy the gti if it is present */ - if (sock->gti) { - gti = msgb_put(msg, sock->gti_len); - memcpy(gti, sock->gti, sock->gti_len); - } - - /* update the length now */ - len[0] = msg->tail - len - 1; - return len[0] + 1; -} - -/* - * Send UDT. Currently we have a fixed address... - */ -struct msgb *sccp_create_udt(int class, const struct sockaddr_sccp *in, - const struct sockaddr_sccp *out, uint8_t *in_data, int len) -{ - struct sccp_data_unitdata *udt; - uint8_t *data; - int out_len, inp_len; - - if (len > 256) { - LOGP(DSCCP, LOGL_ERROR, "The payload is too big for one udt\n"); - return NULL; - } - - struct msgb *msg = msgb_alloc_headroom(SCCP_MSG_SIZE, - SCCP_MSG_HEADROOM, "sccp: udt"); - if (!msg) - return NULL; - - msg->l2h = &msg->data[0]; - udt = (struct sccp_data_unitdata *)msgb_put(msg, sizeof(*udt)); - - udt->type = SCCP_MSG_TYPE_UDT; - udt->proto_class = class; - - /* for variable data we start with a size and the data */ - out_len = sccp_create_sccp_addr(msg, out); - inp_len = sccp_create_sccp_addr(msg, in); - - /* update the offsets now */ - udt->variable_called = 3; - udt->variable_calling = 2 + out_len; - udt->variable_data = 1 + out_len + inp_len; - - /* copy the payload */ - data = msgb_put(msg, 1 + len); - data[0] = len; - memcpy(&data[1], in_data, len); - - return msg; -} - -static int _sccp_send_data(int class, const struct sockaddr_sccp *in, - const struct sockaddr_sccp *out, - struct msgb *payload, void *ctx) -{ - struct msgb *msg; - - msg = sccp_create_udt(class, in, out, payload->l3h, msgb_l3len(payload)); - if (!msg) - return -1; - - _send_msg(NULL, msg, ctx); - return 0; -} - -static int _sccp_handle_read(struct msgb *msgb) -{ - struct sccp_data_callback *cb; - struct sccp_parse_result result; - - if (_sccp_parse_udt(msgb, &result) != 0) - return -1; - - cb = _find_ssn(result.called.ssn); - if (!cb || !cb->read_cb) { - LOGP(DSCCP, LOGL_ERROR, "No routing for UDT for called SSN: %u\n", result.called.ssn); - return -1; - } - - /* sanity check */ - return cb->read_cb(msgb, msgb_l3len(msgb), cb->read_context); -} - -/* - * handle connection orientated methods - */ -static int source_local_reference_is_free(struct sccp_source_reference *reference) -{ - struct sccp_connection *connection; - - llist_for_each_entry(connection, &sccp_connections, list) { - if (memcmp(reference, &connection->source_local_reference, sizeof(*reference)) == 0) - return -1; - } - - return 0; -} - -static int destination_local_reference_is_free(struct sccp_source_reference *reference) -{ - struct sccp_connection *connection; - - llist_for_each_entry(connection, &sccp_connections, list) { - if (memcmp(reference, &connection->destination_local_reference, sizeof(*reference)) == 0) - return -1; - } - - return 0; -} - -static int assign_source_local_reference(struct sccp_connection *connection) -{ - static uint32_t last_ref = 0x30000; - int wrapped = 0; - - do { - struct sccp_source_reference reference; - reference.octet1 = (last_ref >> 0) & 0xff; - reference.octet2 = (last_ref >> 8) & 0xff; - reference.octet3 = (last_ref >> 16) & 0xff; - - ++last_ref; - /* do not use the reversed word and wrap around */ - if ((last_ref & 0x00FFFFFF) == 0x00FFFFFF) { - LOGP(DSCCP, LOGL_DEBUG, "Wrapped searching for a free code\n"); - last_ref = 0; - ++wrapped; - } - - if (source_local_reference_is_free(&reference) == 0) { - connection->source_local_reference = reference; - return 0; - } - } while (wrapped != 2); - - LOGP(DSCCP, LOGL_ERROR, "Finding a free reference failed\n"); - return -1; -} - -static void _sccp_set_connection_state(struct sccp_connection *connection, int new_state) -{ - int old_state = connection->connection_state; - - connection->connection_state = new_state; - if (connection->state_cb) - connection->state_cb(connection, old_state); -} - -struct msgb *sccp_create_refuse(struct sccp_source_reference *src_ref, int cause, uint8_t *inp, int length) -{ - struct msgb *msgb; - struct sccp_connection_refused *ref; - uint8_t *data; - - msgb = msgb_alloc_headroom(SCCP_MSG_SIZE, - SCCP_MSG_HEADROOM, "sccp ref"); - if (!msgb) { - LOGP(DSCCP, LOGL_ERROR, "Failed to allocate refusal msg.\n"); - return NULL; - } - - msgb->l2h = &msgb->data[0]; - - ref = (struct sccp_connection_refused *) msgb_put(msgb, sizeof(*ref)); - ref->type = SCCP_MSG_TYPE_CREF; - memcpy(&ref->destination_local_reference, src_ref, - sizeof(struct sccp_source_reference)); - ref->cause = cause; - ref->optional_start = 1; - - if (inp) { - data = msgb_put(msgb, 1 + 1 + length); - data[0] = SCCP_PNC_DATA; - data[1] = length; - memcpy(&data[2], inp, length); - } - - data = msgb_put(msgb, 1); - data[0] = SCCP_PNC_END_OF_OPTIONAL; - return msgb; -} - -static int _sccp_send_refuse(struct sccp_source_reference *src_ref, int cause, void *ctx) -{ - struct msgb *msgb = sccp_create_refuse(src_ref, cause, NULL, 0); - if (!msgb) - return -1; - - _send_msg(NULL, msgb, ctx); - return 0; -} - -struct msgb *sccp_create_cc(struct sccp_source_reference *src_ref, - struct sccp_source_reference *dst_ref) -{ - struct msgb *response; - struct sccp_connection_confirm *confirm; - uint8_t *optional_data; - - response = msgb_alloc_headroom(SCCP_MSG_SIZE, - SCCP_MSG_HEADROOM, "sccp confirm"); - if (!response) { - LOGP(DSCCP, LOGL_ERROR, "Failed to create SCCP Confirm.\n"); - return NULL; - } - - response->l2h = &response->data[0]; - - confirm = (struct sccp_connection_confirm *) msgb_put(response, sizeof(*confirm)); - - confirm->type = SCCP_MSG_TYPE_CC; - memcpy(&confirm->destination_local_reference, - dst_ref, sizeof(*dst_ref)); - memcpy(&confirm->source_local_reference, - src_ref, sizeof(*src_ref)); - confirm->proto_class = 2; - confirm->optional_start = 1; - - optional_data = (uint8_t *) msgb_put(response, 1); - optional_data[0] = SCCP_PNC_END_OF_OPTIONAL; - return response; -} - -static int _sccp_send_connection_confirm(struct sccp_connection *connection) -{ - struct msgb *response; - - if (assign_source_local_reference(connection) != 0) - return -1; - - response = sccp_create_cc(&connection->source_local_reference, - &connection->destination_local_reference); - if (!response) - return -1; - - _send_msg(connection, response, NULL); - _sccp_set_connection_state(connection, SCCP_CONNECTION_STATE_ESTABLISHED); - return 0; -} - -struct msgb *sccp_create_cr(const struct sccp_source_reference *src_ref, - const struct sockaddr_sccp *called, - const uint8_t *l3_data, size_t l3_length) -{ - struct msgb *request; - struct sccp_connection_request *req; - uint8_t *data; - int called_len; - - if (l3_data) { - if (l3_length < 3 || l3_length > SCCP_MAX_OPTIONAL_DATA) { - LOGP(DSCCP, LOGL_ERROR, "Invalid amount of data... %zu\n", l3_length); - return NULL; - } - } - - request = msgb_alloc_headroom(SCCP_MSG_SIZE, - SCCP_MSG_HEADROOM, "sccp connection request"); - request->l2h = &request->data[0]; - req = (struct sccp_connection_request *) msgb_put(request, sizeof(*req)); - - req->type = SCCP_MSG_TYPE_CR; - memcpy(&req->source_local_reference, src_ref, sizeof(*src_ref)); - req->proto_class = 2; - - /* write the called party address */ - called_len = sccp_create_sccp_addr(request, called); - - /* update the offsets */ - req->variable_called = 2; - req->optional_start = 1 + called_len; - - /* write the payload */ - if (l3_data) { - data = msgb_put(request, 2 + l3_length); - data[0] = SCCP_PNC_DATA; - data[1] = l3_length; - memcpy(&data[2], l3_data, l3_length); - } - - data = msgb_put(request, 1); - data[0] = SCCP_PNC_END_OF_OPTIONAL; - - return request; -} - -static int _sccp_send_connection_request(struct sccp_connection *connection, - const struct sockaddr_sccp *called, struct msgb *msg) -{ - struct msgb *request; - - /* try to find an id */ - if (assign_source_local_reference(connection) != 0) { - LOGP(DSCCP, LOGL_ERROR, "Assigning a local reference failed.\n"); - _sccp_set_connection_state(connection, SCCP_CONNECTION_STATE_SETUP_ERROR); - return -1; - } - - request = sccp_create_cr(&connection->source_local_reference, called, - msg ? msg->l3h : NULL, - msg ? msgb_l3len(msg) : 0); - if (!request) { - _sccp_set_connection_state(connection, SCCP_CONNECTION_STATE_SETUP_ERROR); - return -1; - } - - llist_add_tail(&connection->list, &sccp_connections); - _sccp_set_connection_state(connection, SCCP_CONNECTION_STATE_REQUEST); - - _send_msg(connection, request, NULL); - return 0; -} - -struct msgb *sccp_create_dt1(struct sccp_source_reference *dst_ref, uint8_t *inp_data, uint8_t len) -{ - struct msgb *msgb; - struct sccp_data_form1 *dt1; - uint8_t *data; - - msgb = msgb_alloc_headroom(SCCP_MSG_SIZE, - SCCP_MSG_HEADROOM, "sccp dt1"); - if (!msgb) { - LOGP(DSCCP, LOGL_ERROR, "Failed to create DT1 msg.\n"); - return NULL; - } - - msgb->l2h = &msgb->data[0]; - - dt1 = (struct sccp_data_form1 *) msgb_put(msgb, sizeof(*dt1)); - dt1->type = SCCP_MSG_TYPE_DT1; - memcpy(&dt1->destination_local_reference, dst_ref, - sizeof(struct sccp_source_reference)); - dt1->segmenting = 0; - - /* copy the data */ - dt1->variable_start = 1; - data = msgb_put(msgb, 1 + len); - data[0] = len; - memcpy(&data[1], inp_data, len); - - return msgb; -} - -static int _sccp_send_connection_data(struct sccp_connection *conn, struct msgb *_data) -{ - struct msgb *msgb; - - if (msgb_l3len(_data) < 2 || msgb_l3len(_data) > 256) { - LOGP(DSCCP, LOGL_ERROR, "data size too big, segmenting unimplemented.\n"); - return -1; - } - - msgb = sccp_create_dt1(&conn->destination_local_reference, - _data->l3h, msgb_l3len(_data)); - if (!msgb) - return -1; - - _send_msg(conn, msgb, NULL); - return 0; -} - -static int _sccp_send_connection_it(struct sccp_connection *conn) -{ - struct msgb *msgb; - struct sccp_data_it *it; - - msgb = msgb_alloc_headroom(SCCP_MSG_SIZE, - SCCP_MSG_HEADROOM, "sccp it"); - msgb->l2h = &msgb->data[0]; - it = (struct sccp_data_it *) msgb_put(msgb, sizeof(*it)); - it->type = SCCP_MSG_TYPE_IT; - memcpy(&it->destination_local_reference, &conn->destination_local_reference, - sizeof(struct sccp_source_reference)); - memcpy(&it->source_local_reference, &conn->source_local_reference, - sizeof(struct sccp_source_reference)); - - it->proto_class = 0x2; - it->sequencing[0] = it->sequencing[1] = 0; - it->credit = 0; - - _send_msg(conn, msgb, NULL); - return 0; -} - -struct msgb *sccp_create_rlsd(struct sccp_source_reference *src_ref, - struct sccp_source_reference *dst_ref, int cause) -{ - struct msgb *msg; - struct sccp_connection_released *rel; - uint8_t *data; - - msg = msgb_alloc_headroom(SCCP_MSG_SIZE, SCCP_MSG_HEADROOM, - "sccp: connection released"); - if (!msg) { - LOGP(DSCCP, LOGL_ERROR, "Failed to allocate RLSD.\n"); - return NULL; - } - - msg->l2h = &msg->data[0]; - rel = (struct sccp_connection_released *) msgb_put(msg, sizeof(*rel)); - rel->type = SCCP_MSG_TYPE_RLSD; - rel->release_cause = cause; - - /* copy the source references */ - memcpy(&rel->destination_local_reference, dst_ref, - sizeof(struct sccp_source_reference)); - memcpy(&rel->source_local_reference, src_ref, - sizeof(struct sccp_source_reference)); - - data = msgb_put(msg, 1); - data[0] = SCCP_PNC_END_OF_OPTIONAL; - return msg; -} - -static int _sccp_send_connection_released(struct sccp_connection *conn, int cause) -{ - struct msgb *msg; - - msg = sccp_create_rlsd(&conn->source_local_reference, - &conn->destination_local_reference, - cause); - if (!msg) - return -1; - - _sccp_set_connection_state(conn, SCCP_CONNECTION_STATE_RELEASE); - _send_msg(conn, msg, NULL); - return 0; -} - -/* - * Open a connection. The following is going to happen: - * - * - Verify the packet, e.g. that we have no other connection - * that id. - * - Ask the user if he wants to accept the connection - * - Try to open the connection by assigning a source local reference - * and sending the packet - */ -static int _sccp_handle_connection_request(struct msgb *msgb, void *ctx) -{ - struct sccp_parse_result result; - - struct sccp_data_callback *cb; - struct sccp_connection *connection; - - if (_sccp_parse_connection_request(msgb, &result) != 0) - return -1; - - cb = _find_ssn(result.called.ssn); - if (!cb || !cb->accept_cb) { - LOGP(DSCCP, LOGL_ERROR, "No routing for CR for called SSN: %u\n", result.called.ssn); - return -1; - } - - /* check if the system wants this connection */ - connection = talloc_zero(tall_sccp_ctx, struct sccp_connection); - if (!connection) { - LOGP(DSCCP, LOGL_ERROR, "Allocation failed\n"); - return -1; - } - - /* - * sanity checks: - * - Is the source_local_reference in any other connection? - * then will call accept, assign a "destination" local reference - * and send a connection confirm, otherwise we will send a refuseed - * one.... - */ - if (destination_local_reference_is_free(result.source_local_reference) != 0) { - LOGP(DSCCP, LOGL_ERROR, "Need to reject connection with existing reference\n"); - _sccp_send_refuse(result.source_local_reference, SCCP_REFUSAL_SCCP_FAILURE, ctx); - talloc_free(connection); - return -1; - } - - connection->incoming = 1; - connection->destination_local_reference = *result.source_local_reference; - - if (cb->accept_cb(connection, cb->accept_context) != 0) { - _sccp_send_refuse(result.source_local_reference, SCCP_REFUSAL_END_USER_ORIGINATED, ctx); - _sccp_set_connection_state(connection, SCCP_CONNECTION_STATE_REFUSED); - talloc_free(connection); - return 0; - } - - - llist_add_tail(&connection->list, &sccp_connections); - - if (_sccp_send_connection_confirm(connection) != 0) { - LOGP(DSCCP, LOGL_ERROR, "Sending confirm failed... no available source reference?\n"); - - _sccp_send_refuse(result.source_local_reference, SCCP_REFUSAL_SCCP_FAILURE, ctx); - _sccp_set_connection_state(connection, SCCP_CONNECTION_STATE_REFUSED); - llist_del(&connection->list); - talloc_free(connection); - - return -1; - } - - /* - * If we have data let us forward things. - */ - if (result.data_len != 0 && connection->data_cb) { - connection->data_cb(connection, msgb, result.data_len); - } - - return 0; -} - -/* Handle the release confirmed */ -static int _sccp_handle_connection_release_complete(struct msgb *msgb) -{ - struct sccp_parse_result result = {}; - struct sccp_connection *conn; - - if (_sccp_parse_connection_release_complete(msgb, &result) != 0) - return -1; - - /* find the connection */ - llist_for_each_entry(conn, &sccp_connections, list) { - if (conn->data_cb - && memcmp(&conn->source_local_reference, - result.destination_local_reference, - sizeof(conn->source_local_reference)) == 0 - && memcmp(&conn->destination_local_reference, - result.source_local_reference, - sizeof(conn->destination_local_reference)) == 0) { - goto found; - } - } - - - LOGP(DSCCP, LOGL_ERROR, "Release complete of unknown connection\n"); - return -1; - -found: - llist_del(&conn->list); - _sccp_set_connection_state(conn, SCCP_CONNECTION_STATE_RELEASE_COMPLETE); - return 0; -} - -/* Handle the Data Form 1 message */ -static int _sccp_handle_connection_dt1(struct msgb *msgb) -{ - struct sccp_parse_result result; - struct sccp_connection *conn; - - if (_sccp_parse_connection_dt1(msgb, &result) != 0) - return -1; - - /* lookup if we have a connection with the given reference */ - llist_for_each_entry(conn, &sccp_connections, list) { - if (conn->data_cb - && memcmp(&conn->source_local_reference, - result.destination_local_reference, - sizeof(conn->source_local_reference)) == 0) { - goto found; - } - } - - LOGP(DSCCP, LOGL_ERROR, "No connection found for dt1 data\n"); - return -1; - -found: - conn->data_cb(conn, msgb, result.data_len); - return 0; -} - -/* confirm a connection release */ -static int _sccp_send_connection_release_complete(struct sccp_connection *connection) -{ - struct msgb *msgb; - struct sccp_connection_release_complete *rlc; - - msgb = msgb_alloc_headroom(SCCP_MSG_SIZE, - SCCP_MSG_HEADROOM, "sccp rlc"); - msgb->l2h = &msgb->data[0]; - - rlc = (struct sccp_connection_release_complete *) msgb_put(msgb, sizeof(*rlc)); - rlc->type = SCCP_MSG_TYPE_RLC; - memcpy(&rlc->destination_local_reference, - &connection->destination_local_reference, sizeof(struct sccp_source_reference)); - memcpy(&rlc->source_local_reference, - &connection->source_local_reference, sizeof(struct sccp_source_reference)); - - _send_msg(connection, msgb, NULL); - - /* - * Remove from the list of active connections and set the state. User code - * should now free the entry. - */ - llist_del(&connection->list); - _sccp_set_connection_state(connection, SCCP_CONNECTION_STATE_RELEASE_COMPLETE); - return 0; -} - -/* connection released, send a released confirm */ -static int _sccp_handle_connection_released(struct msgb *msgb) -{ - struct sccp_parse_result result; - struct sccp_connection *conn; - - if (_sccp_parse_connection_released(msgb, &result) == -1) - return -1; - - /* lookup if we have a connection with the given reference */ - llist_for_each_entry(conn, &sccp_connections, list) { - if (conn->data_cb - && memcmp(&conn->source_local_reference, - result.destination_local_reference, - sizeof(conn->source_local_reference)) == 0 - && memcmp(&conn->destination_local_reference, - result.source_local_reference, - sizeof(conn->destination_local_reference)) == 0) { - goto found; - } - } - - - LOGP(DSCCP, LOGL_ERROR, "Unknown connection was released.\n"); - return -1; - - /* we have found a connection */ -found: - /* optional data */ - if (result.data_len != 0 && conn->data_cb) { - conn->data_cb(conn, msgb, result.data_len); - } - - /* generate a response */ - if (_sccp_send_connection_release_complete(conn) != 0) { - LOGP(DSCCP, LOGL_ERROR, "Sending release confirmed failed\n"); - return -1; - } - - return 0; -} - -static int _sccp_handle_connection_refused(struct msgb *msgb) -{ - struct sccp_parse_result result; - struct sccp_connection *conn; - - if (_sccp_parse_connection_refused(msgb, &result) != 0) - return -1; - - /* lookup if we have a connection with the given reference */ - llist_for_each_entry(conn, &sccp_connections, list) { - if (conn->incoming == 0 && conn->data_cb - && memcmp(&conn->source_local_reference, - result.destination_local_reference, - sizeof(conn->source_local_reference)) == 0) { - goto found; - } - } - - LOGP(DSCCP, LOGL_ERROR, "Refused but no connection found\n"); - return -1; - -found: - /* optional data */ - if (result.data_len != 0 && conn->data_cb) { - conn->data_cb(conn, msgb, result.data_len); - } - - - llist_del(&conn->list); - _sccp_set_connection_state(conn, SCCP_CONNECTION_STATE_REFUSED); - return 0; -} - -static int _sccp_handle_connection_confirm(struct msgb *msgb) -{ - struct sccp_parse_result result; - struct sccp_connection *conn; - - if (_sccp_parse_connection_confirm(msgb, &result) != 0) - return -1; - - /* lookup if we have a connection with the given reference */ - llist_for_each_entry(conn, &sccp_connections, list) { - if (conn->incoming == 0 && conn->data_cb - && memcmp(&conn->source_local_reference, - result.destination_local_reference, - sizeof(conn->source_local_reference)) == 0) { - goto found; - } - } - - LOGP(DSCCP, LOGL_ERROR, "Confirmed but no connection found\n"); - return -1; - -found: - /* copy the addresses of the connection */ - conn->destination_local_reference = *result.source_local_reference; - _sccp_set_connection_state(conn, SCCP_CONNECTION_STATE_ESTABLISHED); - - /* optional data */ - if (result.data_len != 0 && conn->data_cb) { - conn->data_cb(conn, msgb, result.data_len); - } - - return 0; -} - - -int sccp_system_init(void (*outgoing)(struct sccp_connection *conn, struct msgb *data, void *, void *), void *ctx) -{ - sccp_system.write_data = outgoing; - sccp_system.write_context = ctx; - - return 0; -} - -/* oh my god a real SCCP packet. need to dispatch it now */ -int sccp_system_incoming(struct msgb *msgb) -{ - return sccp_system_incoming_ctx(msgb, NULL); -} - -int sccp_system_incoming_ctx(struct msgb *msgb, void *ctx) -{ - if (msgb_l2len(msgb) < 1 ) { - LOGP(DSCCP, LOGL_ERROR, "Too short packet\n"); - return -1; - } - - int type = msgb->l2h[0]; - - switch(type) { - case SCCP_MSG_TYPE_CR: - return _sccp_handle_connection_request(msgb, ctx); - break; - case SCCP_MSG_TYPE_RLSD: - return _sccp_handle_connection_released(msgb); - break; - case SCCP_MSG_TYPE_CREF: - return _sccp_handle_connection_refused(msgb); - break; - case SCCP_MSG_TYPE_CC: - return _sccp_handle_connection_confirm(msgb); - break; - case SCCP_MSG_TYPE_RLC: - return _sccp_handle_connection_release_complete(msgb); - break; - case SCCP_MSG_TYPE_DT1: - return _sccp_handle_connection_dt1(msgb); - break; - case SCCP_MSG_TYPE_UDT: - return _sccp_handle_read(msgb); - break; - default: - LOGP(DSCCP, LOGL_ERROR, "unimplemented msg type: %d\n", type); - }; - - return -1; -} - -/* create a packet from the data */ -int sccp_connection_write(struct sccp_connection *connection, struct msgb *data) -{ - if (connection->connection_state < SCCP_CONNECTION_STATE_CONFIRM - || connection->connection_state > SCCP_CONNECTION_STATE_ESTABLISHED) { - LOGP(DSCCP, LOGL_ERROR, "sccp_connection_write: Wrong connection state: %p %d\n", - connection, connection->connection_state); - return -1; - } - - return _sccp_send_connection_data(connection, data); -} - -/* - * Send a Inactivity Test message. The owner of the connection - * should start a timer and call this method regularily. Calling - * this every 60 seconds should be good enough. - */ -int sccp_connection_send_it(struct sccp_connection *connection) -{ - if (connection->connection_state < SCCP_CONNECTION_STATE_CONFIRM - || connection->connection_state > SCCP_CONNECTION_STATE_ESTABLISHED) { - LOGP(DSCCP, LOGL_ERROR, "sccp_connection_write: Wrong connection state: %p %d\n", - connection, connection->connection_state); - return -1; - } - - return _sccp_send_connection_it(connection); -} - -/* send a connection release and wait for the connection released */ -int sccp_connection_close(struct sccp_connection *connection, int cause) -{ - if (connection->connection_state < SCCP_CONNECTION_STATE_CONFIRM - || connection->connection_state > SCCP_CONNECTION_STATE_ESTABLISHED) { - LOGP(DSCCP, LOGL_ERROR, "Can not close the connection. It was never opened: %p %d\n", - connection, connection->connection_state); - return -1; - } - - return _sccp_send_connection_released(connection, cause); -} - -int sccp_connection_free(struct sccp_connection *connection) -{ - if (connection->connection_state > SCCP_CONNECTION_STATE_NONE - && connection->connection_state < SCCP_CONNECTION_STATE_RELEASE_COMPLETE) { - LOGP(DSCCP, LOGL_ERROR, "The connection needs to be released before it is freed"); - return -1; - } - - talloc_free(connection); - return 0; -} - -int sccp_connection_force_free(struct sccp_connection *con) -{ - if (con->connection_state > SCCP_CONNECTION_STATE_NONE && - con->connection_state < SCCP_CONNECTION_STATE_RELEASE_COMPLETE) - llist_del(&con->list); - - con->connection_state = SCCP_CONNECTION_STATE_REFUSED; - sccp_connection_free(con); - return 0; -} - -struct sccp_connection *sccp_connection_socket(void) -{ - return talloc_zero(tall_sccp_ctx, struct sccp_connection); -} - -int sccp_connection_connect(struct sccp_connection *conn, - const struct sockaddr_sccp *local, - struct msgb *data) -{ - return _sccp_send_connection_request(conn, local, data); -} - -int sccp_connection_set_incoming(const struct sockaddr_sccp *sock, - int (*accept_cb)(struct sccp_connection *, void *), void *context) -{ - struct sccp_data_callback *cb; - - if (!sock) - return -2; - - cb = _find_ssn(sock->sccp_ssn); - if (!cb) - return -1; - - cb->accept_cb = accept_cb; - cb->accept_context = context; - return 0; -} - -int sccp_write(struct msgb *data, const struct sockaddr_sccp *in, - const struct sockaddr_sccp *out, int class, void *ctx) -{ - return _sccp_send_data(class, in, out, data, ctx); -} - -int sccp_set_read(const struct sockaddr_sccp *sock, - int (*read_cb)(struct msgb *, unsigned int, void *), void *context) -{ - struct sccp_data_callback *cb; - - if (!sock) - return -2; - - cb = _find_ssn(sock->sccp_ssn); - if (!cb) - return -1; - - cb->read_cb = read_cb; - cb->read_context = context; - return 0; -} - -osmo_static_assert(sizeof(struct sccp_source_reference) <= sizeof(uint32_t), enough_space); - -uint32_t sccp_src_ref_to_int(struct sccp_source_reference *ref) -{ - uint32_t src_ref = 0; -#if OSMO_IS_LITTLE_ENDIAN - memcpy(&src_ref, ref, sizeof(*ref)); -#elif OSMO_IS_BIG_ENDIAN - *(((uint8_t*)(&src_ref))+3) = ref->octet1; - *(((uint8_t*)(&src_ref))+2) = ref->octet2; - *(((uint8_t*)(&src_ref))+1) = ref->octet3; -#endif - return src_ref; -} - -struct sccp_source_reference sccp_src_ref_from_int(uint32_t int_ref) -{ - struct sccp_source_reference ref; -#if OSMO_IS_LITTLE_ENDIAN - memcpy(&ref, &int_ref, sizeof(ref)); -#elif OSMO_IS_BIG_ENDIAN - ref.octet1 = *(((uint8_t*)(&int_ref))+3); - ref.octet2 = *(((uint8_t*)(&int_ref))+2); - ref.octet3 = *(((uint8_t*)(&int_ref))+1); -#endif - return ref; -} - -int sccp_determine_msg_type(struct msgb *msg) -{ - if (msgb_l2len(msg) < 1) - return -1; - - return msg->l2h[0]; -} - -int sccp_parse_header(struct msgb *msg, struct sccp_parse_result *result) -{ - int type; - - if (msgb_l2len(msg) < 1) - return -1; - - type = msg->l2h[0]; - switch(type) { - case SCCP_MSG_TYPE_CR: - return _sccp_parse_connection_request(msg, result); - break; - case SCCP_MSG_TYPE_RLSD: - return _sccp_parse_connection_released(msg, result); - break; - case SCCP_MSG_TYPE_CREF: - return _sccp_parse_connection_refused(msg, result); - break; - case SCCP_MSG_TYPE_CC: - return _sccp_parse_connection_confirm(msg, result); - break; - case SCCP_MSG_TYPE_RLC: - return _sccp_parse_connection_release_complete(msg, result); - break; - case SCCP_MSG_TYPE_DT1: - return _sccp_parse_connection_dt1(msg, result); - break; - case SCCP_MSG_TYPE_UDT: - return _sccp_parse_udt(msg, result); - break; - case SCCP_MSG_TYPE_UDTS: - return _sccp_parse_udts(msg, result); - break; - case SCCP_MSG_TYPE_XUDT: - return _sccp_parse_xudt(msg, result); - break; - case SCCP_MSG_TYPE_XUDTS: - return _sccp_parse_xudts(msg, result); - break; - case SCCP_MSG_TYPE_IT: - return _sccp_parse_it(msg, result); - break; - case SCCP_MSG_TYPE_ERR: - return _sccp_parse_err(msg, result); - break; - }; - - LOGP(DSCCP, LOGL_ERROR, "Unimplemented MSG Type: 0x%x\n", type); - return -1; -} - -static __attribute__((constructor)) void on_dso_load(void) -{ - tall_sccp_ctx = talloc_named_const(NULL, 1, "sccp"); -} - -static __attribute__((destructor)) void on_dso_unload(void) -{ - talloc_report_full(tall_sccp_ctx, stderr); -} - -void sccp_set_log_area(int log_area) -{ - DSCCP = log_area; -} diff --git a/tests/Makefile.am b/tests/Makefile.am index 34bba67..6a150e1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = xua sccp mtp m2ua ss7 vty +SUBDIRS = xua m2ua ss7 vty # The `:;' works around a Bash 3.2 bug when the output is not writeable. $(srcdir)/package.m4: $(top_srcdir)/configure.ac diff --git a/tests/mtp/Makefile.am b/tests/mtp/Makefile.am deleted file mode 100644 index a3f22f1..0000000 --- a/tests/mtp/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) -AM_LDFLAGS = -no-install - -check_PROGRAMS = mtp_parse_test - -EXTRA_DIST = mtp_parse_test.ok - -mtp_parse_test_SOURCES = mtp_parse_test.c diff --git a/tests/mtp/mtp_parse_test.c b/tests/mtp/mtp_parse_test.c deleted file mode 100644 index 92c34ca..0000000 --- a/tests/mtp/mtp_parse_test.c +++ /dev/null @@ -1,643 +0,0 @@ -/* MTP Layer3 parsing tests */ -#include <osmocom/mtp/mtp_level3.h> - -#include <arpa/inet.h> - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) - -struct mtp_test { - const uint8_t *input; - const uint16_t length; - struct mtp_level_3_hdr hdr; - - int has_mng; - struct mtp_level_3_mng mng; - - int has_prohib; - struct mtp_level_3_prohib prohib; -}; - -static const unsigned char pkt1[] = { -0x81, 0x88, 0xc0, 0x16, 0x00, 0x11, 0xe0, 0x62, -0x61, 0x72, 0x62, 0x61, 0x6e, 0x6f, 0x62, 0x61, -0x72, 0x6e, 0x61, 0x62, 0x6f }; - -static const unsigned char pkt3[] = { -0x81, 0x88, 0xc0, 0x16, 0x00, 0x21, 0xe0, 0x41, -0x6d, 0x69, 0x74, 0x20, 0x43, 0x68, 0x61, 0x6e, -0x64, 0x72, 0x61, 0x00, 0x00 }; - -static const unsigned char pkt7[] = { -0x80, 0x88, 0xc0, 0x16, 0x00, 0x14, 0x56, 0x00 }; - -#if 0 -static const unsigned char pkt2[] = { -0x81, 0x5b, 0x00, 0x22, 0x00, 0x11, 0xe0, 0x41, -0x6d, 0x69, 0x74, 0x20, 0x43, 0x68, 0x61, 0x6e, -0x64, 0x72, 0x61, 0x00, 0x00 }; - -static const unsigned char pkt4[] = { -0x81, 0x5b, 0x00, 0x22, 0x00, 0x21, 0xe0, 0x62, -0x61, 0x72, 0x62, 0x61, 0x6e, 0x6f, 0x62, 0x61, -0x72, 0x6e, 0x61, 0x62, 0x6f }; - -static const unsigned char pkt5[] = { -0x81, 0x88, 0xc0, 0x16, 0x00, 0x21, 0xe0, 0x62, -0x61, 0x72, 0x62, 0x61, 0x6e, 0x6f, 0x62, 0x61, -0x72, 0x6e, 0x61, 0x62, 0x6f }; - -static const unsigned char pkt6[] = { -0x80, 0x5b, 0x00, 0x22, 0x00, 0x17 }; - -static const unsigned char pkt8[] = { -0x80, 0x88, 0xc0, 0x16, 0x00, 0x14, 0x00, 0x00 }; - -static const unsigned char pkt9[] = { -0x80, 0x88, 0xc0, 0x16, 0x00, 0x17 }; - -static const unsigned char pkt10[] = { -0x83, 0x5b, 0x00, 0x22, 0x20, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0x01, 0x04, -0xc3, 0x88, 0x00, 0x01, 0x05, 0x03, 0xfe, 0x5b, -0x00, 0x01 }; - -static const unsigned char pkt11[] = { -0x83, 0x88, 0xc0, 0x16, 0xd0, 0x09, 0x00, 0x03, -0x05, 0x07, 0x02, 0x42, 0x01, 0x02, 0x42, 0x01, -0x05, 0x01, 0xfe, 0x5b, 0x00, 0x00 }; - -static const unsigned char pkt12[] = { -0x83, 0x5b, 0x00, 0x22, 0x30, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x30, -0x04, 0x01, 0x20 }; - -static const unsigned char pkt13[] = { -0x83, 0x5b, 0x00, 0x22, 0x40, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x0f, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt14[] = { -0x83, 0x5b, 0x00, 0x22, 0x50, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x10, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt15[] = { -0x83, 0x5b, 0x00, 0x22, 0x60, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x11, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt16[] = { -0x83, 0x5b, 0x00, 0x22, 0x70, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x12, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt17[] = { -0x83, 0x5b, 0x00, 0x22, 0x80, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x13, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt18[] = { -0x83, 0x5b, 0x00, 0x22, 0x90, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x14, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt19[] = { -0x83, 0x5b, 0x00, 0x22, 0xa0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x15, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt20[] = { -0x83, 0x5b, 0x00, 0x22, 0xb0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x16, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt21[] = { -0x83, 0x5b, 0x00, 0x22, 0xc0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x17, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt22[] = { -0x83, 0x5b, 0x00, 0x22, 0xd0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x18, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt23[] = { -0x83, 0x5b, 0x00, 0x22, 0xe0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x19, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt24[] = { -0x83, 0x5b, 0x00, 0x22, 0xf0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x1a, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt25[] = { -0x83, 0x5b, 0x00, 0x22, 0x00, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x1b, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt26[] = { -0x83, 0x5b, 0x00, 0x22, 0x10, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x1c, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt27[] = { -0x83, 0x5b, 0x00, 0x22, 0x20, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x1d, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt28[] = { -0x83, 0x5b, 0x00, 0x22, 0x30, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x1e, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt29[] = { -0x83, 0x88, 0xc0, 0x16, 0x60, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x0f }; - -static const unsigned char pkt30[] = { -0x83, 0x88, 0xc0, 0x16, 0x70, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x10 }; - -static const unsigned char pkt31[] = { -0x83, 0x88, 0xc0, 0x16, 0x80, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x11 }; - -static const unsigned char pkt32[] = { -0x83, 0x88, 0xc0, 0x16, 0x90, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x12 }; - -static const unsigned char pkt33[] = { -0x83, 0x88, 0xc0, 0x16, 0xa0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x13 }; - -static const unsigned char pkt34[] = { -0x83, 0x88, 0xc0, 0x16, 0xb0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x14 }; - -static const unsigned char pkt35[] = { -0x83, 0x88, 0xc0, 0x16, 0xc0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x15 }; - -static const unsigned char pkt36[] = { -0x83, 0x88, 0xc0, 0x16, 0xd0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x16 }; - -static const unsigned char pkt37[] = { -0x83, 0x88, 0xc0, 0x16, 0xe0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x17 }; - -static const unsigned char pkt38[] = { -0x83, 0x88, 0xc0, 0x16, 0xf0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x18 }; - -static const unsigned char pkt39[] = { -0x83, 0x88, 0xc0, 0x16, 0x00, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x19 }; - -static const unsigned char pkt40[] = { -0x83, 0x88, 0xc0, 0x16, 0x10, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x1a }; - -static const unsigned char pkt41[] = { -0x83, 0x88, 0xc0, 0x16, 0x20, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x1b }; - -static const unsigned char pkt42[] = { -0x83, 0x88, 0xc0, 0x16, 0x30, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x1c }; - -static const unsigned char pkt43[] = { -0x83, 0x88, 0xc0, 0x16, 0x40, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x1d }; - -static const unsigned char pkt44[] = { -0x83, 0x88, 0xc0, 0x16, 0x50, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x1e }; - -static const unsigned char pkt45[] = { -0x83, 0x5b, 0x00, 0x22, 0x40, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x0f, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt46[] = { -0x83, 0x5b, 0x00, 0x22, 0x50, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x10, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt47[] = { -0x83, 0x5b, 0x00, 0x22, 0x60, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x11, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt48[] = { -0x83, 0x5b, 0x00, 0x22, 0x70, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x12, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt49[] = { -0x83, 0x5b, 0x00, 0x22, 0x80, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x13, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt50[] = { -0x83, 0x5b, 0x00, 0x22, 0x90, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x14, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt51[] = { -0x83, 0x5b, 0x00, 0x22, 0xa0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x15, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt52[] = { -0x83, 0x5b, 0x00, 0x22, 0xb0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x16, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt53[] = { -0x83, 0x5b, 0x00, 0x22, 0xc0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x17, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt54[] = { -0x83, 0x5b, 0x00, 0x22, 0xd0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x18, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt55[] = { -0x83, 0x5b, 0x00, 0x22, 0xe0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x19, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt56[] = { -0x83, 0x5b, 0x00, 0x22, 0xf0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x1a, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt57[] = { -0x83, 0x5b, 0x00, 0x22, 0x00, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x1b, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt58[] = { -0x83, 0x5b, 0x00, 0x22, 0x10, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x1c, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt59[] = { -0x83, 0x5b, 0x00, 0x22, 0x20, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x1d, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt60[] = { -0x83, 0x5b, 0x00, 0x22, 0x30, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0xc3, 0x5b, 0x00, 0xfe, 0x04, -0x43, 0x88, 0x00, 0xfe, 0x09, 0x00, 0x07, 0x40, -0x01, 0x00, 0x1e, 0x04, 0x01, 0x07 }; - -static const unsigned char pkt61[] = { -0x83, 0x88, 0xc0, 0x16, 0x60, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x0f }; - -static const unsigned char pkt62[] = { -0x83, 0x88, 0xc0, 0x16, 0x70, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x10 }; - -static const unsigned char pkt63[] = { -0x83, 0x88, 0xc0, 0x16, 0x80, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x11 }; - -static const unsigned char pkt64[] = { -0x83, 0x88, 0xc0, 0x16, 0x90, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x12 }; - -static const unsigned char pkt65[] = { -0x83, 0x88, 0xc0, 0x16, 0xa0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x13 }; - -static const unsigned char pkt66[] = { -0x83, 0x88, 0xc0, 0x16, 0xb0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x14 }; - -static const unsigned char pkt67[] = { -0x83, 0x88, 0xc0, 0x16, 0xc0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x15 }; - -static const unsigned char pkt68[] = { -0x83, 0x88, 0xc0, 0x16, 0xd0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x16 }; - -static const unsigned char pkt69[] = { -0x83, 0x88, 0xc0, 0x16, 0xe0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x17 }; - -static const unsigned char pkt70[] = { -0x83, 0x88, 0xc0, 0x16, 0xf0, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x18 }; - -static const unsigned char pkt71[] = { -0x83, 0x88, 0xc0, 0x16, 0x00, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x19 }; - -static const unsigned char pkt72[] = { -0x83, 0x88, 0xc0, 0x16, 0x10, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x1a }; - -static const unsigned char pkt73[] = { -0x83, 0x88, 0xc0, 0x16, 0x20, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x1b }; - -static const unsigned char pkt74[] = { -0x83, 0x88, 0xc0, 0x16, 0x30, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x1c }; - -static const unsigned char pkt75[] = { -0x83, 0x88, 0xc0, 0x16, 0x40, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x1d }; - -static const unsigned char pkt76[] = { -0x83, 0x88, 0xc0, 0x16, 0x50, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x06, 0x00, 0x04, 0x48, -0x01, 0x00, 0x1e }; - -static const unsigned char pkt77[] = { -0x83, 0x88, 0xc0, 0x16, 0x60, 0x09, 0x00, 0x03, -0x07, 0x0b, 0x04, 0x43, 0x88, 0x00, 0xfe, 0x04, -0x43, 0x5b, 0x00, 0xfe, 0x03, 0x00, 0x01, 0x31 }; -#endif - -static struct mtp_test tests[] = { - { - .input = pkt1, - .length = sizeof(pkt1), - .hdr = { - .ni = 0x02, - .spare = 0x00, - .ser_ind = 0x01, - }, - .has_mng = 1, - .mng = { - .cmn = { - .h0 = 0x01, - .h1 = 0x01, - }, - .length = 14, - }, - }, - - { - .input = pkt3, - .length = sizeof(pkt3), - .hdr = { - .ni = 0x02, - .spare = 0x00, - .ser_ind = 0x01, - }, - .has_mng = 1, - .mng = { - .cmn = { - .h0 = 0x01, - .h1 = 0x02, - }, - - .length = 14, - }, - }, - - { - .input = pkt7, - .length = sizeof(pkt7), - .hdr = { - .ni = 2, - .spare = 0, - .ser_ind = 0, - }, - - .has_prohib = 1, - .prohib = { - .cmn = { - .h0 = 0x04, - .h1 = 0x1, - }, - - }, - } -}; - -static void check_hdr(const uint8_t *data, const struct mtp_level_3_hdr *t_hdr) -{ - struct mtp_level_3_hdr *hdr; - hdr = (struct mtp_level_3_hdr *) data; - if (memcmp(hdr, t_hdr, sizeof(*hdr)) == 0) - return; - - if (hdr->ni != t_hdr->ni) - fprintf(stderr, "NI failed.\n"); - if (hdr->spare != t_hdr->spare) - fprintf(stderr, "spare not equal\n"); - if (hdr->ser_ind != t_hdr->ser_ind) - fprintf(stderr, "ser_ind not equal\n"); - if (hdr->addr != t_hdr->addr) - fprintf(stderr, "routing data not equal\n"); - - fprintf(stderr, "FAIL: Comparing headers failed.\n"); - abort(); -} - -static void check_mng(const uint8_t *data, const struct mtp_level_3_mng *t_mng) -{ - struct mtp_level_3_hdr *hdr = (struct mtp_level_3_hdr *) data; - struct mtp_level_3_mng *mng = (struct mtp_level_3_mng *) &hdr->data[0]; - - if (memcmp(mng, t_mng, sizeof(*mng)) == 0) - return; - - if (mng->cmn.h0 != t_mng->cmn.h0) - fprintf(stderr, "h0 not equal.\n"); - if (mng->cmn.h1 != t_mng->cmn.h1) - fprintf(stderr, "h1 not equal.\n"); - if (mng->length != t_mng->length) - fprintf(stderr, "length not euqal.\n"); - fprintf(stderr, "FAIL: Comparing the mtp_level_3_mng\n"); - abort(); -} - -static void check_prohib(const uint8_t *data, const struct mtp_level_3_prohib *t_prohib) -{ - struct mtp_level_3_hdr *hdr = (struct mtp_level_3_hdr *) data; - struct mtp_level_3_prohib *prohib = (struct mtp_level_3_prohib *) &hdr->data[0]; - - if (memcmp(prohib, t_prohib, sizeof(*prohib)) == 0) - return; - - if (prohib->cmn.h0 != t_prohib->cmn.h0) - fprintf(stderr, "h0 not equal.\n"); - if (prohib->cmn.h1 != t_prohib->cmn.h1) - fprintf(stderr, "h1 not equal.\n"); - if (ntohs(prohib->apoc) != t_prohib->apoc) - fprintf(stderr, "apoc not euqal.\n"); - fprintf(stderr, "FAIL: Comparing the mtp_level_3_prohib\n"); - abort(); -} - -int main(int argc, char **argv) -{ - uint32_t addr; - int i; - - printf("Basic MTP Structure testing.\n"); - - /* set the addresses here due big endian MTP_ADDRESS macro */ - tests[0].hdr.addr = MTP_ADDR(0x00, 136, 91); - tests[1].hdr.addr = MTP_ADDR(0x00, 136, 91); - tests[2].hdr.addr = MTP_ADDR(0x00, 136, 91); - tests[2].prohib.apoc = MTP_MAKE_APOC(86); - - for (i = 0; i < ARRAY_SIZE(tests); ++i) { - check_hdr(tests[i].input, &tests[i].hdr); - if (tests[i].has_mng) - check_mng(tests[i].input, &tests[i].mng); - if (tests[i].has_prohib) - check_prohib(tests[i].input, &tests[i].prohib); - } - - if (MTP_READ_OPC(tests[0].hdr.addr) != 91) { - fprintf(stderr, "Failed to read OPC address\n"); - abort(); - } - - if (MTP_READ_DPC(tests[1].hdr.addr) != 136) { - fprintf(stderr, "Failed to read DPC address\n"); - abort(); - } - - /* check the SCCP unitdata */ - { - struct sccp_con_ctrl_prt_mgt prt = { - .sst = 0x03, - .assn = 254, - .apoc = MTP_MAKE_APOC(91), - .mul_ind = 1, - }; - - uint8_t data[] = { 0x03, 0xfe, 0x5b, 0x00, 0x01 }; - if (memcmp(&prt, data, 5) != 0) { - uint8_t *d = (uint8_t *) &prt; - fprintf(stderr, "GOT: 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x\n", - d[0], d[1], d[2], d[3], d[4]); - abort(); - } - } - - /* verify decoding of the sls */ - for (i = 0; i < 16; ++i) { - addr = MTP_ADDR(i, 136, 91); - if (MTP_LINK_SLS(addr) != i) { - fprintf(stderr, "0x%x/0x%x does not match 0x%x\n", addr, MTP_LINK_SLS(addr), i); - abort(); - } - } - - printf("All tests passed.\n"); - return 0; -} diff --git a/tests/mtp/mtp_parse_test.ok b/tests/mtp/mtp_parse_test.ok deleted file mode 100644 index cee2aeb..0000000 --- a/tests/mtp/mtp_parse_test.ok +++ /dev/null @@ -1,2 +0,0 @@ -Basic MTP Structure testing. -All tests passed. diff --git a/tests/sccp/Makefile.am b/tests/sccp/Makefile.am deleted file mode 100644 index fc4f0c8..0000000 --- a/tests/sccp/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -AM_CFLAGS=-Wall -ggdb3 $(LIBOSMOCORE_CFLAGS) -AM_LDFLAGS = -no-install - -EXTRA_DIST = sccp_test.ok - -check_PROGRAMS = sccp_test - -sccp_test_SOURCES = sccp_test.c -sccp_test_LDADD = \ - $(LIBOSMOCORE_LIBS) \ - $(top_builddir)/src/sccp.o \ - $(NULL) - diff --git a/tests/sccp/sccp_test.c b/tests/sccp/sccp_test.c deleted file mode 100644 index 1fe353d..0000000 --- a/tests/sccp/sccp_test.c +++ /dev/null @@ -1,1067 +0,0 @@ -/* - * SCCP testing code - * - * (C) 2009,2011 by Holger Hans Peter Freyther <zecke(a)selfish.org> - * (C) 2009,2011 by On-Waves - * - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include <stdio.h> -#include <string.h> - -#include <arpa/inet.h> - -#include <osmocom/core/logging.h> -#include <osmocom/core/msgb.h> -#include <osmocom/core/utils.h> - -#include <osmocom/sccp/sccp.h> - -#define MIN(x, y) ((x) < (y) ? (x) : (y)) - -/* BSC -> MSC */ -static const uint8_t bssmap_reset[] = { - 0x09, 0x00, 0x03, 0x05, 0x07, 0x02, 0x42, 0xfe, - 0x02, 0x42, 0xfe, 0x06, 0x00, 0x04, 0x30, 0x04, - 0x01, 0x20, -}; - -/* MSC -> BSC reset ack */ -static const uint8_t bssmap_reset_ack[] = { - 0x09, 0x00, 0x03, 0x07, 0x0b, 0x04, 0x43, 0x01, - 0x00, 0xfe, 0x04, 0x43, 0x5c, 0x00, 0xfe, 0x03, - 0x00, 0x01, 0x31, -}; - -/* MSC -> BSC paging, connection less */ -static const uint8_t bssmap_paging[] = { - 0x09, 0x00, 0x03, 0x07, 0x0b, 0x04, 0x43, 0x01, - 0x00, 0xfe, 0x04, 0x43, 0x5c, 0x00, 0xfe, 0x10, - 0x00, 0x0e, 0x52, 0x08, 0x08, 0x29, 0x47, 0x10, - 0x02, 0x01, 0x31, 0x97, 0x61, 0x1a, 0x01, 0x06, -}; - -/* MSC -> BSC paging, UDT without PC */ -static const uint8_t bssmap_udt[] = { - 0x09, 0x00, 0x03, 0x05, 0x07, 0x02, 0x42, 0xfe, - 0x02, 0x42, 0xfe, 0x10, 0x00, 0x0e, 0x52, 0x08, - 0x08, 0x29, 0x47, 0x10, 0x02, 0x01, 0x31, 0x97, - 0x61, 0x1a, 0x01, 0x06, -}; - -/* BSC -> MSC connection open */ -static const uint8_t bssmap_cr[] = { - 0x01, 0x01, 0x02, 0x03, 0x02, 0x02, 0x04, 0x02, - 0x42, 0xfe, 0x0f, 0x1f, 0x00, 0x1d, 0x57, 0x05, - 0x08, 0x00, 0x72, 0xf4, 0x80, 0x20, 0x12, 0xc3, - 0x50, 0x17, 0x10, 0x05, 0x24, 0x11, 0x03, 0x33, - 0x19, 0xa2, 0x08, 0x29, 0x47, 0x10, 0x02, 0x01, - 0x31, 0x97, 0x61, 0x00 -}; - -/* MSC -> BSC connection confirm */ -static const uint8_t bssmap_cc[] = { - 0x02, 0x01, 0x02, 0x03, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, -}; - -/* MSC -> BSC DTAP - * - * we fake a bit and make it BSC -> MSC... so the - * payload does not make any sense.. - */ -static const uint8_t bssmap_dtap[] = { - 0x06, 0x00, 0x00, 0x03, 0x00, 0x01, 0x0f, 0x01, 0x00, 0x0c, - 0x03, 0x05, 0x5c, 0x08, 0x11, 0x81, 0x33, 0x66, 0x02, 0x13, - 0x45, 0xf4, -}; - -/* MSC -> BSC clear command */ -static const uint8_t bssmap_clear[] = { - 0x06, 0x00, 0x00, 0x03, 0x00, 0x01, 0x06, 0x00, 0x04, 0x20, - 0x04, 0x01, 0x09, -}; - -/* MSC -> BSC released */ -static const uint8_t bssmap_released[] = { - 0x04, 0x00, 0x00, 0x03, 0x01, 0x02, 0x03, 0x00, 0x01, 0x0f, - 0x02, 0x23, 0x42, 0x00, -}; - -/* BSC -> MSC released */ -static const uint8_t bssmap_release_complete[] = { - 0x05, 0x01, 0x02, 0x03, 0x00, 0x00, 0x03 -}; - -/* message with a SCCP global title */ -static const uint8_t tcap_global_title[] = { - 0x09, - 0x81, 0x03, 0x0d, 0x18, 0x0a, 0x12, 0x07, 0x00, - 0x12, 0x04, 0x53, 0x84, 0x09, 0x00, 0x17, 0x0b, - 0x12, 0x06, 0x00, 0x12, 0x04, 0x44, 0x87, 0x20, - 0x00, 0x20, 0x65, 0x9a, 0x65, 0x81, 0x97, 0x48, - 0x04, 0x26, 0x00, 0x01, 0x98, 0x49, 0x04, 0x51, - 0x01, 0x03, 0xdf, 0x6c, 0x81, 0x88, 0xa1, 0x81, - 0x85, 0x02, 0x01, 0x44, 0x02, 0x01, 0x07, 0x30, - 0x80, 0xa7, 0x80, 0xa0, 0x80, 0x04, 0x01, 0x2b, - 0x30, 0x80, 0x30, 0x12, 0x83, 0x01, 0x10, 0x84, - 0x01, 0x07, 0x85, 0x07, 0x91, 0x44, 0x57, 0x76, - 0x67, 0x16, 0x97, 0x86, 0x01, 0x20, 0x30, 0x06, - 0x82, 0x01, 0x18, 0x84, 0x01, 0x04, 0x00, 0x00, - 0x00, 0x00, 0xa3, 0x06, 0x04, 0x01, 0x42, 0x84, - 0x01, 0x05, 0xa3, 0x06, 0x04, 0x01, 0x51, 0x84, - 0x01, 0x05, 0xa3, 0x06, 0x04, 0x01, 0x31, 0x84, - 0x01, 0x05, 0xa3, 0x09, 0x04, 0x01, 0x12, 0x84, - 0x01, 0x05, 0x82, 0x01, 0x02, 0xa3, 0x09, 0x04, - 0x01, 0x11, 0x84, 0x01, 0x05, 0x81, 0x01, 0x01, - 0xa3, 0x06, 0x04, 0x01, 0x14, 0x84, 0x01, 0x00, - 0xa3, 0x0b, 0x04, 0x01, 0x41, 0x84, 0x01, 0x04, - 0x30, 0x03, 0x83, 0x01, 0x10, 0xa3, 0x0b, 0x04, - 0x01, 0x41, 0x84, 0x01, 0x04, 0x30, 0x03, 0x82, - 0x01, 0x18, 0x00, 0x00, 0x00, 0x00 -}; - -static const uint8_t tcap_global_dst_gti[] = { - 0x00, 0x12, 0x04, 0x53, 0x84, 0x09, 0x00, 0x17, -}; - -static const uint8_t tcap_global_src_gti[] = { - 0x00, 0x12, 0x04, 0x44, 0x87, 0x20, 0x00, 0x20, 0x65, -}; - - -struct test_data { - int length; - const uint8_t *data; - int payload_start; - int payload_length; - uint8_t first_byte; - - /* in case it should trigger a sccp response */ - int write; - const uint8_t *response; - int response_length; -}; - -static const struct test_data test_data[] = { - { - .length = ARRAY_SIZE(bssmap_reset), - .data = &bssmap_reset[0], - .payload_start = 12, - .payload_length = ARRAY_SIZE(bssmap_reset) - 12, - .first_byte = 0x0, - }, - { - .length = ARRAY_SIZE(bssmap_reset_ack), - .data = &bssmap_reset_ack[0], - .payload_start = 16, - .payload_length = ARRAY_SIZE(bssmap_reset_ack) - 16, - .first_byte = 0x0, - }, - { - .length = ARRAY_SIZE(bssmap_paging), - .data = &bssmap_paging[0], - .payload_start = 16, - .payload_length = ARRAY_SIZE(bssmap_paging) - 16, - .first_byte = 0x0, - }, - { - .length = ARRAY_SIZE(bssmap_cr), - .data = &bssmap_cr[0], - .payload_start = 12, - /* 0x00 is end of optional data, subtract this byte */ - .payload_length = 31, - .first_byte = 0x0, - - /* the connection request should trigger a connection confirm */ - .write = 1, - .response = &bssmap_cc[0], - .response_length= ARRAY_SIZE(bssmap_cc), - }, - { - .length = ARRAY_SIZE(bssmap_dtap), - .data = &bssmap_dtap[0], - .payload_start = 7, - .payload_length = 15, - .first_byte = 0x01, - }, - { - .length = ARRAY_SIZE(bssmap_clear), - .data = &bssmap_clear[0], - .payload_start = 7, - .payload_length = 6, - .first_byte = 0x00, - }, - { - .length = ARRAY_SIZE(bssmap_released), - .data = &bssmap_released[0], - .payload_length = 2, - .payload_start = 11, - .first_byte = 0x23, - - .write = 1, - .response = &bssmap_release_complete[0], - .response_length= ARRAY_SIZE(bssmap_release_complete), - }, -}; - -/* we will send UDTs and verify they look like this */ -static const struct test_data send_data[] = { - { - .length = ARRAY_SIZE(bssmap_udt), - .data = &bssmap_udt[0], - .payload_start = 12, - .payload_length = ARRAY_SIZE(bssmap_udt) - 12, - .first_byte = 0x0, - }, - { - .length = ARRAY_SIZE(bssmap_reset), - .data = &bssmap_reset[0], - .payload_start = 12, - .payload_length = ARRAY_SIZE(bssmap_reset) - 12, - .first_byte = 0x0, - }, -}; - -struct connection_test { - /* should the connection be refused? */ - int refuse; - - int with_data; - - /* on which side to close the connection? */ - int close_side; - int close_cause; -}; - -/* sccp connection handling we want to test */ -static const struct connection_test connection_tests[] = { - { - .refuse = 1, - }, - { - .refuse = 1, - .with_data = 1, - }, - { - .refuse = 0, - .close_side = 0, - .close_cause = 5, - }, - { - .refuse = 0, - .close_side = 0, - .close_cause = 5, - .with_data = 1, - }, - { - .refuse = 0, - .close_side = 1, - .close_cause = 5, - }, - { - .refuse = 0, - .close_side = 1, - .close_cause = 5, - .with_data = 1, - }, -}; - -struct sccp_parse_header_result { - /* results */ - int msg_type; - int wanted_len; - int src_ssn; - int dst_ssn; - - int has_src_ref, has_dst_ref; - struct sccp_source_reference src_ref; - struct sccp_source_reference dst_ref; - - /* global title len */ - int src_gti_len; - const uint8_t *src_gti_data; - int dst_gti_len; - const uint8_t *dst_gti_data; - - /* the input */ - const uint8_t *input; - int input_len; -}; - -static const uint8_t it_test[] = { -0x10, 0x01, 0x07, -0x94, 0x01, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00 }; - -static const uint8_t proto_err[] = { -0x0f, 0x0c, 0x04, 0x00, 0x00, -}; - -static const uint8_t xudt_test_src_gt[] = { -0x00, 0x11, 0x04, 0x26, 0x18, 0x01, 0x30, 0x08, -0x01 -}; - -static const uint8_t xudt_test_dst_gt[] = { -0x00, 0x61, 0x04, 0x15, 0x10, 0x80, 0x21, 0x35, -0x98, 0x55, 0x08 -}; - -static const uint8_t xudt_test[] = { -0x11, 0x81, 0x02, 0x04, 0x11, 0x1C, 0x00, 0x0D, -0x52, 0x06, 0x00, 0x61, 0x04, 0x15, 0x10, 0x80, -0x21, 0x35, 0x98, 0x55, 0x08, 0x0B, 0x12, 0x95, -0x00, 0x11, 0x04, 0x26, 0x18, 0x01, 0x30, 0x08, -0x01, 0x44, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, -0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, -0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, -0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, -0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, -0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, -0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, -0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, -0x3F, 0x40, 0x41, 0x42, 0x43, 0x44 -}; - -static const struct sccp_parse_header_result parse_result[] = { - { - .msg_type = SCCP_MSG_TYPE_IT, - .wanted_len = 0, - .src_ssn = -1, - .dst_ssn = -1, - .has_src_ref = 1, - .has_dst_ref = 1, - - .src_ref = { - .octet1 = 0x01, - .octet2 = 0x04, - .octet3 = 0x00 - }, - .dst_ref = { - .octet1 = 0x01, - .octet2 = 0x07, - .octet3 = 0x94, - }, - - .input = it_test, - .input_len = sizeof(it_test), - }, - { - .msg_type = SCCP_MSG_TYPE_ERR, - .wanted_len = 0, - .src_ssn = -1, - .dst_ssn = -1, - .has_src_ref = 0, - .has_dst_ref = 1, - .dst_ref = { - .octet1 = 0x0c, - .octet2 = 0x04, - .octet3 = 0x00, - }, - .input = proto_err, - .input_len = sizeof(proto_err), - }, - { - .msg_type = SCCP_MSG_TYPE_UDT, - .input = tcap_global_title, - .input_len = sizeof(tcap_global_title), - .wanted_len = 154, - .dst_ssn = SCCP_SSN_VLR, - .dst_gti_data = tcap_global_dst_gti, - .dst_gti_len = 8, - .src_ssn = SCCP_SSN_HLR, - .src_gti_data = tcap_global_src_gti, - .src_gti_len = 9, - }, - { - .msg_type = SCCP_MSG_TYPE_XUDT, - .input = xudt_test, - .input_len = sizeof(xudt_test), - .wanted_len = 68, - .dst_ssn = 6, - .dst_gti_data = xudt_test_dst_gt, - .dst_gti_len = 11, - .src_ssn = 149, - .src_gti_data = xudt_test_src_gt, - .src_gti_len = 9, - }, -}; - - -/* testing procedure: - * - we will use sccp_write and see what will be set in the - * outgoing callback - * - we will call sccp_system_incoming and see which calls - * are made. And then compare it to the ones we expect. We - * want the payload to arrive, or callbacks to be called. - * - we will use sccp_connection_socket and sccp_connection_write - * and verify state handling of connections - */ - -static int current_test; - -/* - * test state... - */ -static int called = 0; -static int matched = 0; -static int write_called = 0; - -#define FAIL(x, args...) do { \ - printf("FAILURE in %s:%d: " x, __FILE__, __LINE__, ## args); \ - abort(); } while (0) - -/* - * writing these packets and expecting a result - */ -int sccp_read_cb(struct msgb *data, unsigned len, void *gctx) -{ - uint16_t payload_length = test_data[current_test].payload_length; - const uint8_t *got, *wanted; - int i; - - called = 1; - - if (msgb_l3len(data) < len) { - /* this should never be reached */ - FAIL("Something horrible happened.. invalid packet..\n"); - } - - if (len == 0 || len != payload_length) { - FAIL("length mismatch: got: %d wanted: %d\n", msgb_l3len(data), payload_length); - } - - if (data->l3h[0] != test_data[current_test].first_byte) { - FAIL("The first bytes of l3 do not match: 0x%x 0x%x\n", - data->l3h[0], test_data[current_test].first_byte); - } - - got = &data->l3h[0]; - wanted = test_data[current_test].data + test_data[current_test].payload_start; - - for (i = 0; i < len; ++i) { - if (got[i] != wanted[i]) { - FAIL("Failed to compare byte. Got: 0x%x Wanted: 0x%x at %d\n", - got[i], wanted[i], i); - } - } - - matched = 1; - return 0; -} - -void sccp_write_cb(struct sccp_connection *conn, struct msgb *data, void *gctx, void *ctx) -{ - int i = 0; - const uint8_t *got, *wanted; - - if (test_data[current_test].response == NULL) { - FAIL("Didn't expect write callback\n"); - } else if (test_data[current_test].response_length != msgb_l2len(data)) { - FAIL("Size does not match. Got: %d Wanted: %d\n", - msgb_l2len(data), test_data[current_test].response_length); - } - - got = &data->l2h[0]; - wanted = test_data[current_test].response; - - for (i = 0; i < msgb_l2len(data); ++i) { - if (got[i] != wanted[i]) { - FAIL("Failed to compare byte. Got: 0x%x Wanted: 0x%x at %d\n", - got[i], wanted[i], i); - } - } - - write_called = 1; - msgb_free(data); -} - -void sccp_c_read(struct sccp_connection *connection, struct msgb *msgb, unsigned int len) -{ - sccp_read_cb(msgb, len, connection->data_ctx); -} - -void sccp_c_state(struct sccp_connection *connection, int old_state) -{ - if (connection->connection_state >= SCCP_CONNECTION_STATE_RELEASE_COMPLETE) - sccp_connection_free(connection); -} - -int sccp_accept_cb(struct sccp_connection *connection, void *user_data) -{ - called = 1; - unsigned int ref = 0; - ref |= connection->destination_local_reference.octet1 << 24; - ref |= connection->destination_local_reference.octet2 << 16; - ref |= connection->destination_local_reference.octet3 << 8; - ref = ntohl(ref); - - connection->data_cb = sccp_c_read; - connection->state_cb = sccp_c_state; - - /* accept this */ - return 0; -} - -static void sccp_udt_write_cb(struct sccp_connection *conn, struct msgb *data, void *gtx, void *ctx) -{ - const uint8_t *got, *wanted; - int i; - - write_called = 1; - - if (send_data[current_test].length != msgb_l2len(data)) { - FAIL("Size does not match. Got: %d Wanted: %d\n", - msgb_l2len(data), send_data[current_test].length); - } - - got = &data->l2h[0]; - wanted = send_data[current_test].data; - - for (i = 0; i < msgb_l2len(data); ++i) { - if (got[i] != wanted[i]) { - FAIL("Failed to compare byte. Got: 0x%x Wanted: 0x%x at %d\n", - got[i], wanted[i], i); - } - } - - matched = 1; - msgb_free(data); -} - -static void test_sccp_system(void) -{ - printf("Testing SCCP System\n"); - - sccp_system_init(sccp_write_cb, NULL); - sccp_set_read(&sccp_ssn_bssap, sccp_read_cb, NULL); - sccp_connection_set_incoming(&sccp_ssn_bssap, sccp_accept_cb, NULL); - - for (current_test = 0; current_test < ARRAY_SIZE(test_data); ++current_test) { - unsigned int length = test_data[current_test].length; - struct msgb *msg = msgb_alloc_headroom(length + 2, 2, __func__); - msg->l2h = msgb_put(msg, length); - memcpy(msg->l2h, test_data[current_test].data, length); - - called = matched = write_called = 0; - printf("Testing packet: %d\n", current_test); - sccp_system_incoming(msg); - - if (!called || !matched || (test_data[current_test].write != write_called)) - FAIL("current test: %d called: %d matched: %d write: %d\n", - current_test, called, matched, write_called); - - msgb_free(msg); - } -} - -/* test sending of udt */ -static void test_sccp_send_udt(void) -{ - printf("Testing send UDT\n"); - - sccp_system_init(sccp_udt_write_cb, NULL); - sccp_set_read(NULL, NULL, NULL); - sccp_connection_set_incoming(NULL, NULL, NULL); - - for (current_test = 0; current_test < ARRAY_SIZE(send_data); ++current_test) { - const struct test_data *test = &send_data[current_test]; - - struct msgb *msg = msgb_alloc(test->payload_length, __func__); - msg->l3h = msgb_put(msg, test->payload_length); - memcpy(msg->l3h, test->data + test->payload_start, test->payload_length); - - matched = write_called = 0; - printf("Testing packet: %d\n", current_test); - sccp_write(msg, &sccp_ssn_bssap, &sccp_ssn_bssap, 0, NULL); - - if (!matched || !write_called) - FAIL("current test: %d matched: %d write: %d\n", - current_test, matched, write_called); - - msgb_free(msg); - } -} - -/* send udt from one end to another */ -static unsigned int test_value = 0x2442; -static int sccp_udt_read(struct msgb *data, unsigned int len, void *gctx) -{ - unsigned int *val; - - if (len != 4) { - FAIL("Wrong size: %d\n", msgb_l3len(data)); - } - - val = (unsigned int*)data->l3h; - matched = test_value == *val; - - return 0; -} - -static void sccp_write_loop(struct sccp_connection *conn, struct msgb *data, void *gctx, void *ctx) -{ - /* send it back to us */ - sccp_system_incoming(data); - msgb_free(data); -} - -static void test_sccp_udt_communication(void) -{ - struct msgb *data; - unsigned int *val; - - printf("Testing UDT Communication.\n"); - - sccp_system_init(sccp_write_loop, NULL); - sccp_set_read(&sccp_ssn_bssap, sccp_udt_read, NULL); - sccp_connection_set_incoming(NULL, NULL, NULL); - - - data = msgb_alloc(4, "test data"); - data->l3h = &data->data[0]; - val = (unsigned int *)msgb_put(data, 4); - *val = test_value; - - matched = 0; - sccp_write(data, &sccp_ssn_bssap, &sccp_ssn_bssap, 0, NULL); - - if (!matched) - FAIL("Talking with us didn't work\n"); - - msgb_free(data); -} - - -/* connection testing... open, send, close */ -static const struct connection_test *current_con_test; -static struct sccp_connection *outgoing_con; -static struct sccp_connection *incoming_con; -static int outgoing_data, incoming_data, incoming_state, outgoing_state; - -static struct msgb *test_data1, *test_data2, *test_data3; - -static void sccp_conn_in_state(struct sccp_connection *conn, int old_state) -{ - printf("\tincome: %d -> %d\n", old_state, conn->connection_state); - if (conn->connection_state >= SCCP_CONNECTION_STATE_RELEASE_COMPLETE) { - if (conn == incoming_con) { - sccp_connection_free(conn); - incoming_con = NULL; - } - } -} - -static void sccp_conn_in_data(struct sccp_connection *conn, struct msgb *msg, unsigned int len) -{ - /* compare the data */ - ++incoming_data; - printf("\tincoming data: %d\n", len); - - /* compare the data */ - if (len != 4) { - FAIL("Length of packet is wrong: %u %u\n", msgb_l3len(msg), len); - } - - if (incoming_data == 1) { - if (memcmp(msg->l3h, test_data1->l3h, len) != 0) { - FAIL("Comparing the data failed: %d\n", incoming_data); - - } - } else if (incoming_data == 2) { - if (memcmp(msg->l3h, test_data2->l3h, len) != 0) { - FAIL("Comparing the data failed: %d\n", incoming_data); - } - } - - /* sending out data */ - if (incoming_data == 2) { - printf("\tReturning data3\n"); - sccp_connection_write(conn, test_data3); - } -} - -static int sccp_conn_accept(struct sccp_connection *conn, void *ctx) -{ - printf("\taccept: srcref(%u)\n", - sccp_src_ref_to_int(&conn->source_local_reference)); - conn->state_cb = sccp_conn_in_state; - conn->data_cb = sccp_conn_in_data; - - if (current_con_test->refuse) - return -1; - - incoming_con = conn; - return 0; -} - -/* callbacks for the outgoing side */ -static void sccp_conn_out_state(struct sccp_connection *conn, int old_state) -{ - printf("\toutgoing: dstref(%u) %d -> %d\n", - sccp_src_ref_to_int(&conn->destination_local_reference), - old_state, conn->connection_state); - - if (conn->connection_state >= SCCP_CONNECTION_STATE_RELEASE_COMPLETE) { - if (conn == outgoing_con) { - sccp_connection_free(conn); - outgoing_con = NULL; - } - } -} - -static void sccp_conn_out_data(struct sccp_connection *conn, struct msgb *msg, unsigned int len) -{ - ++outgoing_data; - printf("\toutgoing data: dstref(%u) %d\n", - sccp_src_ref_to_int(&conn->destination_local_reference), len); - - if (len != 4) - FAIL("Length of packet is wrong: %u %u\n", msgb_l3len(msg), len); - - if (outgoing_data == 1) { - if (memcmp(msg->l3h, test_data3->l3h, len) != 0) { - FAIL("Comparing the data failed\n"); - } - } -} - -static void do_test_sccp_connection(const struct connection_test *test) -{ - int ret; - - current_con_test = test; - outgoing_con = incoming_con = 0; - - outgoing_con = sccp_connection_socket(); - if (!outgoing_con) { - FAIL("Connection is NULL\n"); - } - - outgoing_con->state_cb = sccp_conn_out_state; - outgoing_con->data_cb = sccp_conn_out_data; - outgoing_data = incoming_data = 0; - incoming_state = outgoing_state = 1; - - /* start testing */ - if (test->with_data) { - if (sccp_connection_connect(outgoing_con, &sccp_ssn_bssap, test_data1) != 0) - FAIL("Binding failed\n"); - } else { - ++incoming_data; - if (sccp_connection_connect(outgoing_con, &sccp_ssn_bssap, NULL) != 0) - FAIL("Binding failed\n"); - } - - if (test->refuse) { - if (outgoing_con) - FAIL("Outgoing connection should have been refused.\n"); - } else { - if (!incoming_con) - FAIL("Creating incoming didn't work.\n"); - - printf("\tWriting test data2\n"); - sccp_connection_write(outgoing_con, test_data2); - sccp_connection_send_it(outgoing_con); - - /* closing connection */ - if (test->close_side == 0) - ret = sccp_connection_close(outgoing_con, 0); - else - ret = sccp_connection_close(incoming_con, 0); - - if (ret != 0) - FAIL("Closing the connection failed\n"); - } - - /* outgoing should be gone now */ - if (outgoing_con) - FAIL("Outgoing connection was not properly closed\n"); - - if (incoming_con) - FAIL("Incoming connection was not propery closed.\n"); - - if (test->refuse == 0) { - if (outgoing_data != 1 || incoming_data != 2) { - FAIL("Data sending failed: %d/%d %d/%d\n", - outgoing_data, 1, - incoming_data, 2); - } - } - - if (!incoming_state || !outgoing_state) - FAIL("Failure with the state transition. %d %d\n", - outgoing_state, incoming_state); -} - -static void test_sccp_connection(void) -{ - printf("Testing SCCP connection.\n"); - - sccp_system_init(sccp_write_loop, NULL); - sccp_set_read(NULL, NULL, NULL); - sccp_connection_set_incoming(&sccp_ssn_bssap, sccp_conn_accept, NULL); - - test_data1 = msgb_alloc(4, "data1"); - test_data1->l3h = msgb_put(test_data1, 4); - *((unsigned int*)test_data1->l3h) = 0x23421122; - - test_data2 = msgb_alloc(4, "data2"); - test_data2->l3h = msgb_put(test_data2, 4); - *((unsigned int*)test_data2->l3h) = 0x42232211; - - test_data3 = msgb_alloc(4, "data3"); - test_data3->l3h = msgb_put(test_data3, 4); - *((unsigned int*)test_data3->l3h) = 0x2323ff55; - - - for (current_test = 0; current_test < ARRAY_SIZE(connection_tests); ++current_test) { - printf("Testing %d refuse: %d with_data: %d\n", - current_test, connection_tests[current_test].refuse, - connection_tests[current_test].with_data); - do_test_sccp_connection(&connection_tests[current_test]); - } - - msgb_free(test_data1); - msgb_free(test_data2); - msgb_free(test_data3); -} - -/* invalid input */ -static void test_sccp_system_crash(void) -{ - printf("trying to provoke a crash with invalid input\n"); - sccp_set_read(&sccp_ssn_bssap, sccp_read_cb, NULL); - sccp_connection_set_incoming(&sccp_ssn_bssap, sccp_accept_cb, NULL); - - for (current_test = 0; current_test < ARRAY_SIZE(test_data); ++current_test) { - int original_length = test_data[current_test].length; - int length = original_length + 2; - int i; - - printf("Testing packet: %d\n", current_test); - - for (i = length; i >= 0; --i) { - unsigned int length = MIN(test_data[current_test].length, i); - struct msgb *msg = msgb_alloc_headroom(length + 2, 2, __func__); - msg->l2h = msgb_put(msg, length); - memcpy(msg->l2h, test_data[current_test].data, length); - sccp_system_incoming(msg); - msgb_free(msg); - } - } - - printf("survived\n"); -} - -static void test_sccp_parsing(void) -{ - printf("Test SCCP Parsing.\n"); - - for (current_test = 0; current_test < ARRAY_SIZE(parse_result); ++current_test) { - struct msgb *msg; - struct sccp_parse_result result; - - msg = msgb_alloc_headroom(1024, 128, "parse-test"); - msgb_put(msg, 1); - msg->l2h = msgb_put(msg, parse_result[current_test].input_len); - memcpy(msg->l2h, parse_result[current_test].input, msgb_l2len(msg)); - - memset(&result, 0, sizeof(result)); - if (sccp_parse_header(msg, &result) != 0) { - FAIL("Failed to sccp parse test: %d\n", current_test); - } else { - if (parse_result[current_test].wanted_len != result.data_len) { - FAIL("Unexpected data length. Got: %d\n", result.data_len); - } - - if (parse_result[current_test].has_src_ref) { - if (memcmp(result.source_local_reference, - &parse_result[current_test].src_ref, - sizeof(struct sccp_source_reference)) != 0) { - FAIL("SRC REF did not match\n"); - } - } - - if (parse_result[current_test].has_dst_ref) { - if (memcmp(result.destination_local_reference, - &parse_result[current_test].dst_ref, - sizeof(struct sccp_source_reference)) != 0) { - FAIL("DST REF did not match\n"); - } - } - - if (parse_result[current_test].src_ssn != -1 && - parse_result[current_test].src_ssn != result.calling.ssn) { - FAIL("Calling SSN is wrong..\n"); - } - - if (parse_result[current_test].dst_ssn != -1 && - parse_result[current_test].dst_ssn != result.called.ssn) { - FAIL("Called SSN is wrong..\n"); - } - - if (parse_result[current_test].src_gti_len != result.calling.gti_len) { - FAIL("GTI length is wrong: %d\n", result.calling.gti_len); - } - - if (parse_result[current_test].dst_gti_len != result.called.gti_len) { - FAIL("GTI length is wrong: %d\n", result.called.gti_len); - } - - if (parse_result[current_test].dst_gti_data - && memcmp(&parse_result[current_test].dst_gti_data[0], - result.called.gti_data, result.called.gti_len) != 0) { - FAIL("GTI data is wrong: %d '%s'\n", - result.called.gti_len, - osmo_hexdump(result.called.gti_data, result.called.gti_len)); - } - - if (parse_result[current_test].src_gti_data - && memcmp(&parse_result[current_test].src_gti_data[0], - result.calling.gti_data, result.calling.gti_len) != 0) { - FAIL("GTI data is wrong: %d\n", result.calling.gti_len); - } - } - - msgb_free(msg); - } -} - -/* - * Test the creation of SCCP addresses - */ -int sccp_create_sccp_addr(struct msgb *msg, const struct sockaddr_sccp *sock); - -struct sccp_addr_tst { - const struct sockaddr_sccp *addr; - - const uint8_t *output; - const int output_len; -}; - -static uint8_t ssn_out[] = { - 0x02, 0x42, 0xfe, -}; - -const struct sockaddr_sccp sccp_poi_bssap = { - .sccp_family = 0, - .sccp_ssn = SCCP_SSN_BSSAP, - .poi = {0x01, 0x00}, - .use_poi = 1, -}; - -static uint8_t poi_out[] = { - 0x04, 0x43, 0x01, 0x00, 0xfe, -}; - -static uint8_t gti_dat[] = { - 0x00, 0x12, 0x04, 0x53, 0x84, 0x09, 0x00, 0x17, -}; - -const struct sockaddr_sccp sccp_gti_bssap = { - .sccp_family = 0, - .sccp_ssn = 7, - .gti_ind = 4, - .gti_len = ARRAY_SIZE(gti_dat), - .gti = gti_dat, -}; - -static uint8_t gti_out[] = { - 0x0a, 0x12, 0x07, 0x00, 0x12, 0x04, 0x53, 0x84, 0x09, 0x00, 0x17, -}; - -static struct sccp_addr_tst sccp_addr_tst[] = { - { - .addr = &sccp_ssn_bssap, - .output = ssn_out, - .output_len = ARRAY_SIZE(ssn_out), - }, - { - .addr = &sccp_poi_bssap, - .output = poi_out, - .output_len = ARRAY_SIZE(poi_out), - }, - { - .addr = &sccp_gti_bssap, - .output = gti_out, - .output_len = ARRAY_SIZE(gti_out), - }, -}; - -static void test_sccp_address(void) -{ - int i, ret; - struct msgb *msg = msgb_alloc(128, "sccp-addr"); - - printf("Test SCCP Address\n"); - - for (i = 0; i < ARRAY_SIZE(sccp_addr_tst); ++i) { - msgb_reset(msg); - ret = sccp_create_sccp_addr(msg, sccp_addr_tst[i].addr); - if (ret != sccp_addr_tst[i].output_len) { - FAIL("Length is from for %d\n", i); - } - - if (memcmp(msg->data, sccp_addr_tst[i].output, ret) != 0) { - FAIL("Unexpected data for %d '%s'\n", i, - osmo_hexdump(msg->data, ret)); - } - } - - talloc_free(msg); -} - -static const struct log_info_cat default_categories[] = { - [0] = { - .name = "DSCCP", - .description = "DSCP", - .enabled = 1, .loglevel = LOGL_DEBUG, - }, -}; - -static int null_flt(const struct log_context *ctx, struct log_target *target) -{ - return 1; -} - -const struct log_info log_info = { - .filter_fn = null_flt, - .cat = default_categories, - .num_cat = ARRAY_SIZE(default_categories), -}; - -int main(int argc, char **argv) -{ - struct log_target *stderr_target; - log_init(&log_info, NULL); - stderr_target = log_target_create_stderr(); - log_add_target(stderr_target); - - printf("Testing SCCP handling.\n"); - - sccp_set_log_area(0); - - test_sccp_system(); - test_sccp_send_udt(); - test_sccp_udt_communication(); - test_sccp_connection(); - test_sccp_system_crash(); - test_sccp_parsing(); - test_sccp_address(); - printf("All tests passed.\n"); - return 0; -} - -void db_store_counter(void) {} diff --git a/tests/sccp/sccp_test.ok b/tests/sccp/sccp_test.ok deleted file mode 100644 index 2b55a16..0000000 --- a/tests/sccp/sccp_test.ok +++ /dev/null @@ -1,86 +0,0 @@ -Testing SCCP handling. -Testing SCCP System -Testing packet: 0 -Testing packet: 1 -Testing packet: 2 -Testing packet: 3 -Testing packet: 4 -Testing packet: 5 -Testing packet: 6 -Testing send UDT -Testing packet: 0 -Testing packet: 1 -Testing UDT Communication. -Testing SCCP connection. -Testing 0 refuse: 1 with_data: 0 - outgoing: dstref(0) 0 -> 1 - accept: srcref(0) - outgoing: dstref(0) 1 -> 6 - income: 0 -> 6 -Testing 1 refuse: 1 with_data: 1 - outgoing: dstref(0) 0 -> 1 - accept: srcref(0) - outgoing: dstref(0) 1 -> 6 - income: 0 -> 6 -Testing 2 refuse: 0 with_data: 0 - outgoing: dstref(0) 0 -> 1 - accept: srcref(0) - outgoing: dstref(196612) 1 -> 3 - income: 0 -> 3 - Writing test data2 - incoming data: 4 - Returning data3 - outgoing data: dstref(196612) 4 - outgoing: dstref(196612) 3 -> 4 - outgoing: dstref(196612) 4 -> 5 - income: 3 -> 5 -Testing 3 refuse: 0 with_data: 1 - outgoing: dstref(0) 0 -> 1 - accept: srcref(0) - outgoing: dstref(196614) 1 -> 3 - income: 0 -> 3 - incoming data: 4 - Writing test data2 - incoming data: 4 - Returning data3 - outgoing data: dstref(196614) 4 - outgoing: dstref(196614) 3 -> 4 - outgoing: dstref(196614) 4 -> 5 - income: 3 -> 5 -Testing 4 refuse: 0 with_data: 0 - outgoing: dstref(0) 0 -> 1 - accept: srcref(0) - outgoing: dstref(196616) 1 -> 3 - income: 0 -> 3 - Writing test data2 - incoming data: 4 - Returning data3 - outgoing data: dstref(196616) 4 - income: 3 -> 4 - income: 4 -> 5 - outgoing: dstref(196616) 3 -> 5 -Testing 5 refuse: 0 with_data: 1 - outgoing: dstref(0) 0 -> 1 - accept: srcref(0) - outgoing: dstref(196618) 1 -> 3 - income: 0 -> 3 - incoming data: 4 - Writing test data2 - incoming data: 4 - Returning data3 - outgoing data: dstref(196618) 4 - income: 3 -> 4 - income: 4 -> 5 - outgoing: dstref(196618) 3 -> 5 -trying to provoke a crash with invalid input -Testing packet: 0 -Testing packet: 1 -Testing packet: 2 -Testing packet: 3 -Testing packet: 4 -Testing packet: 5 -Testing packet: 6 -survived -Test SCCP Parsing. -Test SCCP Address -All tests passed. diff --git a/tests/testsuite.at b/tests/testsuite.at index ebc43e7..ce1fd87 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -7,18 +7,6 @@ AT_CHECK([$abs_top_builddir/tests/m2ua/m2ua_test], [], [expout], [ignore]) AT_CLEANUP -AT_SETUP([mtp]) -AT_KEYWORDS([mtp]) -cat $abs_srcdir/mtp/mtp_parse_test.ok > expout -AT_CHECK([$abs_top_builddir/tests/mtp/mtp_parse_test], [], [expout], [ignore]) -AT_CLEANUP - -AT_SETUP([sccp]) -AT_KEYWORDS([sccp]) -cat $abs_srcdir/sccp/sccp_test.ok > expout -AT_CHECK([$abs_top_builddir/tests/sccp/sccp_test], [], [expout], [ignore]) -AT_CLEANUP - AT_SETUP([xua]) AT_KEYWORDS([xua]) cat $abs_srcdir/xua/xua_test.ok > expout -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/38041?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: I299a32a2f8f61477cf49c8126567fef2092d5407 Gerrit-Change-Number: 38041 Gerrit-PatchSet: 5 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-CC: pespin <pespin(a)sysmocom.de>
1 0
0 0
[XL] Change in libosmo-sccp[master]: remove old static libsccp.a, libmtp.a, libxua.a
by laforge 09 Sep '24

09 Sep '24
Attention is currently required from: pespin. laforge has posted comments on this change by laforge. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/38041?usp=email ) Change subject: remove old static libsccp.a, libmtp.a, libxua.a ...................................................................... Patch Set 5: (1 comment) Patchset: PS2: > AFAICT, our master-builds and `osmocom-build-old-tags-against-master. […] Done -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/38041?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: I299a32a2f8f61477cf49c8126567fef2092d5407 Gerrit-Change-Number: 38041 Gerrit-PatchSet: 5 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Mon, 09 Sep 2024 06:55:55 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in libosmo-netif[master]: coverity CID#216829
by neels 09 Sep '24

09 Sep '24
Attention is currently required from: fixeria, pespin. neels has posted comments on this change by neels. ( https://gerrit.osmocom.org/c/libosmo-netif/+/37992?usp=email ) Change subject: coverity CID#216829 ...................................................................... Patch Set 4: (1 comment) Patchset: PS4: While writing this patch, I came across this possible bug: https://osmocom.org/issues/6562 -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/37992?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I30beeac45ff2d8c08905986af9fabfda071ddc5b Gerrit-Change-Number: 37992 Gerrit-PatchSet: 4 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Mon, 09 Sep 2024 00:43:06 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • ...
  • 199
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.