ipaccess: Add connect timeout in e1inp_line
* VTY command e1_line N connect-timeout T to set the connect() timeout * use ipa_client_conn_open2 to connect with timeout Related: SYS#6237 Change-Id: I7379102d19c172bed2aa00377d92bc885f54b640
This commit is contained in:
parent
6113525d6b
commit
c20af05bfc
|
@ -8,3 +8,4 @@
|
|||
# If any interfaces have been removed or changed since the last public release: c:r:0.
|
||||
#library what description / commit summary line
|
||||
libosmo-abis ipa_client_conn_open2 New API added
|
||||
libosmo-abis struct e1inp_line Field added at the end
|
||||
|
|
|
@ -227,6 +227,8 @@ struct e1inp_line {
|
|||
/* file name and file descriptor of pcap for this line */
|
||||
char *pcap_file;
|
||||
int pcap_fd;
|
||||
|
||||
unsigned int connect_timeout;
|
||||
};
|
||||
#define e1inp_line_ipa_oml_ts(line) (&line->ts[0])
|
||||
#define e1inp_line_ipa_rsl_ts(line, trx_id) (((1 + (trx_id)) < NUM_E1_TS) ? (&line->ts[1 + (trx_id)]) : NULL)
|
||||
|
|
|
@ -509,6 +509,7 @@ e1inp_line_create(uint8_t e1_nr, const char *driver_name)
|
|||
line->keepalive_idle_timeout = E1INP_USE_DEFAULT;
|
||||
line->keepalive_num_probes = E1INP_USE_DEFAULT;
|
||||
line->keepalive_probe_interval = E1INP_USE_DEFAULT;
|
||||
line->connect_timeout = 0;
|
||||
|
||||
line->rate_ctr = rate_ctr_group_alloc(line, &e1inp_ctr_g_d, line->num);
|
||||
if (!line->rate_ctr) {
|
||||
|
|
|
@ -245,6 +245,26 @@ DEFUN_ATTR(cfg_e1line_name, cfg_e1_line_name_cmd,
|
|||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN_ATTR(cfg_e1line_connect_timeout, cfg_e1_line_connect_timeout_cmd,
|
||||
"e1_line <0-255> connect-timeout <0-60>",
|
||||
E1_LINE_HELP "Set connect timeout\n" "Connect timeout in seconds (0 to disable)\n",
|
||||
CMD_ATTR_IMMEDIATE)
|
||||
{
|
||||
struct e1inp_line *line;
|
||||
int e1_nr = atoi(argv[0]);
|
||||
unsigned int timeout = atoi(argv[1]);
|
||||
|
||||
line = e1inp_line_find(e1_nr);
|
||||
if (!line) {
|
||||
vty_out(vty, "%% Line %d doesn't exist%s", e1_nr, VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
line->connect_timeout = timeout;
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
DEFUN_ATTR(cfg_e1line_pcap, cfg_e1line_pcap_cmd,
|
||||
"e1_line <0-255> pcap .FILE",
|
||||
E1_LINE_HELP "Setup a pcap recording of E1 traffic for line\n"
|
||||
|
@ -376,6 +396,9 @@ static int e1inp_config_write(struct vty *vty)
|
|||
if (line->name)
|
||||
vty_out(vty, " e1_line %u name %s%s", line->num,
|
||||
line->name, VTY_NEWLINE);
|
||||
if (line->connect_timeout != 0)
|
||||
vty_out(vty, " e1_line %u connect-timeout %u%s", line->num, line->connect_timeout,
|
||||
VTY_NEWLINE);
|
||||
if (!line->keepalive_num_probes)
|
||||
vty_out(vty, " no e1_line %u keepalive%s", line->num,
|
||||
VTY_NEWLINE);
|
||||
|
@ -563,6 +586,7 @@ int e1inp_vty_init(void)
|
|||
install_lib_element(L_E1INP_NODE, &cfg_e1_line_port_cmd);
|
||||
install_lib_element(L_E1INP_NODE, &cfg_e1_line_socket_cmd);
|
||||
install_lib_element(L_E1INP_NODE, &cfg_e1_line_name_cmd);
|
||||
install_lib_element(L_E1INP_NODE, &cfg_e1_line_connect_timeout_cmd);
|
||||
install_lib_element(L_E1INP_NODE, &cfg_e1_line_keepalive_cmd);
|
||||
install_lib_element(L_E1INP_NODE, &cfg_e1_line_keepalive_params_cmd);
|
||||
install_lib_element(L_E1INP_NODE, &cfg_e1_line_no_keepalive_cmd);
|
||||
|
|
|
@ -1124,7 +1124,7 @@ static int ipaccess_line_update(struct e1inp_line *line)
|
|||
}
|
||||
link->dscp = g_e1inp_ipaccess_pars.oml.dscp;
|
||||
link->priority = g_e1inp_ipaccess_pars.oml.priority;
|
||||
if (ipa_client_conn_open(link) < 0) {
|
||||
if (ipa_client_conn_open2(link, line->connect_timeout) < 0) {
|
||||
LOGP(DLINP, LOGL_ERROR, "cannot open OML BTS link: %s\n",
|
||||
strerror(errno));
|
||||
ipa_client_conn_close(link);
|
||||
|
@ -1191,7 +1191,7 @@ int e1inp_ipa_bts_rsl_connect_n(struct e1inp_line *line,
|
|||
}
|
||||
rsl_link->dscp = g_e1inp_ipaccess_pars.rsl.dscp;
|
||||
rsl_link->priority = g_e1inp_ipaccess_pars.rsl.priority;
|
||||
if (ipa_client_conn_open(rsl_link) < 0) {
|
||||
if (ipa_client_conn_open2(rsl_link, line->connect_timeout) < 0) {
|
||||
LOGP(DLINP, LOGL_ERROR, "cannot open RSL BTS link: %s\n",
|
||||
strerror(errno));
|
||||
ipa_client_conn_close(rsl_link);
|
||||
|
|
Loading…
Reference in New Issue