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

November 2024

  • 1 participants
  • 2209 discussions
[XS] Change in libosmocore[master]: gsm 04.08: add P-TMSI type values
by pespin 05 Nov '24

05 Nov '24
Attention is currently required from: lynxis lazus. pespin has posted comments on this change by lynxis lazus. ( https://gerrit.osmocom.org/c/libosmocore/+/38631?usp=email ) Change subject: gsm 04.08: add P-TMSI type values ...................................................................... Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/38631?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: If996ccf48781f9dc8872f314f327b89a51f5a312 Gerrit-Change-Number: 38631 Gerrit-PatchSet: 2 Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Tue, 05 Nov 2024 10:59:57 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in libosmocore[master]: gsm 04.08: add P-TMSI type values
by daniel 05 Nov '24

05 Nov '24
Attention is currently required from: lynxis lazus. daniel has posted comments on this change by lynxis lazus. ( https://gerrit.osmocom.org/c/libosmocore/+/38631?usp=email ) Change subject: gsm 04.08: add P-TMSI type values ...................................................................... Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/38631?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: If996ccf48781f9dc8872f314f327b89a51f5a312 Gerrit-Change-Number: 38631 Gerrit-PatchSet: 2 Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Tue, 05 Nov 2024 10:59:43 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in libosmocore[master]: gsm 04.08: add GSM48 IE GMM_ADD_IDENTITY/RAI2
by pespin 05 Nov '24

05 Nov '24
Attention is currently required from: lynxis lazus. pespin has posted comments on this change by lynxis lazus. ( https://gerrit.osmocom.org/c/libosmocore/+/38630?usp=email ) Change subject: gsm 04.08: add GSM48 IE GMM_ADD_IDENTITY/RAI2 ...................................................................... Patch Set 1: (1 comment) Patchset: PS1: Feel free to merge once you fix the reference issue spotted by daniel. -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/38630?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I1861bae4b9c89a19500322de5670df1d46a6cd81 Gerrit-Change-Number: 38630 Gerrit-PatchSet: 1 Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Tue, 05 Nov 2024 10:59:34 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No
1 0
0 0
[XS] Change in libosmocore[master]: gsm 04.08: add P-TMSI type values
by lynxis lazus 05 Nov '24

05 Nov '24
Attention is currently required from: lynxis lazus. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmocore/+/38631?usp=email to look at the new patch set (#2). The following approvals got outdated and were removed: Verified-1 by Jenkins Builder Change subject: gsm 04.08: add P-TMSI type values ...................................................................... gsm 04.08: add P-TMSI type values Change-Id: If996ccf48781f9dc8872f314f327b89a51f5a312 --- M include/osmocom/gsm/protocol/gsm_04_08_gprs.h 1 file changed, 7 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/31/38631/2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/38631?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: If996ccf48781f9dc8872f314f327b89a51f5a312 Gerrit-Change-Number: 38631 Gerrit-PatchSet: 2 Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu>
1 0
0 0
[XS] Change in libosmocore[master]: gsm 04.08: add GSM48 IE GMM_ADD_IDENTITY/RAI2
by daniel 05 Nov '24

05 Nov '24
Attention is currently required from: lynxis lazus. daniel has posted comments on this change by lynxis lazus. ( https://gerrit.osmocom.org/c/libosmocore/+/38630?usp=email ) Change subject: gsm 04.08: add GSM48 IE GMM_ADD_IDENTITY/RAI2 ...................................................................... Patch Set 1: Code-Review+1 (1 comment) File include/osmocom/gsm/protocol/gsm_04_08_gprs.h: https://gerrit.osmocom.org/c/libosmocore/+/38630/comment/ff818f58_cc56feff?… : PS1, Line 90: 10.5.5.4 10.5.1.4 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/38630?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I1861bae4b9c89a19500322de5670df1d46a6cd81 Gerrit-Change-Number: 38630 Gerrit-PatchSet: 1 Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Tue, 05 Nov 2024 10:56:15 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in osmo-hlr[master]: gsupclient: add missing SPDX line
by lynxis lazus 05 Nov '24

05 Nov '24
lynxis lazus has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hlr/+/38422?usp=email ) Change subject: gsupclient: add missing SPDX line ...................................................................... gsupclient: add missing SPDX line SPDX is a spec to describe the license of a file in a machine readable format. Change-Id: Iaded691cc0eb2f5dd85efd1915ddef1a747fe518 --- M src/gsupclient/cni_peer_id.c M src/gsupclient/gsup_client.c M src/gsupclient/gsup_req.c 3 files changed, 6 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/src/gsupclient/cni_peer_id.c b/src/gsupclient/cni_peer_id.c index ab36959..c4a31b6 100644 --- a/src/gsupclient/cni_peer_id.c +++ b/src/gsupclient/cni_peer_id.c @@ -2,6 +2,8 @@ * * All Rights Reserved * + * SPDX-License-Identifier: GPL-2.0-or-later + * * 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 diff --git a/src/gsupclient/gsup_client.c b/src/gsupclient/gsup_client.c index 4041366..3329361 100644 --- a/src/gsupclient/gsup_client.c +++ b/src/gsupclient/gsup_client.c @@ -6,6 +6,8 @@ * Author: Jacob Erlbeck * Author: Neels Hofmeyr * + * SPDX-License-Identifier: GPL-2.0-or-later + * * 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 diff --git a/src/gsupclient/gsup_req.c b/src/gsupclient/gsup_req.c index 2e7caf1..bde002e 100644 --- a/src/gsupclient/gsup_req.c +++ b/src/gsupclient/gsup_req.c @@ -2,6 +2,8 @@ * * All Rights Reserved * + * SPDX-License-Identifier: GPL-2.0-or-later + * * 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 -- To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/38422?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Change-Id: Iaded691cc0eb2f5dd85efd1915ddef1a747fe518 Gerrit-Change-Number: 38422 Gerrit-PatchSet: 1 Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-hlr[master]: debian/copyright: add gsup_client under GPLv2+
by lynxis lazus 05 Nov '24

05 Nov '24
lynxis lazus has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hlr/+/38423?usp=email ) Change subject: debian/copyright: add gsup_client under GPLv2+ ...................................................................... debian/copyright: add gsup_client under GPLv2+ Change-Id: Idddcd6356af76987bf57ecd21096299cb2ba896f --- M debian/copyright 1 file changed, 18 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve diff --git a/debian/copyright b/debian/copyright index 374c9a2..b66ed88 100644 --- a/debian/copyright +++ b/debian/copyright @@ -6,6 +6,10 @@ Copyright: 2016-2022 Sysmocom s. f. m. c. GmbH <info(a)sysmocom.de> License: AGPL-3+ +Files: src/gsupclient/* +Copyright: 2014-2016,2019 by sysmocom s.f.m.c. GmbH <info(a)sysmocom.de> +License: GPL-2+ + License: AGPL-3+ 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 @@ -19,3 +23,17 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. + +License: GPL-2+ + 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. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. -- To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/38423?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Change-Id: Idddcd6356af76987bf57ecd21096299cb2ba896f Gerrit-Change-Number: 38423 Gerrit-PatchSet: 1 Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[L] Change in osmo-hlr[master]: gsupclient: Introduce gsup_client_mux
by lynxis lazus 05 Nov '24

05 Nov '24
lynxis lazus has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hlr/+/38112?usp=email ) Change subject: gsupclient: Introduce gsup_client_mux ...................................................................... gsupclient: Introduce gsup_client_mux GSUP supports different message classes (e.g. SMS, USSD, Subscriber management), within a daemon, the messages are usually handled in different parts of it. The gsup client mux allow to place callbacks for the different message class. This code original comes from the osmo-msc code and is here re-licensed under the GPLv2. 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, 252 insertions(+), 0 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve fixeria: Looks good to me, but someone else must approve lynxis lazus: Looks good to me, approved Jenkins Builder: Verified 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..537ae60 --- /dev/null +++ b/include/osmocom/gsupclient/gsup_client_mux.h @@ -0,0 +1,56 @@ +/* + * (C) 2019 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * All Rights Reserved + * + * Author: Neels Hofmeyr + * + * SPDX-License-Identifier: GPL-2.0-or-later + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#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..7699ca1 --- /dev/null +++ b/src/gsupclient/gsup_client_mux.c @@ -0,0 +1,194 @@ +/* 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: GPL-2.0-or-later + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#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: merged Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Change-Id: I916c1bb6cfc48f92fc5db2b5c914eb1b4e25fa7f Gerrit-Change-Number: 38112 Gerrit-PatchSet: 5 Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-upf[master]: osmo-upf: add VTY 'gtp-echo' command
by osmith 05 Nov '24

05 Nov '24
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-upf/+/37830?usp=email ) Change subject: osmo-upf: add VTY 'gtp-echo' command ...................................................................... osmo-upf: add VTY 'gtp-echo' command Allow sending GTPv1-U Echo Requests to GTP peers via new VTY command gtp1u-echo send to (A.B.C.D|X:X::X:X) gtp1u-echo send to (A.B.C.D|X:X::X:X) local-ip (A.B.C.D|X:X::X:X) gtp1u-echo send to (A.B.C.D|X:X::X:X) local-dev DEV_NAME Related: OS#6541 Tweaked-by: Oliver Smith <osmith(a)sysmocom.de> Change-Id: I970dccd7a27b098eea9e660822e24e2c4b059fc6 --- M include/osmocom/upf/upf.h M include/osmocom/upf/upf_gtpu_echo.h M src/osmo-upf/upf_gtpu_echo.c M src/osmo-upf/upf_vty.c A tests/gtp-echo.vty 5 files changed, 184 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve diff --git a/include/osmocom/upf/upf.h b/include/osmocom/upf/upf.h index 145567b..d558600 100644 --- a/include/osmocom/upf/upf.h +++ b/include/osmocom/upf/upf.h @@ -118,6 +118,7 @@ struct { uint32_t next_local_teid_state; + uint16_t next_echo_seq_nr; } gtp; struct llist_head netinst; diff --git a/include/osmocom/upf/upf_gtpu_echo.h b/include/osmocom/upf/upf_gtpu_echo.h index 2575424..2bb7c31 100644 --- a/include/osmocom/upf/upf_gtpu_echo.h +++ b/include/osmocom/upf/upf_gtpu_echo.h @@ -2,3 +2,4 @@ #pragma once int upf_gtpu_echo_setup(struct upf_gtp_dev *dev); +int upf_gtpu_echo_req_tx(struct upf_gtp_dev *dev, const struct osmo_sockaddr *remote, uint16_t seq_nr); diff --git a/src/osmo-upf/upf_gtpu_echo.c b/src/osmo-upf/upf_gtpu_echo.c index b234065..f4bbb76 100644 --- a/src/osmo-upf/upf_gtpu_echo.c +++ b/src/osmo-upf/upf_gtpu_echo.c @@ -122,6 +122,43 @@ return rc; } +int upf_gtpu_echo_req_tx(struct upf_gtp_dev *dev, const struct osmo_sockaddr *remote, uint16_t seq_nr) +{ + struct gtp1u_hdr *tx_h; + int rc; + uint8_t msgbuf[sizeof(struct gtp1u_hdr) + 2]; + + tx_h = (void *)msgbuf; + *tx_h = (struct gtp1u_hdr){ + /* 3GPP TS 29.281 5.1 defines that the ECHO REQ & RESP shall contain a sequence nr */ + .s = 1, + .pt = 1, + .version = 1, + .msg_type = GTP1U_MSGTYPE_ECHO_REQ, + .ext = { + .seq_nr = seq_nr, + }, + }; + + /* ECHO REQUEST shall contain a recovery counter */ + tx_h->data2[0] = GTP1U_IEI_RECOVERY; + tx_h->data2[1] = g_upf->tunend.recovery_count; + + osmo_store16be(sizeof(msgbuf) - offsetof(struct gtp1u_hdr, data1), &tx_h->length); + + rc = sendto(dev->gtpv1.ofd.fd, msgbuf, sizeof(msgbuf), 0, &remote->u.sa, sizeof(*remote)); + if (rc < 0) { + rc = -errno; + LOG_GTP_DEV(dev, LOGL_ERROR, "GTP1-U sendto(len=%zu, to=%s): %s\n", sizeof(msgbuf), + osmo_sockaddr_to_str(remote), strerror(-rc)); + } else { + rc = 0; + } + LOG_GTP_DEV(dev, LOGL_INFO, "<- %s: tx GTP1-U Echo Request: seq_nr=%u recovery_count=%u\n", + osmo_sockaddr_to_str(remote), seq_nr, g_upf->tunend.recovery_count); + return rc; +} + int upf_gtpu_echo_read_cb(struct osmo_fd *ofd, unsigned int what) { struct upf_gtp_dev *dev = ofd->data; diff --git a/src/osmo-upf/upf_vty.c b/src/osmo-upf/upf_vty.c index 44d14db..9c5f7f0 100644 --- a/src/osmo-upf/upf_vty.c +++ b/src/osmo-upf/upf_vty.c @@ -38,6 +38,7 @@ #include <osmocom/upf/up_session.h> #include <osmocom/upf/up_gtp_action.h> #include <osmocom/upf/netinst.h> +#include <osmocom/upf/upf_gtpu_echo.h> enum upf_vty_node { PFCP_NODE = _LAST_OSMOVTY_NODE + 1, @@ -486,6 +487,105 @@ return CMD_SUCCESS; } +/* variant: + * 0 "gtp1u-echo send to (A.B.C.D|X:X::X:X)" + * 1 "gtp1u-echo send to (A.B.C.D|X:X::X:X) local-ip (A.B.C.D|X:X::X:X)" + * 2 "gtp1u-echo send to (A.B.C.D|X:X::X:X) local-dev DEV_NAME" + */ +static int _gtp_echo_tx(struct vty *vty, int variant, int argc, const char **argv) +{ + struct osmo_sockaddr_str addr; + struct osmo_sockaddr osa_remote; + struct osmo_sockaddr osa_local; + struct upf_gtp_dev *gtp_dev = NULL; + const char *remote_str = argv[0]; + const char *local_str = NULL; + if (argc > 1) + local_str = argv[1]; + + /* GTP can be received on port 2152 only, i.e. the remote port must be 2152. (The sending port is allowed to + * differ). */ + if (osmo_sockaddr_str_from_str(&addr, remote_str, 2152) + || osmo_sockaddr_str_to_osa(&addr, &osa_remote)) { + vty_out(vty, "%% Error: cannot send Echo: invalid IP address: %s%s", + osmo_quote_str(remote_str, -1), VTY_NEWLINE); + return CMD_WARNING; + } + + switch (variant) { + case 0: + gtp_dev = llist_first_entry_or_null(&g_upf->tunend.devs, struct upf_gtp_dev, entry); + if (!gtp_dev) { + vty_out(vty, "%% Error: cannot send Echo: there is no GTP device%s", + VTY_NEWLINE); + return CMD_WARNING; + } + break; + case 1: + if (osmo_sockaddr_str_from_str(&addr, local_str, 2152) + || osmo_sockaddr_str_to_osa(&addr, &osa_local)) { + vty_out(vty, "%% Error: cannot send Echo: invalid IP address: %s%s", + osmo_quote_str(local_str, -1), VTY_NEWLINE); + return CMD_WARNING; + } + gtp_dev = upf_gtp_dev_find_by_local_addr(&osa_local); + if (!gtp_dev) { + vty_out(vty, "%% Error: cannot send Echo: this does not seem to be a locally bound GTP address: %s%s", + osmo_sockaddr_to_str_c(OTC_SELECT, &osa_local), VTY_NEWLINE); + return CMD_WARNING; + } + break; + case 2: + gtp_dev = upf_gtp_dev_find_by_name(local_str); + if (!gtp_dev) { + vty_out(vty, "%% Error: cannot send Echo: there is no GTP device by the name of '%s'%s", + local_str, VTY_NEWLINE); + return CMD_WARNING; + } + break; + } + OSMO_ASSERT(gtp_dev); + + if (upf_gtpu_echo_req_tx(gtp_dev, &osa_remote, g_upf->gtp.next_echo_seq_nr++)) { + vty_out(vty, "%% Error: Failed to transmit Echo Request (see DGTP logging)%s", VTY_NEWLINE); + return CMD_WARNING; + } + vty_out(vty, "%s -> %s tx Echo Request; for responses, see DGTP logging level INFO%s", + gtp_dev->name, osmo_sockaddr_to_str_c(OTC_SELECT, &osa_remote), VTY_NEWLINE); + return CMD_SUCCESS; +} + +#define IP46_STR "IPv4 address\nIPv6 address\n" +#define GTP_ECHO_TX_STR \ + "GTP1-U Echo probing\n" \ + "Send a GTP1-U Echo Request to a remote peer\n" \ + "Send to remote peer's GTP address\n" IP46_STR + +DEFUN(gtp_echo_tx, gtp_echo_tx_cmd, + "gtp1u-echo send to " VTY_IPV46_CMD, + GTP_ECHO_TX_STR) +{ + return _gtp_echo_tx(vty, 0, argc, argv); +} + +DEFUN(gtp_echo_tx_local_ip, gtp_echo_tx_local_ip_cmd, + "gtp1u-echo send to " VTY_IPV46_CMD " local-ip " VTY_IPV46_CMD, + GTP_ECHO_TX_STR + "Send from local GTP device, chosen by IP address\n" + IP46_STR) +{ + return _gtp_echo_tx(vty, 1, argc, argv); +} + +DEFUN(gtp_echo_tx_local_dev, gtp_echo_tx_local_dev_cmd, + "gtp1u-echo send to " VTY_IPV46_CMD " local-dev DEV_NAME", + GTP_ECHO_TX_STR + "Send from local GTP device, chosen by name as configured in 'dev create' or 'dev use'.\n" + "A GTP device name as it appears in the cfg\n") +{ + return _gtp_echo_tx(vty, 2, argc, argv); +} + void upf_vty_init() { OSMO_ASSERT(g_upf != NULL); @@ -495,6 +595,9 @@ install_element_ve(&show_session_cmd); install_element_ve(&show_netinst_cmd); install_element_ve(&show_nft_rule_append_cmd); + install_element_ve(&gtp_echo_tx_cmd); + install_element_ve(&gtp_echo_tx_local_ip_cmd); + install_element_ve(&gtp_echo_tx_local_dev_cmd); install_node(&cfg_pfcp_node, config_write_pfcp); install_element(CONFIG_NODE, &cfg_pfcp_cmd); diff --git a/tests/gtp-echo.vty b/tests/gtp-echo.vty new file mode 100644 index 0000000..e8ffa9c --- /dev/null +++ b/tests/gtp-echo.vty @@ -0,0 +1,42 @@ +OsmoUPF> list +... + gtp1u-echo send to (A.B.C.D|X:X::X:X) + gtp1u-echo send to (A.B.C.D|X:X::X:X) local-ip (A.B.C.D|X:X::X:X) + gtp1u-echo send to (A.B.C.D|X:X::X:X) local-dev DEV_NAME +... +OsmoUPF> enable +OsmoUPF# list +... + gtp1u-echo send to (A.B.C.D|X:X::X:X) + gtp1u-echo send to (A.B.C.D|X:X::X:X) local-ip (A.B.C.D|X:X::X:X) + gtp1u-echo send to (A.B.C.D|X:X::X:X) local-dev DEV_NAME +... +OsmoUPF# configure terminal +OsmoUPF(config)# list +... !gtp1u-echo +OsmoUPF(config)# end + +OsmoUPF# gtp1u-echo? + gtp1u-echo GTP1-U Echo probing +OsmoUPF# gtp1u-echo ? + send Send a GTP1-U Echo Request to a remote peer +OsmoUPF# gtp1u-echo send ? + to Send to remote peer's GTP address +OsmoUPF# gtp1u-echo send to ? + A.B.C.D IPv4 address + X:X::X:X IPv6 address +OsmoUPF# gtp1u-echo send to 1.2.3.4 ? + local-ip Send from local GTP device, chosen by IP address + local-dev Send from local GTP device, chosen by name as configured in 'dev create' or 'dev use'. + <cr> +OsmoUPF# gtp1u-echo send to 1.2.3.4 local-ip ? + A.B.C.D IPv4 address + X:X::X:X IPv6 address +OsmoUPF# gtp1u-echo send to 1.2.3.4 local-dev ? + DEV_NAME A GTP device name as it appears in the cfg +OsmoUPF# gtp1u-echo send to 1.2.3.4 +% Error: cannot send Echo: there is no GTP device +OsmoUPF# gtp1u-echo send to 1.2.3.4 local-ip 1.2.3.4 +% Error: cannot send Echo: this does not seem to be a locally bound GTP address: 1.2.3.4:2152 +OsmoUPF# gtp1u-echo send to 1.2.3.4 local-dev apn0 +% Error: cannot send Echo: there is no GTP device by the name of 'apn0' -- To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/37830?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-upf Gerrit-Branch: master Gerrit-Change-Id: I970dccd7a27b098eea9e660822e24e2c4b059fc6 Gerrit-Change-Number: 37830 Gerrit-PatchSet: 6 Gerrit-Owner: neels <nhofmeyr(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-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-upf[master]: osmo-upf: add VTY 'gtp-echo' command
by fixeria 05 Nov '24

05 Nov '24
Attention is currently required from: laforge, neels, osmith. fixeria has posted comments on this change by neels. ( https://gerrit.osmocom.org/c/osmo-upf/+/37830?usp=email ) Change subject: osmo-upf: add VTY 'gtp-echo' command ...................................................................... Patch Set 6: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/37830?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-upf Gerrit-Branch: master Gerrit-Change-Id: I970dccd7a27b098eea9e660822e24e2c4b059fc6 Gerrit-Change-Number: 37830 Gerrit-PatchSet: 6 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: osmith <osmith(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Tue, 05 Nov 2024 10:37:43 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • ...
  • 221
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.