diff options
author | Harald Welte <laforge@osmocom.org> | 2021-03-03 18:12:09 +0100 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2021-03-24 00:30:23 +0100 |
commit | 42e3646a98bb7bc4f07faabb3bd3f33bfcf6cd8c (patch) | |
tree | d12eae7d6d6c1696775c3c2ba692d6d2ea9ca610 | |
parent | 01fa6a3ef33082b0c177ea2da822633c2fe343eb (diff) |
gprs_ns2_vty: Permit VTY configuration of bind->accept_sns
Related: OS#3373
Change-Id: Ifb52cd245b10bf47d42d57d167d6d6c02b12ee12
-rw-r--r-- | src/gb/gprs_ns2_vty.c | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c index 42ab2b25..55509d28 100644 --- a/src/gb/gprs_ns2_vty.c +++ b/src/gb/gprs_ns2_vty.c @@ -462,6 +462,8 @@ static void config_write_vbind(struct vty *vty, struct vty_bind *vbind) } if (vbind->accept_ipaccess) vty_out(vty, " accept-ipaccess%s", VTY_NEWLINE); + if (vbind->accept_sns) + vty_out(vty, " accept-dynamic-ip-sns%s", VTY_NEWLINE); if (vbind->dscp) vty_out(vty, " dscp %u%s", vbind->dscp, VTY_NEWLINE); vty_out(vty, " ip-sns signalling-weight %u data-weight %u%s", @@ -758,6 +760,51 @@ DEFUN(cfg_no_ns_bind_ipaccess, cfg_no_ns_bind_ipaccess_cmd, return CMD_SUCCESS; } +DEFUN(cfg_ns_bind_accept_sns, cfg_ns_bind_accept_sns_cmd, + "accept-dynamic-ip-sns", + "Allow to create dynamic NS Entities by IP-SNS PDUs\n" + ) +{ + struct vty_bind *vbind = vty->index; + struct gprs_ns2_vc_bind *bind; + + if (vbind->ll != GPRS_NS2_LL_UDP) { + vty_out(vty, "accept-dynamic-ip-sns can be only used with UDP bind%s", + VTY_NEWLINE); + return CMD_WARNING; + } + + vbind->accept_sns = true; + bind = gprs_ns2_bind_by_name(vty_nsi, vbind->name); + if (bind) + bind->accept_sns = true; + + return CMD_SUCCESS; +} + +DEFUN(cfg_no_ns_bind_accept_sns, cfg_no_ns_bind_accept_sns_cmd, + "no accept-dynamic-ip-sns", + NO_STR + "Disable dynamic creation of NS Entities by IP-SNS PDUs\n" + ) +{ + struct vty_bind *vbind = vty->index; + struct gprs_ns2_vc_bind *bind; + + if (vbind->ll != GPRS_NS2_LL_UDP) { + vty_out(vty, "no accept-dynamic-ip-sns can be only used with UDP bind%s", + VTY_NEWLINE); + return CMD_WARNING; + } + + vbind->accept_sns = false; + bind = gprs_ns2_bind_by_name(vty_nsi, vbind->name); + if (bind) + bind->accept_sns = false; + + return CMD_SUCCESS; +} + DEFUN(cfg_ns_bind_ip_sns_weight, cfg_ns_bind_ip_sns_weight_cmd, "ip-sns signalling-weight <0-254> data-weight <0-254>", "IP SNS\n" @@ -2062,7 +2109,8 @@ int gprs_ns2_vty_init(struct gprs_ns2_inst *nsi) install_lib_element(L_NS_BIND_NODE, &cfg_no_ns_bind_ipaccess_cmd); install_lib_element(L_NS_BIND_NODE, &cfg_ns_bind_fr_cmd); install_lib_element(L_NS_BIND_NODE, &cfg_no_ns_bind_fr_cmd); - /* TODO: accept-ip-sns when SGSN SNS has been implemented */ + install_lib_element(L_NS_BIND_NODE, &cfg_ns_bind_accept_sns_cmd); + install_lib_element(L_NS_BIND_NODE, &cfg_no_ns_bind_accept_sns_cmd); install_node(&ns_nse_node, NULL); install_lib_element(L_NS_NSE_NODE, &cfg_ns_nse_nsvc_fr_cmd); |