Don't establish RSL at same time as OML link on IPA type lines

If we have a BTS-side e1inp_line, we can only establish OML at the
time of line_update.  We have to wait with RSL until the BTS explicitly
tells us the RSL destination IP and port (received via OML from BSC).

This is now handled in a new function called
e1inp_ipa_bts_rsl_connect().
This commit is contained in:
Harald Welte 2013-06-30 13:13:59 +02:00
parent d331f862dc
commit 84f67b2832
3 changed files with 35 additions and 22 deletions

View File

@ -255,6 +255,11 @@ int e1_set_pcap_fd(int fd);
/* called by TRAU muxer to obtain the destination mux entity */
struct subch_mux *e1inp_get_mux(uint8_t e1_nr, uint8_t ts_nr);
/* on an IPA BTS, the BTS needs to establish the RSL connection much
* later than the OML connection. */
int e1inp_ipa_bts_rsl_connect(struct e1inp_line *line,
const char *rem_addr, uint16_t rem_port);
void e1inp_sign_link_destroy(struct e1inp_sign_link *link);
int e1inp_line_update(struct e1inp_line *line);

View File

@ -965,7 +965,7 @@ static int ipaccess_line_update(struct e1inp_line *line)
break;
}
case E1INP_LINE_R_BTS: {
struct ipa_client_conn *link, *rsl_link;
struct ipa_client_conn *link;
LOGP(DLINP, LOGL_NOTICE, "enabling ipaccess BTS mode\n");
@ -990,27 +990,6 @@ static int ipaccess_line_update(struct e1inp_line *line)
ipa_client_conn_destroy(link);
return -EIO;
}
rsl_link = ipa_client_conn_create(tall_ipa_ctx,
&line->ts[E1INP_SIGN_RSL-1],
E1INP_SIGN_RSL,
line->ops->cfg.ipa.addr,
IPA_TCP_PORT_RSL,
NULL,
ipaccess_bts_cb,
ipaccess_bts_write_cb,
NULL);
if (rsl_link == NULL) {
LOGP(DLINP, LOGL_ERROR, "cannot create RSL "
"BTS link: %s\n", strerror(errno));
return -ENOMEM;
}
if (ipa_client_conn_open(rsl_link) < 0) {
LOGP(DLINP, LOGL_ERROR, "cannot open RSL BTS link: %s\n",
strerror(errno));
ipa_client_conn_close(rsl_link);
ipa_client_conn_destroy(rsl_link);
return -EIO;
}
ret = 0;
break;
}
@ -1020,6 +999,34 @@ static int ipaccess_line_update(struct e1inp_line *line)
return ret;
}
int e1inp_ipa_bts_rsl_connect(struct e1inp_line *line,
const char *rem_addr, uint16_t rem_port)
{
struct ipa_client_conn *rsl_link;
rsl_link = ipa_client_conn_create(tall_ipa_ctx,
&line->ts[E1INP_SIGN_RSL-1],
E1INP_SIGN_RSL,
rem_addr, rem_port,
NULL,
ipaccess_bts_cb,
ipaccess_bts_write_cb,
NULL);
if (rsl_link == NULL) {
LOGP(DLINP, LOGL_ERROR, "cannot create RSL "
"BTS link: %s\n", strerror(errno));
return -ENOMEM;
}
if (ipa_client_conn_open(rsl_link) < 0) {
LOGP(DLINP, LOGL_ERROR, "cannot open RSL BTS link: %s\n",
strerror(errno));
ipa_client_conn_close(rsl_link);
ipa_client_conn_destroy(rsl_link);
return -EIO;
}
return 0;
}
void e1inp_ipaccess_init(void)
{
tall_ipa_ctx = talloc_named_const(libosmo_abis_ctx, 1, "ipa");

View File

@ -70,6 +70,7 @@ sign_link_up(void *unit, struct e1inp_line *line, enum e1inp_sign_type type)
/* Now we can send OML messages to the BSC. */
bts_state = BTS_TEST_OML_SIGN_LINK_UP;
}
e1inp_ipa_bts_rsl_connect(line, "127.0.0.1", IPA_TCP_PORT_RSL);
break;
case E1INP_SIGN_RSL:
LOGP(DBTSTEST, LOGL_NOTICE, "RSL link up request received.\n");