diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-04-27 13:21:39 +0800 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-04-27 13:21:39 +0800 |
commit | 12b63716e2b92d429aa7be7a67f361b1abebd78c (patch) | |
tree | 9b74996f306806fd00d9690ee8a6efb96696a58a /openbsc/src/nat/bsc_nat_vty.c | |
parent | 184961ea3e3004d1e2eec2ad16eb13852e607289 (diff) |
nat: Add a command to close a given BSC Connection
This can be used to clear stale connections for a given BSC
or to force a reconnect of the BSC.
Diffstat (limited to 'openbsc/src/nat/bsc_nat_vty.c')
-rw-r--r-- | openbsc/src/nat/bsc_nat_vty.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/openbsc/src/nat/bsc_nat_vty.c b/openbsc/src/nat/bsc_nat_vty.c index 6387aaf25..7501767a2 100644 --- a/openbsc/src/nat/bsc_nat_vty.c +++ b/openbsc/src/nat/bsc_nat_vty.c @@ -170,6 +170,24 @@ DEFUN(show_stats, return CMD_SUCCESS; } +DEFUN(close_bsc, + close_bsc_cmd, + "close bsc connection BSC_NR", + "Close the connection with the BSC identified by the config number.\n") +{ + struct bsc_connection *bsc; + int bsc_nr = atoi(argv[0]); + + llist_for_each_entry(bsc, &_nat->bsc_connections, list_entry) { + if (!bsc->cfg || bsc->cfg->nr != bsc_nr) + continue; + bsc_close_connection(bsc); + break; + } + + return CMD_SUCCESS; +} + DEFUN(cfg_nat, cfg_nat_cmd, "nat", "Configute the NAT") { vty->index = _nat; @@ -349,6 +367,7 @@ int bsc_nat_vty_init(struct bsc_nat *nat) install_element(VIEW_NODE, &show_bsc_cmd); install_element(VIEW_NODE, &show_bsc_cfg_cmd); install_element(VIEW_NODE, &show_stats_cmd); + install_element(VIEW_NODE, &close_bsc_cmd); openbsc_vty_add_cmds(); |