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

June 2023

  • 1 participants
  • 2480 discussions
[M] Change in libosmo-gprs[master]: rlcmac: BS_CV_MAX=0 should be interpreted as =1 when calculating N310...
by fixeria 21 Jun '23

21 Jun '23
Attention is currently required from: pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/33383 ) Change subject: rlcmac: BS_CV_MAX=0 should be interpreted as =1 when calculating N3104_MAX ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/33383 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: Ia83173afdbb25df18c7cead7857fe1b39a1ce82f Gerrit-Change-Number: 33383 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 21 Jun 2023 10:26:04 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in osmo-gsm-manuals[master]: mgwpool: Document keepalive feature
by pespin 21 Jun '23

21 Jun '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/33310 ) Change subject: mgwpool: Document keepalive feature ...................................................................... mgwpool: Document keepalive feature Related: SYS#6481 Change-Id: I2cb4e2098b71b386278eb6026271a6d786a34c2a --- M common/chapters/mgwpool.adoc 1 file changed, 77 insertions(+), 22 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/common/chapters/mgwpool.adoc b/common/chapters/mgwpool.adoc index c4cf28a..afb0d2b 100644 --- a/common/chapters/mgwpool.adoc +++ b/common/chapters/mgwpool.adoc @@ -8,7 +8,7 @@ scale-out to multiple cores on a single host. The load distribution is managed in such a way that when a new call is placed, -the pool will automatically assign the call to the MGW with the lowest load. +the pool will automatically assign the call to the available MGW with the lowest load. MGW pooling is recommended for larger RAN or CN installations. For small networks and lab installations the classic method with one MGW per {program-name} offers @@ -72,11 +72,11 @@ OsmoBSC> show mgw-pool % MGW-Pool: % MGW 0:media-gw-0 -% mgcp-client: connected +% MGCP link: connected,UP % service: unblocked % ongoing calls: 1 % MGW 1:media-gw-1 -% mgcp-client: connected +% MGCP link: connected,UP % service: unblocked % ongoing calls: 0 ---- @@ -96,6 +96,7 @@ OsmoBSC(config)# network OsmoBSC(config-net)# mgw 2 OsmoBSC(config-mgw)# ? + keepalive Monitor if the MGCP link against MGW is still usable local-ip local bind to connect to MGW from local-port local port to connect to MGW from remote-ip remote IP address to reach the MGW at @@ -110,15 +111,15 @@ ---- % MGW-Pool: % MGW 0:media-gw-0 -% mgcp-client: connected +% MGCP link: connected,UP % service: unblocked % ongoing calls: 2 % MGW 1:media-gw-1 -% mgcp-client: connected +% MGCP link: connected,UP % service: unblocked % ongoing calls: 3 % MGW 2:mgw <1> -% mgcp-client: disconnected +% MGCP link: disconnected,DOWN % service: unblocked % ongoing calls: 0 ---- @@ -146,33 +147,77 @@ OsmoBSC# show mgw-pool % MGW-Pool: % MGW 0:media-gw-0 -% mgcp-client: connected +% MGCP link: connected,UP % service: unblocked % ongoing calls: 2 % MGW 1:media-gw-1 -% mgcp-client: connected +% MGCP link: connected,UP % service: unblocked % ongoing calls: 3 % MGW 2:mgw -% mgcp-client: connected +% MGCP link: connected,UP % service: unblocked % ongoing calls: 0 ---- It should be noted that MGCP a protocol is used via UDP, the connect only -happens locally to forward the UDP datagrams properly. Also (unless a reset -endpoint is configured like in the example config above) there will be no -immediate interaction with the MGW. However, the log should at least confirm -the connect worked and the MGCP client has been created successfully. +happens locally to forward the UDP datagrams properly (state printed in +`mgcp-client: (dis)connected` above). Also (unless a reset endpoint is +configured like in the example config above) there will be no immediate +interaction with the MGW. However, the log should at least confirm the connect +worked and the MGCP client has been created successfully. ---- Mon Aug 2 17:15:00 2021 DLMGCP mgcp_client.c:788 MGCP client: using endpoint domain '@mgw' Mon Aug 2 17:15:00 2021 DLMGCP mgcp_client.c:908 MGCP GW connection: r=127.0.0.1:2427<->l=127.0.0.1:2727 ---- -It is strongly advised to check the activity on the related MGW and to follow -the log in order to see that the communication between {program-name} and the MGW is -working correctly. +For that reason, it is strongly advised to enable the `keepalive` feature in +{program-name} to schedule periodical MGCP queries against the MGW, in order to +make sure it is reachable (the state `MGCP link: UP|DOWN` printed above). See +section <<mgw_pooling_keepalive>> below for more information. + +[[mgw_pooling_keepalive]] +==== Monitor MGCP link (keepalive) / MGCP-Client + +The `keepalive` feature in {program-name} allows scheduling periodical queries +on the MGCP layer in order to make sure it is reachable and hence obtain +information on the state of the MGCP link. This is in turn used by the MGW Pool +when picking an MGW from the pool: MGWs whose link is considered to be DOWN are +skipped. + +The feature consists of: +- A `keepalive request-interval` which will trigger a transmission of an MGCP +AuditEndpoint command targeting endpoint with name `keepalive request-endpoint`. +This interval is updated every time any message is transmitted in the MGCP link, +meaning the MGCP AuditEndpoint message is only triggered if no message has been +transmitted since `keepalive request-interval` seconds ago. +- A `keepalive timeout` which upon triggering (because no message was received +over that amount of time) will then consider the MGW to be non-reachable (link +DOWN). + +The `keepalive` parameters are to be preferrably configured so that +`"keepalive request-interval" * 2 < "keepalive timeout"`. + +Example VTY configuration of `keepalive` feature in {program-name}: +---- + mgw 0 + ... + keepalive request-interval 20 <1> + keepalive request-endpoint null <2> + keepalive timeout 50 <3> +---- + +<1> Transmit an MGCP AuditEndpoint message to the MGW if no message has been +sent to it over last 20 seconds +<2> The MGCP AuditEndpoint targets the `null` endpoint. This is a special +endpoint available at OsmoMGW for those purposes, but any available endpoint can +be configured and used instead. +<3> Consider the MGCP link to be DOWN if no message is received from the MGW +over the last 50 seconds + +NOTE: The `keepalive` feature is disabled by default, and must be explicitly +configured in order to enable it. [[mgw_pooling_blocking]] ==== Blocking an MGW / MGCP-Client @@ -188,15 +233,15 @@ OsmoBSC# show mgw-pool % MGW-Pool: % MGW 0:media-gw-0 -% mgcp-client: connected +% MGCP link: connected,UP % service: unblocked % ongoing calls: 11 % MGW 1:media-gw-1 -% mgcp-client: connected +% MGCP link: connected,UP % service: unblocked % ongoing calls: 12 % MGW 2:mgw -% mgcp-client: connected +% MGCP link: connected,UP % service: blocked % ongoing calls: 10 ---- @@ -208,15 +253,15 @@ OsmoBSC# show mgw-pool % MGW-Pool: % MGW 0:media-gw-0 -% mgcp-client: connected +% MGCP link: connected,UP % service: unblocked % ongoing calls: 15 % MGW 1:media-gw-1 -% mgcp-client: connected +% MGCP link: connected,UP % service: unblocked % ongoing calls: 14 % MGW 2:mgw -% mgcp-client: connected +% MGCP link: connected,UP % service: blocked % ongoing calls: 0 ---- -- To view, visit https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/33310 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Change-Id: I2cb4e2098b71b386278eb6026271a6d786a34c2a Gerrit-Change-Number: 33310 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> 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> Gerrit-MessageType: merged
1 0
0 0
[S] Change in osmocom-bb[master]: modem: cosmetic: fix formatting in modem_gmm_prim_up_cb()
by pespin 21 Jun '23

21 Jun '23
Attention is currently required from: fixeria. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/33384 ) Change subject: modem: cosmetic: fix formatting in modem_gmm_prim_up_cb() ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/33384 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I1498b92f2dc3d056ca69072dfb077cba65b86b6e Gerrit-Change-Number: 33384 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Wed, 21 Jun 2023 10:13:52 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmocom-bb[master]: modem: cosmetic: fix formatting in modem_gmm_prim_up_cb()
by fixeria 21 Jun '23

21 Jun '23
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/33384 ) Change subject: modem: cosmetic: fix formatting in modem_gmm_prim_up_cb() ...................................................................... modem: cosmetic: fix formatting in modem_gmm_prim_up_cb() Change-Id: I1498b92f2dc3d056ca69072dfb077cba65b86b6e --- M src/host/layer23/src/modem/gmm.c 1 file changed, 11 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/84/33384/1 diff --git a/src/host/layer23/src/modem/gmm.c b/src/host/layer23/src/modem/gmm.c index 5445672..0853162 100644 --- a/src/host/layer23/src/modem/gmm.c +++ b/src/host/layer23/src/modem/gmm.c @@ -97,8 +97,8 @@ break; case OSMO_PRIM(OSMO_GPRS_GMM_GMMREG_DETACH, PRIM_OP_CONFIRM): case OSMO_PRIM(OSMO_GPRS_GMM_GMMREG_DETACH, PRIM_OP_INDICATION): - LOGP(DGMM, LOGL_NOTICE, "%s(): Rx %s\n", __func__, pdu_name); - ms_dispatch_all_apn(ms, APN_EV_GMM_DETACHED, NULL); + LOGP(DGMM, LOGL_NOTICE, "%s(): Rx %s\n", __func__, pdu_name); + ms_dispatch_all_apn(ms, APN_EV_GMM_DETACHED, NULL); break; default: LOGP(DGMM, LOGL_ERROR, "%s(): Rx %s UNIMPLEMENTED\n", __func__, pdu_name); -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/33384 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I1498b92f2dc3d056ca69072dfb077cba65b86b6e Gerrit-Change-Number: 33384 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-mgw[master]: mgcp_client: pool: Only pick clients with an MGCP link considered to ...
by pespin 21 Jun '23

21 Jun '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/33313 ) Change subject: mgcp_client: pool: Only pick clients with an MGCP link considered to be UP ...................................................................... mgcp_client: pool: Only pick clients with an MGCP link considered to be UP This way the user ends up picking a working MGW instance instead of one which is not reachable around the time. Related: SYS#6481 Change-Id: Ia3f451d3cd97851f65074408812b1ddc68f67056 --- M src/libosmo-mgcp-client/mgcp_client_pool.c 1 file changed, 18 insertions(+), 4 deletions(-) Approvals: osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/src/libosmo-mgcp-client/mgcp_client_pool.c b/src/libosmo-mgcp-client/mgcp_client_pool.c index 4156664..61fb134 100644 --- a/src/libosmo-mgcp-client/mgcp_client_pool.c +++ b/src/libosmo-mgcp-client/mgcp_client_pool.c @@ -94,7 +94,7 @@ } /* Not every pool member may have a functional MGCP client, we will run through the pool once until we meet a - * pool member that is suitable (has a client, is not blocked, has a low load). */ + * pool member that is suitable (is not blocked, has a client with a working link, has a low load). */ static struct mgcp_client_pool_member *mgcp_client_pool_pick(struct mgcp_client_pool *pool) { struct mgcp_client_pool_member *pool_member; @@ -103,14 +103,15 @@ llist_for_each_entry(pool_member, &pool->member_list, list) { n_pool_members++; - if (pool_member->blocked == false && pool_member->client) { + bool conn_up = pool_member->client && pool_member->client->conn_up; + if (pool_member->blocked == false && conn_up) { if (!pool_member_picked) pool_member_picked = pool_member; else if (pool_member_picked->refcount > pool_member->refcount) pool_member_picked = pool_member; } else { - LOGPPMGW(pool_member, LOGL_DEBUG, "%s -- MGW %u is unusable (blocked=%u, cli=%u)\n", - __func__, pool_member->nr, pool_member->blocked, !!pool_member->client); + LOGPPMGW(pool_member, LOGL_DEBUG, "%s -- MGW %u is unusable (blocked=%u, cli=%u, link=%u)\n", + __func__, pool_member->nr, pool_member->blocked, !!pool_member->client, conn_up); } } -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/33313 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: Ia3f451d3cd97851f65074408812b1ddc68f67056 Gerrit-Change-Number: 33313 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[L] Change in osmo-mgw[master]: mgcp-client: Add keepalive feature
by pespin 21 Jun '23

21 Jun '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/33308 ) Change subject: mgcp-client: Add keepalive feature ...................................................................... mgcp-client: Add keepalive feature The `keepalive` feature in libosmo-mgcp-client allows scheduling periodical queries on the MGCP layer in order to make sure it is reachable and hence obtain information on the state of the MGCP link. This patch only uses it to print the status on the VTY, but it will be used too in a follow-up commit by the MGW Pool when picking an MGW from the pool: MGWs whose link is considered to be DOWN are skipped. The feature consists of: - A `keepalive request-interval` which will trigger a transmission of an MGCP AuditEndpoint command targeting endpoint with name `keepalive request-endpoint`. This interval is updated every time any message is transmitted in the MGCP link, meaning the MGCP AuditEndpoint message is only triggered if no message has been transmitted since `keepalive request-interval` seconds ago. - A `keepalive timeout` considering the MGW to be non-reachable (link DOWN) if no message is received over that amount of time. The `keepalive` parameters are to be preferrably configured so that "keepalive request-interval" * 2 < "keepalive timeout". Example VTY configuration of `keepalive` feature in libosmo-mgcp-client: ---- mgw 0 ... keepalive request-interval 20 <1> keepalive request-endpoint null <2> keepalive timeout 50 <3> ---- <1> Transmit an MGCP AuditEndpoint message to the MGW if no message has been sent to it over last 10 seconds <2> The MGCP AuditEndpoint targets the `null` endpoint. This is a special endpoint available at OsmoMGW for those purposes, but any available endpoint can be configured and used instead. <3> Consider the MGCP link to be DOWN if no message is received from the MGW over the last 50 seconds NOTE: The `keepalive` feature is disabled by default, and must be explicitly configured in order to enable it. Related: SYS#6481 Change-Id: I3dc74c78548d017f272da863d5282dc5e0020ca3 --- M include/osmocom/mgcp_client/mgcp_client.h M include/osmocom/mgcp_client/mgcp_client_internal.h M src/libosmo-mgcp-client/mgcp_client.c M src/libosmo-mgcp-client/mgcp_client_vty.c M tests/mgcp_client/mgcp_client_test.err 5 files changed, 268 insertions(+), 16 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/include/osmocom/mgcp_client/mgcp_client.h b/include/osmocom/mgcp_client/mgcp_client.h index 46ec210..9a0611a 100644 --- a/include/osmocom/mgcp_client/mgcp_client.h +++ b/include/osmocom/mgcp_client/mgcp_client.h @@ -11,7 +11,7 @@ #define MGCP_CLIENT_LOCAL_PORT_DEFAULT 0 #define MGCP_CLIENT_REMOTE_ADDR_DEFAULT "127.0.0.1" #define MGCP_CLIENT_REMOTE_PORT_DEFAULT 2427 - +#define MGCP_CLIENT_KEEPALIVE_DEFAULT_ENDP "null" #define MGCP_CLIENT_MGW_STR "Configure MGCP connection to Media Gateway\n" struct msgb; @@ -36,6 +36,12 @@ /* human readable name / description */ char *description; + + struct { + uint32_t timeout_sec; + uint32_t req_interval_sec; + char req_endpoint_name[MGCP_ENDPOINT_MAXLEN]; + } keepalive; }; typedef unsigned int mgcp_trans_id_t; diff --git a/include/osmocom/mgcp_client/mgcp_client_internal.h b/include/osmocom/mgcp_client/mgcp_client_internal.h index 4e97a48..d0ae76b 100644 --- a/include/osmocom/mgcp_client/mgcp_client_internal.h +++ b/include/osmocom/mgcp_client/mgcp_client_internal.h @@ -1,6 +1,7 @@ #pragma once #include <osmocom/core/write_queue.h> +#include <osmocom/core/timer.h> #define MSGB_CB_MGCP_TRANS_ID 0 @@ -16,6 +17,9 @@ mgcp_trans_id_t next_trans_id; struct llist_head responses_pending; struct mgcp_client_pool_member *pool_member; + struct osmo_timer_list keepalive_tx_timer; + struct osmo_timer_list keepalive_rx_timer; + bool conn_up; }; struct mgcp_response_pending { diff --git a/src/libosmo-mgcp-client/mgcp_client.c b/src/libosmo-mgcp-client/mgcp_client.c index f74255c..677a4f3 100644 --- a/src/libosmo-mgcp-client/mgcp_client.c +++ b/src/libosmo-mgcp-client/mgcp_client.c @@ -202,6 +202,11 @@ .local_port = -1, .remote_addr = NULL, .remote_port = -1, + .keepalive = { + .timeout_sec = 0, /* disabled */ + .req_interval_sec = 0, /* disabled */ + .req_endpoint_name = MGCP_CLIENT_KEEPALIVE_DEFAULT_ENDP, + }, }; INIT_LLIST_HEAD(&conf->reset_epnames); @@ -696,6 +701,14 @@ r = talloc_zero(mgcp, struct mgcp_response); OSMO_ASSERT(r); + /* Re-arm keepalive timer if enabled */ + if (OSMO_UNLIKELY(mgcp->conn_up == false)) { + LOGPMGW(mgcp, LOGL_NOTICE, "MGCP link to MGW now considered UP\n"); + mgcp->conn_up = true; + } + if (mgcp->actual.keepalive.timeout_sec > 0) + osmo_timer_schedule(&mgcp->keepalive_rx_timer, mgcp->actual.keepalive.timeout_sec, 0); + rc = mgcp_response_parse_head(r, msg); if (rc) { LOGPMGW(mgcp, LOGL_ERROR, "Cannot parse MGCP response (head)\n"); @@ -766,10 +779,14 @@ osmo_escape_str((const char *)msg->data, OSMO_MIN(42, msg->len))); ret = write(fd->fd, msg->data, msg->len); - if (ret != msg->len) + if (OSMO_UNLIKELY(ret != msg->len)) LOGPMGW(mgcp, LOGL_ERROR, "Failed to Tx MGCP: %s: %d='%s'; msg: len=%u '%s'...\n", osmo_sock_get_name2(fd->fd), errno, strerror(errno), msg->len, osmo_escape_str((const char *)msg->data, OSMO_MIN(42, msg->len))); + + /* Re-arm the keepalive Tx timer: */ + if (mgcp->actual.keepalive.req_interval_sec > 0) + osmo_timer_schedule(&mgcp->keepalive_tx_timer, mgcp->actual.keepalive.req_interval_sec, 0); return ret; } @@ -807,6 +824,39 @@ mgcp_client_tx(mgcp, msgb_dlcx, &_ignore_mgcp_response, NULL); } +/* Format AuditEndpoint message (fire and forget) and send it off to the MGW */ +static void _mgcp_client_send_auep(struct mgcp_client *mgcp, const char *epname) +{ + struct msgb *msgb_auep; + struct mgcp_msg mgcp_msg_auep = { + .verb = MGCP_VERB_AUEP, + .presence = MGCP_MSG_PRESENCE_ENDPOINT, + }; + OSMO_STRLCPY_ARRAY(mgcp_msg_auep.endpoint, epname); + msgb_auep = mgcp_msg_gen(mgcp, &mgcp_msg_auep); + mgcp_client_tx(mgcp, msgb_auep, &_ignore_mgcp_response, NULL); +} + +static void mgcp_client_keepalive_tx_timer_cb(void *data) +{ + struct mgcp_client *mgcp = (struct mgcp_client *)data; + LOGPMGW(mgcp, LOGL_INFO, "Triggering keepalive MGCP request\n"); + const char *epname = _mgcp_client_name_append_domain(mgcp, mgcp->actual.keepalive.req_endpoint_name); + _mgcp_client_send_auep(mgcp, epname); + + /* Re-arm the timer: */ + osmo_timer_schedule(&mgcp->keepalive_tx_timer, mgcp->actual.keepalive.req_interval_sec, 0); +} + +static void mgcp_client_keepalive_rx_timer_cb(void *data) +{ + struct mgcp_client *mgcp = (struct mgcp_client *)data; + LOGPMGW(mgcp, LOGL_ERROR, "MGCP link to MGW now considered DOWN (keepalive timeout, more than %u seconds with no answer from MGW)\n", + mgcp->actual.keepalive.timeout_sec); + mgcp->conn_up = false; + /* TODO: Potentially time out all ongoing transactions for that MGW. Maybe based on VTY cfg? */ +} + struct mgcp_client *mgcp_client_init(void *ctx, struct mgcp_client_conf *conf) { @@ -851,6 +901,15 @@ if (conf->description) mgcp->actual.description = talloc_strdup(mgcp, conf->description); + osmo_wqueue_init(&mgcp->wq, 1024); + mgcp->wq.read_cb = mgcp_do_read; + mgcp->wq.write_cb = mgcp_do_write; + osmo_fd_setup(&mgcp->wq.bfd, -1, OSMO_FD_READ, osmo_wqueue_bfd_cb, mgcp, 0); + + memcpy(&mgcp->actual.keepalive, &conf->keepalive, sizeof(conf->keepalive)); + osmo_timer_setup(&mgcp->keepalive_tx_timer, mgcp_client_keepalive_tx_timer_cb, mgcp); + osmo_timer_setup(&mgcp->keepalive_rx_timer, mgcp_client_keepalive_rx_timer_cb, mgcp); + return mgcp; } @@ -859,24 +918,17 @@ * \returns 0 on success, -EINVAL on error. */ int mgcp_client_connect(struct mgcp_client *mgcp) { - struct osmo_wqueue *wq; int rc; struct reset_ep *reset_ep; const char *epname; + bool some_dlcx_sent = false; if (!mgcp) { LOGPMGW(mgcp, LOGL_FATAL, "Client not initialized properly\n"); return -EINVAL; } - wq = &mgcp->wq; - osmo_wqueue_init(wq, 1024); - wq->read_cb = mgcp_do_read; - wq->write_cb = mgcp_do_write; - - osmo_fd_setup(&wq->bfd, -1, OSMO_FD_READ, osmo_wqueue_bfd_cb, mgcp, 0); - - rc = osmo_sock_init2_ofd(&wq->bfd, AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP, mgcp->actual.local_addr, + rc = osmo_sock_init2_ofd(&mgcp->wq.bfd, AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP, mgcp->actual.local_addr, mgcp->actual.local_port, mgcp->actual.remote_addr, mgcp->actual.remote_port, OSMO_SOCK_F_BIND | OSMO_SOCK_F_CONNECT); if (rc < 0) { @@ -888,7 +940,7 @@ goto error_close_fd; } - LOGPMGW(mgcp, LOGL_INFO, "MGW connection: %s\n", osmo_sock_get_name2(wq->bfd.fd)); + LOGPMGW(mgcp, LOGL_INFO, "MGW connection: %s\n", osmo_sock_get_name2(mgcp->wq.bfd.fd)); /* If configured, send a DLCX message to the endpoints that are configured to * be reset on startup. Usually this is a wildcarded endpoint. */ @@ -896,11 +948,27 @@ epname = _mgcp_client_name_append_domain(mgcp, reset_ep->name); LOGPMGW(mgcp, LOGL_INFO, "Sending DLCX to: %s\n", epname); _mgcp_client_send_dlcx(mgcp, epname); + some_dlcx_sent = true; } + + if (!some_dlcx_sent) { + if (mgcp->actual.keepalive.req_interval_sec > 0) { + /* Attempt an immediate probe to find out if link is UP or DOWN: */ + osmo_timer_schedule(&mgcp->keepalive_tx_timer, 0, 0); + } else { + /* Assume link is UP by default, so that this MGW can be selected: */ + mgcp->conn_up = true; + } + } + /* else: keepalive_tx_timer was already scheduled (if needed) down in the stack during Tx DLCX above */ + + if (mgcp->actual.keepalive.timeout_sec > 0) + osmo_timer_schedule(&mgcp->keepalive_rx_timer, mgcp->actual.keepalive.timeout_sec, 0); + return 0; error_close_fd: - close(wq->bfd.fd); - wq->bfd.fd = -1; + close(mgcp->wq.bfd.fd); + mgcp->wq.bfd.fd = -1; return rc; } @@ -924,6 +992,11 @@ return; } + /* Disarm keepalive Tx/Rx timer until next connect() */ + osmo_timer_del(&mgcp->keepalive_rx_timer); + osmo_timer_del(&mgcp->keepalive_tx_timer); + mgcp->conn_up = false; + wq = &mgcp->wq; osmo_wqueue_clear(wq); LOGPMGW(mgcp, LOGL_INFO, "MGCP association: %s -- closed!\n", osmo_sock_get_name2(wq->bfd.fd)); diff --git a/src/libosmo-mgcp-client/mgcp_client_vty.c b/src/libosmo-mgcp-client/mgcp_client_vty.c index 336733b..a164637 100644 --- a/src/libosmo-mgcp-client/mgcp_client_vty.c +++ b/src/libosmo-mgcp-client/mgcp_client_vty.c @@ -28,6 +28,7 @@ #include <osmocom/vty/command.h> #include <osmocom/vty/misc.h> #include <osmocom/core/utils.h> +#include <osmocom/core/timer.h> #include <osmocom/mgcp_client/mgcp_client.h> #include <osmocom/mgcp_client/mgcp_client_internal.h> @@ -48,7 +49,7 @@ /* Pointer to the MGCP pool that is managed by mgcp_client_pool_vty_init() */ static struct mgcp_client_pool *global_mgcp_client_pool = NULL; -struct mgcp_client_conf *get_mgcp_client_config(struct vty *vty) +static struct mgcp_client_conf *get_mgcp_client_config(struct vty *vty) { if (global_mgcp_client_pool && vty->node == global_mgcp_client_pool->vty_node->node) return vty->index; @@ -61,6 +62,30 @@ return global_mgcp_client_conf; } +static struct mgcp_client *get_mgcp_client(struct vty *vty) +{ + struct mgcp_client_conf *conf = get_mgcp_client_config(vty); + struct mgcp_client_pool_member *pool_member; + + if (global_mgcp_client_pool && vty->node == global_mgcp_client_pool->vty_node->node) { + llist_for_each_entry(pool_member, &global_mgcp_client_pool->member_list, list) { + /* Find matching the conf pointer: */ + if (&pool_member->conf != conf) + continue; + return pool_member->client; + } + } + + /* Global single MGCP config, deprecated: */ + vty_out(vty, "%% MGCP commands outside of 'mgw' nodes are deprecated. " + "You should consider reading the User Manual and migrating to 'mgw' node.%s", + VTY_NEWLINE); + + /* There's no way to obtain the struct mgcp_client in old interface, but anyway it's deprecated. */ + return NULL; +} + + DEFUN(cfg_mgw_local_ip, cfg_mgw_local_ip_cmd, "local-ip " VTY_IPV46_CMD, "local bind to connect to MGW from\n" @@ -280,6 +305,81 @@ NO_STR MGW_STR "remove an endpoint name from the reset-endpoint list, e.g. 'rtpbridge/*'\n" "Endpoint name, e.g. 'rtpbridge/*' or 'ds/e1-0/s-3/su16-4'.\n") +DEFUN(cfg_mgw_mgw_keepalive_req_interval, + cfg_mgw_mgw_keepalive_req_interval_cmd, + "keepalive request-interval <0-4294967295>", + "Monitor if the MGCP link against MGW is still usable\n" + "Send an MGCP command to the MGW at given interval if no other commands are sent\n" + "The interval at which send MGCP commands (s), 0 to disable\n") +{ + struct mgcp_client_conf *conf = get_mgcp_client_config(vty); + struct mgcp_client *mgcp = get_mgcp_client(vty); + + conf->keepalive.req_interval_sec = atoi(argv[0]); + + if (!mgcp) + return CMD_SUCCESS; + + /* If client already exists, apply the change immediately if possible: */ + mgcp->actual.keepalive.req_interval_sec = atoi(argv[0]); + if (mgcp->wq.bfd.fd != -1) { /* UDP MGCP socket connected */ + if (mgcp->actual.keepalive.req_interval_sec > 0) /* Re-schedule: */ + osmo_timer_schedule(&mgcp->keepalive_tx_timer, mgcp->actual.keepalive.req_interval_sec, 0); + else if (osmo_timer_pending(&mgcp->keepalive_tx_timer)) + osmo_timer_del(&mgcp->keepalive_tx_timer); + } /* else: wait until connect() to do first scheduling */ + + return CMD_SUCCESS; +} + +DEFUN(cfg_mgw_mgw_keepalive_req_endpoint, + cfg_mgw_mgw_keepalive_req_endpoint_cmd, + "keepalive request-endpoint NAME", + "Monitor if the MGCP link against MGW is still usable\n" + "Use a given endpoint name when sending an MGCP command to the MGW for keepalive purposes\n" + "The name of the endpoint to use\n") +{ + struct mgcp_client_conf *conf = get_mgcp_client_config(vty); + struct mgcp_client *mgcp = get_mgcp_client(vty); + + OSMO_STRLCPY_ARRAY(conf->keepalive.req_endpoint_name, argv[0]); + + if (!mgcp) + return CMD_SUCCESS; + + /* If client already exists, apply the change immediately if possible: */ + OSMO_STRLCPY_ARRAY(mgcp->actual.keepalive.req_endpoint_name, argv[0]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_mgw_mgw_keepalive_timeout, + cfg_mgw_mgw_keepalive_timeout_cmd, + "keepalive timeout <0-4294967295>", + "Monitor if the MGCP link against MGW is still usable\n" + "Consider the link to the MGW to be down after time without receiving any message from it\n" + "The timeout (s), 0 to disable\n") +{ + struct mgcp_client_conf *conf = get_mgcp_client_config(vty); + struct mgcp_client *mgcp = get_mgcp_client(vty); + + conf->keepalive.timeout_sec = atoi(argv[0]); + + if (!mgcp) + return CMD_SUCCESS; + + /* If client already exists, apply the change immediately if possible: */ + mgcp->actual.keepalive.timeout_sec = atoi(argv[0]); + if (mgcp->wq.bfd.fd != -1) { /* UDP MGCP socket connected */ + if (mgcp->actual.keepalive.timeout_sec > 0) /* Re-schedule: */ + osmo_timer_schedule(&mgcp->keepalive_rx_timer, mgcp->actual.keepalive.timeout_sec, 0); + else if (osmo_timer_pending(&mgcp->keepalive_rx_timer)) + osmo_timer_del(&mgcp->keepalive_rx_timer); + } /* else: wait until connect() to do first scheduling */ + + return CMD_SUCCESS; +} + static int config_write(struct vty *vty, const char *indent, struct mgcp_client_conf *conf) { const char *addr; @@ -317,6 +417,17 @@ llist_for_each_entry(reset_ep, &conf->reset_epnames, list) vty_out(vty, "%s%sreset-endpoint %s%s", indent, mgw_prefix, reset_ep->name, VTY_NEWLINE); + if (conf->keepalive.req_interval_sec != 0) + vty_out(vty, "%s%skeepalive request-interval %u%s", indent, mgw_prefix, + conf->keepalive.req_interval_sec, VTY_NEWLINE); + if (strncmp(conf->keepalive.req_endpoint_name, MGCP_CLIENT_KEEPALIVE_DEFAULT_ENDP, + sizeof(conf->keepalive.req_endpoint_name)) != 0) + vty_out(vty, "%s%skeepalive request-endpoint %s%s", indent, mgw_prefix, + conf->keepalive.req_endpoint_name, VTY_NEWLINE); + if (conf->keepalive.timeout_sec != 0) + vty_out(vty, "%s%skeepalive timeout %u%s", indent, mgw_prefix, + conf->keepalive.timeout_sec, VTY_NEWLINE); + return CMD_SUCCESS; } @@ -347,6 +458,9 @@ install_lib_element(node, &cfg_mgw_mgw_endpoint_domain_name_cmd); install_lib_element(node, &cfg_mgw_mgw_reset_ep_name_cmd); install_lib_element(node, &cfg_mgw_mgw_no_reset_ep_name_cmd); + install_lib_element(node, &cfg_mgw_mgw_keepalive_req_interval_cmd); + install_lib_element(node, &cfg_mgw_mgw_keepalive_req_endpoint_cmd); + install_lib_element(node, &cfg_mgw_mgw_keepalive_timeout_cmd); osmo_fsm_vty_add_cmds(); } @@ -553,8 +667,13 @@ } llist_for_each_entry(pool_member, &global_mgcp_client_pool->member_list, list) { + const struct mgcp_client *cli = pool_member->client; vty_out(vty, "%% MGW %s%s", mgcp_client_pool_member_name(pool_member), VTY_NEWLINE); - vty_out(vty, "%% mgcp-client: %s%s", pool_member->client ? "connected" : "disconnected", + vty_out(vty, "%% MGCP link: %s,%s%s", + cli && cli->wq.bfd.fd != -1 ? "connected" : "disconnected", + cli && cli->conn_up ? + ((cli->actual.keepalive.timeout_sec > 0) ? "UP" : "MAYBE") : + "DOWN", VTY_NEWLINE); vty_out(vty, "%% service: %s%s", pool_member->blocked ? "blocked" : "unblocked", VTY_NEWLINE); vty_out(vty, "%% ongoing calls: %u%s", pool_member->refcount, VTY_NEWLINE); diff --git a/tests/mgcp_client/mgcp_client_test.err b/tests/mgcp_client/mgcp_client_test.err index 0bf6d8f..22ad3cc 100644 --- a/tests/mgcp_client/mgcp_client_test.err +++ b/tests/mgcp_client/mgcp_client_test.err @@ -11,6 +11,7 @@ - cancel succeeds DLMGCP MGW(mgw) Canceled transaction 1 - late response gets discarded +DLMGCP MGW(mgw) MGCP link to MGW now considered UP DLMGCP MGW(mgw) MGCP client: Rx 200 1 OK DLMGCP MGW(mgw) Cannot find matching MGCP transaction for trans_id 1 - canceling again does nothing -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/33308 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I3dc74c78548d017f272da863d5282dc5e0020ca3 Gerrit-Change-Number: 33308 Gerrit-PatchSet: 6 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[L] Change in osmo-mgw[master]: mgcp-client: Add keepalive feature
by pespin 21 Jun '23

21 Jun '23
Attention is currently required from: osmith, dexter. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/33308 ) Change subject: mgcp-client: Add keepalive feature ...................................................................... Patch Set 6: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/33308 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I3dc74c78548d017f272da863d5282dc5e0020ca3 Gerrit-Change-Number: 33308 Gerrit-PatchSet: 6 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 21 Jun 2023 10:13:24 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[L] Change in osmo-mgw[master]: mgcp-client: Add keepalive feature
by pespin 21 Jun '23

21 Jun '23
Attention is currently required from: osmith, dexter. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/33308 ) Change subject: mgcp-client: Add keepalive feature ...................................................................... Patch Set 6: (1 comment) Patchset: PS6: > Interesting that you chose MAYBE as wording instead of UNKNOWN. […] unknown sounded more like something unexpected to me, while "maybe" fits better here when displaying (less failure-ish). If others really think UNKNOWN fits better I can change it, but otherwise I prefer "maybe". -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/33308 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I3dc74c78548d017f272da863d5282dc5e0020ca3 Gerrit-Change-Number: 33308 Gerrit-PatchSet: 6 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 21 Jun 2023 10:13:16 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[L] Change in osmo-mgw[master]: mgcp-client: Add keepalive feature
by osmith 21 Jun '23

21 Jun '23
Attention is currently required from: pespin, dexter. osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/33308 ) Change subject: mgcp-client: Add keepalive feature ...................................................................... Patch Set 6: Code-Review+1 (1 comment) Patchset: PS6: Interesting that you chose MAYBE as wording instead of UNKNOWN. I think the latter is more common in programs that show status of things. But not that important, LGTM! -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/33308 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I3dc74c78548d017f272da863d5282dc5e0020ca3 Gerrit-Change-Number: 33308 Gerrit-PatchSet: 6 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 21 Jun 2023 10:09:20 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-bsc[master]: prevent bogus NCH related error message if no NCH is configured
by pespin 21 Jun '23

21 Jun '23
Attention is currently required from: jolly, laforge. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/33382 ) Change subject: prevent bogus NCH related error message if no NCH is configured ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/33382 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Iab2120a343cb0f6553f13a821b44b3c312587579 Gerrit-Change-Number: 33382 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: jolly <andreas(a)eversberg.eu> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Wed, 21 Jun 2023 10:05:13 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • ...
  • 248
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.