aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-sysmo/l1_fwd_main.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-01-28 16:11:30 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-01-28 16:36:34 +0100
commitf91799eecfbe03d9edd906b5834bf3f952359d0a (patch)
tree97dc662918874d2db0690eddd9466e0cc94285b9 /src/osmo-bts-sysmo/l1_fwd_main.c
parent023739fc94af2be7e2f70f26dea92d9f0c250efb (diff)
l1fwd-proxy: Bind to the bts VTY port to block another process
Today we had the problem that multiple l1fwd-proxy instances ran at the same time and not everything working all the time (some packets were sent to a different host). Another approach is to use flock on the message queues. This appears to work fine as well.
Diffstat (limited to 'src/osmo-bts-sysmo/l1_fwd_main.c')
-rw-r--r--src/osmo-bts-sysmo/l1_fwd_main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/osmo-bts-sysmo/l1_fwd_main.c b/src/osmo-bts-sysmo/l1_fwd_main.c
index 527a559..cb05e15 100644
--- a/src/osmo-bts-sysmo/l1_fwd_main.c
+++ b/src/osmo-bts-sysmo/l1_fwd_main.c
@@ -161,6 +161,17 @@ int main(int argc, char **argv)
bts_log_init(NULL);
+ /*
+ * hack and prevent that two l1fwd-proxy/sysmobts run at the same
+ * time. This is done by binding to the same VTY port.
+ */
+ rc = osmo_sock_init(AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP,
+ "127.0.0.1", 4241, OSMO_SOCK_F_BIND);
+ if (rc < 0) {
+ fprintf(stderr, "Failed to bind to the BTS VTY port.\n");
+ return EXIT_FAILURE;
+ }
+
/* allocate new femtol1_handle */
fl1h = talloc_zero(NULL, struct femtol1_hdl);
INIT_LLIST_HEAD(&fl1h->wlc_list);