summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* GPRS: print remote state info for NS peerMax2017-10-201-3/+5
| | | | | Change-Id: I1714c68909507eae6ef2933661a085859aca3b54 Related: SYS#3610
* [doc] Properly define gsm0800 group and move all related files into itHarald Welte2017-10-172-3/+4
| | | | Change-Id: I91920c69c86d6a1932172becacb76faff2d3eb1e
* [doc] Properly define 'oap' group and add introductory textHarald Welte2017-10-171-2/+1
| | | | Change-Id: I1e875991ae1dd93862f850f85d40b3dac61ece72
* [doc] Define 'gsup' group with proper name, add intro textHarald Welte2017-10-171-2/+1
| | | | Change-Id: Ieee6213dc5aad082a2d439c7418b51f281b80b1a
* [doc] make sure all SMS related code is part of the 'sms' groupHarald Welte2017-10-174-7/+7
| | | | Change-Id: I24c56ccb56d5b39cfb887808f91b715da54c0f8b
* [doc] gea has separate group; A5 is not part of crypto but a5 groupHarald Welte2017-10-172-14/+11
| | | | Change-Id: I2fd24c86f9b52244073ec800a3287e3d38e660d9
* [doc] Don't add libosmovty bits to libosmocore groupsHarald Welte2017-10-164-30/+29
| | | | | | | | Let's not put files of libosmovty into Doxygen groups of libosmocore, as this seems to confuse Doxygen. Also, some minor updates/fixes of libosmovty documentation. Change-Id: I70e612b8d06aabefe634fcd7861641ffb941d974
* [doc] Expand Doxuygen documentation for osmo_primHarald Welte2017-10-161-1/+5
| | | | | | Also, make sure prim.c is actually part of the 'prim' module. Change-Id: I4363e46a5f606eb2114a9cc1d2086007eaa58d31
* [doc] Introductory text on what the logging ring buffer is aboutHarald Welte2017-10-161-0/+7
| | | | Change-Id: I876cd31e03a53ca90e658e353c0c8a839dece8ad
* [doc] Make sure loggingrb.c file is in correct Doxygen group.Harald Welte2017-10-161-1/+1
| | | | | | loggingrb.c, like loggingrb.h should be part of the loggingrb group! Change-Id: I4822a46631b45df1afda202c00038b6ad2c8b5ae
* [doc] Doxygen documentation on osmo_hexdump print buffer sizeHarald Welte2017-10-161-0/+6
| | | | Change-Id: I83ca2a3a555e5b3c1b7f23bf9e463a5063a8006c
* [doc] Put CRC-16 and generic CRC code in one Doxygen moduleHarald Welte2017-10-162-3/+14
| | | | | | .. and add missing API documentation bits Change-Id: I67119894bcbf8c779426a0272bae4c5ce1fbd1ed
* [doc] bits.c: Better / more Doxygen documentationHarald Welte2017-10-161-0/+5
| | | | Change-Id: If824a5c8d8ee6e3dc96a3fddeb105786c0c027c1
* [doc] rate_ctr: Extend Doxygen API documentation with human-readable text on ↵Harald Welte2017-10-161-2/+35
| | | | | | its use Change-Id: If9abd46e1b0ebb6114522418fd3b45c1d802968a
* [doc] src/logging.c: Fix Doxygen syntax to make logging.c show up in logging ↵Harald Welte2017-10-161-1/+1
| | | | | | group Change-Id: I56718e1eca1739a1b0a790f2f3a1b554899a93ab
* [doc] Add Doxygen API documentation for stats.c and stats_statsd.cHarald Welte2017-10-162-1/+112
| | | | Change-Id: I8e49505f5c19beac90290fdba8821714e8eecd97
* [doc] counter.[ch] Add Doxygen API documentationHarald Welte2017-10-161-0/+18
| | | | | | | This adds a more complete set of API documentation for all osmo_counter relatedd functions and definitions. Change-Id: I24283c05620ee86a8beb165af98a85d754549efb
* [doc] stat_item: Complete doxygen documentation for APIHarald Welte2017-10-161-9/+76
| | | | | | | | The stat_item code base had some incomplete doxygen documentation so far. Let's complete it, and at the same time fix some cosmetic as well as copy+paste issues in the existing documentation bits. Change-Id: Ib514c137b40bf7b9791bd74be99af0b65575f2b6
* Rename 'statistics.c' to 'counter.c'Harald Welte2017-10-156-7/+7
| | | | | | | | | With stat_item, stats.c and stats_statsd.c, it is becoming a bit difficult to understand file naming. Also, the 'statistics.c' file actually only contained osmo_counter handling, so let's rename it to counter.c altogether. Change-Id: I2cfb2310543902b7da46cb15a76e2da317eaed7d
* gsm: make osmo_imsi_str_valid() NULL-safeNeels Hofmeyr2017-10-101-0/+2
| | | | | | | | | No callers that would pass NULL exist, but let's check against NULL from the start. Fixup for recent change I1e94f5b0717b947d2a7a7d36bacdf04a75cb3522. Change-Id: I111fbf29228929f2cd6ffa06bcb1f69da223224e
* Fix build on older systemsMax2017-10-101-0/+3
| | | | | | | | Make sure GRND_NONBLOCK is always defined, even when using syscall directly. Change-Id: I1bcac37ee1847596b49122f9307bd2689ba71b1b Related: OS#1694
* utils: add osmo_is_hexstr(), add unit testNeels Hofmeyr2017-10-091-0/+33
| | | | | | Will be used by OsmoHLR to validate VTY and CTRL input. Change-Id: Idf75946eb0a84e145adad13fc7c78bb7a267aa0a
* auth: add OSMO_MILENAGE_IND_BITLEN_MAXNeels Hofmeyr2017-10-091-1/+1
| | | | | | Will be used by OsmoHLR to validate VTY and CTRL input. Change-Id: Ic39f3404d1a49ffd06070aa9897b36f219eacf4d
* auth: add value_strings for osmo_sub_auth_type, comment on osmo_auth_alg_name()Neels Hofmeyr2017-10-092-0/+8
| | | | | | | | | Add osmo_sub_auth_type_names[] and osmo_sub_auth_type_name(). Also add a hint to enum osmo_auth_algo's API doc that osmo_auth_alg_name() already exists (it is defined further below). Change-Id: I652a929bcd11c694d86812fb03d0a1cbd985efda
* Add function to generate random identifierMax2017-10-092-0/+49
| | | | | | | | | | | | | | | | | The function is a wrapper on top of getrandom() (if available via glibc) or corresponding syscall. If neither is available than failure is always returned. It's intended to generate small random data good enough for session identifiers and keys. To generate long-term cryptographic keys it's better to use special crypto libraries (like GnuTLS for example) instead. As an example it's used to replace old insecure random number generator in osmo-auc-gen utility. Change-Id: I0241b814ea4c4ce1458f7ad76e31d390383c2048 Related: OS#1694
* Ensure __always_inline is defined on operating systems that don't have itHarald Welte2017-10-091-0/+6
| | | | | | | For example, Alpine Linux fails to build libosmocore without us locally defining __always_inline. Change-Id: I0c22aac410e668f8fb8d5de57281bcaeb343eeb1
* add osmo_imsi_str_valid() and osmo_msisdn_str_valid()Neels Hofmeyr2017-10-053-1/+70
| | | | | | | | | Add GSM23003_IMSI_MIN_DIGITS definition. Add regression test gsm23003_test.c to test the two new functions. Will be used by OsmoHLR to validate VTY and CTRL input. Change-Id: I1e94f5b0717b947d2a7a7d36bacdf04a75cb3522
* doxygen: adjust copyright to include 2017Neels Hofmeyr2017-09-281-1/+1
| | | | Change-Id: If7c09a676f67da15454aedcda99d0e9b301c9945
* vty: install 'exit', 'end',... commands on *all* nodesNeels Hofmeyr2017-09-277-19/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In many callers of the VTY API, we are lacking the vty_install_default() step at certain node levels. This creates nodes that lack the 'exit' command, and hence the only way to exit such a node is to restart the telnet session. Historically, the VTY looked for missing commands on the immediate parent node, and hence possibly found the parent's 'exit' command when the local node was missing it. That is why we so far did not notice the missing default commands. Furthermore, some callers call install_default() instead of vty_install_default(). Only vty_install_default() also includes the 'exit' and 'end' commands. There is no reason why there are two sets of default commands. To end this confusion, to catch all missing 'exit' commands and to prevent this from re-appearing in the future, simply *always* install all default commands implicitly when calling install_node(). In cmd_init(), there are some top-level nodes that apparently do not want the default commands installed. Keep those the way they are, by changing the invocation to new install_node_bare() ({VIEW,AUTH,AUTH_ENABLE}_NODE). Make both install_default() and vty_install_default() no-ops so that users of the API may still call them without harm. Do not yet deprecate yet, which follows in Icf5d83f641e838cebcccc635a043e94ba352abff. Drop all invocations to these two functions found in libosmocore. Change-Id: I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b
* gb: drop special vty exit commands, use vty_install_default()Neels Hofmeyr2017-09-274-43/+2
| | | | | | | | | | | | | | | L_NS_NODE and L_BSSGP_NODE had specialized 'exit' and 'end' vty commands, but all they do is return to the CONFIG and ENABLE_NODEs like the default 'exit' and 'end' commands. Drop them and use the default 'exit' and 'end' cmds. Examining BSSGP and NS node behavior in osmo-sgsn exhibited identical list and exit/end behavior before and after this patch. Prepares for an upcoming commit incorporating vty_install_default() into install_node(), see I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b: this patch changes to the default commands, the upcoming change implies them. Change-Id: I5b0de066b4249d482c22620d5b1bcb03f381293c
* vty: fix style: bssgp node vty promptNeels Hofmeyr2017-09-271-1/+1
| | | | | | | Add trailing space and 'config-' prefix to match our common VTY node prompt style. Change-Id: I88db128cad9fcc6e53326b4aed5d06ea9102f328
* VTY: implement talloc context introspection commandVadim Yanitskiy2017-09-272-1/+281
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces a new command, which could be used to inspect the application's talloc context directly from VTY. To enable this feature, an application need to provide it's context via the 'vty_app_info' struct, and register the VTY command by calling the osmo_talloc_vty_add_cmds(). The new command is a sub-command of 'show': show talloc-context <context> <depth> [filter] Currently the following contexts may be inspected: - application - a context provided by an application; - null - all contexts, if NULL-context tracking is enabled. A report depth is defined by the next parameter, and could be: - full - full tree report, as the talloc_report_full() does; - brief - brief tree report, as the talloc_report() does; - DEPTH - user defined maximal report depth. Also, there are two optional report filters: - regexp - print only contexts, matching a regular expression; - tree - print a specific context, pointed by specified address. The command output is formatted the same way as in case of calling the talloc_report() or talloc_report_full(). Change-Id: I43fc42880b22294d83c565ae600ac65e4f38b30d
* vty/vty.c: do not bind vty context to application's oneVadim Yanitskiy2017-09-271-1/+1
| | | | | | | | | | | | | | | The 'vty_app_info' struct could be used by some applications to provide its talloc context. In the future, it will facilitate the implementation of talloc context introspection via VTY. But the 'vty' talloc context, that contains lots of items (memory chunks), is being bound to an application's one, so it becomes hard to read the last. Let's do not bind the 'vty' context automatically, until some common talloc context export policy is implemented. Change-Id: I9cb6ce9f24dbae400029e2d9f9c933fbfb16248f
* vty: derive node name from prompt, use as XML idsNeels Hofmeyr2017-09-231-1/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'show online-help' produces XML output with <node id="..."> ids. We reference those from the osmo-gsm-manuals. Instead of numeric IDs coming from internal code, rather use a human-readable node ID -- referencing id='config-msc' is much easier than referencing id='23'. Add a char name[] to struct cmd_node, to hold this name. This may be provided upon struct definition. Since callers of the VTY API so far don't have a name yet, we would need to add names everywhere to get meaningful node IDs. There is a way to get node ID names without touching dependent code: My first idea was to find out which command entered the node, i.e. command 'msc' enters the MSC_NODE. But it is impossible to derive which command entered which node from data structs, it's hidden in the vty command definition. But in fact all (TM) known API callers indeed provide a prompt string that contains a logical and human readable string name. Thus, if the name is unset in the struct, parse the prompt string and strip all "weird" characters to obtain a node name from that. We can still set names later on, but for now will have meaningful node IDs (e.g. 'config-msc' from '%s(config-msc)# ') without touching any dependent code. When VTY nodes get identical node names, which is quite possible, the XML export de-dups these by appending _2, _3,... suffixes. The first occurence is called e.g. 'name', the second 'name_2', then 'name_3', and so forth. If a node has no name (even after parsing the prompt), it will be named merely by the suffix. The first empty node will become id='_1', then '_2', '_3', and so forth. This happens for nodes like VIEW_NODE or AUTH_NODE. If this is merged, we need to adjust the references in osmo-gsm-manuals.git. This can happen in our own time though, because we manually create the vty reference xml and copy it to the osmo-gsm-manuals.git and then update the references from the vty_additions.xml. This anyway has to happen because currently the references tend to be hopelessly out of sync anyway, placing comments at wildly unrelated VTY commands. Change-Id: I8fa555570268b231c5e01727c661da92fad265de
* vty: use internal node id for xml idsNeels Hofmeyr2017-09-231-1/+1
| | | | | | | | | | | | | The 'show online-help' produces XML output with <node id="..."> ids. We reference those from the osmo-gsm-manuals, but until now, these ids fall out of sync when the amount of VTY nodes changes. Change these ids to use the internal node ID constant (as in enum bsc_vty_node) instead of a simple counter. If this is merged, we need to adjust the references in osmo-gsm-manuals.git. Change-Id: Ib07fb9d9106e19f5be6539493e82b5d5991f8bc2
* comment: describe indent_cmp()Neels Hofmeyr2017-09-201-0/+4
| | | | Change-Id: Ia58c16d995f6751bdd69defe8a46665aee163f3d
* fix vty regression: empty parent nodeNeels Hofmeyr2017-09-201-7/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | The recent exit-by-indent patch breaks a VTY case where a node is entered but directly followed by a sibling or ancestor without listing any child nodes. Regression introduced by I24cbb3f6de111f2d31110c3c484c066f1153aac9. An example is a common usage in osmo-bts, where 'phy N' / 'instance N' is a parent node that is commonly left empty: phy 0 instance 0 bts 0 band 1800 Before this patch, this case produces the error: There is no such command. Error occurred during reading the below line: bts 0 Fix indentation parsing logic in command.c to accomodate this case. Add a unit test for empty parent node. Change-Id: Ia0880a17ae55accb092ae8585cc3a1bec9986891
* VTY: implicit node exit by de-indenting, not parent lookupNeels Hofmeyr2017-09-192-24/+200
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note: This will break users' config files if they do not use consistent indenting. (see below for a definition of "consistent".) When reading VTY commands from a file, use indenting as means to implicitly exit child nodes. Do not look for commands in the parent node implicitly. The VTY so far implies 'exit' commands if a VTY line cannot be parsed on the current node, but succeeds on the parent node. That is the mechanism by which our VTY config files do not need 'exit' at the end of each child node. We've hit problems with this in the following scenarios, which will show improved user experience after this patch: *) When both a parent and its child node have commands with identical names: cs7 instace 0 point-code 1.2.3 sccp-address osmo-msc point-code 0.0.1 If I put the parent's command below the child, it is still interpreted in the context of the child node: cs7 instace 0 sccp-address osmo-msc point-code 0.0.1 point-code 1.2.3 Though the indenting lets me assume I am setting the cs7 instance's global PC to 1.2.3, I'm actually overwriting osmo-msc's PC with 1.2.3 and discarding the 0.0.1. *) When a software change moves a VTY command from a child to a parent. Say 'timezone' moved from 'bts' to 'network' level: network timezone 1 2 Say a user still has an old config file with 'timezone' on the child level: network bts 0 timezone 1 2 trx 0 The user would expect an error message that 'timezone' is invalid on the 'bts' level. Instead, the VTY finds the parent node's 'timezone', steps out of 'bts' to the 'network' level, and instead says that the 'trx' command does not exist. Format: Consistent means that two adjacent indenting lines have the exact same indenting characters for the common length: Weird mix if you ask me, but correct and consistent: ROOT <space>PARENT <space><tab><space>CHILD <space><tab><space><tab><tab>GRANDCHILD <space><tab><space><tab><tab>GRANDCHILD2 <space>SIBLING Inconsistent: ROOT <space>PARENT <tab><space>CHILD <space><space><tab>GRANDCHILD <space><tab><tab>GRANDCHILD2 <tab>SIBLING Also, when going back to a parent level, the exact same indenting must be used as before in that node: Incorrect: ROOT <tab>PARENT <tab><tab><tab>CHILD <tab><tab>SIBLING As not really intended side effect, it is also permitted to indent the entire file starting from the root level. We could guard against it but there's no harm: Correct and consistent: <tab>ROOT <tab><tab>PARENT <tab><tab><tab><tab>CHILD <tab><tab>SIBLING Implementation: Track parent nodes state: whenever a command enters a child node, push a parent node onto an llist to remember the exact indentation characters used for that level. As soon as the first line on a child node is parsed, remember this new indentation (which must have a longer strlen() than its parent level) to apply to all remaining child siblings and grandchildren. If the amount of spaces that indent a following VTY command are less than this expected indentation, call vty_go_parent() until it matches up. At any level, if the common length of indentation characters mismatch, abort parsing in error. Transitions to child node are spread across VTY implementations and are hard to change. But transitions to the parent node are all handled by vty_go_parent(). By popping a parent from the list of parents in vty_go_parent(), we can also detect that a command has changed the node without changing the parent, hence it must have stepped into a child node, and we can push a parent frame. The behavior on the interactive telnet VTY remains unchanged. Change-Id: I24cbb3f6de111f2d31110c3c484c066f1153aac9
* VTY: interactive: never look for matching commands on parent nodeNeels Hofmeyr2017-09-081-26/+2
| | | | | | | | | | | | | | | | | | | | | | For interactive telnet VTY, remove the implicit move up to the parent node when a command did not succeed on the current node level. When reading config files, this behavior was useful to allow skipping explicit 'exit' commands. (A different patch deals with that.) In the telnet VTY, this behavior was never necessary. Explicit 'exit' commands can move to the parent node, and typically uninformed users expect to require that. On a telnet VTY, counting indents like for reading config files is not an option: a user will always type from the first column or may paste some leading spaces without intended meaning. After this patch, it is thus no longer possible to paste a complete config across several node levels directly to a telnet session, unless it contains 'exit' commands. Change-Id: Id73cba2dd34676bad8a130e9c45e67a272f19588
* ipa: place comment "IPA Multiplex" on ipa allocated msgbsNeels Hofmeyr2017-09-071-1/+1
| | | | | | | | | | libosmocore offers the ipa API as general IPA Multiplex, which is e.g. used for GSUP in osmo-msc. Looking at talloc reports, it is confusing to see "Abis/IP" as msgb comment, because osmo-msc does not have an Abis interface. Rename to "IPA Multiplex" as a more general description. Change-Id: I3714dd21707bec0c4bcd0871e6ee8ff32d56b125
* cosmetic: clarify language in vty read errorKeith2017-09-051-1/+1
| | | | | | | | | | | | | | This is very minor but it annoys every time I see it. The text: "Error occurred during reading below line:" is not a complete sentence. The default understanding in english having left out the article implies that the error occured reading below [the] specified line, not that the error occured reading [the] specified line. That is to say, The message implied that the printed line was the last successfully parsed line. Change-Id: Ib4dd135feb9609b14983db5dac321a70267d8f30
* lapd_core: Fix crash in lapd_est_req() functionIvan Kluchnikov2017-09-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lapd_est_req() function could be called on uninitialized lapd link (before lapd_dl_init() and after lapd_dl_exit() functions) due to invalid usage on higher levels. In order to prevent using uninitialized lapd link, we should set LAPD_STATE_NULL state for lapd_datalink in lapd_dl_exit() function. So all messages for lapd_datalink in null state will be unhandled by lapd_recv_dlsap() function and lapd_est_req() function will not be called before lapd_dl_init() function where lapd link state is changed to idle. #0 0x00007f46ecd99aa5 in lapd_est_req (dp=<optimized out>, lctx=0x7f46ed80b8b8) at lapd_core.c:1769 #1 0x00007f46ecd9dda8 in rslms_rx_rll_est_req (msg=msg@entry=0x7f46eeab4940, dl=dl@entry=0x7f46ed80b888) at lapdm.c:845 #2 0x00007f46ecd9fc03 in rslms_rx_rll (lc=0x7f46ed80b398, msg=0x7f46eeab4940) at lapdm.c:1157 #3 lapdm_rslms_recvmsg (msg=0x7f46eeab4940, lc=0x7f46ed80b398) at lapdm.c:1223 #4 0x00007f46ed63773d in rsl_rx_rll (msg=<optimized out>, trx=<optimized out>) at rsl.c:2178 #5 down_rsl (trx=<optimized out>, msg=<optimized out>) at rsl.c:2541 #6 0x00007f46ed641529 in sign_link_cb (msg=<optimized out>) at abis.c:169 #7 0x00007f46ec54b111 in ipaccess_bts_read_cb (link=0x7f46eeab4940, msg=0x0) at input/ipaccess.c:807 #8 0x00007f46ec548a8e in ipa_client_read (link=0x7f46ee26ae30) at input/ipa.c:74 #9 ipa_client_fd_cb (ofd=<optimized out>, what=1) at input/ipa.c:137 #10 0x00007f46ecfc726f in osmo_fd_disp_fds (_eset=0x7ffe7a9fcd20, _wset=0x7ffe7a9fcca0, _rset=0x7ffe7a9fcc20) at select.c:167 #11 osmo_select_main (polling=polling@entry=0) at select.c:207 #12 0x00007f46ed63fc25 in bts_main (argc=5, argv=<optimized out>) at main.c:359 #13 0x00007f46ebd76f45 in __libc_start_main (main=0x7f46ed61b120 <main>, argc=5, argv=0x7ffe7a9fcf18, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, #14 0x00007f46ed61b14e in _start () Related: OS#1982 Change-Id: I306dad9b78e3becaef14c5305ec25c312feefe3c
* Makefile.am: fix missing LTLDFLAGS for libosmocodingVadim Yanitskiy2017-08-311-0/+1
| | | | | | | | Despite the libosmocoding.map is preset since the library release, one was not used in a proper way. The LTLDFLAGS were missing, so let's add them. Change-Id: Idf677825ff642d50bea43c7f970810783e864fdd
* umts aka: add sqn_ms out-param, print SQN.MS in osmo-auc-genNeels Hofmeyr2017-08-291-1/+2
| | | | | | | | | | | | | | | | When doing UMTS AKA with AUTS, it can be interesting to know the SQN.MS that was encoded in the AUTS. The only way to know this is to provide it as a separate out-parameter from milenage_gen_vec_auts(), because the SQN.MS from AUTS stored in umts.sqn is immediately modified non-trivially by milenage_gen_vec(). Add sqn_ms to struct osmo_sub_auth_data to retain SQN.MS even after a vector was generated. Use this to print out SQN.MS for 'osmo-auc-gen -3 -A'. Adjust test suite expectations. Related: OS#2464 Change-Id: I9fc05bbf169d06716f40b995154fd42a3f91bef3
* vty: 'ctrl' node: add missing default commands like list,exit,endNeels Hofmeyr2017-08-281-0/+1
| | | | Change-Id: I72569ed767b6a4d792b2867d02caa65520e27cd3
* gsm0411_utils: GSM03.40 9.2.3.11 SCTS should be localKeith2017-08-171-1/+1
| | | | | | |