summaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2017-11-27mobile: Use bool to show started can only be true or falseHolger Hans Peter Freyther2-4/+5
The state handling is complicated and maybe it gets better by moving started to bool and then the rest to an enum. Change-Id: I6aef22e7bf954a8a4ecda980c2c558eb8c9180b7
2017-11-27mobile: Switch from printf to LOGP statementsHolger Hans Peter Freyther5-12/+19
Add a mobile application logging category and replace printf with a LOGP. The code is sadly still using exit in the middle of handling. Change-Id: I71e7f6e6375a485b45bad76ada2be17b0901577d
2017-11-24mobile/vty_interface.c: fix Kc / Ki confusionVadim Yanitskiy1-2/+2
Change-Id: Ibbd1d080896b5cadc3d4281fe8f839a103a35088
2017-11-14layer23 vty: fix prompts: insert space after '#'Neels Hofmeyr1-3/+3
"All" our VTY prompts have a space after the prompt. Also do that for '(ms)', '(test-sim)' and '(support)' prompts. Change OsmocomBB(ms)#exit to OsmocomBB(ms)# exit Change-Id: Id437279e0fa9845630a306958b404efa3b94b492
2017-11-09mobile: Make VTY logging commands available to the mobile appHolger Hans Peter Freyther1-0/+2
So far logging_vty_add_cmds wasn't called. The main.c might be shared with other apps so place it into the routine that is setting up the VTY. Change-Id: I3db9cf288bce12f51e36caad44e9bc34094638f4
2017-11-09mobile/gsm322.c: prevent buffer over-/under-runVadim Yanitskiy1-0/+3
Change-Id: Ic12587a6c6456b8663e5357cf68a22c6d1927a07
2017-11-09mobile/gsm322.c: prevent calling memset() with zero lengthVadim Yanitskiy1-0/+4
This change prevents a possibility of calling memset() with constant zero length parameter, and the corresponding compiler warning. Change-Id: I2d8d78474614939659a7f24d5007b1c890776b1a
2017-11-09mobile: Do not exclude DGPS from the list of default categoriesHolger Hans Peter Freyther1-1/+1
I don't remember why we parse the categories like this. First if the mobile doesn't use a subsystem there is no harm to have it enabled, second the default levels can be adjusted for all apps and third we have the VTY to reconfigure these logging targets. Change-Id: Ia874b7ed127026b8395072a3bac2aed9944b1cce
2017-11-09vty: skip installing cmds now always installed by defaultNeels Hofmeyr5-7/+0
vty_install_default() and install_default() will soon be deprecated. Depends: I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b Change-Id: I300a4b34a2031fd09d110ef18375d140a6dca7ba
2017-11-08host/mobile: use osmocom_ms as talloc contextVadim Yanitskiy10-35/+23
As we use talloc, it's absurdly not to use the main feature of the library - hierarchical memory management. This change sets talloc context of all sub-allocated objects to related osmocom_ms instance. So, as soon as osmocom_ms instance is destroyed, all sub-allocated chunks are getting destroyed too. Change-Id: I6e3467ff739f3e6dc8dd60cc6d1fcd3f8e490ce9
2017-11-05mobile: get rid of unused variables / functionsVadim Yanitskiy3-28/+19
Change-Id: Id867ffed9b2b67025320d002e1e009e19c759a23
2017-11-05mobile/gsm411_sms.c: use secure gsm_7bit_(en|de)code_nVadim Yanitskiy1-2/+4
Since some 'gsm_7bit_*' functions were deprecated and replaced by more secure ones with the '_n_' postfix in names, it's better to use the updated functions. Change-Id: I58150e9b74699e5f54b9a83416ad8efcb2eccd8e
2017-11-05mobile/gsm48_mm.c: use secure gsm_7bit_decode_nVadim Yanitskiy1-4/+1
Since some 'gsm_7bit_*' functions were deprecated and replaced by more secure ones with the '_n_' postfix in names, it's better to use the updated functions. Change-Id: I4499b592a0dfea71462aed19fe641419d79b3cbd
2017-11-05mobile/gsm480_ss.c: use secure gsm_7bit_(en|de)code_n_ussdVadim Yanitskiy1-6/+2
Since some 'gsm_7bit_*' functions were deprecated and replaced by more secure ones with the '_n_' suffix in names, it's better to use the updated functions. Change-Id: If8a1983592f5800e3981f29962eb333ac9473f40
2017-11-05mobile/vty_interface.c: fix incompatible pointer type warningVadim Yanitskiy2-2/+2
According to the vty_app_info struct definition, the go_parent_cb() should return an integer, but not enum. So, this change fixes the following compiler warning: > warning: initialization from incompatible pointer type > .go_parent_cb = ms_vty_go_parent, Change-Id: Ib55e43eaaebdd9fe0d74a030b1057ae82804a77e
2017-11-02mobile/main.c: fix deprecated call to msgb_set_talloc_ctx()Vadim Yanitskiy1-1/+2
The usage of msgb_set_talloc_ctx() was deprecated many days ago, so it's time to use the proper replacement. Change-Id: I56440d8e2152c4bb2e5ad677f88c61742d2ad9ca
2017-11-02mobile/vty_interface.c: add missing 'vty/misc.h' headerVadim Yanitskiy1-0/+1
This header contains declaration of the osmo_talloc_vty_add_cmds(). Change-Id: Icdafb22758897cfb67e249f37991f4af4213a5fa
2017-10-29mobile: register the talloc context introspection commandVadim Yanitskiy3-1/+5
This change registers the command, which is now implemented in libosmocore since the 463deef8c209dd7eb023ac70bf41fa9893ad35ed and allows to introspect mobile application's talloc context directly from the VTY interface. Change-Id: I979d64ae63d385f4fd082a4e3f981cbf5ab28338
2017-10-23mobile: clean up and share example configsVadim Yanitskiy3-187/+2
It is better to have a shared example config files directory, like other Osmocom projects do. Change-Id: I903f31a8afc518ac258cdaeaf76430de07f7edea
2017-10-23mobile/vty_interface.c: do not write 'exit' to configVadim Yanitskiy1-3/+0
Since we use indenting as means to implicitly exit child nodes, no need to write 'exit' at the end of each child node. Change-Id: I73b0f3926d766d21ca68c8e01b7fc70b2b4636c9
2017-10-23mobile/vty_interface.c: do not install default commandsVadim Yanitskiy1-50/+0
Since in recent version of libosmocore default commands (such as 'exit' and 'end') are being installed by default, no need to install them twice. This will crash the program. Change-Id: I82c8d04ccc7dc3f19589a79b859a2c993bd1d39c
2017-09-09mobile/main.c: clean up config file selection logicVadim Yanitskiy1-9/+15
The 903e2515 introduced the following problems: - The home variable is allocated dynamically by talloc, but not being freed. There is no need for dynamical memory allocation, as the getenv() returns a pointer to a value in the environment or NULL. - In case of custom configuration file, a pointer to a part of stack (not heap) is passed to talloc_free(). This may cause unexpected behaviour of segfault. Let's fix both of them. Change-Id: I79cc3b954c3018b7e780f6351c3030c3062470b5
2017-09-07Add arbitrary config file location supportMax2-11/+16
All other Osmocom projects use '-c' command line option to specify the location of config file. Let's do the same with fallback to existing implicit config file name logic. Also print config file path and vty host on startup. Change-Id: Idaac3ff8d1f8541e00c45290db948a67bb899311
2017-08-20VIRT-PHY: Add support for GPRS / TBF modeHarald Welte3-5/+249
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-20VIRT-PHY: virt_l1_sched: Pass timeslot number into call-backHarald Welte7-10/+10
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-20VIRT-PHY: Support forwarding of CBCH similar to BCCH/CCCHHarald Welte1-2/+2
Change-Id: I3e6f936603e43e885b28953be5ac262e3fb7c09a
2017-08-20virtphy: Add SIGINT+SIGTERM handlersHarald Welte1-0/+6
Change-Id: I2fe65e0c1912c4d72c276a2db169f0bdbcbda2b8
2017-07-27vty_interface.c: use RPLMN from settings if presetVadim Yanitskiy1-0/+15
Previously, when testcard was attached via VTY interface, the initial values were used for MCC / MNC, LAC and TMSI, even if correct RPLMN settings were set. Change-Id: Ic70889cdb6be95f06d0c2df710524b4128b5f72b
2017-07-19VIRT-PHY: enable proper memory leak debuggingHarald Welte2-3/+26
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-19VIRT-PHY: We don't do line-breaks inside log statementsHarald Welte1-3/+1
Change-Id: I27cba13ee782c53a9b2406319241fc7f4e3db0bd
2017-07-19VIRT-PHY: Properly destroy l1_model_ms after disconnectHarald Welte7-1/+33
If a MS disconnects, we need to clean up all related state Change-Id: Ib7adef61150b5a4338483019e4dd75d7279d1f5d
2017-07-19VIRT-PHY: Change default log levelsHarald Welte1-1/+1
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-19VIRT-PHY: Clean up logging statementsHarald Welte7-59/+66
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-19VIRT-PHY: Separate logging of L1 Control and L1 DataHarald Welte6-7/+37
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-19VIRT-PHY: Log MS context number whenever possibleHarald Welte13-45/+71
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-19VIRT-PHY: Major rewrite to deal with muliple L1CTL clientsHarald Welte16-424/+384
Change-Id: Ibfb2a93f8b45a95215c01368b1a52d92283474e6
2017-07-19VIRT-PHY: Don't redefine GSMTAP port number, use libosmocoreHarald Welte2-4/+2
Change-Id: I11d04d76292c52ec5ab70893e8c6a2e55586b2ec
2017-07-18VIRT-PHY Use libosmocore unix domain socket helperHarald Welte1-28/+11
Change-Id: Ic0fa003bd7c7468d39a0c39fbea89000d576a4f3
2017-07-18VIRT-PHY: reorganize data structuresHarald Welte11-77/+82
* 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-18VIRT-PHY: some more comments/documentationHarald Welte2-0/+8
Change-Id: I24fc98624178e9441d6cfcd61bc14e17c1391e9e
2017-07-13VIRT-PHY: Use IPv4 multicast groups for private / local scopeHarald Welte1-2/+7
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-13VIRT-PHY: Use osmo_fd_close() introduced in libosmocoreHarald Welte1-15/+4
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-13VIRT-PHY: Use new OSMO_SOCK_F_NO_MCAST_{LOOP,ALL} flagsHarald Welte1-36/+8
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-13VIRT-PHY mcast_sock: Use uint16_t for ports, bool and constHarald Welte2-14/+16
Change-Id: I4eab1da8d43fdad05c04f23d89711081c4696fe7
2017-07-13VIRT-PHY: mcast_sock: properly clean up in error paths (close/unreg socket)Harald Welte1-0/+4
Change-Id: I2c22359735af6b867e25e0f566cadbc88f21ef44
2017-07-13VIRT-PHY: Further simplify mcast_sock codeHarald Welte2-97/+69
By avoiding dynamic allocations and relying on osmo_fd, we can significantly simplify the code. Change-Id: Iad653686ac2bda5b3c92c30b4386ee7727d16271
2017-07-13VIRT-PHY: mcast_sock: We must close the fd before setting it to -1Harald Welte1-1/+1
Change-Id: Id8e72c8800a8b3021ab350acaebd912f1b387063
2017-07-13VIRT-PHY: mcast_sock: Don't keep subscribed multicast group aroundHarald Welte2-11/+7
We can avoid having to keep around the multicast group in a chunk of dynamically allocated memory and simplify related code. Change-Id: Ic39ffe73dfd2cb8ffefb9614340e275dac87bd50
2017-07-13VIRT-PHY: mcast_sock: Avoid dynamic allocation of osmo_fd memberHarald Welte2-24/+19
Change-Id: I11e0137849797eb67047b4ddca0e917c599ed909
2017-07-13VIRT-PHY: osmo_mcast_sock: Get rid of server_sock.sock_confHarald Welte2-10/+1
We don't need to store this data, we cans simply connect the socket to the destination mcast address instead. Change-Id: I3c98653c41eff9feb649d9c47cd40b26fd81ed05