diff options
author | Harald Welte <laforge@gnumonks.org> | 2013-06-30 13:13:59 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2013-10-06 11:54:38 +0200 |
commit | 84f67b2832f984fd28e78596bc3d7fbbc661e04f (patch) | |
tree | d8ee999efacb3adb74a73b2b06645862fbaa7cd8 | |
parent | d331f862dc5d0217a836c8826790c45e86b77ec3 (diff) |
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().
-rw-r--r-- | include/osmocom/abis/e1_input.h | 5 | ||||
-rw-r--r-- | src/input/ipaccess.c | 51 | ||||
-rw-r--r-- | tests/e1inp_ipa_bts_test.c | 1 |
3 files changed, 35 insertions, 22 deletions
diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h index f9f5bec..0abf0b8 100644 --- a/include/osmocom/abis/e1_input.h +++ b/include/osmocom/abis/e1_input.h @@ -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); diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c index 2eb0335..7e1891e 100644 --- a/src/input/ipaccess.c +++ b/src/input/ipaccess.c @@ -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"); diff --git a/tests/e1inp_ipa_bts_test.c b/tests/e1inp_ipa_bts_test.c index 31aac95..02a4cb3 100644 --- a/tests/e1inp_ipa_bts_test.c +++ b/tests/e1inp_ipa_bts_test.c @@ -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"); |