[GPRS] SGSN: Allow vty-based configuration of local listen/bind IP for GTP

This commit is contained in:
Harald Welte 2010-06-02 12:41:34 +02:00
parent 6144452068
commit e300d0021c
1 changed files with 19 additions and 5 deletions

View File

@ -49,11 +49,13 @@ static struct cmd_node sgsn_node = {
static int config_write_sgsn(struct vty *vty)
{
struct in_addr ia;
struct sgsn_ggsn_ctx *gctx;
vty_out(vty, "sgsn%s", VTY_NEWLINE);
vty_out(vty, " gtp local-ip %s%s",
inet_ntoa(g_cfg->gtp_listenaddr.sin_addr), VTY_NEWLINE);
llist_for_each_entry(gctx, &sgsn_ggsn_ctxts, list) {
vty_out(vty, " ggsn %u remote-ip %s%s", gctx->id,
inet_ntoa(gctx->remote_addr), VTY_NEWLINE);
@ -64,15 +66,26 @@ static int config_write_sgsn(struct vty *vty)
return CMD_SUCCESS;
}
DEFUN(cfg_sgsn,
cfg_sgsn_cmd,
"sgsn",
"Configure the SGSN")
#define SGSN_STR "Configure the SGSN"
DEFUN(cfg_sgsn, cfg_sgsn_cmd,
"sgsn",
SGSN_STR)
{
vty->node = SGSN_NODE;
return CMD_SUCCESS;
}
DEFUN(cfg_sgsn_bind_addr, cfg_sgsn_bind_addr_cmd,
"gtp local-ip A.B.C.D",
"GTP Parameters\n"
"Set the IP address for the local GTP bind\n")
{
inet_aton(argv[0], &g_cfg->gtp_listenaddr.sin_addr);
return CMD_SUCCESS;
}
DEFUN(cfg_ggsn_remote_ip, cfg_ggsn_remote_ip_cmd,
"ggsn <0-255> remote-ip A.B.C.D",
"")
@ -254,6 +267,7 @@ int sgsn_vty_init(void)
install_default(SGSN_NODE);
install_element(SGSN_NODE, &ournode_exit_cmd);
install_element(SGSN_NODE, &ournode_end_cmd);
install_element(SGSN_NODE, &cfg_sgsn_bind_addr_cmd);
install_element(SGSN_NODE, &cfg_ggsn_remote_ip_cmd);
//install_element(SGSN_NODE, &cfg_ggsn_remote_port_cmd);
install_element(SGSN_NODE, &cfg_ggsn_gtp_version_cmd);