aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/nat/bsc_nat_vty.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-05-15 00:14:58 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-06-15 20:24:19 +0800
commite635dab52fd8351cb3af2e120580374ae6a38065 (patch)
treed7227333b651953f2fb23201dd3dc8253163bf31 /openbsc/src/nat/bsc_nat_vty.c
parentf76e7ef5e1528a33a7f314e78a5b029a76ff2282 (diff)
[nat] Add a token to the nat config and handle ID GET
This allows to chain a nat with a nat by answering to the id get code and sending the token.
Diffstat (limited to 'openbsc/src/nat/bsc_nat_vty.c')
-rw-r--r--openbsc/src/nat/bsc_nat_vty.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/openbsc/src/nat/bsc_nat_vty.c b/openbsc/src/nat/bsc_nat_vty.c
index 7209ae946..c41929e7b 100644
--- a/openbsc/src/nat/bsc_nat_vty.c
+++ b/openbsc/src/nat/bsc_nat_vty.c
@@ -61,6 +61,8 @@ static int config_write_nat(struct vty *vty)
vty_out(vty, " timeout auth %d%s", _nat->auth_timeout, VTY_NEWLINE);
vty_out(vty, " timeout ping %d%s", _nat->ping_timeout, VTY_NEWLINE);
vty_out(vty, " timeout pong %d%s", _nat->pong_timeout, VTY_NEWLINE);
+ if (_nat->token)
+ vty_out(vty, " token %s%s", _nat->token, VTY_NEWLINE);
return CMD_SUCCESS;
}
@@ -296,6 +298,16 @@ DEFUN(cfg_nat_pong_time,
return CMD_SUCCESS;
}
+DEFUN(cfg_nat_token, cfg_nat_token_cmd,
+ "token TOKEN",
+ "Set a token for the NAT")
+{
+ if (_nat->token)
+ talloc_free(_nat->token);
+ _nat->token = talloc_strdup(_nat, argv[0]);
+ return CMD_SUCCESS;
+}
+
/* per BSC configuration */
DEFUN(cfg_bsc, cfg_bsc_cmd, "bsc BSC_NR", "Select a BSC to configure")
{
@@ -457,6 +469,7 @@ int bsc_nat_vty_init(struct bsc_nat *nat)
install_element(NAT_NODE, &cfg_nat_auth_time_cmd);
install_element(NAT_NODE, &cfg_nat_ping_time_cmd);
install_element(NAT_NODE, &cfg_nat_pong_time_cmd);
+ install_element(NAT_NODE, &cfg_nat_token_cmd);
/* BSC subgroups */
install_element(NAT_NODE, &cfg_bsc_cmd);