diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/links.c | 51 | ||||
-rw-r--r-- | src/main.c | 1 | ||||
-rw-r--r-- | src/main_stp.c | 1 | ||||
-rw-r--r-- | src/main_udt.c | 1 | ||||
-rw-r--r-- | src/vty_interface.c | 10 |
5 files changed, 41 insertions, 23 deletions
diff --git a/src/links.c b/src/links.c index 9bd202b..7a114fb 100644 --- a/src/links.c +++ b/src/links.c @@ -94,6 +94,7 @@ static void start_rest(void *start) int link_init(struct bsc_data *bsc) { + int i; struct mtp_udp_link *lnk; bsc->link_set = mtp_link_set_alloc(); @@ -106,14 +107,6 @@ int link_init(struct bsc_data *bsc) bsc->link_set->spare = bsc->ni_spare; bsc->link_set->bsc = bsc; - lnk = talloc_zero(bsc->link_set, struct mtp_udp_link); - lnk->base.pcap_fd = bsc->pcap_fd; - lnk->bsc = bsc; - lnk->data = &bsc->udp_data; - lnk->link_index = 1; - lnk->reset_timeout = bsc->udp_reset_timeout; - mtp_link_set_add_link(bsc->link_set, (struct mtp_link *) lnk); - if (!bsc->src_port) { LOGP(DINP, LOGL_ERROR, "You need to set a UDP address.\n"); return -1; @@ -124,22 +117,34 @@ int link_init(struct bsc_data *bsc) if (link_global_init(&bsc->udp_data, bsc->udp_ip, bsc->src_port) != 0) return -1; - /* now connect to the transport */ - if (link_udp_init(lnk, bsc->udp_ip, bsc->udp_port) != 0) - return -1; - /* - * We will ask the MTP link to be taken down for two - * timeouts of the BSC to make sure we are missing the - * SLTM and it begins a reset. Then we will take it up - * again and do the usual business. - */ - snmp_mtp_deactivate(lnk->data->session, - lnk->link_index); - bsc->start_timer.cb = start_rest; - bsc->start_timer.data = &bsc; - bsc_schedule_timer(&bsc->start_timer, lnk->reset_timeout, 0); - LOGP(DMSC, LOGL_NOTICE, "Making sure SLTM will timeout.\n"); + for (i = 1; i <= bsc->udp_nr_links; ++i) { + lnk = talloc_zero(bsc->link_set, struct mtp_udp_link); + lnk->base.pcap_fd = bsc->pcap_fd; + lnk->bsc = bsc; + lnk->data = &bsc->udp_data; + lnk->link_index = i; + lnk->reset_timeout = bsc->udp_reset_timeout; + mtp_link_set_add_link(bsc->link_set, (struct mtp_link *) lnk); + + + /* now connect to the transport */ + if (link_udp_init(lnk, bsc->udp_ip, bsc->udp_port) != 0) + return -1; + + /* + * We will ask the MTP link to be taken down for two + * timeouts of the BSC to make sure we are missing the + * SLTM and it begins a reset. Then we will take it up + * again and do the usual business. + */ + snmp_mtp_deactivate(lnk->data->session, + lnk->link_index); + bsc->start_timer.cb = start_rest; + bsc->start_timer.data = &bsc; + bsc_schedule_timer(&bsc->start_timer, lnk->reset_timeout, 0); + LOGP(DMSC, LOGL_NOTICE, "Making sure SLTM will timeout.\n"); + } return 0; } @@ -633,6 +633,7 @@ int main(int argc, char **argv) bsc.isup_opc = -1; bsc.udp_port = 3456; bsc.udp_ip = NULL; + bsc.udp_nr_links = 1; bsc.src_port = 1313; bsc.ni_ni = MTP_NI_NATION_NET; bsc.ni_spare = 0; diff --git a/src/main_stp.c b/src/main_stp.c index 328eabe..a957478 100644 --- a/src/main_stp.c +++ b/src/main_stp.c @@ -194,6 +194,7 @@ int main(int argc, char **argv) bsc.src_port = 1313; bsc.ni_ni = MTP_NI_NATION_NET; bsc.ni_spare = 0; + bsc.udp_nr_links = 1; mtp_link_set_init(); thread_init(); diff --git a/src/main_udt.c b/src/main_udt.c index 436ae1b..f8c5c6c 100644 --- a/src/main_udt.c +++ b/src/main_udt.c @@ -193,6 +193,7 @@ int main(int argc, char **argv) bsc.src_port = 1313; bsc.ni_ni = MTP_NI_NATION_NET; bsc.ni_spare = 0; + bsc.udp_nr_links = 1; mtp_link_set_init(); thread_init(); diff --git a/src/vty_interface.c b/src/vty_interface.c index c529e1c..7a9c157 100644 --- a/src/vty_interface.c +++ b/src/vty_interface.c @@ -74,6 +74,7 @@ static int config_write_cell(struct vty *vty) vty_out(vty, " udp dest port %d%s", bsc.udp_port, VTY_NEWLINE); vty_out(vty, " udp src port %d%s", bsc.src_port, VTY_NEWLINE); vty_out(vty, " udp reset %d%s", bsc.udp_reset_timeout, VTY_NEWLINE); + vty_out(vty, " udp number-links %d%s", bsc.udp_nr_links, VTY_NEWLINE); vty_out(vty, " msc ip %s%s", bsc.msc_address, VTY_NEWLINE); vty_out(vty, " msc ip-dscp %d%s", bsc.msc_ip_dscp, VTY_NEWLINE); vty_out(vty, " msc token %s%s", bsc.token, VTY_NEWLINE); @@ -171,6 +172,14 @@ DEFUN(cfg_udp_reset, cfg_udp_reset_cmd, return CMD_SUCCESS; } +DEFUN(cfg_udp_nr_links, cfg_udp_nr_links_cmd, + "udp number-links <1-32>", + "Set the number of links to use\n") +{ + bsc.udp_nr_links = atoi(argv[0]); + return CMD_SUCCESS; +} + DEFUN(cfg_sltm_once, cfg_sltm_once_cmd, "mtp sltm once (0|1)", "Send SLTMs until the link is established.") @@ -361,6 +370,7 @@ void cell_vty_init(void) install_element(CELLMGR_NODE, &cfg_udp_dst_port_cmd); install_element(CELLMGR_NODE, &cfg_udp_src_port_cmd); install_element(CELLMGR_NODE, &cfg_udp_reset_cmd); + install_element(CELLMGR_NODE, &cfg_udp_nr_links_cmd); install_element(CELLMGR_NODE, &cfg_sltm_once_cmd); install_element(CELLMGR_NODE, &cfg_msc_ip_cmd); install_element(CELLMGR_NODE, &cfg_msc_token_cmd); |