aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-sysmo/l1_transp_fwd.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-07-01 18:25:22 +0200
committerHarald Welte <laforge@gnumonks.org>2011-07-01 18:25:22 +0200
commitf788d79411ab8e2364f884988b0fbcb8f4bd4294 (patch)
tree472ef55a5149403b70e01eef892f881386a1d186 /src/osmo-bts-sysmo/l1_transp_fwd.c
parentf15cef94f722c02b0fc401e40bcc4b7a22f9cbed (diff)
sysmobts-remote: Remove hard-coded BTS IP address
The BTS IP address can now be specified by the L1FWD_BTS_HOST env variable. Option parsing would not have been that easy to integrate without touching the main program...
Diffstat (limited to 'src/osmo-bts-sysmo/l1_transp_fwd.c')
-rw-r--r--src/osmo-bts-sysmo/l1_transp_fwd.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/osmo-bts-sysmo/l1_transp_fwd.c b/src/osmo-bts-sysmo/l1_transp_fwd.c
index 3d33751b..aad7f9b0 100644
--- a/src/osmo-bts-sysmo/l1_transp_fwd.c
+++ b/src/osmo-bts-sysmo/l1_transp_fwd.c
@@ -20,6 +20,7 @@
*/
#include <stdint.h>
+#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
@@ -52,8 +53,6 @@
#include "l1_transp.h"
#include "l1_fwd.h"
-#define BTS_HOST "192.168.100.151"
-
static const uint16_t fwd_udp_ports[] = {
[MQ_SYS_WRITE] = L1FWD_SYS_PORT,
[MQ_L1_WRITE] = L1FWD_L1_PORT,
@@ -98,10 +97,16 @@ static int prim_write_cb(struct osmo_fd *ofd, struct msgb *msg)
int l1if_transport_open(struct femtol1_hdl *fl1h)
{
int rc, i;
+ char *bts_host = getenv("L1FWD_BTS_HOST");
printf("sizeof(GsmL1_Prim_t) = %lu\n", sizeof(GsmL1_Prim_t));
printf("sizeof(FemtoBts_Prim_t) = %lu\n", sizeof(FemtoBts_Prim_t));
+ if (!bts_host) {
+ fprintf(stderr, "You have to set the L1FWD_BTS_HOST environment variable\n");
+ exit(2);
+ }
+
for (i = 0; i < ARRAY_SIZE(fl1h->write_q); i++) {
struct osmo_wqueue *wq = &fl1h->write_q[i];
struct osmo_fd *ofd = &wq->bfd;
@@ -115,7 +120,7 @@ int l1if_transport_open(struct femtol1_hdl *fl1h)
ofd->when |= BSC_FD_READ;
rc = osmo_sock_init_ofd(ofd, AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP,
- BTS_HOST, fwd_udp_ports[i],
+ bts_host, fwd_udp_ports[i],
OSMO_SOCK_F_CONNECT);
if (rc < 0) {
talloc_free(fl1h);