laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26617 )
Change subject: bsc: make perform_clear() work when VTY is not initialized
......................................................................
Patch Set 1:
(1 comment)
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26617/1/bsc/BSC_Tests.ttcn
File bsc/BSC_Tests.ttcn:
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26617/1/bsc/BSC_Tests.ttcn@…
PS1, Line 1069: if (g_vty_initialized) {
> Can we simply have this check in f_logp()?
good idea!
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26617
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I8116075f32937bd06ba14b426010bf6fec2ef402
Gerrit-Change-Number: 26617
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 04 Jan 2022 13:33:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: comment
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/26609 )
Change subject: log: always include timeouts in FSM transition logging
......................................................................
log: always include timeouts in FSM transition logging
Before:
state_chg to ACTIVE
state_chg to WAIT_RLL_RTP_RELEASED
state_chg to WAIT_SCCP_RLSD
After:
State change to ACTIVE (no timeout)
State change to WAIT_RLL_RTP_RELEASED (T3109, 5s)
State change to WAIT_SCCP_RLSD (X4, 60s)
Change-Id: I94b7dc4d9e5e45dc731bcb3a843ede9fb6cc0839
---
M src/osmo-bsc/osmo_bsc_main.c
1 file changed, 1 insertion(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index b7e2616..167b0a3 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -891,6 +891,7 @@
rate_ctr_init(tall_bsc_ctx);
osmo_fsm_set_dealloc_ctx(OTC_SELECT);
+ osmo_fsm_log_timeouts(true);
/* Allocate global gsm_network struct */
rc = bsc_network_alloc();
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/26609
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I94b7dc4d9e5e45dc731bcb3a843ede9fb6cc0839
Gerrit-Change-Number: 26609
Gerrit-PatchSet: 2
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-MessageType: merged
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/26610 )
Change subject: lchan/gscon: always clear both cross ref pointers
......................................................................
lchan/gscon: always clear both cross ref pointers
During specific release scenarios, it became clear that an lchan still
pointed at a conn even after it had been deallocated. That was due to
setting conn->lchan = NULL but not lchan->conn = NULL. Fix that.
Do lchan_forget_conn() first, because during gscon_forget_lchan() we may
enter the gscon clearing dance, which in case of no SCCP conn being
present will soon / should immediately deallocate the conn.
Related: OS#5337
Related: I8c8537acf6b47b121903197608636c43ae601a57 (osmo-bsc)
Change-Id: Idbfe4672233ba8105eff5ba77ee07fd871358255
---
M src/osmo-bsc/lchan_fsm.c
1 file changed, 7 insertions(+), 3 deletions(-)
Approvals:
laforge: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index 5ae6df6..84f8dc5 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -478,8 +478,11 @@
{
LOG_LCHAN(lchan, LOGL_DEBUG, "Clearing lchan state\n");
- if (lchan->conn)
- gscon_forget_lchan(lchan->conn, lchan);
+ if (lchan->conn) {
+ struct gsm_subscriber_connection *conn = lchan->conn;
+ lchan_forget_conn(lchan);
+ gscon_forget_lchan(conn, lchan);
+ }
if (lchan->rqd_ref) {
talloc_free(lchan->rqd_ref);
@@ -1392,8 +1395,9 @@
* lchan_reset(), we make sure it does. But in case of releases from error handling, the
* conn might as well notice now already that its lchan is becoming unusable. */
if (lchan->conn) {
- gscon_forget_lchan(lchan->conn, lchan);
+ struct gsm_subscriber_connection *conn = lchan->conn;
lchan_forget_conn(lchan);
+ gscon_forget_lchan(conn, lchan);
}
rc = rsl_tx_rf_chan_release(lchan);
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/26610
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Idbfe4672233ba8105eff5ba77ee07fd871358255
Gerrit-Change-Number: 26610
Gerrit-PatchSet: 2
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-MessageType: merged
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/26612 )
Change subject: fix gscon clear 1/n: store clear cause in gscon
......................................................................
fix gscon clear 1/n: store clear cause in gscon
Allow returning a context sensitive cause instead of a hardcoded one in
gscon pre_term().
Also, the conn->cause is needed to move message dispatch to an "onenter"
function in patch I234b2a754d0c98031056981823cdbc187e977741. I Split
this part off as a separate patch for better readability.
Related: OS#5337
Change-Id: Ib6432746040899129d1d73ae8dc59add2d88a915
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/bsc_subscr_conn_fsm.c
2 files changed, 7 insertions(+), 3 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 238b2f7..4e26ec1 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -404,6 +404,8 @@
bool last_eutran_plmn_valid; /* Is information stored in field below available? */
struct osmo_plmn_id last_eutran_plmn;
} fast_return;
+
+ enum gsm0808_cause clear_cause;
};
diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c
index 2140c9b..ff742a2 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -144,6 +144,7 @@
struct msgb *resp;
int rc;
+ conn->clear_cause = cause;
if (conn->rx_clear_command) {
LOGPFSML(conn->fi, LOGL_DEBUG, "Not sending BSSMAP CLEAR REQUEST, already got CLEAR COMMAND from MSC\n");
@@ -976,9 +977,7 @@
}
LOGPFSML(fi, LOGL_DEBUG, "Releasing all lchans (if any) because this conn is terminating\n");
- /* when things go smoothly, the lchan should have been released before FSM instance termination. So if this is
- * necessary it's probably "abnormal". */
- gscon_release_lchans(conn, true, GSM48_RR_CAUSE_ABNORMAL_UNSPEC);
+ gscon_release_lchans(conn, true, bsc_gsm48_rr_cause_from_gsm0808_cause(conn->clear_cause));
/* drop pending messages */
gscon_dtap_queue_flush(conn, 0);
@@ -1057,6 +1056,9 @@
INIT_LLIST_HEAD(&conn->hodec2.penalty_timers);
conn->sccp.conn_id = -1;
+ /* Default clear cause (on RR translates to GSM48_RR_CAUSE_ABNORMAL_UNSPEC) */
+ conn->clear_cause = GSM0808_CAUSE_EQUIPMENT_FAILURE;
+
/* don't allocate from 'conn' context, as gscon_cleanup() will call talloc_free(conn) before
* libosmocore will call talloc_free(conn->fi), i.e. avoid use-after-free during cleanup */
conn->fi = osmo_fsm_inst_alloc(&gscon_fsm, net, conn, LOGL_DEBUG, NULL);
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/26612
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ib6432746040899129d1d73ae8dc59add2d88a915
Gerrit-Change-Number: 26612
Gerrit-PatchSet: 2
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-MessageType: merged
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc-nat/+/26659 )
Change subject: Add vty interface
......................................................................
Add vty interface
Related: OS#2545
Change-Id: I6f2d8d1d62b97be471ebcf1bb14aac0b895833d1
---
M include/osmocom/bsc_nat/Makefile.am
M include/osmocom/bsc_nat/bsc_nat.h
A include/osmocom/bsc_nat/logging.h
A include/osmocom/bsc_nat/vty.h
M src/osmo-bsc-nat/Makefile.am
A src/osmo-bsc-nat/bsc_nat.c
A src/osmo-bsc-nat/logging.c
M src/osmo-bsc-nat/main.c
A src/osmo-bsc-nat/vty.c
9 files changed, 297 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved; Verified
pespin: Looks good to me, but someone else must approve
diff --git a/include/osmocom/bsc_nat/Makefile.am b/include/osmocom/bsc_nat/Makefile.am
index 158ca4b..f573dd9 100644
--- a/include/osmocom/bsc_nat/Makefile.am
+++ b/include/osmocom/bsc_nat/Makefile.am
@@ -1,3 +1,5 @@
noinst_HEADERS = \
bsc_nat.h \
+ logging.h \
+ vty.h \
$(NULL)
diff --git a/include/osmocom/bsc_nat/bsc_nat.h b/include/osmocom/bsc_nat/bsc_nat.h
index bbdf826..511d5a4 100644
--- a/include/osmocom/bsc_nat/bsc_nat.h
+++ b/include/osmocom/bsc_nat/bsc_nat.h
@@ -17,3 +17,12 @@
*
*/
#pragma once
+
+struct bsc_nat {
+};
+
+struct bsc_nat *bsc_nat_alloc(void *tall_ctx);
+void bsc_nat_free(struct bsc_nat *bsc_nat);
+
+extern void *tall_bsc_nat_ctx;
+extern struct bsc_nat *g_bsc_nat;
diff --git a/include/osmocom/bsc_nat/logging.h b/include/osmocom/bsc_nat/logging.h
new file mode 100644
index 0000000..88f67b0
--- /dev/null
+++ b/include/osmocom/bsc_nat/logging.h
@@ -0,0 +1,27 @@
+/* (C) 2021 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de>
+ * Author: Oliver Smith <osmith(a)sysmocom.de>
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/lienses/>.
+ *
+ */
+#pragma once
+
+#include <osmocom/core/logging.h>
+
+enum {
+ DMAIN,
+};
+
+extern const struct log_info bsc_nat_log_info;
diff --git a/include/osmocom/bsc_nat/vty.h b/include/osmocom/bsc_nat/vty.h
new file mode 100644
index 0000000..f882c23
--- /dev/null
+++ b/include/osmocom/bsc_nat/vty.h
@@ -0,0 +1,31 @@
+/* (C) 2021 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de>
+ * Author: Oliver Smith <osmith(a)sysmocom.de>
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/lienses/>.
+ *
+ */
+
+#pragma once
+
+#include <osmocom/vty/vty.h>
+#include <osmocom/vty/buffer.h>
+#include <osmocom/vty/command.h>
+
+enum bsc_nat_vty_nodes {
+ BSC_NAT_NODE = _LAST_OSMOVTY_NODE,
+};
+
+void bsc_nat_vty_init(void);
+int bsc_nat_vty_go_parent(struct vty *vty);
diff --git a/src/osmo-bsc-nat/Makefile.am b/src/osmo-bsc-nat/Makefile.am
index 9d0bf3e..9aa9524 100644
--- a/src/osmo-bsc-nat/Makefile.am
+++ b/src/osmo-bsc-nat/Makefile.am
@@ -25,7 +25,10 @@
$(NULL)
osmo_bsc_nat_SOURCES = \
+ bsc_nat.c \
+ logging.c \
main.c \
+ vty.c \
$(NULL)
osmo_bsc_nat_LDADD = \
diff --git a/src/osmo-bsc-nat/bsc_nat.c b/src/osmo-bsc-nat/bsc_nat.c
new file mode 100644
index 0000000..149e7cb
--- /dev/null
+++ b/src/osmo-bsc-nat/bsc_nat.c
@@ -0,0 +1,38 @@
+/* (C) 2021 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de>
+ * Author: Oliver Smith <osmith(a)sysmocom.de>
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/lienses/>.
+ *
+ */
+
+#include "config.h"
+
+#include <osmocom/core/talloc.h>
+#include <osmocom/bsc_nat/bsc_nat.h>
+
+struct bsc_nat *bsc_nat_alloc(void *tall_ctx)
+{
+ struct bsc_nat *bsc_nat;
+
+ bsc_nat = talloc_zero(tall_ctx, struct bsc_nat);
+ OSMO_ASSERT(bsc_nat);
+
+ return bsc_nat;
+}
+
+void bsc_nat_free(struct bsc_nat *bsc_nat)
+{
+ talloc_free(bsc_nat);
+}
diff --git a/src/osmo-bsc-nat/logging.c b/src/osmo-bsc-nat/logging.c
new file mode 100644
index 0000000..5ada8c2
--- /dev/null
+++ b/src/osmo-bsc-nat/logging.c
@@ -0,0 +1,37 @@
+/* (C) 2021 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de>
+ * Author: Oliver Smith <osmith(a)sysmocom.de>
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/lienses/>.
+ *
+ */
+#include <osmocom/core/logging.h>
+#include <osmocom/core/utils.h>
+
+#include <osmocom/bsc_nat/logging.h>
+
+static const struct log_info_cat log_cat[] = {
+ [DMAIN] = {
+ .name = "DMAIN",
+ .loglevel = LOGL_NOTICE,
+ .enabled = 1,
+ .color = "",
+ .description = "Main program",
+ },
+};
+
+const struct log_info bsc_nat_log_info = {
+ .cat = log_cat,
+ .num_cat = ARRAY_SIZE(log_cat),
+};
diff --git a/src/osmo-bsc-nat/main.c b/src/osmo-bsc-nat/main.c
index 8775af1..813909b 100644
--- a/src/osmo-bsc-nat/main.c
+++ b/src/osmo-bsc-nat/main.c
@@ -19,7 +19,78 @@
#include "config.h"
+#include <osmocom/core/application.h>
+#include <osmocom/vty/cpu_sched_vty.h>
+#include <osmocom/vty/logging.h>
+#include <osmocom/vty/misc.h>
+#include <osmocom/vty/ports.h>
+#include <osmocom/vty/telnet_interface.h>
+
+#include <osmocom/bsc_nat/bsc_nat.h>
+#include <osmocom/bsc_nat/logging.h>
+#include <osmocom/bsc_nat/vty.h>
+
+static const char *const copyright =
+ "OsmoBSCNAT - Osmocom BSC NAT\r\n"
+ "Copyright (C) 2021 by sysmocom s.f.m.c. GmbH <info(a)sysmocom.de>\r\n"
+ "Author: Oliver Smith\r\n"
+ "License AGPLv3+: GNU AGPL version 3 or later <http://gnu.org/licenses/agpl-3.0.html>\r\n"
+ "This is free software: you are free to change and redistribute it.\r\n"
+ "There is NO WARRANTY, to the extent permitted by law.\r\n";
+
+void *tall_bsc_nat_ctx;
+struct bsc_nat *g_bsc_nat;
+
+static struct vty_app_info vty_info = {
+ .name = "OsmoBSCNAT",
+ .version = PACKAGE_VERSION,
+ .go_parent_cb = bsc_nat_vty_go_parent,
+};
+
+static void main_vty_init()
+{
+ int rc;
+
+ vty_info.copyright = copyright;
+ vty_info.tall_ctx = tall_bsc_nat_ctx;
+ vty_init(&vty_info);
+
+ bsc_nat_vty_init();
+
+ logging_vty_add_cmds();
+ osmo_talloc_vty_add_cmds();
+ osmo_cpu_sched_vty_init(tall_bsc_nat_ctx);
+
+ rc = telnet_init_dynif(tall_bsc_nat_ctx, g_bsc_nat, vty_get_bind_addr(), OSMO_VTY_PORT_BSC_NAT);
+ if (rc < 0) {
+ perror("Error binding VTY port");
+ exit(1);
+ }
+}
+
int main(int argc, char **argv)
{
+ int rc;
+
+ talloc_enable_null_tracking();
+ tall_bsc_nat_ctx = talloc_named_const(NULL, 0, "bsc_nat");
+
+ rc = osmo_init_logging2(tall_bsc_nat_ctx, &bsc_nat_log_info);
+ if (rc < 0)
+ exit(1);
+
+ g_bsc_nat = bsc_nat_alloc(tall_bsc_nat_ctx);
+
+ main_vty_init();
+
+ while (!osmo_select_shutdown_done())
+ osmo_select_main_ctx(0);
+
+ talloc_report_full(tall_bsc_nat_ctx, stderr);
+ talloc_free(tall_bsc_nat_ctx);
+ talloc_free(tall_vty_ctx);
+ talloc_report_full(NULL, stderr);
+ talloc_disable_null_tracking();
+
return 0;
}
diff --git a/src/osmo-bsc-nat/vty.c b/src/osmo-bsc-nat/vty.c
new file mode 100644
index 0000000..089d27b
--- /dev/null
+++ b/src/osmo-bsc-nat/vty.c
@@ -0,0 +1,79 @@
+/* (C) 2021 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de>
+ * Author: Oliver Smith <osmith(a)sysmocom.de>
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/lienses/>.
+ *
+ */
+
+#include "config.h"
+
+#include <unistd.h>
+
+#include <osmocom/vty/telnet_interface.h>
+#include <osmocom/vty/logging.h>
+#include <osmocom/vty/command.h>
+
+#include <osmocom/bsc_nat/bsc_nat.h>
+#include <osmocom/bsc_nat/vty.h>
+
+int bsc_nat_vty_go_parent(struct vty *vty)
+{
+ switch (vty->node) {
+ case BSC_NAT_NODE:
+ vty->node = CONFIG_NODE;
+ vty->index = g_bsc_nat;
+ break;
+ case CONFIG_NODE:
+ vty->node = ENABLE_NODE;
+ vty->index = NULL;
+ break;
+ default:
+ vty->node = CONFIG_NODE;
+ vty->index = NULL;
+ break;
+ }
+
+ return vty->node;
+}
+
+static struct cmd_node bsc_nat_node = {
+ BSC_NAT_NODE,
+ "%s(config-bsc-nat)# ",
+ 1,
+};
+
+DEFUN(cfg_bsc_nat,
+ cfg_bsc_nat_cmd,
+ "bsc-nat", "Configure the BSC NAT\n")
+{
+ OSMO_ASSERT(g_bsc_nat);
+ vty->index = g_bsc_nat;
+ vty->node = BSC_NAT_NODE;
+
+ return CMD_SUCCESS;
+}
+
+static int config_write_bsc_nat(struct vty *vty)
+{
+ vty_out(vty, "bsc-nat%s", VTY_NEWLINE);
+ return CMD_SUCCESS;
+}
+
+
+void bsc_nat_vty_init(void)
+{
+ install_element(CONFIG_NODE, &cfg_bsc_nat_cmd);
+ install_node(&bsc_nat_node, config_write_bsc_nat);
+}
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc-nat/+/26659
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc-nat
Gerrit-Branch: master
Gerrit-Change-Id: I6f2d8d1d62b97be471ebcf1bb14aac0b895833d1
Gerrit-Change-Number: 26659
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: merged