nat: Make the MSC configurable.
This commit is contained in:
parent
a88742cf5e
commit
8139553962
|
@ -205,6 +205,7 @@ struct bsc_nat {
|
||||||
|
|
||||||
/* msc things */
|
/* msc things */
|
||||||
char *msc_ip;
|
char *msc_ip;
|
||||||
|
int msc_port;
|
||||||
int first_contact;
|
int first_contact;
|
||||||
|
|
||||||
struct bsc_endpoint *bsc_endpoints;
|
struct bsc_endpoint *bsc_endpoints;
|
||||||
|
|
|
@ -853,7 +853,7 @@ int main(int argc, char** argv)
|
||||||
return -4;
|
return -4;
|
||||||
|
|
||||||
/* connect to the MSC */
|
/* connect to the MSC */
|
||||||
msc_con = bsc_msc_create(nat->msc_ip, 5000);
|
msc_con = bsc_msc_create(nat->msc_ip, nat->msc_port);
|
||||||
if (!msc_con) {
|
if (!msc_con) {
|
||||||
fprintf(stderr, "Creating a bsc_msc_connection failed.\n");
|
fprintf(stderr, "Creating a bsc_msc_connection failed.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -52,6 +52,7 @@ struct bsc_nat *bsc_nat_alloc(void)
|
||||||
nat->stats.bsc.auth_fail = counter_alloc("nat.bsc.auth_fail");
|
nat->stats.bsc.auth_fail = counter_alloc("nat.bsc.auth_fail");
|
||||||
nat->stats.msc.reconn = counter_alloc("nat.msc.conn");
|
nat->stats.msc.reconn = counter_alloc("nat.msc.conn");
|
||||||
nat->msc_ip = talloc_strdup(nat, "127.0.0.1");
|
nat->msc_ip = talloc_strdup(nat, "127.0.0.1");
|
||||||
|
nat->msc_port = 5000;
|
||||||
return nat;
|
return nat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ static int config_write_nat(struct vty *vty)
|
||||||
if (_nat->imsi_deny)
|
if (_nat->imsi_deny)
|
||||||
vty_out(vty, " insi deny %s%s", _nat->imsi_deny, VTY_NEWLINE);
|
vty_out(vty, " insi deny %s%s", _nat->imsi_deny, VTY_NEWLINE);
|
||||||
vty_out(vty, " msc ip %s%s", _nat->msc_ip, VTY_NEWLINE);
|
vty_out(vty, " msc ip %s%s", _nat->msc_ip, VTY_NEWLINE);
|
||||||
|
vty_out(vty, " msc port %d%s", _nat->msc_port, VTY_NEWLINE);
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,6 +214,15 @@ DEFUN(cfg_nat_msc_ip,
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFUN(cfg_nat_msc_port,
|
||||||
|
cfg_nat_msc_port_cmd,
|
||||||
|
"msc port <1-65500>",
|
||||||
|
"Set the port of the MSC.")
|
||||||
|
{
|
||||||
|
_nat->msc_port = atoi(argv[0]);
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/* per BSC configuration */
|
/* per BSC configuration */
|
||||||
DEFUN(cfg_bsc, cfg_bsc_cmd, "bsc BSC_NR", "Select a BSC to configure\n")
|
DEFUN(cfg_bsc, cfg_bsc_cmd, "bsc BSC_NR", "Select a BSC to configure\n")
|
||||||
{
|
{
|
||||||
|
@ -327,6 +337,7 @@ int bsc_nat_vty_init(struct bsc_nat *nat)
|
||||||
install_element(NAT_NODE, &cfg_nat_imsi_allow_cmd);
|
install_element(NAT_NODE, &cfg_nat_imsi_allow_cmd);
|
||||||
install_element(NAT_NODE, &cfg_nat_imsi_deny_cmd);
|
install_element(NAT_NODE, &cfg_nat_imsi_deny_cmd);
|
||||||
install_element(NAT_NODE, &cfg_nat_msc_ip_cmd);
|
install_element(NAT_NODE, &cfg_nat_msc_ip_cmd);
|
||||||
|
install_element(NAT_NODE, &cfg_nat_msc_port_cmd);
|
||||||
|
|
||||||
/* BSC subgroups */
|
/* BSC subgroups */
|
||||||
install_element(NAT_NODE, &cfg_bsc_cmd);
|
install_element(NAT_NODE, &cfg_bsc_cmd);
|
||||||
|
|
Loading…
Reference in New Issue