diff options
Diffstat (limited to 'src/pcu_vty.c')
-rw-r--r-- | src/pcu_vty.c | 104 |
1 files changed, 72 insertions, 32 deletions
diff --git a/src/pcu_vty.c b/src/pcu_vty.c index c85e324b..9de99c82 100644 --- a/src/pcu_vty.c +++ b/src/pcu_vty.c @@ -23,6 +23,7 @@ #include "bts.h" #include "tbf.h" #include "pcu_vty_functions.h" +#include "alloc_algo.h" #define X(x) (1 << x) @@ -70,6 +71,49 @@ static const struct value_string pcu_gsmtap_categ_help[] = { { 0, NULL } }; +DEFUN(cfg_pcu_gsmtap_remote_host, + cfg_pcu_gsmtap_remote_host_cmd, + "gsmtap-remote-host [HOSTNAME]", + "Enable GSMTAP Um logging (see also 'gsmtap-category')\n" + "Remote IP address or hostname ('localhost' if omitted)\n") +{ + osmo_talloc_replace_string(the_pcu, &the_pcu->gsmtap_remote_host, + argc > 0 ? argv[0] : "localhost"); + + if (vty->type != VTY_FILE) + vty_out(vty, "%% This command requires restart%s", VTY_NEWLINE); + + return CMD_SUCCESS; +} + +DEFUN(cfg_pcu_no_gsmtap_remote_host, + cfg_pcu_no_gsmtap_remote_host_cmd, + "no gsmtap-remote-host", + NO_STR "Disable GSMTAP Um logging\n") +{ + if (the_pcu->gsmtap_remote_host) + TALLOC_FREE(the_pcu->gsmtap_remote_host); + + if (vty->type != VTY_FILE) + vty_out(vty, "%% This command requires restart%s", VTY_NEWLINE); + + return CMD_SUCCESS; +} + +DEFUN(cfg_pcu_gsmtap_sapi_all, pcucfg_pcu_gsmtap_categ_all_cmd, + "gsmtap-category (enable-all|disable-all)", + "Enable/disable sending of UL/DL messages over GSMTAP\n" + "Enable all kinds of messages (all categories)\n" + "Disable all kinds of messages (all categories)\n") +{ + + if (strcmp(argv[0], "enable-all") == 0) + the_pcu->gsmtap_categ_mask = UINT32_MAX; + else + the_pcu->gsmtap_categ_mask = 0x00; + + return CMD_SUCCESS; +} DEFUN(cfg_pcu_gsmtap_categ, cfg_pcu_gsmtap_categ_cmd, "HIDDEN", "HIDDEN") { @@ -235,14 +279,19 @@ static int config_write_pcu(struct vty *vty) vty_out(vty, " gamma %d%s", the_pcu->vty.gamma * 2, VTY_NEWLINE); if (!the_pcu->vty.dl_tbf_preemptive_retransmission) vty_out(vty, " no dl-tbf-preemptive-retransmission%s", VTY_NEWLINE); + if (the_pcu->vty.msclass_default != PCU_DEFAULT_MSLOT_CLASS) + vty_out(vty, " multislot-class default %u%s", the_pcu->vty.msclass_default, VTY_NEWLINE); if (strcmp(the_pcu->pcu_sock_path, PCU_SOCK_DEFAULT)) vty_out(vty, " pcu-socket %s%s", the_pcu->pcu_sock_path, VTY_NEWLINE); + if (the_pcu->gsmtap_remote_host) + vty_out(vty, " gsmtap-remote-host %s%s", the_pcu->gsmtap_remote_host, VTY_NEWLINE); for (i = 0; i < 32; i++) { - uint32_t cs = ((uint32_t)1 << i); - if (the_pcu->gsmtap_categ_mask & cs) { - vty_out(vty, " gsmtap-category %s%s", - get_value_string(pcu_gsmtap_categ_names, i), VTY_NEWLINE); + if (the_pcu->gsmtap_categ_mask & ((uint32_t)1 << i)) { + const char *category_buf; + if (!(category_buf = get_value_string_or_null(pcu_gsmtap_categ_names, i))) + continue; + vty_out(vty, " gsmtap-category %s%s", category_buf, VTY_NEWLINE); } } @@ -256,11 +305,6 @@ static int config_write_pcu(struct vty *vty) if (the_pcu->vty.ns_priority != -1) vty_out(vty, " gb socket-priority %d%s", the_pcu->vty.ns_priority, VTY_NEWLINE); - if (the_pcu->vty.neigh_ctrl_addr) { - vty_out(vty, " neighbor resolution %s %u%s", - the_pcu->vty.neigh_ctrl_addr, the_pcu->vty.neigh_ctrl_port, VTY_NEWLINE); - } - osmo_tdef_vty_write(vty, the_pcu->T_defs, " timer "); return CMD_SUCCESS; @@ -840,6 +884,19 @@ DEFUN_ATTR(cfg_pcu_no_dl_tbf_preemptive_retransmission, return CMD_SUCCESS; } +DEFUN_ATTR_USRATTR(cfg_pcu_msclass_default, + cfg_pcu_msclass_default_cmd, + CMD_ATTR_HIDDEN, + X(PCU_VTY_ATTR_NEW_TBF), + "multislot-class default <1-45>", + "MultiSlot Class configuration\n" + "Set assumed default MultiSlot Class if unknown during TBF allocation\n" + "MultiSlot Class number to use as default (default: 12)\n") +{ + the_pcu->vty.msclass_default = atoi(argv[0]); + return CMD_SUCCESS; +} + #define MS_IDLE_TIME_STR "keep an idle MS object alive for the time given\n" DEFUN_DEPRECATED(cfg_pcu_ms_idle_time, cfg_pcu_ms_idle_time_cmd, @@ -1060,26 +1117,6 @@ DEFUN_USRATTR(cfg_pcu_gb_priority, return CMD_SUCCESS; } -DEFUN(cfg_neighbor_resolution, cfg_neighbor_resolution_cmd, - "neighbor resolution " VTY_IPV46_CMD " [<0-65535>]", - "Manage local and remote-BSS neighbor cells\n" - "Connect to Neighbor Resolution Service (CTRL interface) to given ip and port\n" - "IPv4 address to connect to\n" "IPv6 address to connect to\n" - "Port to connect to (default 4248)\n") -{ - vty_out(vty, "%% Warning: The CTRL interface for Neighbor Address Resolution is now deprecated." - "Upgrade osmo-bsc and drop the 'neighbor resolution " VTY_IPV46_CMD " [<0-65535>]' VTY " - "option in order to let osmo-pcu use the new resoluton method using the PCUIF over IPA " - "multiplex, which will work out of the box without required configuration.%s", VTY_NEWLINE); - osmo_talloc_replace_string(the_pcu, &the_pcu->vty.neigh_ctrl_addr, argv[0]); - if (argc > 1) - the_pcu->vty.neigh_ctrl_port = atoi(argv[1]); - else - the_pcu->vty.neigh_ctrl_port = OSMO_CTRL_PORT_BSC_NEIGH; - return CMD_SUCCESS; -} - - DEFUN(show_bts_timer, show_bts_timer_cmd, "show bts-timer " OSMO_TDEF_VTY_ARG_T_OPTIONAL, SHOW_STR "Show BTS controlled timers\n" @@ -1195,8 +1232,8 @@ DEFUN(show_ms_imsi, } static const char pcu_copyright[] = - "Copyright (C) 2012 by Ivan Kluchnikov <kluchnikovi@gmail.com> and \r\n" - " Andreas Eversberg <jolly@eversberg.eu>\r\n" + "Copyright (C) 2012-2013 by Ivan Kluchnikov and Andreas Eversberg\r\n" + "Copyright (C) 2013-2022 by sysmocom - s.f.m.c. GmbH\r\n" "License GNU GPL version 2 or later\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"; @@ -1292,15 +1329,18 @@ int pcu_vty_init(void) install_element(PCU_NODE, &cfg_pcu_no_dl_tbf_idle_time_cmd); install_element(PCU_NODE, &cfg_pcu_dl_tbf_preemptive_retransmission_cmd); install_element(PCU_NODE, &cfg_pcu_no_dl_tbf_preemptive_retransmission_cmd); + install_element(PCU_NODE, &cfg_pcu_msclass_default_cmd); install_element(PCU_NODE, &cfg_pcu_ms_idle_time_cmd); install_element(PCU_NODE, &cfg_pcu_no_ms_idle_time_cmd); + install_element(PCU_NODE, &cfg_pcu_gsmtap_remote_host_cmd); + install_element(PCU_NODE, &cfg_pcu_no_gsmtap_remote_host_cmd); + install_element(PCU_NODE, &pcucfg_pcu_gsmtap_categ_all_cmd); install_element(PCU_NODE, &cfg_pcu_gsmtap_categ_cmd); install_element(PCU_NODE, &cfg_pcu_no_gsmtap_categ_cmd); install_element(PCU_NODE, &cfg_pcu_sock_cmd); install_element(PCU_NODE, &cfg_pcu_gb_dialect_cmd); install_element(PCU_NODE, &cfg_pcu_gb_ip_dscp_cmd); install_element(PCU_NODE, &cfg_pcu_gb_priority_cmd); - install_element(PCU_NODE, &cfg_neighbor_resolution_cmd); install_element(PCU_NODE, &cfg_pcu_timer_cmd); install_element_ve(&show_bts_stats_cmd); |