summaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/osmoappdesc.py5
-rw-r--r--openbsc/src/libbsc/bsc_msc.c8
-rw-r--r--openbsc/src/libbsc/bsc_rf_ctrl.c4
-rw-r--r--openbsc/src/libbsc/pcu_sock.c18
-rw-r--r--openbsc/src/libcommon/bsc_version.c9
-rw-r--r--openbsc/src/libcommon/socket.c2
-rw-r--r--openbsc/src/libmgcp/mgcp_network.c4
-rw-r--r--openbsc/src/libmgcp/mgcp_osmux.c2
-rw-r--r--openbsc/src/libmsc/meas_feed.c4
-rw-r--r--openbsc/src/libmsc/mncc_sock.c20
-rw-r--r--openbsc/src/libmsc/smpp_smsc.c2
-rw-r--r--openbsc/src/libtrau/rtp_proxy.c18
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_msc.c2
-rw-r--r--openbsc/src/osmo-bsc_mgcp/mgcp_main.c2
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c2
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat.c20
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_ussd.c4
-rw-r--r--openbsc/src/osmo-nitb/bsc_hack.c47
-rwxr-xr-xopenbsc/tests/ctrl_test_runner.py3
-rwxr-xr-xopenbsc/tests/smpp_test_runner.py3
-rwxr-xr-xopenbsc/tests/vty_test_runner.py3
21 files changed, 119 insertions, 63 deletions
diff --git a/openbsc/osmoappdesc.py b/openbsc/osmoappdesc.py
index af949e8fa..ba3ccf900 100644
--- a/openbsc/osmoappdesc.py
+++ b/openbsc/osmoappdesc.py
@@ -39,10 +39,11 @@ app_configs = {
apps = [(4242, "src/osmo-bsc/osmo-bsc-sccplite", "OsmoBSC", "osmo-bsc-sccplite"),
(4244, "src/osmo-bsc_nat/osmo-bsc_nat", "OsmoBSCNAT", "nat"),
(4243, "src/osmo-bsc_mgcp/osmo-bsc_mgcp", "OpenBSC MGCP", "mgcp"),
- (4242, "src/osmo-nitb/osmo-nitb", "OpenBSC", "nitb"),
+ (4242, "src/osmo-nitb/osmo-nitb --yes-i-really-want-to-run-prehistoric-software", "OpenBSC", "nitb"),
]
vty_command = ["./src/osmo-nitb/osmo-nitb", "-c",
- "doc/examples/osmo-nitb/nanobts/osmo-nitb.cfg"]
+ "doc/examples/osmo-nitb/nanobts/osmo-nitb.cfg",
+ "--yes-i-really-want-to-run-prehistoric-software"]
vty_app = apps[3] # reference apps[] entry for osmo-nitb
diff --git a/openbsc/src/libbsc/bsc_msc.c b/openbsc/src/libbsc/bsc_msc.c
index 82a572dbe..dac0e5203 100644
--- a/openbsc/src/libbsc/bsc_msc.c
+++ b/openbsc/src/libbsc/bsc_msc.c
@@ -81,7 +81,7 @@ static int msc_connection_connect(struct osmo_fd *fd, unsigned int what)
queue = container_of(fd, struct osmo_wqueue, bfd);
con = container_of(queue, struct bsc_msc_connection, write_queue);
- if ((what & BSC_FD_WRITE) == 0) {
+ if ((what & OSMO_FD_WRITE) == 0) {
LOGP(DMSC, LOGL_ERROR,
"MSC(%s) Callback but not writable.\n", con->name);
return -1;
@@ -107,7 +107,7 @@ static int msc_connection_connect(struct osmo_fd *fd, unsigned int what)
/* go to full operation */
fd->cb = osmo_wqueue_bfd_cb;
- fd->when = BSC_FD_READ | BSC_FD_EXCEPT;
+ fd->when = OSMO_FD_READ | OSMO_FD_EXCEPT;
con->is_connected = 1;
LOGP(DMSC, LOGL_NOTICE,
@@ -209,7 +209,7 @@ int bsc_msc_connect(struct bsc_msc_connection *con)
if (ret == -1 && errno == EINPROGRESS) {
LOGP(DMSC, LOGL_ERROR,
"MSC(%s) Connection in progress\n", con->name);
- fd->when = BSC_FD_WRITE;
+ fd->when = OSMO_FD_WRITE;
fd->cb = msc_connection_connect;
osmo_timer_setup(&con->timeout_timer, msc_con_timeout, con);
osmo_timer_schedule(&con->timeout_timer, 20, 0);
@@ -218,7 +218,7 @@ int bsc_msc_connect(struct bsc_msc_connection *con)
connection_loss(con);
return ret;
} else {
- fd->when = BSC_FD_READ | BSC_FD_EXCEPT;
+ fd->when = OSMO_FD_READ | OSMO_FD_EXCEPT;
fd->cb = osmo_wqueue_bfd_cb;
con->is_connected = 1;
if (con->connected)
diff --git a/openbsc/src/libbsc/bsc_rf_ctrl.c b/openbsc/src/libbsc/bsc_rf_ctrl.c
index 0e28600b5..9159a8f76 100644
--- a/openbsc/src/libbsc/bsc_rf_ctrl.c
+++ b/openbsc/src/libbsc/bsc_rf_ctrl.c
@@ -373,7 +373,7 @@ static int rf_ctrl_accept(struct osmo_fd *bfd, unsigned int what)
osmo_wqueue_init(&conn->queue, 10);
conn->queue.bfd.data = conn;
conn->queue.bfd.fd = fd;
- conn->queue.bfd.when = BSC_FD_READ | BSC_FD_WRITE;
+ conn->queue.bfd.when = OSMO_FD_READ | OSMO_FD_WRITE;
conn->queue.read_cb = rf_read_cmd;
conn->queue.write_cb = rf_write_cmd;
conn->rf = rf;
@@ -479,7 +479,7 @@ static int rf_create_socket(struct osmo_bsc_rf *rf, const char *path)
return -1;
}
- bfd->when = BSC_FD_READ;
+ bfd->when = OSMO_FD_READ;
bfd->cb = rf_ctrl_accept;
bfd->data = rf;
diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c
index e2066ba3e..4411df84a 100644
--- a/openbsc/src/libbsc/pcu_sock.c
+++ b/openbsc/src/libbsc/pcu_sock.c
@@ -484,7 +484,7 @@ static int pcu_sock_send(struct gsm_bts *bts, struct msgb *msg)
return -EIO;
}
msgb_enqueue(&state->upqueue, msg);
- conn_bfd->when |= BSC_FD_WRITE;
+ conn_bfd->when |= OSMO_FD_WRITE;
return 0;
}
@@ -507,7 +507,7 @@ static void pcu_sock_close(struct pcu_sock_state *state)
osmo_fd_unregister(bfd);
/* re-enable the generation of ACCEPT for new connections */
- state->listen_bfd.when |= BSC_FD_READ;
+ state->listen_bfd.when |= OSMO_FD_READ;
#if 0
/* remove si13, ... */
@@ -586,7 +586,7 @@ static int pcu_sock_write(struct osmo_fd *bfd)
msg = llist_entry(state->upqueue.next, struct msgb, list);
pcu_prim = (struct gsm_pcu_if *)msg->data;
- bfd->when &= ~BSC_FD_WRITE;
+ bfd->when &= ~OSMO_FD_WRITE;
/* bug hunter 8-): maybe someone forgot msgb_put(...) ? */
if (!msgb_length(msg)) {
@@ -601,7 +601,7 @@ static int pcu_sock_write(struct osmo_fd *bfd)
goto close;
if (rc < 0) {
if (errno == EAGAIN) {
- bfd->when |= BSC_FD_WRITE;
+ bfd->when |= OSMO_FD_WRITE;
break;
}
goto close;
@@ -625,12 +625,12 @@ static int pcu_sock_cb(struct osmo_fd *bfd, unsigned int flags)
{
int rc = 0;
- if (flags & BSC_FD_READ)
+ if (flags & OSMO_FD_READ)
rc = pcu_sock_read(bfd);
if (rc < 0)
return rc;
- if (flags & BSC_FD_WRITE)
+ if (flags & OSMO_FD_WRITE)
rc = pcu_sock_write(bfd);
return rc;
@@ -656,13 +656,13 @@ static int pcu_sock_accept(struct osmo_fd *bfd, unsigned int flags)
LOGP(DPCU, LOGL_NOTICE, "PCU connects but we already have "
"another active connection ?!?\n");
/* We already have one PCU connected, this is all we support */
- state->listen_bfd.when &= ~BSC_FD_READ;
+ state->listen_bfd.when &= ~OSMO_FD_READ;
close(rc);
return 0;
}
conn_bfd->fd = rc;
- conn_bfd->when = BSC_FD_READ;
+ conn_bfd->when = OSMO_FD_READ;
conn_bfd->cb = pcu_sock_cb;
conn_bfd->data = state;
@@ -705,7 +705,7 @@ int pcu_sock_init(const char *path, struct gsm_bts *bts)
return -1;
}
- bfd->when = BSC_FD_READ;
+ bfd->when = OSMO_FD_READ;
bfd->cb = pcu_sock_accept;
bfd->data = state;
diff --git a/openbsc/src/libcommon/bsc_version.c b/openbsc/src/libcommon/bsc_version.c
index f0369bffe..9111a0eb1 100644
--- a/openbsc/src/libcommon/bsc_version.c
+++ b/openbsc/src/libcommon/bsc_version.c
@@ -19,12 +19,19 @@
#include "../../bscconfig.h"
+#define DIVIDER "======================================================================\r\n"
const char *openbsc_copyright =
"Copyright (C) 2008-2016 Harald Welte, Holger Freyther\r\n"
"Contributions by Daniel Willmann, Jan Lübbe, Stefan Schmidt\r\n"
"Dieter Spaar, Andreas Eversberg, Sylvain Munaut, Neels Hofmeyr\r\n\r\n"
"License AGPLv3+: GNU AGPL version 3 or later <http://gnu.org/licenses/agpl-3.0.html>\r\n"
"This is free software: you are free to change and redistribute it.\r\n"
- "There is NO WARRANTY, to the extent permitted by law.\r\n";
+ "There is NO WARRANTY, to the extent permitted by law.\r\n" DIVIDER
+ "WARNING: You should not run osmo-nitb except for archaeological purpose.\r\n"
+ "It is ancient, unmaintained and obsolete for several years. But you seem\r\n"
+ "to insist on using obsolete and known-broken software that ignores years \r\n"
+ "of hard development work. That's your choice, but you have been warned.\r\n"
+ "DON'T EVER BOTHER THE DEVELOPERS IF YOU ENCOUNTER PROBLEMS WITH IT!!!\r\n"
+ "See https://osmocom.org/projects/cellular-infrastructure/wiki/Osmocom_Network_In_The_Box\r\n" DIVIDER;
diff --git a/openbsc/src/libcommon/socket.c b/openbsc/src/libcommon/socket.c
index 2a64767f8..5697c3367 100644
--- a/openbsc/src/libcommon/socket.c
+++ b/openbsc/src/libcommon/socket.c
@@ -65,7 +65,7 @@ int make_sock(struct osmo_fd *bfd, int proto,
bfd->fd = socket(AF_INET, type, proto);
bfd->cb = cb;
- bfd->when = BSC_FD_READ;
+ bfd->when = OSMO_FD_READ;
bfd->data = data;
bfd->priv_nr = priv_nr;
diff --git a/openbsc/src/libmgcp/mgcp_network.c b/openbsc/src/libmgcp/mgcp_network.c
index 49500d92c..e2686587d 100644
--- a/openbsc/src/libmgcp/mgcp_network.c
+++ b/openbsc/src/libmgcp/mgcp_network.c
@@ -972,14 +972,14 @@ static int bind_rtp(struct mgcp_config *cfg, const char *source_addr,
mgcp_set_ip_tos(rtp_end->rtp.fd, cfg->endp_dscp);
mgcp_set_ip_tos(rtp_end->rtcp.fd, cfg->endp_dscp);
- rtp_end->rtp.when = BSC_FD_READ;
+ rtp_end->rtp.when = OSMO_FD_READ;
if (osmo_fd_register(&rtp_end->rtp) != 0) {
LOGP(DMGCP, LOGL_ERROR, "Failed to register RTP port %d on 0x%x\n",
rtp_end->local_port, endpno);
goto cleanup2;
}
- rtp_end->rtcp.when = BSC_FD_READ;
+ rtp_end->rtcp.when = OSMO_FD_READ;
if (osmo_fd_register(&rtp_end->rtcp) != 0) {
LOGP(DMGCP, LOGL_ERROR, "Failed to register RTCP port %d on 0x%x\n",
rtp_end->local_port + 1, endpno);
diff --git a/openbsc/src/libmgcp/mgcp_osmux.c b/openbsc/src/libmgcp/mgcp_osmux.c
index ce344ca7b..232c23ad6 100644
--- a/openbsc/src/libmgcp/mgcp_osmux.c
+++ b/openbsc/src/libmgcp/mgcp_osmux.c
@@ -445,7 +445,7 @@ int osmux_init(int role, struct mgcp_config *cfg)
return ret;
}
mgcp_set_ip_tos(osmux_fd.fd, cfg->endp_dscp);
- osmux_fd.when |= BSC_FD_READ;
+ osmux_fd.when |= OSMO_FD_READ;
ret = osmo_fd_register(&osmux_fd);
if (ret < 0) {
diff --git a/openbsc/src/libmsc/meas_feed.c b/openbsc/src/libmsc/meas_feed.c
index 3ddcdc39c..64134934c 100644
--- a/openbsc/src/libmsc/meas_feed.c
+++ b/openbsc/src/libmsc/meas_feed.c
@@ -101,7 +101,7 @@ static int feed_read_cb(struct osmo_fd *ofd)
char buf[256];
rc = read(ofd->fd, buf, sizeof(buf));
- ofd->fd &= ~BSC_FD_READ;
+ ofd->fd &= ~OSMO_FD_READ;
return rc;
}
@@ -140,7 +140,7 @@ int meas_feed_cfg_set(const char *dst_host, uint16_t dst_port)
if (rc < 0)
return rc;
- g_mfs.wqueue.bfd.when &= ~BSC_FD_READ;
+ g_mfs.wqueue.bfd.when &= ~OSMO_FD_READ;
if (g_mfs.dst_host)
talloc_free(g_mfs.dst_host);
diff --git a/openbsc/src/libmsc/mncc_sock.c b/openbsc/src/libmsc/mncc_sock.c
index 0efe3a156..98cafa16c 100644
--- a/openbsc/src/libmsc/mncc_sock.c
+++ b/openbsc/src/libmsc/mncc_sock.c
@@ -73,7 +73,7 @@ int mncc_sock_from_cc(struct gsm_network *net, struct msgb *msg)
/* Actually enqueue the message and mark socket write need */
msgb_enqueue(&net->upqueue, msg);
- net->mncc_state->conn_bfd.when |= BSC_FD_WRITE;
+ net->mncc_state->conn_bfd.when |= OSMO_FD_WRITE;
return 0;
}
@@ -88,7 +88,7 @@ static void mncc_sock_close(struct mncc_sock_state *state)
osmo_fd_unregister(bfd);
/* re-enable the generation of ACCEPT for new connections */
- state->listen_bfd.when |= BSC_FD_READ;
+ state->listen_bfd.when |= OSMO_FD_READ;
/* release all exisitng calls */
gsm0408_clear_all_trans(state->net, GSM48_PDISC_CC);
@@ -151,7 +151,7 @@ static int mncc_sock_write(struct osmo_fd *bfd)
msg = llist_entry(net->upqueue.next, struct msgb, list);
mncc_prim = (struct gsm_mncc *)msg->data;
- bfd->when &= ~BSC_FD_WRITE;
+ bfd->when &= ~OSMO_FD_WRITE;
/* bug hunter 8-): maybe someone forgot msgb_put(...) ? */
if (!msgb_length(msg)) {
@@ -166,7 +166,7 @@ static int mncc_sock_write(struct osmo_fd *bfd)
goto close;
if (rc < 0) {
if (errno == EAGAIN) {
- bfd->when |= BSC_FD_WRITE;
+ bfd->when |= OSMO_FD_WRITE;
break;
}
goto close;
@@ -190,12 +190,12 @@ static int mncc_sock_cb(struct osmo_fd *bfd, unsigned int flags)
{
int rc = 0;
- if (flags & BSC_FD_READ)
+ if (flags & OSMO_FD_READ)
rc = mncc_sock_read(bfd);
if (rc < 0)
return rc;
- if (flags & BSC_FD_WRITE)
+ if (flags & OSMO_FD_WRITE)
rc = mncc_sock_write(bfd);
return rc;
@@ -227,7 +227,7 @@ static void queue_hello(struct mncc_sock_state *mncc)
hello->lchan_type_offset = offsetof(struct gsm_mncc, lchan_type);
msgb_enqueue(&mncc->net->upqueue, msg);
- mncc->conn_bfd.when |= BSC_FD_WRITE;
+ mncc->conn_bfd.when |= OSMO_FD_WRITE;
}
/* accept a new connection */
@@ -250,13 +250,13 @@ static int mncc_sock_accept(struct osmo_fd *bfd, unsigned int flags)
LOGP(DMNCC, LOGL_NOTICE, "MNCC app connects but we already have "
"another active connection ?!?\n");
/* We already have one MNCC app connected, this is all we support */
- state->listen_bfd.when &= ~BSC_FD_READ;
+ state->listen_bfd.when &= ~OSMO_FD_READ;
close(rc);
return 0;
}
conn_bfd->fd = rc;
- conn_bfd->when = BSC_FD_READ;
+ conn_bfd->when = OSMO_FD_READ;
conn_bfd->cb = mncc_sock_cb;
conn_bfd->data = state;
@@ -299,7 +299,7 @@ int mncc_sock_init(struct gsm_network *net, const char *sock_path)
return -1;
}
- bfd->when = BSC_FD_READ;
+ bfd->when = OSMO_FD_READ;
bfd->cb = mncc_sock_accept;
bfd->data = state;
diff --git a/openbsc/src/libmsc/smpp_smsc.c b/openbsc/src/libmsc/smpp_smsc.c
index 1cee3fe81..3b76d5793 100644
--- a/openbsc/src/libmsc/smpp_smsc.c
+++ b/openbsc/src/libmsc/smpp_smsc.c
@@ -915,7 +915,7 @@ static int link_accept_cb(struct smsc *smsc, int fd,
osmo_wqueue_init(&esme->wqueue, 10);
esme->wqueue.bfd.fd = fd;
esme->wqueue.bfd.data = esme;
- esme->wqueue.bfd.when = BSC_FD_READ;
+ esme->wqueue.bfd.when = OSMO_FD_READ;
if (osmo_fd_register(&esme->wqueue.bfd) != 0) {
close(fd);
diff --git a/openbsc/src/libtrau/rtp_proxy.c b/openbsc/src/libtrau/rtp_proxy.c
index 6b38ee5fe..59fee12b8 100644
--- a/openbsc/src/libtrau/rtp_proxy.c
+++ b/openbsc/src/libtrau/rtp_proxy.c
@@ -286,7 +286,7 @@ int rtp_send_frame(struct rtp_socket *rs, struct gsm_data_frame *frame)
else
memcpy(payload, frame->data, payload_len);
msgb_enqueue(&rss->tx_queue, msg);
- rss->bfd.when |= BSC_FD_WRITE;
+ rss->bfd.when |= OSMO_FD_WRITE;
return 0;
}
@@ -396,7 +396,7 @@ static int rtp_socket_read(struct rtp_socket *rs, struct rtp_sub_socket *rss)
rc = read(rss->bfd.fd, msg->data, RTP_ALLOC_SIZE);
if (rc == 0) {
- rss->bfd.when &= ~BSC_FD_READ;
+ rss->bfd.when &= ~OSMO_FD_READ;
goto out_free;
} else if (rc < 0) {
/* Ignore "connection refused". this happens, If we open the
@@ -405,7 +405,7 @@ static int rtp_socket_read(struct rtp_socket *rs, struct rtp_sub_socket *rss)
goto out_free;
DEBUGPC(DLMUX, "Read of RTP socket (%p) failed (errno %d, "
"%s)\n", rs, errno, strerror(errno));
- rss->bfd.when &= ~BSC_FD_READ;
+ rss->bfd.when &= ~OSMO_FD_READ;
goto out_free;
}
@@ -430,7 +430,7 @@ static int rtp_socket_read(struct rtp_socket *rs, struct rtp_sub_socket *rss)
goto out_free;
}
msgb_enqueue(&other_rss->tx_queue, msg);
- other_rss->bfd.when |= BSC_FD_WRITE;
+ other_rss->bfd.when |= OSMO_FD_WRITE;
break;
case RTP_RECV_UPSTREAM:
@@ -448,7 +448,7 @@ static int rtp_socket_read(struct rtp_socket *rs, struct rtp_sub_socket *rss)
if (rc < 0)
goto out_free;
msgb_enqueue(&rss->tx_queue, msg);
- rss->bfd.when |= BSC_FD_WRITE;
+ rss->bfd.when |= OSMO_FD_WRITE;
break;
}
if (rss->bfd.priv_nr != RTP_PRIV_RTP) {
@@ -482,7 +482,7 @@ static int rtp_socket_write(struct rtp_socket *rs, struct rtp_sub_socket *rss)
msg = msgb_dequeue(&rss->tx_queue);
if (!msg) {
- rss->bfd.when &= ~BSC_FD_WRITE;
+ rss->bfd.when &= ~OSMO_FD_WRITE;
return 0;
}
@@ -516,10 +516,10 @@ static int rtp_bfd_cb(struct osmo_fd *bfd, unsigned int flags)
return -EINVAL;
}
- if (flags & BSC_FD_READ)
+ if (flags & OSMO_FD_READ)
rtp_socket_read(rs, rss);
- if (flags & BSC_FD_WRITE)
+ if (flags & OSMO_FD_WRITE)
rtp_socket_write(rs, rss);
return 0;
@@ -600,7 +600,7 @@ static int rtp_sub_socket_bind(struct rtp_sub_socket *rss, uint32_t ip,
rss->sin_local.sin_family = AF_INET;
rss->sin_local.sin_addr.s_addr = htonl(ip);
rss->sin_local.sin_port = htons(port);
- rss->bfd.when |= BSC_FD_READ;
+ rss->bfd.when |= OSMO_FD_READ;
rc = bind(rss->bfd.fd, (struct sockaddr *)&rss->sin_local,
sizeof(rss->sin_local));
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_msc.c b/openbsc/src/osmo-bsc/osmo_bsc_msc.c
index badecc682..a4b0d0f01 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_msc.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_msc.c
@@ -153,7 +153,7 @@ static int mgcp_create_port(struct bsc_msc_data *data)
}
osmo_wqueue_init(&data->mgcp_agent, 10);
- data->mgcp_agent.bfd.when = BSC_FD_READ;
+ data->mgcp_agent.bfd.when = OSMO_FD_READ;
data->mgcp_agent.bfd.data = data;
data->mgcp_agent.read_cb = mgcp_do_read;
data->mgcp_agent.write_cb = mgcp_do_write;
diff --git a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
index 220efa3e8..8a71f53f5 100644
--- a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
+++ b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
@@ -246,7 +246,7 @@ int main(int argc, char **argv)
/* we need to bind a socket */
if (rc == 0) {
- cfg->gw_fd.bfd.when = BSC_FD_READ;
+ cfg->gw_fd.bfd.when = OSMO_FD_READ;
cfg->gw_fd.bfd.cb = read_call_agent;
cfg->gw_fd.bfd.fd = socket(AF_INET, SOCK_DGRAM, 0);
if (cfg->gw_fd.bfd.fd < 0) {
diff --git a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
index 1b0abf371..069c9646b 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
@@ -1127,7 +1127,7 @@ static int init_mgcp_socket(struct bsc_nat *nat, struct mgcp_config *cfg)
}
osmo_wqueue_init(&cfg->gw_fd, 10);
- cfg->gw_fd.bfd.when = BSC_FD_READ;
+ cfg->gw_fd.bfd.when = OSMO_FD_READ;
cfg->gw_fd.bfd.data = nat;
cfg->gw_fd.read_cb = mgcp_do_read;
cfg->gw_fd.write_cb = mgcp_do_write;
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index 9bb33adcf..90af4d780 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -1381,7 +1381,7 @@ static int ipaccess_listen_bsc_cb(struct osmo_fd *bfd, unsigned int what)
struct sockaddr_in sa;
socklen_t sa_len = sizeof(sa);
- if (!(what & BSC_FD_READ))
+ if (!(what & OSMO_FD_READ))
return 0;
fd = accept(bfd->fd, (struct sockaddr *) &sa, &sa_len);
@@ -1431,7 +1431,7 @@ static int ipaccess_listen_bsc_cb(struct osmo_fd *bfd, unsigned int what)
bsc->write_queue.bfd.fd = fd;
bsc->write_queue.read_cb = ipaccess_bsc_read_cb;
bsc->write_queue.write_cb = bsc_write_cb;
- bsc->write_queue.bfd.when = BSC_FD_READ;
+ bsc->write_queue.bfd.when = OSMO_FD_READ;
if (osmo_fd_register(&bsc->write_queue.bfd) < 0) {
LOGP(DNAT, LOGL_ERROR, "Failed to register BSC fd.\n");
close(fd);
@@ -1535,12 +1535,20 @@ static void handle_options(int argc, char **argv)
}
}
-static void signal_handler(int signal)
+static void signal_handler(int signum)
{
- switch (signal) {
+ switch (signum) {
case SIGABRT:
- /* in case of abort, we want to obtain a talloc report
- * and then return to the caller, who will abort the process */
+ /* in case of abort, we want to obtain a talloc report and
+ * then run default SIGABRT handler, who will generate coredump
+ * and abort the process. abort() should do this for us after we
+ * return, but program wouldn't exit if an external SIGABRT is
+ * received.
+ */
+ talloc_report_full(tall_bsc_ctx, stderr);
+ signal(SIGABRT, SIG_DFL);
+ raise(SIGABRT);
+ break;
case SIGUSR1:
talloc_report_full(tall_bsc_ctx, stderr);
break;
diff --git a/openbsc/src/osmo-bsc_nat/bsc_ussd.c b/openbsc/src/osmo-bsc_nat/bsc_ussd.c
index d44b1b2fe..471743ac9 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_ussd.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_ussd.c
@@ -237,7 +237,7 @@ static int ussd_listen_cb(struct osmo_fd *bfd, unsigned int what)
socklen_t sa_len = sizeof(sa);
int fd;
- if (!(what & BSC_FD_READ))
+ if (!(what & OSMO_FD_READ))
return 0;
fd = accept(bfd->fd, (struct sockaddr *) &sa, &sa_len);
@@ -259,7 +259,7 @@ static int ussd_listen_cb(struct osmo_fd *bfd, unsigned int what)
osmo_wqueue_init(&conn->queue, 10);
conn->queue.bfd.data = conn;
conn->queue.bfd.fd = fd;
- conn->queue.bfd.when = BSC_FD_READ;
+ conn->queue.bfd.when = OSMO_FD_READ;
conn->queue.read_cb = ussd_read_cb;
conn->queue.write_cb = bsc_write_cb;
diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c
index 2aeaa8fef..9ce5e124a 100644
--- a/openbsc/src/osmo-nitb/bsc_hack.c
+++ b/openbsc/src/osmo-nitb/bsc_hack.c
@@ -65,6 +65,7 @@ extern const char *openbsc_copyright;
static int daemonize = 0;
static const char *mncc_sock_path = NULL;
static int use_db_counter = 1;
+static bool yes_i_really_want = false;
/* timer to store statistics */
#define DB_SYNC_INTERVAL 60, 0
@@ -115,6 +116,7 @@ static void handle_options(int argc, char **argv)
while (1) {
int option_index = 0, c;
static struct option long_options[] = {
+ {"yes-i-really-want-to-run-prehistoric-software", 0, 0, 0},
{"help", 0, 0, 'h'},
{"debug", 1, 0, 'd'},
{"daemonize", 0, 0, 'D'},
@@ -139,6 +141,10 @@ static void handle_options(int argc, char **argv)
break;
switch (c) {
+ case 0:
+ if (option_index == 0)
+ yes_i_really_want = true;
+ break;
case 'h':
print_usage();
print_help();
@@ -196,11 +202,11 @@ static void handle_options(int argc, char **argv)
}
extern void *tall_vty_ctx;
-static void signal_handler(int signal)
+static void signal_handler(int signum)
{
- fprintf(stdout, "signal %u received\n", signal);
+ fprintf(stdout, "signal %u received\n", signum);
- switch (signal) {
+ switch (signum) {
case SIGINT:
case SIGTERM:
bsc_shutdown_net(bsc_gsmnet);
@@ -210,8 +216,17 @@ static void signal_handler(int signal)
break;
case SIGABRT:
osmo_generate_backtrace();
- /* in case of abort, we want to obtain a talloc report
- * and then return to the caller, who will abort the process */
+ /* in case of abort, we want to obtain a talloc report and
+ * then run default SIGABRT handler, who will generate coredump
+ * and abort the process. abort() should do this for us after we
+ * return, but program wouldn't exit if an external SIGABRT is
+ * received.
+ */
+ talloc_report(tall_vty_ctx, stderr);
+ talloc_report_full(tall_bsc_ctx, stderr);
+ signal(SIGABRT, SIG_DFL);
+ raise(SIGABRT);
+ break;
case SIGUSR1:
talloc_report(tall_vty_ctx, stderr);
talloc_report_full(tall_bsc_ctx, stderr);
@@ -273,6 +288,28 @@ int main(int argc, char **argv)
/* Parse options */
handle_options(argc, argv);
+#define DIVIDER "======================================================================\n"
+ if (!yes_i_really_want) {
+ fprintf(stderr, DIVIDER
+ "ERROR: You should not run osmo-nitb. It is ancient, unmaintained and\n"
+ "obsolete for several years. If you really want to ignore years of hard work on\n"
+ "the new post-NITB stack (osmo-bsc, osmo-mgw, osmo-msc, osmo-hlr, osmo-stp),\n"
+ "you may ues the '--yes-i-really-want-to-run-prehistoric-software' command line\n"
+ "argument. DON'T EVER BOTHER THE DEVELOPERS IF YOU ENCOUNTER PROBLEMS WITH IT!!!\n"
+ "Use https://osmocom.org/projects/cellular-infrastructure/wiki/Osmocom_Network_In_The_Box\n"
+ DIVIDER);
+ exit(2);
+ } else {
+ fprintf(stderr, DIVIDER
+ "WARNING: You should not run osmo-nitb except for archaeological purpose.\n"
+ "It is ancient, unmaintained and obsolete for several years. But you seem\n"
+ "to insist on using obsolete and known-broken software that ignores years \n"
+ "of hard development work. That's your choice, but you have been warned.\n"
+ "DON'T EVER BOTHER THE DEVELOPERS IF YOU ENCOUNTER PROBLEMS WITH IT!!!\n"
+ "Use https://osmocom.org/projects/cellular-infrastructure/wiki/Osmocom_Network_In_The_Box\n"
+ DIVIDER);
+ }
+
/* Allocate global gsm_network struct; choose socket/internal MNCC */
rc = bsc_network_alloc(mncc_sock_path?
mncc_sock_from_cc : int_mncc_recv);
diff --git a/openbsc/tests/ctrl_test_runner.py b/openbsc/tests/ctrl_test_runner.py
index a1d4195c7..7724f77fd 100755
--- a/openbsc/tests/ctrl_test_runner.py
+++ b/openbsc/tests/ctrl_test_runner.py
@@ -468,7 +468,8 @@ class TestCtrlNITB(TestCtrlBase):
def ctrl_command(self):
return ["./src/osmo-nitb/osmo-nitb", "-c",
- "doc/examples/osmo-nitb/nanobts/osmo-nitb.cfg", "-l", "test_hlr.sqlite3"]
+ "doc/examples/osmo-nitb/nanobts/osmo-nitb.cfg", "-l", "test_hlr.sqlite3",
+ "--yes-i-really-want-to-run-prehistoric-software"]
def ctrl_app(self):
return (4249, "./src/osmo-nitb/osmo-nitb", "OsmoBSC", "nitb")
diff --git a/openbsc/tests/smpp_test_runner.py b/openbsc/tests/smpp_test_runner.py
index a34d7baa6..b518ebbdd 100755
--- a/openbsc/tests/smpp_test_runner.py
+++ b/openbsc/tests/smpp_test_runner.py
@@ -64,7 +64,8 @@ class TestSMPPNITB(TestVTYBase):
def vty_command(self):
return ["./src/osmo-nitb/osmo-nitb", "-c",
- "doc/examples/osmo-nitb/nanobts/osmo-nitb.cfg"]
+ "doc/examples/osmo-nitb/nanobts/osmo-nitb.cfg",
+ "--yes-i-really-want-to-run-prehistoric-software"]
def vty_app(self):
return (4242, "./src/osmo-nitb/osmo-nitb", "OpenBSC", "nitb")
diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py
index 8044e6186..a1293be4b 100755
--- a/openbsc/tests/vty_test_runner.py
+++ b/openbsc/tests/vty_test_runner.py
@@ -171,7 +171,8 @@ class TestVTYNITB(TestVTYGenericBSC):
def vty_command(self):
return ["./src/osmo-nitb/osmo-nitb", "-c",
- "doc/examples/osmo-nitb/nanobts/osmo-nitb.cfg"]
+ "doc/examples/osmo-nitb/nanobts/osmo-nitb.cfg",
+ "--yes-i-really-want-to-run-prehistoric-software"]
def vty_app(self):
return (4242, "./src/osmo-nitb/osmo-nitb", "OpenBSC", "nitb")