aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/ipaccess
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2011-08-17 22:44:07 +0200
committerHarald Welte <laforge@gnumonks.org>2011-08-19 22:38:35 +0200
commited5cacb240b846c106f0fc6a3ab8e8721f4c70a5 (patch)
treeba6bffbf0c95ecc0c50b5335bed77f3a2b29120f /openbsc/src/ipaccess
parent7abecfcfc9ef94c1367cd88ac858b79d20f75db0 (diff)
src: port openBSC over libosmo-abis0.9.15
This is a big patch that ports openBSC over libosmo-abis. Sorry, the changes that are included here are all dependent of libosmo-abis, splitting them into smaller pieces would leave the repository in some intermediate state, which is not desired. The main changes are: - The directory libabis/ has been removed as it now lives in libosmo-abis. - new configuration file format for nanoBTS and HSL femto, we need to define the virtual e1_line and attach it to the OML link. - all the existing BTS drivers (nanoBTS, hsl femto, Nokia site, BS11 and rbs2000) now use the new libosmo-abis framework. - use r232 input driver available in libosmo-abis for bs11_config. - use ipa_msg_recv instead of old ipaccess_read_msg function. - delete definition of gsm_e1_subslot and input_signal_data. These structures now lives in libosmo-abis. Most of this patch are deletions of libabis/ which has been moved to libosmo-abis. This patch also modifies openBSC to use all the new definitions available in libosmocore and libosmo-abis. In order to do that, we have replaced the following: - DINP, DMI, DMIB and DMUX by their respective DL* correspondences. - SS_GLOBAL by SS_L_GLOBAL - SS_INPUT by SS_L_INPUT - S_GLOBAL_SHUTDOWN by S_L_GLOBAL_SHUTDOWN - SS_INPUT by SS_L_INPUT - S_INP_* by S_L_INP_* sub-signals - E1INP_NODE by L_E1INP_NODE vty node This patch has been tested with: - one nanoBTS - the HSL femto with the examples available under libosmo-abis - BS11 with both dahdi and misdn drivers.
Diffstat (limited to 'openbsc/src/ipaccess')
-rw-r--r--openbsc/src/ipaccess/Makefile.am7
-rw-r--r--openbsc/src/ipaccess/ipaccess-config.c90
-rw-r--r--openbsc/src/ipaccess/ipaccess-proxy.c120
-rw-r--r--openbsc/src/ipaccess/network_listen.c2
4 files changed, 152 insertions, 67 deletions
diff --git a/openbsc/src/ipaccess/Makefile.am b/openbsc/src/ipaccess/Makefile.am
index 4fe1e379f..6d163f62e 100644
--- a/openbsc/src/ipaccess/Makefile.am
+++ b/openbsc/src/ipaccess/Makefile.am
@@ -1,12 +1,11 @@
INCLUDES = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)
-AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(COVERAGE_CFLAGS)
-AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(COVERAGE_LDFLAGS)
+AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(COVERAGE_CFLAGS)
+AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOABIS_LIBS) $(COVERAGE_LDFLAGS)
bin_PROGRAMS = ipaccess-find ipaccess-config ipaccess-proxy
ipaccess_find_LDADD = $(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libmsc/libmsc.a \
- $(top_builddir)/src/libabis/libabis.a \
$(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libtrau/libtrau.a \
$(top_builddir)/src/libcommon/libcommon.a
@@ -17,7 +16,6 @@ ipaccess_config_SOURCES = ipaccess-config.c ipaccess-firmware.c network_listen.c
# FIXME: resolve the bogus dependencies patched around here:
ipaccess_config_LDADD = $(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libmsc/libmsc.a \
- $(top_builddir)/src/libabis/libabis.a \
$(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libtrau/libtrau.a \
$(top_builddir)/src/libcommon/libcommon.a \
@@ -26,7 +24,6 @@ ipaccess_config_LDADD = $(top_builddir)/src/libbsc/libbsc.a \
ipaccess_proxy_SOURCES = ipaccess-proxy.c
ipaccess_proxy_LDADD = $(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libmsc/libmsc.a \
- $(top_builddir)/src/libabis/libabis.a \
$(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libtrau/libtrau.a \
$(top_builddir)/src/libcommon/libcommon.a
diff --git a/openbsc/src/ipaccess/ipaccess-config.c b/openbsc/src/ipaccess/ipaccess-config.c
index 368f788ee..05fdc14af 100644
--- a/openbsc/src/ipaccess/ipaccess-config.c
+++ b/openbsc/src/ipaccess/ipaccess-config.c
@@ -39,12 +39,19 @@
#include <osmocom/core/timer.h>
#include <openbsc/ipaccess.h>
#include <openbsc/gsm_data.h>
-#include <openbsc/e1_input.h>
+#include <osmocom/abis/e1_input.h>
+#include <openbsc/abis_nm.h>
+#include <openbsc/signal.h>
+#include <openbsc/debug.h>
+#include <openbsc/network_listen.h>
+#include <osmocom/abis/ipaccess.h>
+#include <openbsc/gsm_data.h>
#include <openbsc/abis_nm.h>
#include <openbsc/signal.h>
#include <openbsc/debug.h>
#include <openbsc/network_listen.h>
#include <osmocom/core/talloc.h>
+#include <osmocom/abis/abis.h>
static struct gsm_network *gsmnet;
@@ -80,6 +87,86 @@ static uint8_t prim_oml_attr[] = { 0x95, 0x00, 7, 0x88, 192, 168, 100, 11, 0x00,
static uint8_t unit_id_attr[] = { 0x91, 0x00, 9, '2', '3', '4', '2', '/' , '0', '/', '0', 0x00 };
*/
+extern int ipaccess_fd_cb(struct osmo_fd *bfd, unsigned int what);
+extern struct e1inp_line_ops ipaccess_e1inp_line_ops;
+
+/* Actively connect to a BTS. Currently used by ipaccess-config.c */
+static int ipaccess_connect(struct e1inp_line *line, struct sockaddr_in *sa)
+{
+ struct e1inp_ts *e1i_ts = &line->ts[0];
+ struct osmo_fd *bfd = &e1i_ts->driver.ipaccess.fd;
+ int ret, on = 1;
+
+ bfd->fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ bfd->cb = ipaccess_fd_cb;
+ bfd->when = BSC_FD_READ | BSC_FD_WRITE;
+ bfd->data = line;
+ bfd->priv_nr = E1INP_SIGN_OML;
+
+ if (bfd->fd < 0) {
+ LOGP(DLINP, LOGL_ERROR, "could not create TCP socket.\n");
+ return -EIO;
+ }
+
+ setsockopt(bfd->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+
+ ret = connect(bfd->fd, (struct sockaddr *) sa, sizeof(*sa));
+ if (ret < 0) {
+ LOGP(DLINP, LOGL_ERROR, "could not connect socket\n");
+ close(bfd->fd);
+ return ret;
+ }
+
+ ret = osmo_fd_register(bfd);
+ if (ret < 0) {
+ close(bfd->fd);
+ return ret;
+ }
+ return ret;
+ //return e1inp_line_register(line);
+}
+
+/* configure pseudo E1 line in ip.access style and connect to BTS */
+static int ia_config_connect(struct gsm_bts *bts, struct sockaddr_in *sin)
+{
+ struct e1inp_line *line;
+ struct e1inp_ts *sign_ts, *rsl_ts;
+ struct e1inp_sign_link *oml_link, *rsl_link;
+
+ line = talloc_zero(tall_bsc_ctx, struct e1inp_line);
+ if (!line)
+ return -ENOMEM;
+
+ line->driver = e1inp_driver_find("ipa");
+ if (!line->driver) {
+ fprintf(stderr, "cannot `ipa' driver, giving up.\n");
+ return -EINVAL;
+ }
+ line->ops = &ipaccess_e1inp_line_ops;
+
+ /* create E1 timeslots for signalling and TRAU frames */
+ e1inp_ts_config_sign(&line->ts[1-1], line);
+ e1inp_ts_config_sign(&line->ts[2-1], line);
+
+ /* create signalling links for TS1 */
+ sign_ts = &line->ts[1-1];
+ rsl_ts = &line->ts[2-1];
+ oml_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_OML,
+ bts->c0, 0xff, 0);
+ rsl_link = e1inp_sign_link_create(rsl_ts, E1INP_SIGN_RSL,
+ bts->c0, 0, 0);
+
+ /* create back-links from bts/trx */
+ bts->oml_link = oml_link;
+ bts->c0->rsl_link = rsl_link;
+
+ /* default port at BTS for incoming connections is 3006 */
+ if (sin->sin_port == 0)
+ sin->sin_port = htons(3006);
+
+ return ipaccess_connect(line, sin);
+}
+
/*
* Callback function for NACK on the OML NM
*
@@ -891,6 +978,7 @@ int main(int argc, char **argv)
fprintf(stderr, "you have to specify the IP address of the BTS. Use --help for more information\n");
exit(2);
}
+ libosmo_abis_init(tall_ctx_config);
gsmnet = gsm_network_init(1, 1, NULL);
if (!gsmnet)
diff --git a/openbsc/src/ipaccess/ipaccess-proxy.c b/openbsc/src/ipaccess/ipaccess-proxy.c
index 1dd5b8456..0f03e4e89 100644
--- a/openbsc/src/ipaccess/ipaccess-proxy.c
+++ b/openbsc/src/ipaccess/ipaccess-proxy.c
@@ -210,12 +210,12 @@ static int handle_udp_read(struct osmo_fd *bfd)
ret = recv(bfd->fd, msg->data, msg->data_len, 0);
if (ret < 0) {
if (errno != EAGAIN)
- LOGP(DINP, LOGL_ERROR, "recv error %s\n", strerror(errno));
+ LOGP(DLINP, LOGL_ERROR, "recv error %s\n", strerror(errno));
msgb_free(msg);
return ret;
}
if (ret == 0) {
- DEBUGP(DINP, "UDP peer disappeared, dead socket\n");
+ DEBUGP(DLINP, "UDP peer disappeared, dead socket\n");
osmo_fd_unregister(bfd);
close(bfd->fd);
bfd->fd = -1;
@@ -223,16 +223,16 @@ static int handle_udp_read(struct osmo_fd *bfd)
return -EIO;
}
if (ret < sizeof(*hh)) {
- DEBUGP(DINP, "could not even read header!?!\n");
+ DEBUGP(DLINP, "could not even read header!?!\n");
msgb_free(msg);
return -EIO;
}
msgb_put(msg, ret);
msg->l2h = msg->data + sizeof(*hh);
- DEBUGP(DMI, "UDP RX: %s\n", osmo_hexdump(msg->data, msg->len));
+ DEBUGP(DLMI, "UDP RX: %s\n", osmo_hexdump(msg->data, msg->len));
if (hh->len != msg->len - sizeof(*hh)) {
- DEBUGP(DINP, "length (%u/%u) disagrees with header(%u)\n",
+ DEBUGP(DLINP, "length (%u/%u) disagrees with header(%u)\n",
msg->len, msg->len - 3, hh->len);
msgb_free(msg);
return -EIO;
@@ -247,7 +247,7 @@ static int handle_udp_read(struct osmo_fd *bfd)
other_conn = ipbc->rsl_conn[0];
break;
default:
- DEBUGP(DINP, "Unknown protocol 0x%02x, sending to "
+ DEBUGP(DLINP, "Unknown protocol 0x%02x, sending to "
"OML FD\n", hh->proto);
/* fall through */
case IPAC_PROTO_IPACCESS:
@@ -264,7 +264,7 @@ static int handle_udp_read(struct osmo_fd *bfd)
other_conn = ipbc->bsc_rsl_conn[0];
break;
default:
- DEBUGP(DINP, "Unknown protocol 0x%02x, sending to "
+ DEBUGP(DLINP, "Unknown protocol 0x%02x, sending to "
"OML FD\n", hh->proto);
case IPAC_PROTO_IPACCESS:
case IPAC_PROTO_OML:
@@ -273,7 +273,7 @@ static int handle_udp_read(struct osmo_fd *bfd)
}
break;
default:
- DEBUGP(DINP, "Unknown filedescriptor priv_nr=%04x\n", bfd->priv_nr);
+ DEBUGP(DLINP, "Unknown filedescriptor priv_nr=%04x\n", bfd->priv_nr);
break;
}
@@ -323,12 +323,12 @@ static int ipbc_alloc_connect(struct ipa_proxy_conn *ipc, struct osmo_fd *bfd,
sin.sin_family = AF_INET;
inet_aton(bsc_ipaddr, &sin.sin_addr);
- DEBUGP(DINP, "(%u/%u/%u) New BTS connection: ",
+ DEBUGP(DLINP, "(%u/%u/%u) New BTS connection: ",
site_id, bts_id, trx_id);
/* OML needs to be established before RSL */
if ((bfd->priv_nr & 0xff) != OML_FROM_BTS) {
- DEBUGPC(DINP, "Not a OML connection ?!?\n");
+ DEBUGPC(DLINP, "Not a OML connection ?!?\n");
return -EIO;
}
@@ -339,7 +339,7 @@ static int ipbc_alloc_connect(struct ipa_proxy_conn *ipc, struct osmo_fd *bfd,
goto err_out;
}
- DEBUGPC(DINP, "Created BTS Conn data structure\n");
+ DEBUGPC(DLINP, "Created BTS Conn data structure\n");
ipbc->ipp = ipp;
ipbc->unit_id.site_id = site_id;
ipbc->unit_id.bts_id = bts_id;
@@ -360,7 +360,7 @@ static int ipbc_alloc_connect(struct ipa_proxy_conn *ipc, struct osmo_fd *bfd,
goto err_bsc_conn;
}
- DEBUGP(DINP, "(%u/%u/%u) OML Connected to BSC\n",
+ DEBUGP(DLINP, "(%u/%u/%u) OML Connected to BSC\n",
site_id, bts_id, trx_id);
/* Create UDP socket for BTS packet injection */
@@ -369,7 +369,7 @@ static int ipbc_alloc_connect(struct ipa_proxy_conn *ipc, struct osmo_fd *bfd,
UDP_TO_BTS, udp_fd_cb, ipbc);
if (ret < 0)
goto err_udp_bts;
- DEBUGP(DINP, "(%u/%u/%u) Created UDP socket for injection "
+ DEBUGP(DLINP, "(%u/%u/%u) Created UDP socket for injection "
"towards BTS at port %u\n", site_id, bts_id, trx_id, udp_port);
/* Create UDP socket for BSC packet injection */
@@ -378,7 +378,7 @@ static int ipbc_alloc_connect(struct ipa_proxy_conn *ipc, struct osmo_fd *bfd,
UDP_TO_BSC, udp_fd_cb, ipbc);
if (ret < 0)
goto err_udp_bsc;
- DEBUGP(DINP, "(%u/%u/%u) Created UDP socket for injection "
+ DEBUGP(DLINP, "(%u/%u/%u) Created UDP socket for injection "
"towards BSC at port %u\n", site_id, bts_id, trx_id, udp_port);
@@ -394,13 +394,13 @@ static int ipbc_alloc_connect(struct ipa_proxy_conn *ipc, struct osmo_fd *bfd,
ret = make_sock(&ipbc->gprs_ns_fd, IPPROTO_UDP, ip, 0, 0,
gprs_ns_cb, ipbc);
if (ret < 0) {
- LOGP(DINP, LOGL_ERROR, "Creating the GPRS socket failed.\n");
+ LOGP(DLINP, LOGL_ERROR, "Creating the GPRS socket failed.\n");
goto err_udp_bsc;
}
ret = getsockname(ipbc->gprs_ns_fd.fd, (struct sockaddr* ) &sock, &len);
ipbc->gprs_local_port = ntohs(sock.sin_port);
- LOGP(DINP, LOGL_NOTICE,
+ LOGP(DLINP, LOGL_NOTICE,
"Created GPRS NS Socket. Listening on: %s:%d\n",
inet_ntoa(sock.sin_addr), ipbc->gprs_local_port);
@@ -445,17 +445,17 @@ static int ipaccess_rcvmsg(struct ipa_proxy_conn *ipc, struct msgb *msg,
ret = ipaccess_send_pong(bfd->fd);
break;
case IPAC_MSGT_PONG:
- DEBUGP(DMI, "PONG!\n");
+ DEBUGP(DLMI, "PONG!\n");
break;
case IPAC_MSGT_ID_RESP:
- DEBUGP(DMI, "ID_RESP ");
+ DEBUGP(DLMI, "ID_RESP ");
/* parse tags, search for Unit ID */
ipaccess_idtag_parse(&tlvp, (uint8_t *)msg->l2h + 2,
msgb_l2len(msg)-2);
- DEBUGP(DMI, "\n");
+ DEBUGP(DLMI, "\n");
if (!TLVP_PRESENT(&tlvp, IPAC_IDTAG_UNIT)) {
- LOGP(DINP, LOGL_ERROR, "No Unit ID in ID RESPONSE !?!\n");
+ LOGP(DLINP, LOGL_ERROR, "No Unit ID in ID RESPONSE !?!\n");
return -EIO;
}
@@ -479,17 +479,17 @@ static int ipaccess_rcvmsg(struct ipa_proxy_conn *ipc, struct msgb *msg,
sin.sin_family = AF_INET;
inet_aton(bsc_ipaddr, &sin.sin_addr);
- DEBUGP(DINP, "Identified BTS %u/%u/%u\n",
+ DEBUGP(DLINP, "Identified BTS %u/%u/%u\n",
site_id, bts_id, trx_id);
if ((bfd->priv_nr & 0xff) != RSL_FROM_BTS) {
- LOGP(DINP, LOGL_ERROR, "Second OML connection from "
+ LOGP(DLINP, LOGL_ERROR, "Second OML connection from "
"same BTS ?!?\n");
return 0;
}
if (trx_id >= MAX_TRX) {
- LOGP(DINP, LOGL_ERROR, "We don't support more "
+ LOGP(DLINP, LOGL_ERROR, "We don't support more "
"than %u TRX\n", MAX_TRX);
return -EINVAL;
}
@@ -505,30 +505,30 @@ static int ipaccess_rcvmsg(struct ipa_proxy_conn *ipc, struct msgb *msg,
connect_bsc(&sin, RSL_TO_BSC | (trx_id << 8), ipbc);
if (!ipbc->bsc_oml_conn)
return -EIO;
- DEBUGP(DINP, "(%u/%u/%u) Connected RSL to BSC\n",
+ DEBUGP(DLINP, "(%u/%u/%u) Connected RSL to BSC\n",
site_id, bts_id, trx_id);
}
break;
case IPAC_MSGT_ID_GET:
- DEBUGP(DMI, "ID_GET\n");
+ DEBUGP(DLMI, "ID_GET\n");
if ((bfd->priv_nr & 0xff) != OML_TO_BSC &&
(bfd->priv_nr & 0xff) != RSL_TO_BSC) {
- DEBUGP(DINP, "IDentity REQuest from BTS ?!?\n");
+ DEBUGP(DLINP, "IDentity REQuest from BTS ?!?\n");
return -EIO;
}
ipbc = ipc->bts_conn;
if (!ipbc) {
- DEBUGP(DINP, "ID_GET from BSC before we have ID_RESP from BTS\n");
+ DEBUGP(DLINP, "ID_GET from BSC before we have ID_RESP from BTS\n");
return -EIO;
}
ret = write(bfd->fd, ipbc->id_resp, ipbc->id_resp_len);
break;
case IPAC_MSGT_ID_ACK:
- DEBUGP(DMI, "ID_ACK? -> ACK!\n");
+ DEBUGP(DLMI, "ID_ACK? -> ACK!\n");
ret = ipaccess_send_id_ack(bfd->fd);
break;
default:
- LOGP(DMI, LOGL_ERROR, "Unhandled IPA type; %d\n", msg_type);
+ LOGP(DLMI, LOGL_ERROR, "Unhandled IPA type; %d\n", msg_type);
return 1;
break;
}
@@ -551,7 +551,7 @@ struct msgb *ipaccess_proxy_read_msg(struct osmo_fd *bfd, int *error)
ret = recv(bfd->fd, msg->data, 3, 0);
if (ret < 0) {
if (errno != EAGAIN)
- LOGP(DINP, LOGL_ERROR, "recv error: %s\n", strerror(errno));
+ LOGP(DLINP, LOGL_ERROR, "recv error: %s\n", strerror(errno));
msgb_free(msg);
*error = ret;
return NULL;
@@ -568,7 +568,7 @@ struct msgb *ipaccess_proxy_read_msg(struct osmo_fd *bfd, int *error)
len = ntohs(hh->len);
ret = recv(bfd->fd, msg->l2h, len, 0);
if (ret < len) {
- LOGP(DINP, LOGL_ERROR, "short read!\n");
+ LOGP(DLINP, LOGL_ERROR, "short read!\n");
msgb_free(msg);
*error = -EIO;
return NULL;
@@ -611,7 +611,7 @@ static void reconn_tmr_cb(void *data)
struct sockaddr_in sin;
int i;
- DEBUGP(DINP, "Running reconnect timer\n");
+ DEBUGP(DLINP, "Running reconnect timer\n");
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
@@ -621,13 +621,13 @@ static void reconn_tmr_cb(void *data)
/* if OML to BSC is dead, try to restore it */
if (ipbc->oml_conn && !ipbc->bsc_oml_conn) {
sin.sin_port = htons(IPA_TCP_PORT_OML);
- logp_ipbc_uid(DINP, LOGL_NOTICE, ipbc, 0);
- LOGPC(DINP, LOGL_NOTICE, "OML Trying to reconnect\n");
+ logp_ipbc_uid(DLINP, LOGL_NOTICE, ipbc, 0);
+ LOGPC(DLINP, LOGL_NOTICE, "OML Trying to reconnect\n");
ipbc->bsc_oml_conn = connect_bsc(&sin, OML_TO_BSC, ipbc);
if (!ipbc->bsc_oml_conn)
goto reschedule;
- logp_ipbc_uid(DINP, LOGL_NOTICE, ipbc, 0);
- LOGPC(DINP, LOGL_NOTICE, "OML Reconnected\n");
+ logp_ipbc_uid(DLINP, LOGL_NOTICE, ipbc, 0);
+ LOGPC(DLINP, LOGL_NOTICE, "OML Reconnected\n");
}
/* if we (still) don't have a OML connection, skip RSL */
if (!ipbc->oml_conn || !ipbc->bsc_oml_conn)
@@ -644,13 +644,13 @@ static void reconn_tmr_cb(void *data)
priv_nr &= ~0xff;
priv_nr |= RSL_TO_BSC;
sin.sin_port = htons(IPA_TCP_PORT_RSL);
- logp_ipbc_uid(DINP, LOGL_NOTICE, ipbc, priv_nr >> 8);
- LOGPC(DINP, LOGL_NOTICE, "RSL Trying to reconnect\n");
+ logp_ipbc_uid(DLINP, LOGL_NOTICE, ipbc, priv_nr >> 8);
+ LOGPC(DLINP, LOGL_NOTICE, "RSL Trying to reconnect\n");
ipbc->bsc_rsl_conn[i] = connect_bsc(&sin, priv_nr, ipbc);
if (!ipbc->bsc_rsl_conn)
goto reschedule;
- logp_ipbc_uid(DINP, LOGL_NOTICE, ipbc, priv_nr >> 8);
- LOGPC(DINP, LOGL_NOTICE, "RSL Reconnected\n");
+ logp_ipbc_uid(DLINP, LOGL_NOTICE, ipbc, priv_nr >> 8);
+ LOGPC(DLINP, LOGL_NOTICE, "RSL Reconnected\n");
}
}
return;
@@ -778,8 +778,8 @@ static int handle_tcp_read(struct osmo_fd *bfd)
msg = ipaccess_proxy_read_msg(bfd, &ret);
if (!msg) {
if (ret == 0) {
- logp_ipbc_uid(DINP, LOGL_NOTICE, ipbc, bfd->priv_nr >> 8);
- LOGPC(DINP, LOGL_NOTICE, "%s disappeared, "
+ logp_ipbc_uid(DLINP, LOGL_NOTICE, ipbc, bfd->priv_nr >> 8);
+ LOGPC(DLINP, LOGL_NOTICE, "%s disappeared, "
"dead socket\n", btsbsc);
handle_dead_socket(bfd);
}
@@ -787,8 +787,8 @@ static int handle_tcp_read(struct osmo_fd *bfd)
}
msgb_put(msg, ret);
- logp_ipbc_uid(DMI, LOGL_DEBUG, ipbc, bfd->priv_nr >> 8);
- DEBUGPC(DMI, "RX<-%s: %s\n", btsbsc, osmo_hexdump(msg->data, msg->len));
+ logp_ipbc_uid(DLMI, LOGL_DEBUG, ipbc, bfd->priv_nr >> 8);
+ DEBUGPC(DLMI, "RX<-%s: %s\n", btsbsc, osmo_hexdump(msg->data, msg->len));
hh = (struct ipaccess_head *) msg->data;
if (hh->proto == IPAC_PROTO_IPACCESS) {
@@ -809,7 +809,7 @@ static int handle_tcp_read(struct osmo_fd *bfd)
}
if (!ipbc) {
- LOGP(DINP, LOGL_ERROR,
+ LOGP(DLINP, LOGL_ERROR,
"received %s packet but no ipc->bts_conn?!?\n", btsbsc);
msgb_free(msg);
return -EIO;
@@ -824,8 +824,8 @@ static int handle_tcp_read(struct osmo_fd *bfd)
/* mark respective filedescriptor as 'we want to write' */
bsc_conn->fd.when |= BSC_FD_WRITE;
} else {
- logp_ipbc_uid(DINP, LOGL_INFO, ipbc, bfd->priv_nr >> 8);
- LOGPC(DINP, LOGL_INFO, "Dropping packet from %s, "
+ logp_ipbc_uid(DLINP, LOGL_INFO, ipbc, bfd->priv_nr >> 8);
+ LOGPC(DLINP, LOGL_INFO, "Dropping packet from %s, "
"since remote connection is dead\n", btsbsc);
msgb_free(msg);
}
@@ -858,16 +858,16 @@ static int handle_tcp_write(struct osmo_fd *bfd)
llist_del(lh);
msg = llist_entry(lh, struct msgb, list);
- logp_ipbc_uid(DMI, LOGL_DEBUG, ipbc, bfd->priv_nr >> 8);
- DEBUGPC(DMI, "TX %04x: %s\n", bfd->priv_nr,
+ logp_ipbc_uid(DLMI, LOGL_DEBUG, ipbc, bfd->priv_nr >> 8);
+ DEBUGPC(DLMI, "TX %04x: %s\n", bfd->priv_nr,
osmo_hexdump(msg->data, msg->len));
ret = send(bfd->fd, msg->data, msg->len, 0);
msgb_free(msg);
if (ret == 0) {
- logp_ipbc_uid(DINP, LOGL_NOTICE, ipbc, bfd->priv_nr >> 8);
- LOGP(DINP, LOGL_NOTICE, "%s disappeared, dead socket\n", btsbsc);
+ logp_ipbc_uid(DLINP, LOGL_NOTICE, ipbc, bfd->priv_nr >> 8);
+ LOGP(DLINP, LOGL_NOTICE, "%s disappeared, dead socket\n", btsbsc);
handle_dead_socket(bfd);
}
@@ -907,7 +907,7 @@ static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what)
perror("accept");
return ret;
}
- DEBUGP(DINP, "accept()ed new %s link from %s\n",
+ DEBUGP(DLINP, "accept()ed new %s link from %s\n",
(listen_bfd->priv_nr & 0xff) == OML_FROM_BTS ? "OML" : "RSL",
inet_ntoa(sa.sin_addr));
@@ -925,7 +925,7 @@ static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what)
bfd->when = BSC_FD_READ;
ret = osmo_fd_register(bfd);
if (ret < 0) {
- LOGP(DINP, LOGL_ERROR, "could not register FD\n");
+ LOGP(DLINP, LOGL_ERROR, "could not register FD\n");
close(bfd->fd);
talloc_free(ipc);
return ret;
@@ -950,7 +950,7 @@ static void send_ns(int fd, const char *buf, int size, struct in_addr ip, int po
ret = sendto(fd, buf, size, 0, (struct sockaddr *) &addr, len);
if (ret < 0) {
- LOGP(DINP, LOGL_ERROR, "Failed to forward GPRS message.\n");
+ LOGP(DLINP, LOGL_ERROR, "Failed to forward GPRS message.\n");
}
}
@@ -965,7 +965,7 @@ static int gprs_ns_cb(struct osmo_fd *bfd, unsigned int what)
/* 1. get the data... */
ret = recvfrom(bfd->fd, buf, sizeof(buf), 0, (struct sockaddr *) &sock, &len);
if (ret < 0) {
- LOGP(DINP, LOGL_ERROR, "Failed to recv GPRS NS msg: %s.\n", strerror(errno));
+ LOGP(DLINP, LOGL_ERROR, "Failed to recv GPRS NS msg: %s.\n", strerror(errno));
return -1;
}
@@ -973,13 +973,13 @@ static int gprs_ns_cb(struct osmo_fd *bfd, unsigned int what)
/* 2. figure out where to send it to */
if (memcmp(&sock.sin_addr, &ipp->gprs_addr, sizeof(sock.sin_addr)) == 0) {
- LOGP(DINP, LOGL_DEBUG, "GPRS NS msg from network.\n");
+ LOGP(DLINP, LOGL_DEBUG, "GPRS NS msg from network.\n");
send_ns(bfd->fd, buf, ret, bts->bts_addr, 23000);
} else if (memcmp(&sock.sin_addr, &bts->bts_addr, sizeof(sock.sin_addr)) == 0) {
- LOGP(DINP, LOGL_DEBUG, "GPRS NS msg from BTS.\n");
+ LOGP(DLINP, LOGL_DEBUG, "GPRS NS msg from BTS.\n");
send_ns(bfd->fd, buf, ret, ipp->gprs_addr, 23000);
} else {
- LOGP(DINP, LOGL_ERROR, "Unknown GPRS source: %s\n", inet_ntoa(sock.sin_addr));
+ LOGP(DLINP, LOGL_ERROR, "Unknown GPRS source: %s\n", inet_ntoa(sock.sin_addr));
}
return 0;
@@ -1009,7 +1009,7 @@ static struct ipa_proxy_conn *connect_bsc(struct sockaddr_in *sa, int priv_nr, v
ret = connect(bfd->fd, (struct sockaddr *) sa, sizeof(*sa));
if (ret < 0) {
- LOGP(DINP, LOGL_ERROR, "Could not connect socket: %s\n",
+ LOGP(DLINP, LOGL_ERROR, "Could not connect socket: %s\n",
inet_ntoa(sa->sin_addr));
close(bfd->fd);
talloc_free(ipc);
@@ -1184,7 +1184,7 @@ int main(int argc, char **argv)
tall_bsc_ctx = talloc_named_const(NULL, 1, "ipaccess-proxy");
osmo_init_logging(&log_info);
- log_parse_category_mask(osmo_stderr_target, "DINP:DMI");
+ log_parse_category_mask(osmo_stderr_target, "DLINP:DLMI");
handle_options(argc, argv);
diff --git a/openbsc/src/ipaccess/network_listen.c b/openbsc/src/ipaccess/network_listen.c
index 71b49eaaf..6749c4aa3 100644
--- a/openbsc/src/ipaccess/network_listen.c
+++ b/openbsc/src/ipaccess/network_listen.c
@@ -37,7 +37,7 @@
#include <openbsc/abis_nm.h>
#include <openbsc/signal.h>
#include <openbsc/debug.h>
-#include <openbsc/e1_input.h>
+#include <osmocom/abis/e1_input.h>
#define WHITELIST_MAX_SIZE ((NUM_ARFCNS*2)+2+1)