From f91799eecfbe03d9edd906b5834bf3f952359d0a Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 28 Jan 2014 16:11:30 +0100 Subject: 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. --- src/osmo-bts-sysmo/l1_fwd_main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/osmo-bts-sysmo/l1_fwd_main.c') diff --git a/src/osmo-bts-sysmo/l1_fwd_main.c b/src/osmo-bts-sysmo/l1_fwd_main.c index 527a559e..cb05e15c 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); -- cgit v1.2.3