Commit Graph

14 Commits

Author SHA1 Message Date
Stefan Sperling 173d7fdbb9 check for overlong unix socket paths
In pcu_l1if_open(), use osmo_strlcpy() instead of strncpy() and check for
overflow. This catches overlong and non-NUL-terminated socket paths.

Change-Id: I825190cbb34d052b797e9fb5208884d6f5992839
Related: OS#2673
2018-09-20 18:31:36 +02:00
Max 6dc90b8c86 Move PDCH-related functions into separate files
The PDCH class and corresponding functions are rather self-contained and
independent from BTS implementation. Let's move them into separate file
to make bts.cpp more manageable. As additional benefit it allow us to
somewhat untangle all the different cross-dependent includes.

Change-Id: Ie05e25361e6741a81b024679f9675c98d4923683
Related: OS#1539
2018-02-19 17:41:24 +01:00
Max 1187a7719c Update header includes
Many files include unnecessary headers and don't include headers which
are actually used. Because of that combined with the fact that OsmoPCU
is a mixture of C and C++, it makes it hard to modularize code. Fix
this (using iwyu [1] tool):

* add missing headers
* remove unused headers

[1] https://include-what-you-use.org/

Related: OS#1539
Change-Id: I8c9f488a43b099c72b2d30d3245e7ba50872fc00
2018-02-19 08:43:46 +00:00
Stefan Sperling 5b22fb7953 Make osmo-pcu wait for BTS to become available at start-up time.
After the PCU socket becomes available, the BTS might send an
INFO_IND message with the 'ACTIVE' flag cleared. If this happens,
do not exit immediately, but keep retrying until an INFO_IND
message with the 'ACTIVE' flag arrives.

Note that this change only affects behaviour at process start-up time.
If the BTS switches from active to inactive state then osmo-pcu will
still exit. If this behaviour should be changed as well it could be
done in a follow-up patch.

Tested against osom-bsc + osmo-bts-virtual.

Change-Id: Ic42a5601a43b81d260721fef5d9fa52447f9d309
Related: OS#2689
2018-02-14 19:55:05 +01:00
Pau Espin da0a194b57 Print error cause of pcu socket connect failure
This log is useful to quickly debug scenarions in which pcu never
connects to bts. For instance, if bts is started as root and pcu is not,
pcu will fail to connect to the socket and will fail with "Permission
Denied".

Change-Id: I6fd5736b5916cbad72b96f064929bb667ff97ded
2017-12-05 18:44:06 +01:00
Max 5a6bcfb797 cosmetic: convert explicit warnings to fixme/todo
We do not use this style (#warning as an issue tracker replacement) in
any other Osmocom project. Also those warnings clutter compiler output
making it harder to spot warnings for the actual code.

Change-Id: I72070e2a027e60e8b80c12ccfa23ff075434689f
2017-09-04 13:06:01 +00:00
Pau Espin c4178e55ea Add pcu-socket vty config
osmo-bts already supports configuring a different path for the bts<->pcu
socket by using the 'pcu-socket' config field.

Change-Id: I9b3e1171da467519750b201849ec892a1e318129
2017-08-09 12:17:39 +02:00
Max 0a8fae8d14 Support sending OML Alerts via BTS
* extend BTS <-> PCU protocol with TXT messages
* use it to implement OML alerts support
* use it to implement version message
* add function to transmit both of them them
* send alerts for internal encoding problems as an example
* send version when BTS socket is connected

Note: requires corresponding change
If57459c0610f2c7b36d599b13087c8deef8bdd9e in libosmocore.

Related: OS#1614, 1615
Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7
2017-03-17 17:01:28 +00:00
Max b3df58660f Log socket path on connection
Change-Id: I81c5c1068a8b59ee30399dac90b0f7e730fc19f4
2017-01-06 17:20:57 +01:00
Harald Welte 68fc12775f Install the pcuif_proto.h header file
So far, we used to keep a copy of the header file around in
both osmo-pcu and osmo-bts projects.  Before we start introducing
a third copy in openbsc, let's have the osmo-pcu install the header
file and make the other programs use that.

Change-Id: I60976c9be5488256d1ff55fdc5aa548e3705400d
2016-11-17 21:09:55 +01:00
Max cad867ec8d Rename define for direct hw access 2016-04-22 14:41:36 +02:00
Harald Welte 19d1e9270d osmobts_sock.cpp: Add missing space in log statement. 2015-11-12 01:08:19 +01:00
Harald Welte 218482769b print/log OpenBTS / OsmoBTS variant in PCU startup
Otherwise it can be very confusing, as Max had to figure out today...
2015-11-12 01:07:41 +01:00
Harald Welte d32cbbb130 rename sysmo_sock.cpp to osmobts_sock.cpp
This also renames the --enable-sysmbts option to --enable-osmobts

This socket interface was nevery sysmoBTS specific, but it is a generic
socket interface to any OsmoBTS supported layer1/hardware.  So it was a
mis-nomer so far.
2015-11-12 01:01:35 +01:00