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
[M] Change in osmo-trx[master]: contrib/jenkins: remove broken chroot + qemu code
by osmith 12 Sep '24

12 Sep '24
osmith has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/osmo-trx/+/38114?usp=email ) Change subject: contrib/jenkins: remove broken chroot + qemu code ...................................................................... contrib/jenkins: remove broken chroot + qemu code The mirror where it would download images from is not online anymore, and it looks like this whole block has not been executed in years (we always test the arm builds on native arm machines nowadays, and run all builds in docker). Replace the whole block with a simple check that ensures when arm flags are used, that the build is actually running on an arm machine. Change-Id: I2e204e4a0a7dfcf32f011ed6fb403b564f8155a7 --- M contrib/jenkins.sh 1 file changed, 13 insertions(+), 54 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/14/38114/2 -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/38114?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I2e204e4a0a7dfcf32f011ed6fb403b564f8155a7 Gerrit-Change-Number: 38114 Gerrit-PatchSet: 2 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-CC: Jenkins Builder
1 0
0 0
[XS] Change in osmo-trx[master]: contrib/jenkins: remove duplicate "set -ex"
by osmith 12 Sep '24

12 Sep '24
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-trx/+/38113?usp=email ) Change subject: contrib/jenkins: remove duplicate "set -ex" ...................................................................... contrib/jenkins: remove duplicate "set -ex" There is already a "set -ex" on top of the file, no need to set it again. Change-Id: Ia071f1f1d37cd1936d6a4001edfe2c5c335787b8 --- M contrib/jenkins.sh 1 file changed, 0 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/13/38113/1 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 73d3ffd..dc04540 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -62,8 +62,6 @@ fi fi -set -ex - if ! [ -x "$(command -v osmo-build-dep.sh)" ]; then echo "Error: We need to have scripts/osmo-deps.sh from http://git.osmocom.org/osmo-ci/ in PATH !" exit 2 -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/38113?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: Ia071f1f1d37cd1936d6a4001edfe2c5c335787b8 Gerrit-Change-Number: 38113 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-trx[master]: contrib/jenkins: remove broken chroot + qemu code
by osmith 12 Sep '24

12 Sep '24
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-trx/+/38114?usp=email ) Change subject: contrib/jenkins: remove broken chroot + qemu code ...................................................................... contrib/jenkins: remove broken chroot + qemu code The mirror where it would download images from is not online anymore, and it looks like this whole block has not been executed in years (we always test the arm builds on native arm machines nowadays, and run all builds in docker). Replace the whole block with a simple check that ensures when arm flags are used, that the build is actually running on an arm machine. Related: OS#6549 Change-Id: I2e204e4a0a7dfcf32f011ed6fb403b564f8155a7 --- M contrib/jenkins.sh 1 file changed, 13 insertions(+), 52 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/14/38114/1 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index dc04540..8aeeb41 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -9,58 +9,19 @@ # set -ex -substr() { [ -z "${2##*$1*}" ]; } - -#apt-get install qemu qemu-user-static qemu-system-arm debootstrap fakeroot proot -mychroot_nocwd() { - # LC_ALL + LANGUAGE set to avoid lots of print errors due to locale not being set inside container - # PATH is needed to be able to reach binaries like ldconfig without logging in to root, which adds the paths to PATH. - # PROOT_NO_SECCOMP is required due to proot bug #106 - LC_ALL=C LANGUAGE=C PATH="$PATH:/usr/sbin:/sbin" PROOT_NO_SECCOMP=1 proot -r "$ROOTFS" -w / -b /proc --root-id -q qemu-arm-static "$@" -} - -mychroot() { - mychroot_nocwd -w / "$@" -} - -if [ -z "${INSIDE_CHROOT}" ]; then - - # Only use ARM chroot if host is not ARM and the target is ARM: - if ! $(substr "arm" "$(uname -m)") && [ "x${INSTR}" = "x--with-neon" -o "x${INSTR}" = "x--with-neon-vfpv4" ]; then - - OSMOTRX_DIR="$PWD" # we assume we are called as contrib/jenkins.sh - ROOTFS_PREFIX="${ROOTFS_PREFIX:-$HOME}" - ROOTFS="${ROOTFS_PREFIX}/qemu-img" - mkdir -p "${ROOTFS_PREFIX}" - - # Prepare chroot: - if [ ! -d "$ROOTFS" ]; then - mkdir -p "$ROOTFS" - if [ "x${USE_DEBOOTSTRAP}" = "x1" ]; then - fakeroot qemu-debootstrap --foreign --include="linux-image-armmp-lpae" --arch=armhf stretch "$ROOTFS" http://ftp.de.debian.org/debian/ - # Hack to avoid debootstrap trying to mount /proc, as it will fail with "no permissions" and anyway proot takes care of it: - sed -i "s/setup_proc//g" "$ROOTFS/debootstrap/suite-script" - mychroot /debootstrap/debootstrap --second-stage --verbose http://ftp.de.debian.org/debian/ - else - YESTERDAY=$(python -c 'import datetime ; print((datetime.datetime.now() - datetime.timedelta(days=1)).strftime("%Y%m%d"))') - wget -nc -q "https://uk.images.linuxcontainers.org/images/debian/stretch/armhf/default/$…" - tar -xf rootfs.tar.xz -C "$ROOTFS/" || true - echo "nameserver 8.8.8.8" > "$ROOTFS/etc/resolv.conf" - fi - mychroot -b /dev apt-get update - mychroot apt-get -y install build-essential dh-autoreconf pkg-config libuhd-dev libusb-1.0-0-dev libusb-dev git libtalloc-dev libgnutls28-dev stow - fi - # Run jenkins.sh inside the chroot: - INSIDE_CHROOT=1 mychroot_nocwd \ - -w /osmo-trx \ - -b "$OSMOTRX_DIR:/osmo-trx" \ - -b "$(which osmo-clean-workspace.sh):/usr/bin/osmo-clean-workspace.sh" \ - -b "$(which osmo-build-dep.sh):/usr/bin/osmo-build-dep.sh" \ - -b "$(which osmo-deps.sh):/usr/bin/osmo-deps.sh" \ - ./contrib/jenkins.sh - exit 0 - fi -fi +case "$INSTR" in + "--with-neon"*) + case "$(arch)" in + arm*) + ;; + *) + set +x + echo "ERROR: trying to build with INSTR=$INSTR but not running on a 32-bit arm machine! (arch=$(arch))" + exit 1 + ;; + esac + ;; +esac if ! [ -x "$(command -v osmo-build-dep.sh)" ]; then echo "Error: We need to have scripts/osmo-deps.sh from http://git.osmocom.org/osmo-ci/ in PATH !" -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/38114?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I2e204e4a0a7dfcf32f011ed6fb403b564f8155a7 Gerrit-Change-Number: 38114 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-ci[master]: …gerrit/comment generate: make error more helpful
by osmith 12 Sep '24

12 Sep '24
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ci/+/38097?usp=email ) Change subject: …gerrit/comment_generate: make error more helpful ...................................................................... …gerrit/comment_generate: make error more helpful The start of a stage may also not be found if the related -build job was not deployed. This was not obvious before, add a hint to the error message. Change-Id: Iec5f4cde53b763bb6c814934abcc83e39518566f --- M scripts/jenkins-gerrit/comment_generate.py 1 file changed, 12 insertions(+), 5 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve osmith: Looks good to me, approved Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve diff --git a/scripts/jenkins-gerrit/comment_generate.py b/scripts/jenkins-gerrit/comment_generate.py index e127c4c..a2aec0e 100755 --- a/scripts/jenkins-gerrit/comment_generate.py +++ b/scripts/jenkins-gerrit/comment_generate.py @@ -6,6 +6,7 @@ import json import re import urllib.request +import sys jenkins_url = "https://jenkins.osmocom.org" re_start_build = re.compile("Starting building: gerrit-[a-zA-Z-_0-9]* #[0-9]*") @@ -94,11 +95,17 @@ if stage.startswith("comment_"): # Jobs that run this script, not relevant for summary continue - assert stage in ret, f"found result for stage {stage}, but" \ - " didn't find where it was started. The" \ - " re_start_build regex probably needs to be adjusted" \ - " to match the related gerrit-*-build job.\n\n" \ - f"ret: {ret}" + if stage not in ret: + print(f"URL: {url}") + print() + print(f"ERROR: found result for stage {stage}, but didn't" + " find where it was started. Possible reasons:") + print("* The re_stat_build regex needs to be adjusted" + " to match the related gerrit-*-build job") + print("* The gerrit-*-build job has not been deployed," + " and therefore could not be started by the" + " gerrit-* job.") + sys.exit(1) ret[stage]["passed"] = (match.group(2) == "SUCCESS") return ret -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/38097?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: Iec5f4cde53b763bb6c814934abcc83e39518566f Gerrit-Change-Number: 38097 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-ci[master]: …gerrit/comment generate: make error more helpful
by osmith 12 Sep '24

12 Sep '24
Attention is currently required from: fixeria. osmith has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/osmo-ci/+/38097?usp=email ) Change subject: …gerrit/comment_generate: make error more helpful ...................................................................... Patch Set 1: Code-Review+2 (1 comment) File scripts/jenkins-gerrit/comment_generate.py: https://gerrit.osmocom.org/c/osmo-ci/+/38097/comment/18c2511a_ee801563?usp=… : PS1, Line 99: print > Maybe use a multi-line f-string here? […] AFAIK this can't be used without losing indentation, so I'll keep it as is. -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/38097?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: Iec5f4cde53b763bb6c814934abcc83e39518566f Gerrit-Change-Number: 38097 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Thu, 12 Sep 2024 07:30:19 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-ci[master]: gerrit-verifications,master-builds: Add pyosmocom
by osmith 12 Sep '24

12 Sep '24
Attention is currently required from: laforge, pespin. osmith has posted comments on this change by laforge. ( https://gerrit.osmocom.org/c/osmo-ci/+/38024?usp=email ) Change subject: gerrit-verifications,master-builds: Add pyosmocom ...................................................................... Patch Set 5: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/38024?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: I9ec289f8d3116bbc8291298146c58d0209684439 Gerrit-Change-Number: 38024 Gerrit-PatchSet: 5 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Thu, 12 Sep 2024 07:28:16 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in osmo-hlr[master]: RFC: add gsup_client_mux from osmo-msc
by lynxis lazus 12 Sep '24

12 Sep '24
Attention is currently required from: laforge, lynxis lazus. Hello Jenkins Builder, laforge, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-hlr/+/38112?usp=email to look at the new patch set (#2). Change subject: RFC: add gsup_client_mux from osmo-msc ...................................................................... RFC: add gsup_client_mux from osmo-msc To mux multiple clients into a single gsup connection. Change license to LGPL? The libvlr is using it, but it seems a good idea to merge it into gsupclient. Change-Id: I916c1bb6cfc48f92fc5db2b5c914eb1b4e25fa7f --- M include/Makefile.am A include/osmocom/gsupclient/gsup_client_mux.h M src/gsupclient/Makefile.am A src/gsupclient/gsup_client_mux.c 4 files changed, 227 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/12/38112/2 -- To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/38112?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Change-Id: I916c1bb6cfc48f92fc5db2b5c914eb1b4e25fa7f Gerrit-Change-Number: 38112 Gerrit-PatchSet: 2 Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu>
1 0
0 0
[M] Change in osmo-hlr[master]: RFC: add gsup_client_mux from osmo-msc
by lynxis lazus 12 Sep '24

12 Sep '24
Attention is currently required from: laforge. lynxis lazus has posted comments on this change by lynxis lazus. ( https://gerrit.osmocom.org/c/osmo-hlr/+/38112?usp=email ) Change subject: RFC: add gsup_client_mux from osmo-msc ...................................................................... Patch Set 1: (1 comment) File src/gsupclient/gsup_client_mux.c: https://gerrit.osmocom.org/c/osmo-hlr/+/38112/comment/370d8452_f93be5fc?usp… : PS1, Line 8: * SPDX-License-Identifier: AGPL-3.0+ Change license to GPLv2? LGPL? -- To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/38112?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Change-Id: I916c1bb6cfc48f92fc5db2b5c914eb1b4e25fa7f Gerrit-Change-Number: 38112 Gerrit-PatchSet: 1 Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-CC: Jenkins Builder Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Thu, 12 Sep 2024 01:27:46 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No
1 0
0 0
[M] Change in osmo-hlr[master]: RFC: add gsup_client_mux from osmo-msc
by Jenkins Builder 12 Sep '24

12 Sep '24
Jenkins Builder has posted comments on this change by lynxis lazus. ( https://gerrit.osmocom.org/c/osmo-hlr/+/38112?usp=email ) Change subject: RFC: add gsup_client_mux from osmo-msc ...................................................................... Patch Set 1: (3 comments) File include/osmocom/gsupclient/gsup_client_mux.h: Robot Comment from checkpatch (run ID jenkins-gerrit-lint-18480): https://gerrit.osmocom.org/c/osmo-hlr/+/38112/comment/c9ddf4dc_21075bbf?usp… : PS1, Line 9: int (* func )(struct gsup_client_mux *gcm, void *data, const struct osmo_gsup_message *gsup_msg); Unnecessary space before function pointer name Robot Comment from checkpatch (run ID jenkins-gerrit-lint-18480): https://gerrit.osmocom.org/c/osmo-hlr/+/38112/comment/fc64d02c_bc7acbd8?usp… : PS1, Line 9: int (* func )(struct gsup_client_mux *gcm, void *data, const struct osmo_gsup_message *gsup_msg); Unnecessary space after function pointer name Robot Comment from checkpatch (run ID jenkins-gerrit-lint-18480): https://gerrit.osmocom.org/c/osmo-hlr/+/38112/comment/45d51e25_89421e5e?usp… : PS1, Line 9: int (* func )(struct gsup_client_mux *gcm, void *data, const struct osmo_gsup_message *gsup_msg); space prohibited before that close parenthesis ')' -- To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/38112?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Change-Id: I916c1bb6cfc48f92fc5db2b5c914eb1b4e25fa7f Gerrit-Change-Number: 38112 Gerrit-PatchSet: 1 Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu> Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Thu, 12 Sep 2024 01:26:48 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No
1 0
0 0
[M] Change in osmo-hlr[master]: RFC: add gsup_client_mux from osmo-msc
by lynxis lazus 12 Sep '24

12 Sep '24
lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hlr/+/38112?usp=email ) Change subject: RFC: add gsup_client_mux from osmo-msc ...................................................................... RFC: add gsup_client_mux from osmo-msc To mux multiple clients into a single gsup connection. Change license to LGPL? Change-Id: I916c1bb6cfc48f92fc5db2b5c914eb1b4e25fa7f --- M include/Makefile.am A include/osmocom/gsupclient/gsup_client_mux.h M src/gsupclient/Makefile.am A src/gsupclient/gsup_client_mux.c 4 files changed, 227 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/12/38112/1 diff --git a/include/Makefile.am b/include/Makefile.am index e93fe29..f3baca6 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -3,6 +3,7 @@ nobase_include_HEADERS = \ osmocom/gsupclient/cni_peer_id.h \ osmocom/gsupclient/gsup_client.h \ + osmocom/gsupclient/gsup_client_mux.h \ osmocom/gsupclient/gsup_req.h \ osmocom/mslookup/mdns.h \ osmocom/mslookup/mdns_sock.h \ diff --git a/include/osmocom/gsupclient/gsup_client_mux.h b/include/osmocom/gsupclient/gsup_client_mux.h new file mode 100644 index 0000000..f327786 --- /dev/null +++ b/include/osmocom/gsupclient/gsup_client_mux.h @@ -0,0 +1,34 @@ +#pragma once + +#include <osmocom/gsm/gsup.h> + +struct gsup_client_mux; +struct ipaccess_unit; + +struct gsup_client_mux_rx_cb { + int (* func )(struct gsup_client_mux *gcm, void *data, const struct osmo_gsup_message *gsup_msg); + void *data; +}; + +/* A GSUP client shared between code paths for various GSUP Message Classes. + * The main task is to dispatch GSUP messages to code paths corresponding to the respective Message Class, i.e. + * subscriber management, SMS, SS/USSD and inter-MSC messaging. + * If a GSUP Message Class IE is present in the message, the received message is dispatched directly to the rx_cb entry + * for that Message Class. Otherwise, the Message Class is determined by a switch() on the Message Type.*/ +struct gsup_client_mux { + struct osmo_gsup_client *gsup_client; + + /* Target clients by enum osmo_gsup_message_class */ + struct gsup_client_mux_rx_cb rx_cb[OSMO_GSUP_MESSAGE_CLASS_ARRAYSIZE]; +}; + +struct gsup_client_mux *gsup_client_mux_alloc(void *talloc_ctx); +int gsup_client_mux_start(struct gsup_client_mux *gcm, const char *gsup_server_addr_str, uint16_t gsup_server_port, + struct ipaccess_unit *ipa_dev); + +int gsup_client_mux_tx(struct gsup_client_mux *gcm, const struct osmo_gsup_message *gsup_msg); +void gsup_client_mux_tx_set_source(const struct gsup_client_mux *gcm, struct osmo_gsup_message *gsup_msg); +void gsup_client_mux_tx_error_reply(struct gsup_client_mux *gcm, const struct osmo_gsup_message *gsup_orig, + enum gsm48_gmm_cause cause); + +int gsup_client_mux_rx(struct osmo_gsup_client *gsup_client, struct msgb *msg); diff --git a/src/gsupclient/Makefile.am b/src/gsupclient/Makefile.am index a627ccc..ab9c478 100644 --- a/src/gsupclient/Makefile.am +++ b/src/gsupclient/Makefile.am @@ -11,6 +11,7 @@ libosmo_gsup_client_la_SOURCES = \ cni_peer_id.c \ gsup_client.c \ + gsup_client_mux.c \ gsup_req.c \ $(NULL) diff --git a/src/gsupclient/gsup_client_mux.c b/src/gsupclient/gsup_client_mux.c new file mode 100644 index 0000000..943ba2c --- /dev/null +++ b/src/gsupclient/gsup_client_mux.c @@ -0,0 +1,191 @@ +/* Directing individual GSUP messages to their respective handlers. */ +/* + * (C) 2019 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * All Rights Reserved + * + * Author: Neels Hofmeyr + * + * SPDX-License-Identifier: AGPL-3.0+ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 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 Affero General Public License for more details. + */ +#include <errno.h> + +#include <osmocom/core/logging.h> + +#include <osmocom/gsupclient/gsup_client.h> +#include <osmocom/gsupclient/gsup_client_mux.h> + +static enum osmo_gsup_message_class gsup_client_mux_classify(struct gsup_client_mux *gcm, + const struct osmo_gsup_message *gsup_msg) +{ + if (gsup_msg->message_class) + return gsup_msg->message_class; + + LOGP(DLGSUP, LOGL_DEBUG, "No explicit GSUP Message Class, trying to guess from message type %s\n", + osmo_gsup_message_type_name(gsup_msg->message_type)); + + switch (gsup_msg->message_type) { + case OSMO_GSUP_MSGT_PROC_SS_REQUEST: + case OSMO_GSUP_MSGT_PROC_SS_RESULT: + case OSMO_GSUP_MSGT_PROC_SS_ERROR: + return OSMO_GSUP_MESSAGE_CLASS_USSD; + + /* GSM 04.11 code implementing MO SMS */ + case OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR: + case OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT: + case OSMO_GSUP_MSGT_READY_FOR_SM_ERROR: + case OSMO_GSUP_MSGT_READY_FOR_SM_RESULT: + case OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST: + return OSMO_GSUP_MESSAGE_CLASS_SMS; + + default: + return OSMO_GSUP_MESSAGE_CLASS_SUBSCRIBER_MANAGEMENT; + } +} + +/* Non-static for unit tests */ +int gsup_client_mux_rx(struct osmo_gsup_client *gsup_client, struct msgb *msg) +{ + struct gsup_client_mux *gcm = gsup_client->data; + struct osmo_gsup_message gsup; + enum osmo_gsup_message_class message_class; + int rc; + + rc = osmo_gsup_decode(msgb_l2(msg), msgb_l2len(msg), &gsup); + if (rc < 0) { + LOGP(DLGSUP, LOGL_ERROR, "Failed to decode GSUP message: '%s' (%d) [ %s]\n", + get_value_string(gsm48_gmm_cause_names, -rc), -rc, osmo_hexdump(msg->data, msg->len)); + goto msgb_free_and_return; + } + + if (!gsup.imsi[0]) { + LOGP(DLGSUP, LOGL_ERROR, "Failed to decode GSUP message: missing IMSI\n"); + if (OSMO_GSUP_IS_MSGT_REQUEST(gsup.message_type)) + gsup_client_mux_tx_error_reply(gcm, &gsup, GMM_CAUSE_INV_MAND_INFO); + rc = -GMM_CAUSE_INV_MAND_INFO; + goto msgb_free_and_return; + } + + message_class = gsup_client_mux_classify(gcm, &gsup); + + if (message_class <= OSMO_GSUP_MESSAGE_CLASS_UNSET || message_class >= ARRAY_SIZE(gcm->rx_cb)) { + LOGP(DLGSUP, LOGL_ERROR, "Failed to classify GSUP message target\n"); + rc = -EINVAL; + goto msgb_free_and_return; + } + + if (!gcm->rx_cb[message_class].func) { + LOGP(DLGSUP, LOGL_ERROR, "No receiver set up for GSUP Message Class %s\n", osmo_gsup_message_class_name(message_class)); + rc = -ENOTSUP; + goto msgb_free_and_return; + } + + rc = gcm->rx_cb[message_class].func(gcm, gcm->rx_cb[message_class].data, &gsup); + +msgb_free_and_return: + msgb_free(msg); + return rc; +} + +/* Make it clear that struct gsup_client_mux should be talloc allocated, so that it can be used as talloc parent. */ +struct gsup_client_mux *gsup_client_mux_alloc(void *talloc_ctx) +{ + return talloc_zero(talloc_ctx, struct gsup_client_mux); +} + +/* Start a GSUP client to serve this gsup_client_mux. */ +int gsup_client_mux_start(struct gsup_client_mux *gcm, const char *gsup_server_addr_str, uint16_t gsup_server_port, + struct ipaccess_unit *ipa_dev) +{ + gcm->gsup_client = osmo_gsup_client_create2(gcm, ipa_dev, + gsup_server_addr_str, + gsup_server_port, + &gsup_client_mux_rx, NULL); + if (!gcm->gsup_client) + return -ENOMEM; + gcm->gsup_client->data = gcm; + return 0; +} + +int gsup_client_mux_tx(struct gsup_client_mux *gcm, const struct osmo_gsup_message *gsup_msg) +{ + struct msgb *msg; + int rc; + + if (!gcm || !gcm->gsup_client) { + LOGP(DLGSUP, LOGL_ERROR, "GSUP link is down, cannot send GSUP message\n"); + return -ENOTSUP; + } + + msg = osmo_gsup_client_msgb_alloc(); + rc = osmo_gsup_encode(msg, gsup_msg); + if (rc < 0) { + LOGP(DLGSUP, LOGL_ERROR, "Failed to encode GSUP message: '%s'\n", strerror(-rc)); + return rc; + } + + return osmo_gsup_client_send(gcm->gsup_client, msg); +} + +/* Set GSUP source_name to our local IPA name */ +void gsup_client_mux_tx_set_source(const struct gsup_client_mux *gcm, + struct osmo_gsup_message *gsup_msg) +{ + const char *local_msc_name; + + if (!gcm) + return; + if (!gcm->gsup_client) + return; + if (!gcm->gsup_client->ipa_dev) + return; + local_msc_name = gcm->gsup_client->ipa_dev->serno; + if (!local_msc_name) + return; + gsup_msg->source_name = (const uint8_t *) local_msc_name; + gsup_msg->source_name_len = strlen(local_msc_name) + 1; +} + +/* Transmit GSUP error in response to original message */ +void gsup_client_mux_tx_error_reply(struct gsup_client_mux *gcm, const struct osmo_gsup_message *gsup_orig, + enum gsm48_gmm_cause cause) +{ + struct osmo_gsup_message gsup_reply; + + /* No need to answer if we couldn't parse an ERROR message type, only REQUESTs need an error reply. */ + if (!OSMO_GSUP_IS_MSGT_REQUEST(gsup_orig->message_type)) + return; + + gsup_reply = (struct osmo_gsup_message){ + .cause = cause, + .message_type = OSMO_GSUP_TO_MSGT_ERROR(gsup_orig->message_type), + .message_class = gsup_orig->message_class, + .destination_name = gsup_orig->source_name, + .destination_name_len = gsup_orig->source_name_len, + + /* RP-Message-Reference is mandatory for SM Service */ + .sm_rp_mr = gsup_orig->sm_rp_mr, + }; + + OSMO_STRLCPY_ARRAY(gsup_reply.imsi, gsup_orig->imsi); + gsup_client_mux_tx_set_source(gcm, &gsup_reply); + + /* For SS/USSD, it's important to keep both session state and ID IEs */ + if (gsup_orig->session_state != OSMO_GSUP_SESSION_STATE_NONE) { + gsup_reply.session_state = OSMO_GSUP_SESSION_STATE_END; + gsup_reply.session_id = gsup_orig->session_id; + } + + if (osmo_gsup_client_enc_send(gcm->gsup_client, &gsup_reply)) + LOGP(DLGSUP, LOGL_ERROR, "Failed to send Error reply (imsi=%s)\n", + osmo_quote_str(gsup_orig->imsi, -1)); +} -- To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/38112?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Change-Id: I916c1bb6cfc48f92fc5db2b5c914eb1b4e25fa7f Gerrit-Change-Number: 38112 Gerrit-PatchSet: 1 Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • ...
  • 199
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.