vty: add 'asp' / 'local-ip' command

We can set the ASP's remote IP (i.e. where to reach osmo-stp), but so far the
only way to specify the local IP address to bind to can only be set from C code
(e.g. the simple client). Allow setting the local address via VTY.

For example, this is desired for the osmo-gsm-tester, to not use arbitrary IP
addresses.

Change-Id: I3f71897dfacafcf3126e51894d6ca756b02dcd7d
This commit is contained in:
Neels Hofmeyr 2017-09-05 12:48:01 +02:00
parent 769e9354ab
commit 3488cf5b85
1 changed files with 13 additions and 0 deletions

View File

@ -556,6 +556,16 @@ DEFUN(no_cs7_asp, no_cs7_asp_cmd,
return CMD_SUCCESS;
}
DEFUN(asp_local_ip, asp_local_ip_cmd,
"local-ip A.B.C.D",
"Specify Local IP Address from which to contact ASP\n"
"Local IP Address from which to contact of ASP\n")
{
struct osmo_ss7_asp *asp = vty->index;
osmo_talloc_replace_string(asp, &asp->cfg.local.host, argv[0]);
return CMD_SUCCESS;
}
DEFUN(asp_remote_ip, asp_remote_ip_cmd,
"remote-ip A.B.C.D",
"Specify Remote IP Address of ASP\n"
@ -633,6 +643,8 @@ static void write_one_asp(struct vty *vty, struct osmo_ss7_asp *asp)
osmo_ss7_asp_protocol_name(asp->cfg.proto), VTY_NEWLINE);
if (asp->cfg.description)
vty_out(vty, " description %s%s", asp->cfg.description, VTY_NEWLINE);
if (asp->cfg.local.host)
vty_out(vty, " local-ip %s%s", asp->cfg.local.host, VTY_NEWLINE);
if (asp->cfg.remote.host)
vty_out(vty, " remote-ip %s%s", asp->cfg.remote.host, VTY_NEWLINE);
if (asp->cfg.qos_class)
@ -1728,6 +1740,7 @@ static void vty_init_shared(void *ctx)
install_element(L_CS7_NODE, &no_cs7_asp_cmd);
install_element(L_CS7_ASP_NODE, &cfg_description_cmd);
install_element(L_CS7_ASP_NODE, &asp_remote_ip_cmd);
install_element(L_CS7_ASP_NODE, &asp_local_ip_cmd);
install_element(L_CS7_ASP_NODE, &asp_qos_class_cmd);
install_element(L_CS7_ASP_NODE, &asp_block_cmd);
install_element(L_CS7_ASP_NODE, &asp_shutdown_cmd);