fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/29537 )
Change subject: power_control: add CTRL command for sending default params
......................................................................
power_control: add CTRL command for sending default params
There exists a VTY command for sending default power control params,
but so far there was no CTRL counterpart for it. This patch adds a
SET command 'send-power-control-defaults':
$ osmo_ctrl.py \
--host 127.0.0.1 -p 4249 \
--set "bts.0.send-power-control-defaults" 1
Similar to 'send-new-system-informations', this command takes an
arbitrary dummy value (required for SET), which is simply ignored.
Change-Id: Ib370bd97ee2d9f72f8bec553550b1792d1345387
Related: SYS#6138
---
M doc/manuals/chapters/control.adoc
M doc/manuals/chapters/power_control.adoc
M src/osmo-bsc/bsc_ctrl_commands.c
3 files changed, 42 insertions(+), 2 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/doc/manuals/chapters/control.adoc b/doc/manuals/chapters/control.adoc
index 09e828e..8009ec7 100644
--- a/doc/manuals/chapters/control.adoc
+++ b/doc/manuals/chapters/control.adoc
@@ -33,6 +33,7 @@
|bts.N.cell-identity|RW|No|"<id>"|Set/Get Cell Identity (value between (0, 65535)).
|bts.N.apply-configuration|WO|No|Ignored|Restart BTS via OML.
|bts.N.send-new-system-informations|WO|No|Ignored|Regenerate and resend System Information messages for given BTS.
+|bts.N.send-power-control-defaults|WO|No|Ignored|Resend default power control parameters for given BTS.
|bts.N.channel-load|RO|No|"<name>,<used>,<total>"|See <<chanlo>> for details.
|bts.N.oml-connection-state|RO|No|"connected", "disconnected", "degraded"|Indicate the status of OML connection of BTS.
|bts.N.oml-uptime|RO|No|<uptime>|Return OML link uptime in seconds.
diff --git a/doc/manuals/chapters/power_control.adoc b/doc/manuals/chapters/power_control.adoc
index f5f94f6..9b48f15 100644
--- a/doc/manuals/chapters/power_control.adoc
+++ b/doc/manuals/chapters/power_control.adoc
@@ -53,13 +53,24 @@
link re-establishment and thus interrupting the service. The following command
triggers resending of both MS/BS power control parameters:
+.Example: Resending default power control parameters via the VTY
----
# Resending from the 'enable' node:
-OsmoBSC# bts 0 resend-power-control-defaults
+OsmoBSC# bts 0 <1> resend-power-control-defaults
# Resending from any configuration node (note prefix 'do'):
-OsmoBSC(config-ms-power-ctrl)# do bts 0 resend-power-control-defaults
+OsmoBSC(config-ms-power-ctrl)# do bts 0 <1> resend-power-control-defaults
----
+<1> BTS number for which to resend default power control parameters.
+
+.Example: Resending default power control parameters via the CTRL
+----
+$ osmo_ctrl.py \
+ --host 127.0.0.1 <1> -p 4249 \
+ --set "bts.0.send-power-control-defaults" 1 <2>
+----
+<1> Remote address of the host running osmo-bsc (localhost in this example).
+<2> An arbitrary dummy value (ignored). Required because SET command is used.
NOTE: The above statement mostly applies to parameters for dynamic power control
mode (see below). Switching between power control modes, as well as changing
diff --git a/src/osmo-bsc/bsc_ctrl_commands.c b/src/osmo-bsc/bsc_ctrl_commands.c
index fb8bd0c..304ccf9 100644
--- a/src/osmo-bsc/bsc_ctrl_commands.c
+++ b/src/osmo-bsc/bsc_ctrl_commands.c
@@ -290,6 +290,33 @@
}
CTRL_CMD_DEFINE_WO_NOVRF(bts_si, "send-new-system-informations");
+static int set_bts_power_ctrl_defs(struct ctrl_cmd *cmd, void *data)
+{
+ const struct gsm_bts *bts = cmd->node;
+ const struct gsm_bts_trx *trx;
+
+ if (bts->ms_power_ctrl.mode != GSM_PWR_CTRL_MODE_DYN_BTS) {
+ cmd->reply = "BTS is not using dyn-bts mode";
+ return CTRL_CMD_ERROR;
+ }
+
+ if (bts->model->power_ctrl_send_def_params == NULL) {
+ cmd->reply = "Not implemented for this BTS model";
+ return CTRL_CMD_ERROR;
+ }
+
+ llist_for_each_entry(trx, &bts->trx_list, list) {
+ if (bts->model->power_ctrl_send_def_params(trx) != 0) {
+ cmd->reply = "power_ctrl_send_def_params() failed";
+ return CTRL_CMD_ERROR;
+ }
+ }
+
+ cmd->reply = "Default power control parameters have been sent";
+ return CTRL_CMD_REPLY;
+}
+CTRL_CMD_DEFINE_WO_NOVRF(bts_power_ctrl_defs, "send-power-control-defaults");
+
static int get_bts_chan_load(struct ctrl_cmd *cmd, void *data)
{
int i;
@@ -799,6 +826,7 @@
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_ci);
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_apply_config);
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_si);
+ rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_power_ctrl_defs);
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_chan_load);
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_oml_conn);
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_oml_up);
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/29537
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ib370bd97ee2d9f72f8bec553550b1792d1345387
Gerrit-Change-Number: 29537
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(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-MessageType: merged
Attention is currently required from: pespin.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/29537 )
Change subject: power_control: add CTRL command for sending default params
......................................................................
Patch Set 2:
(1 comment)
File src/osmo-bsc/bsc_ctrl_commands.c:
https://gerrit.osmocom.org/c/osmo-bsc/+/29537/comment/ec02a88d_7ff4bd77
PS2, Line 315: cmd->reply = "Default power control parameters have been sent";
> agreeing with pespin
Well, I looked at the 'send-new-system-informations' while adding this new command. I can submit a patch making successful outcome of both commands less verbose, if you think it makes sense.
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/29537
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ib370bd97ee2d9f72f8bec553550b1792d1345387
Gerrit-Change-Number: 29537
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 30 Sep 2022 19:13:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/29552 )
Change subject: vty: 'hopping arfcn add': succeed if adding arfcn already in set
......................................................................
vty: 'hopping arfcn add': succeed if adding arfcn already in set
There's no need to fail, simply make it a noop in that case,
everything's fine and everybody is happy (specially when using CTRL
command "apply-config-file" to load a .cfg file containing
modifications.
Related: SYS#6138
(cherry picked from Change-Id Ia4e70d20d48a28c46a21dd10358577e5c798744c)
Change-Id: I1f90f76653a8c4f76d1200ba370dc8fe2a568949
---
M src/osmo-bsc/bts_trx_vty.c
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/52/29552/1
diff --git a/src/osmo-bsc/bts_trx_vty.c b/src/osmo-bsc/bts_trx_vty.c
index 9cf128e..920df16 100644
--- a/src/osmo-bsc/bts_trx_vty.c
+++ b/src/osmo-bsc/bts_trx_vty.c
@@ -401,7 +401,7 @@
if (bitvec_get_bit_pos(&ts->hopping.arfcns, arfcn) == ONE) {
vty_out(vty, "%% ARFCN %" PRIu16 " is already set%s", arfcn, VTY_NEWLINE);
- return CMD_WARNING;
+ return CMD_SUCCESS;
}
bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1);
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/29552
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: 2022q2
Gerrit-Change-Id: I1f90f76653a8c4f76d1200ba370dc8fe2a568949
Gerrit-Change-Number: 29552
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/29536 )
Change subject: Workaround bug where old hnb_context from same remote addr+port is kept
......................................................................
Workaround bug where old hnb_context from same remote addr+port is kept
Under some circumstancies not yet fully known, which seems to
involve bad link quality and high latencies and some specific hNodeB
which reuse its local IP addr+port, it is seen that a 2nd SCTP
connection is created from the same HNB while locally we still keep the
old SCTP connection and its related hnb_context. Hence, when the hNodeB
tries to register again with this new conn, it is rejected all the time
by the HNBGW.
Related: SYS#6113
Change-Id: I33ae901cc37646eca90bf06953e44fcc25f4d6c6
---
M src/osmo-hnbgw/hnbgw_hnbap.c
1 file changed, 29 insertions(+), 2 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/src/osmo-hnbgw/hnbgw_hnbap.c b/src/osmo-hnbgw/hnbgw_hnbap.c
index 1c51b63..23d1f48 100644
--- a/src/osmo-hnbgw/hnbgw_hnbap.c
+++ b/src/osmo-hnbgw/hnbgw_hnbap.c
@@ -395,7 +395,7 @@
static int hnbgw_rx_hnb_register_req(struct hnb_context *ctx, ANY_t *in)
{
- struct hnb_context *hnb;
+ struct hnb_context *hnb, *tmp;
HNBAP_HNBRegisterRequestIEs_t ies;
int rc;
struct osmo_plmn_id plmn;
@@ -422,8 +422,35 @@
ctx->id.mcc = plmn.mcc;
ctx->id.mnc = plmn.mnc;
- llist_for_each_entry(hnb, &ctx->gw->hnb_list, list) {
+ llist_for_each_entry_safe(hnb, tmp, &ctx->gw->hnb_list, list) {
if (hnb->hnb_registered && ctx != hnb && memcmp(&ctx->id, &hnb->id, sizeof(ctx->id)) == 0) {
+ /* If it's coming from the same remote IP addr+port, then it must be our internal
+ * fault (bug), and we release the old context to keep going... */
+ struct osmo_fd *other_fd = osmo_stream_srv_get_ofd(hnb->conn);
+ struct osmo_sockaddr other_osa = {};
+ struct osmo_sockaddr cur_osa = {};
+ socklen_t len = sizeof(other_osa);
+ if (getpeername(other_fd->fd, &other_osa.u.sa, &len) < 0) {
+ LOGHNB(ctx, DHNBAP, LOGL_ERROR, "BUG! Found old registered HNB with invalid socket, releasing it\n");
+ hnb_context_release(hnb);
+ continue;
+ }
+ len = sizeof(cur_osa);
+ if (getpeername(ofd->fd, &cur_osa.u.sa, &len) < 0) {
+ LOGHNB(ctx, DHNBAP, LOGL_ERROR, "Error getpeername(): %s\n", strerror(errno));
+ if (osmo_sockaddr_cmp(&cur_osa, &other_osa) == 0) {
+ LOGHNB(ctx, DHNBAP, LOGL_ERROR, "BUG! Found old registered HNB with same remote address, releasing it\n");
+ hnb_context_release(hnb);
+ continue;
+ }
+ } else if (osmo_sockaddr_cmp(&cur_osa, &other_osa) == 0) {
+ LOGHNB(ctx, DHNBAP, LOGL_ERROR, "BUG! Found old registered HNB with same remote address, releasing it\n");
+ hnb_context_release(hnb);
+ continue;
+ } /* else: addresses are different, we continue below */
+
+ /* If new conn registering same HNB is from anoter remote addr+port, let's reject it to avoid
+ * misconfigurations or someone trying to impersonate an already working HNB: */
LOGHNB(ctx, DHNBAP, LOGL_ERROR, "rejecting HNB-REGISTER-REQ with duplicate cell identity "
"MCC=%u,MNC=%u,LAC=%u,RAC=%u,SAC=%u,CID=%u from %s\n",
ctx->id.mcc, ctx->id.mnc, ctx->id.lac, ctx->id.rac, ctx->id.sac, ctx->id.cid, name);
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/29536
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I33ae901cc37646eca90bf06953e44fcc25f4d6c6
Gerrit-Change-Number: 29536
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: neels.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/29547 )
Change subject: Close conn when receiving SCTP_ASSOC_CHANGE notification
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
> (looks like this function also fails to put() to msgb if sctp_revmsg() rc > 0 in case of NOTIFICATIO […]
This is done in general recv() code path in the other function. This one is for sctp notifications specifically.
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/29547
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: If35efd404405f926a4a6cc45862eeadd1b04e08c
Gerrit-Change-Number: 29547
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 30 Sep 2022 16:02:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: comment
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/29545 )
Change subject: stream: Return 0 when receiving sctp notification SCTP_COMM_LOST
......................................................................
stream: Return 0 when receiving sctp notification SCTP_COMM_LOST
It was seen on a real pcap trace (sctp & gsmtap_log) that the Linux
kernel stack may decide to kill the connection (sending an ABORT) if
it fails to transmit some data after a while:
ABORT Cause code: "Protocol violation (0x000d)",
Cause Information: "Association exceeded its max_retrans count".
When this occurs, the kernel sends the
MSG_NOTIFICATION,SCTP_ASSOC_CHANGE,SCTP_COMM_LOST notification when
reading from the socket with sctp_recvmsg(). This basically signals that
the socket conn is dead, and subsequent writes to it will result in
send() failures (and receive SCTP_SEND_FAILED notification upon follow
up reads).
It's important to notice that after those events, there's no other sort
of different event like SHUTDOWN coming in, so that's the time at which
we must tell the user to close the socket.
Hence, let's signal the caller that the socket is dead by returning 0,
to comply with usual recv() API.
Related: SYS#6113
Change-Id: If94d44f25b76a96a5ea402fec9fc14c4e6296ba3
---
M src/stream.c
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
pespin: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/stream.c b/src/stream.c
index 5e15142..38d24fe 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1490,7 +1490,8 @@
break;
case SCTP_COMM_LOST:
LOGPC(DLINP, LOGL_DEBUG, " LOST\n");
- break;
+ /* Handle this like a regular disconnect */
+ return 0;
case SCTP_RESTART:
LOGPC(DLINP, LOGL_DEBUG, " RESTART\n");
break;
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29545
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: If94d44f25b76a96a5ea402fec9fc14c4e6296ba3
Gerrit-Change-Number: 29545
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/29550 )
Change subject: stream: Document osmo_stream_srv_recv() SCTP specialties
......................................................................
stream: Document osmo_stream_srv_recv() SCTP specialties
Change-Id: I47b066f26e63afd4bdb135f822667d1cd9479920
---
M src/stream.c
1 file changed, 10 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, approved
laforge: Looks good to me, but someone else must approve
diff --git a/src/stream.c b/src/stream.c
index 38d24fe..8cb3ad0 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1524,6 +1524,16 @@
* \param[in] conn Stream Server from which to receive
* \param msg pre-allocate message buffer to which received data is appended
* \returns number of bytes read, negative on error.
+ *
+ * If conn is an SCTP connection, additional specific considerations shall be taken:
+ * - msg->cb is always filled with SCTP ppid, and SCTP stream values, see msgb_sctp_*() APIs.
+ * - If an SCTP notification was received when reading from the SCTP socket,
+ * msgb_sctp_msg_flags(msg) will contain bit flag
+ * OSMO_STREAM_SCTP_MSG_FLAGS_NOTIFICATION set, and the msgb will
+ * contain a "union sctp_notification" instead of user data. In this case the
+ * return code will be either 0 (if conn is considered dead after the
+ * notification) or -EAGAIN (if conn is considered still alive after the
+ * notification) resembling the standard recv() API.
*/
int osmo_stream_srv_recv(struct osmo_stream_srv *conn, struct msgb *msg)
{
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29550
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I47b066f26e63afd4bdb135f822667d1cd9479920
Gerrit-Change-Number: 29550
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged