Commit Graph

83 Commits

Author SHA1 Message Date
Oliver Smith 1741372556 treewide: remove FSF address
Remove the paragraph about writing to the Free Software Foundation's
mailing address. The FSF has changed addresses in the past, and may do
so again. In 2021 this is not useful, let's rather have a bit less
boilerplate at the start of source files.

Change-Id: I73be012c01c0108fb6951dbff91d50eb19b40c51
2021-12-14 12:52:04 +00:00
Philipp Maier 0af84f408d logging: use meaningful default loglevels
Some logging categories use LOGL_INFO or even LOGL_DEBUG. Lets set those
to LOGL_NOTICE to have a less crowded default log output.

Change-Id: I3faefccae2218b17bd942bc2afac7d8e515897b7
Related: OS#2577
2021-11-15 17:12:22 +00:00
Pau Espin 5c3c28cc1d tests: Replace deprecated API log_set_print_filename
Change-Id: I9d24365d2be528477f1c190c698a81bfc7f2d2df
2021-02-19 14:16:53 +01:00
Harald Welte de31aa3af7 Use osmo_fd_setup() whenever applicable.
Change-Id: If9b636c295fc6b5349a54c70662f09efa616ee63
2020-10-18 23:34:46 +02:00
Harald Welte 508d8523c0 Use OSMO_FD_* instead of deprecated BSC_FD_*
Change-Id: Ibf64b18288b9109927035f650d6ef7ad9f15d688
2020-10-18 22:43:05 +02:00
Harald Welte e607f7ef18 virt_phy: tweak log levels
Related: SYS#4822
Change-Id: Ia7e368cda8e016a4141b21e5219697420a503124
2020-05-15 08:58:21 +02:00
Harald Welte b9ab7150bf virtphy: Delay response between L1SAP_PM_REQ and L1SAP_PM_CONF
Change-Id: I443b5512c4966c232107aeb73e1fd8b83335d63d
2020-03-10 21:24:04 +01:00
Harald Welte c429e7a1d8 virtphy: Add command line arguments to set multicast netdev + TTL
This allows us to bind the multicast sockets to a given network device
and/or to set the TTL of the multicast frames and hence control their
reach in terms of number of network hops.

Change-Id: Ia74aa381a4c1921cb8c7e263842a864ea8028139
Related: OS#2966
2020-03-10 18:58:55 +01:00
Harald Welte 17a9089452 virtphy: Sync virtual_um.[ch] with osmo-bts
The files are used in both projects, and while the osmo-bts code has
evolved, this copy didn't.  Let's sync again (to libosmocore
change-Id I303f2e616d2d32b5a8005c3dcf0f5fad19ad3445).

Change-Id: I189ee28a85a6d7a7a07b062f6b07012478503e8f
Depends: libosmocore.git Ib52d22710020b56965aefcef09bde8247ace4a9c
Related: OS#2966
2020-03-10 18:58:55 +01:00
Harald Welte 419f617a3c virtphy: Fix GSMTAP ARFCN use with multi-TRX BTS
In case we get assignments to secondary TRXs, the ARFCN of that
TRX must be used, and not the serving cell BCCH ARFCN.

Change-Id: Ief6cf5816969d819ff9506be70bec9b8d0d9d9be
2020-03-09 19:35:49 +01:00
Harald Welte a42563b684 virt_phy: implement GSMTAP_CHANNEL_VOICE
GSMTAP_CHANNEL_VOICE is the mechanism by which GSMTAP can [finally!]
be used to transport circuit-switched voice codec payload, and not
just signalling.

Original patch by Neels Hofmeyr, heavily extended by Harald Welte.

Change-Id: Id72cf23b7c6587efae4cdaa7b50ab4d85b8c8d22
2020-03-09 19:35:49 +01:00
Harald Welte 90616c1eba virtphy: Don't pass CBCH to L1CTL if not requested by application
Doing so can create a number of warning messages in e.g. 'mobile'
like
<0015> lapd_core.c:1239 Unnumbered frame not allowed. (dl=0x55c632f9f220)
<0015> lapd_core.c:392 sending MDL-ERROR-IND cause 12 from state LAPD_STATE_IDLE (dl=0x55c632f9f220)
<0015> lapdm.c:481 sending MDL-ERROR-IND 12
<0001> gsm48_rr.c:4977 MDL-Error (cause 12) ignoring

Change-Id: I2cf65be5b2f879fe940e08c9f369bc1cada7b0dd
Closes: OS#4439
2020-03-07 16:25:46 +01:00
Harald Welte d32797677d virt_l1_sched_execute: talloc_free() TDMA item after unlinking it
We so far relied on it being free'd once the TDMA item is free'd,
but let's make it more explicit.  After we've unlinked it from the
list, nobody is going to reference it ever again.

Change-Id: I57a596428be10ce720e0b528ecfc44a70e3e3078
2020-03-07 10:31:48 +01:00
Harald Welte ee26ba6e60 cosmetic: Use INIT_LLIST_HEAD() and llist_add_tail()
... instead of manually re-inventing them.

Change-Id: I7e0810aa7fd1daa8f9f3e46a207589a4c6da836b
2020-03-07 10:18:18 +01:00
Neels Hofmeyr bf4a026db9 remove unused func decl
Change-Id: I94c8fff1557c0ce50cc3072573ef7cda8622fb84
2020-03-05 13:32:56 +01:00
Vadim Yanitskiy 2d355c2453 virt_phy/build: add configure option to build with ASan/USBan
Change-Id: I23fc4e38632c02269b3895115ba4e3171cc212d1
2020-02-27 23:46:40 +07:00
Martin Hauke 1f7a2ab5d3 Fix common misspellings and typos
Change-Id: I962b42871693f33b1054d43d195817e9cd84bb64
2019-10-17 08:07:39 +00:00
Harald Welte d38ea94fab virt_phy: Fix hexdump of L1CTL SIM REQ in l1ctl_rx_sim_req()
Change-Id: I74e07e2c97bfe5d6e9c6e848ebce58ced1b197aa
Closes: CID#198538
2019-07-21 13:40:43 +00:00
Harald Welte cfd28d5e29 virtphy: Handle strtok() returning NULL on first call
Change-Id: I37bfb91cf75982bfa2f75bd62d0c13859268cd93
Closes: CID#198565
2019-07-21 09:04:16 +02:00
Harald Welte 4b742700a4 virtphy: Fix array out of bounds access in getL1ctlPrimName()
Closes: CID#198573
Change-Id: I6504a7ffcf961d3162e6ab2ec8f5f2016ef12cde
2019-07-21 08:01:09 +02:00
Harald Welte 27b6bb0721 virt_phy: Fix typo in log message
Change-Id: I9291957ef5d7033d46060d07f2aa0a3880612e1a
2019-05-28 06:32:34 +00:00
Vadim Yanitskiy 219ed20cb5 l1ctl_proto.h: use flexible array member for traffic messages
Unlike the DATA messages, traffic frames may have different length.
Instead of having fixed payload (i.e. TCH frame) length, let's
introduce a flexible array member. This would allow one to
calculate the frame length using the MSGB API.

Change-Id: I119fa36c84e95c3003d57c19e25f8146ed45c3c6
2018-11-05 05:13:57 +00:00
Holger Hans Peter Freyther 94064583cd Install to /bin as it doesn't require special privileges..
This makes packaging the binary for the gsm tester more easy.

Change-Id: Ibe572a4c17871785b623e70acc7f5da056f945e5
2018-09-16 06:44:04 +00:00
Philipp Maier 1f578082e9 cosmetic: add commandline help
There is no helptext for the commandline options, which makes it
difficult for new users to use the program.

- Add commandline help

Change-Id: I8d04644342acd64432742f96e32dc9f2e0e91c20
2018-08-27 13:03:20 +02:00
Philipp Maier b7092b920e cosmetic: fix typo
Change-Id: Ib9c5cb1aa0aaf12b68f9d93f9ce9a27037b84a56
2018-08-27 13:03:15 +02:00
Philipp Maier 072f04fea4 osmo_mcast_sock: make sure SO_REUSEADDR is applied
virtphy uses UDP multicast to communicate with its osmo-bts-virtual
counterpart. At the momemnt SO_REUSEADDR is not applied for those
multicast connections because OSMO_SOCK_F_UDP_REUSEADDR is not set. This
makes prevents the proper function of UDP multicast.

- Make sure OSMO_SOCK_F_UDP_REUSEADDR is set

Change-Id: Ia1014ac5e0522e77178249cdc6398dec2168bffe
Depends: libosmocore I1399a428467ca12f1564a14eb8ffb294d4f59874
Related: OS#3497
2018-08-24 06:48:52 +00:00
Vadim Yanitskiy 12b07883e7 VIRT_PHY: add missing L1CTL_BURST_IND to l1ctlPrimNames
Change-Id: I442305c034bbba5eaed080fb262a61895623eb4f
2018-04-15 20:36:03 +07:00
Pau Espin f9ac7eb36e virt_phy: Add missing gprs related entries to l1ctlPrimNames
Change-Id: Ia59e22cda9cf5e25b5e2b1fe38f8ec3937b16f80
2018-03-21 16:35:07 +00:00
Max 75e11d1d44 Don't ignore top-level Makefile
Move corresponding .gitignore entry inside virt-phy to avoid interfering
with other subprojects still using hand-crafted Makefiles.

Change-Id: I19a8661b74ae0b28da51cf2e81f0ca40de76fcbd
2018-01-22 17:33:54 +01:00
Vadim Yanitskiy 363d4d22da mobile: clean up and share example configs
It is better to have a shared example config files directory,
like other Osmocom projects do.

Change-Id: I903f31a8afc518ac258cdaeaf76430de07f7edea
2017-10-23 15:11:16 +03:30
Harald Welte b2c19fc5d3 VIRT-PHY: Add support for GPRS / TBF mode
we add a new STATE_TBF to vthe MS model and add some L1CTL primitives
to configure that TBF mode as well as to enqueue transmissions for
blocks at a given USF+TS.

Change-Id: Ie6f37090bd45f463aa25d9e00bc06f563be5264a
2017-08-20 22:19:17 +02:00
Harald Welte 35564c691f VIRT-PHY: virt_l1_sched: Pass timeslot number into call-back
When we schedule a given frame for transmission, we save its timeslot
number.  However, the callback doesn't get informed about this so far.

Change-Id: I608a91ae8e2a57a2d6f87f4b873c82edb0215bf6
2017-08-20 22:19:17 +02:00
Harald Welte ae15e7f9de VIRT-PHY: Support forwarding of CBCH similar to BCCH/CCCH
Change-Id: I3e6f936603e43e885b28953be5ac262e3fb7c09a
2017-08-20 22:19:17 +02:00
Harald Welte 3595402641 virtphy: Add SIGINT+SIGTERM handlers
Change-Id: I2fe65e0c1912c4d72c276a2db169f0bdbcbda2b8
2017-08-20 22:19:17 +02:00
Harald Welte 5e0fa863cb VIRT-PHY: enable proper memory leak debugging
We make sure that all allocations are tracked back to one talloc root
context, and install the usual SIGUSR1 handler to dump the talloc
report.  This enables us to do interactive debugging for memory leaks
while virtphy is running.

Change-Id: I73b3cf86eea5f56595c1b045cf0fde8035ff185a
2017-07-19 14:10:04 +02:00
Harald Welte dd3fd10903 VIRT-PHY: We don't do line-breaks inside log statements
Change-Id: I27cba13ee782c53a9b2406319241fc7f4e3db0bd
2017-07-19 14:00:09 +02:00
Harald Welte f122d4cd36 VIRT-PHY: Properly destroy l1_model_ms after disconnect
If a MS disconnects, we need to clean up all related state

Change-Id: Ib7adef61150b5a4338483019e4dd75d7279d1f5d
2017-07-19 13:53:30 +02:00
Harald Welte c0fba7a298 VIRT-PHY: Change default log levels
This will basically only print L1C message for all L1CTL happening
between MS and the BTS, while suppressing the GSMTAP/virtUM and L1P
related messages.

Change-Id: I9513db3cee12644ed9b9858e13b740ffd27aba24
2017-07-19 13:39:54 +02:00
Harald Welte d80c6f4ef8 VIRT-PHY: Clean up logging statements
The generated log lines have been *super* long, let's make them
significantly shorter.  Also, differentiate between DEBUG and INFO
level, so normal operation with LOGL_INFO will not spam the user while
still printing useful information.

Change-Id: If06a8b5f99349796d66a71201524361a6547945a
2017-07-19 13:01:56 +02:00
Harald Welte f7dafcc5d2 VIRT-PHY: Separate logging of L1 Control and L1 Data
L1 Data is quite verbose, while control is typically limited, so let's
make sure we log them as separate sub-systems

Change-Id: Idebc371a63508c593855486ff01b2ba6e8c2cfd1
2017-07-19 12:14:35 +02:00
Harald Welte 198dbda3c8 VIRT-PHY: Log MS context number whenever possible
Now that we can have multiple MS connected to one virtphy instance,
it is important to log some context whenever possible.  To do so, we
introduce a monotonically increasing MS number which gets assigned
whenever we allocate a l1_model_ms and printed when the LOGPMS() or
DEBUGPMS() macros are used.

Change-Id: Id7d9507126a03def5bd7690f1dbe987f9a749e65
2017-07-19 11:53:13 +02:00
Harald Welte f5e0f6424b VIRT-PHY: Major rewrite to deal with muliple L1CTL clients
Change-Id: Ibfb2a93f8b45a95215c01368b1a52d92283474e6
2017-07-19 11:30:26 +02:00
Harald Welte ef9ee6116b VIRT-PHY: Don't redefine GSMTAP port number, use libosmocore
Change-Id: I11d04d76292c52ec5ab70893e8c6a2e55586b2ec
2017-07-19 00:32:36 +02:00
Harald Welte 7b6071208e VIRT-PHY Use libosmocore unix domain socket helper
Change-Id: Ic0fa003bd7c7468d39a0c39fbea89000d576a4f3
2017-07-18 23:36:17 +02:00
Harald Welte c2083feefa VIRT-PHY: reorganize data structures
* l1_model_ms can become a static member of l1_model_ms
* crypto_info_ms can become a static member of l1_state_ms

Change-Id: I94ca4dad1c6c668ce6307d5e5d728b1c1502af12
2017-07-18 22:18:52 +02:00
Harald Welte 3ee8ac1593 VIRT-PHY: some more comments/documentation
Change-Id: I24fc98624178e9441d6cfcd61bc14e17c1391e9e
2017-07-18 21:41:24 +02:00
Harald Welte 70dd7e5b75 VIRT-PHY: Use IPv4 multicast groups for private / local scope
The addresses in the original code make little sense:
* 224.0.0.1 is "All systems on this subnet" and not routed
  outside the local ethernet segment
* 225.0.0.1 is in a RESERVED range that shouldn't be used

Change-Id: I8e3acd745e65a6cfa70b681a440da6a59a1ed0b5
2017-07-13 17:18:00 +02:00
Harald Welte c4324da7c6 VIRT-PHY: Use osmo_fd_close() introduced in libosmocore
libosmocore has recently received a new function osmo_fd_close() which
can be used to replace the private fd_close() function in this code.

This requires Change-Id Icd0933eed6a24edde7cdcb378e138897ecc5332c in
libosmocore.

Change-Id: Id8a518dfb09465c2765681407e5581aee2d62d6d
2017-07-13 16:37:27 +02:00
Harald Welte 4f9913f1fd VIRT-PHY: Use new OSMO_SOCK_F_NO_MCAST_{LOOP,ALL} flags
libosmocore has recently gained support for flags like
OSMO_SOCK_F_NO_MCAST_LOOP and OSMO_SOCK_F_NO_MCAST_ALL that can be
passed to the socket initializer functions, further reducing complexity
of the code in osmo_mcast_sock.c here.

The related change-IDs are I5ab5de45c0b64ceb3636ea98245a23defa24ffd4 and
I24a5b1ebc3f84d2d5d4734e54df50efaea26490b in libosmocore.git.

Change-Id: I961aa07a381fef2cf9a2fb5357937864364ca04b
2017-07-13 16:35:50 +02:00
Harald Welte 48d2a55b40 VIRT-PHY mcast_sock: Use uint16_t for ports, bool and const
Change-Id: I4eab1da8d43fdad05c04f23d89711081c4696fe7
2017-07-13 14:24:57 +02:00