AgeCommit message (Collapse)AuthorFilesLines
4 dayslogging: Change LLAPD category color to purple-like oneHEADmasterPau Espin Pedrol1-1/+1
Previous dark shiny blue one is really difficult to read on the terminal. Let's change it for some purpleish color which is far easier to read. Change-Id: Ia5c0860dd8d756bb24eb8972f94590bfba5bc865
5 daysns2: correct parse a BLOCK PDU which was received over a different NSVCAlexander Couzens1-10/+36
BLOCK PDU can be send over a different NSVC than the NSVC. E.g. informing a NSVC got blocked in case of a lower-layer failure. Change-Id: I483e3a1d3b8c43bbb0cc6185b7f7f772bcb264bf
5 daysns2: don't forward an invalid RESET PDU to the FSMAlexander Couzens1-0/+2
When receiving an invalid RESET (e.g. wrong NSEI or NSVCI) do not forward the PDU to the NSVC fsm. Answer it with correct NSEI & NSVCI, log the PDU, then ignore it. Fixes: OS#5258 Change-Id: I6e562def9c5a1e4534d42884215272b1e66d26c2
5 daysns2: improve log line when receving a PDU with wrong NSEAlexander Couzens1-1/+1
Change-Id: I072510461fb426fa62ca20c5103764b0efd25f82
7 daysutils: introduce osmo_talloc_replace_string_fmt()Vadim Yanitskiy2-0/+23
Change-Id: I6b84fa0525555a98c531fc558e5dc1298fec00c1
12 daysns2: correct parse a STATUS PDU which was received over a different NSVCAlexander Couzens1-4/+20
STATUS PDU can be send over a different NSVC than the NSVC which generated the STATUS PDU. E.g. informing a NSVC got blocked in case of a lower-layer failure. Change-Id: I5c9e9de10c669c1226da67bb9e2663c5cfe828a8
12 daysns2: message: allow to pass a foreign NSVCI to STATUS PDUAlexander Couzens4-7/+12
To answer correct on a BLOCK PDU with a different NSVCI, the STATUS PDU needs also a NSVCI parameter. Change-Id: I373eb48697097cdfa45748a091c11f7b3f0345fa
12 daysns2: fsm: add comment don't answer on a STATUS with a STATUSAlexander Couzens1-0/+1
Change-Id: Ib8f700f9193a96a7bada3b0293dcecf6a05d6efc
12 daysns2: ensure the NSVC is in the correct mode for NSVC UNKNOWN/NSVC BLOCKED ↵Alexander Couzens1-0/+5
cause codes Those cause codes are only valid for BLOCK/RESET NSVCs. Change-Id: I560f1c8c2826befd03641bebffe156ac070061c2
12 daysns2: message: BLOCK/BLOCK ACK allow to use a given NSVCI instead of using ↵Alexander Couzens4-15/+27
the nsvc nsvci The BLOCK and BLOCK ACK PDUs can be send over a working NSVC to inform the NSE that a NSVC is blocked. Change-Id: I6189229fdc1f054e86811bc60cb7646e1f758a78
14 daysgsmtap: allow 127.0.0.x local listenersEric1-0/+22
Even if not bound to a IF they just exist and work as expected, and make distinguishing traffic for local setups easy. Change-Id: I1043dfd8075f14481011f43db45c943e9320413c
2021-10-04utils: remove misleading comments for osmo_hexdump[_nospc]_c()Vadim Yanitskiy1-6/+0
The buffer is allocated dynamically on heap, so there is no such limitation of 4096 bytes / 1365 characters. Change-Id: I960dd6a53123fd4209ef6e61dcd0d22e4005e397
2021-10-04revisit some calls of strtol(), stroul(), strtoull()Neels Hofmeyr7-73/+31
Replace some with atoi(), where the VTY has already validated correct range of the argument. Replace others with the new osmo_str_to_int() or osmo_str_to_int64() functions, possibly covering more detection of invalid number strings. Leave those strtol() callers that depend on endptr to provide the next string token. Related: SYS#5542 Change-Id: I0ebb06e751c28f7d1cdf328de29cd227a2449391
2021-10-01fix rsl_chan_nr_str_{buf,c}(): enlarge the buffer sizeVadim Yanitskiy1-3/+3
20 bytes is not enough for some VAMOS specific channel number values, so the resulting string representation gets truncated by snprintf(): expected: "VAMOS TCH/H(0) on TS4\0" actual: "VAMOS TCH/H(0) on T\0" Let's enlarge the buffers to 32 bytes. Change-Id: I68d839f4ab742cf56de34e7e22572a1163aec2da
2021-09-30cosmetic: get rid of 3 deprecation warningsNeels Hofmeyr3-3/+3
Some deprecated functions are still used in libosmocore .c code. Use OSMO_DEPRECATED_OUTSIDE() to get rid of those "resident warnings". Change-Id: I6e79acc87be37ac1aaec900e737e41450b46826a
2021-09-30refactor stat_item: report only changed valuesNeels Hofmeyr4-14/+9
Change the functionality of skipping unchanged values: instead of looking up whether new values have been set on a stat item, rather remember the last reported value and skip reporting identical values. stats_test.c shows that previously, a stat item reported a value of 10 again, even though the previous report had already sent a value of 10. That's just because the value 10 was explicitly set again, internally. From a perspective of preserving all data points, it could make sense to send consecutive identical values. But since we already collapse all data points per reporting period into a max, that is pointless. Related: SYS#5542 Change-Id: I8f4cf34dfed17e0879716fa2cbeee137c158978b
2021-09-30refactor stat_item: get rid of FIFO and "skipped" errorNeels Hofmeyr11-335/+371
Intead of attempting to store all distinct values of a reporting period, just store min, max, last as well as a sum and N of each reporting period. This gets rid of error messages like DLSTATS ERROR stat_item.c:285 num_bts:oml_connected: 44 stats values skipped while at the same time more accurately reporting the max value for each reporting period. (So far stats_item only reports the max value; keep that part unchanged, as shown in stats_test.c.) With the other so far unused values (min, sum), we are ready to also report the minimum value as well as an average value per reporting period in the future, if/when our stats reporter allows for it. Store the complete record of the previous reporting period. So far we only compare the 'max' value, but like this we are ready to also see changes in min, last and average value between reporting periods. This patch breaks API by removing: - struct members osmo_stats_item.stats_next_id, .last_offs and .values[] - struct osmo_stats_item_value - osmo_stat_item_get_next() - osmo_stat_item_discard() - osmo_stat_item_discard_all() and by making struct osmo_stats_item opaque. In libosmocore, we do have a policy of never breaking API. But since the above should never be accessed by users of the osmo_stats_item API -- or if they are, would no longer yield useful results, we decided to make an exception in this case. The alternative would be to introduce a new osmo_stats_item2 API and maintaining an unused legacy osmo_stats_item forever, but we decided that the effort is not worth it. There are no known users of the removed items. Related: SYS#5542 Change-Id: I137992a5479fc39bbceb6c6c2af9c227bd33b39b
2021-09-29GPRS: Add PDP_TYPE_N_IETF_IPv4v6Keith1-0/+1
Change-Id: I1f82f9d8fc13dcc4474760329bd74ae9685b9031
2021-09-28cosmetic: gsm: meas_rep.h: Fix typo in commentPau Espin Pedrol1-1/+1
Change-Id: I35c47a69ad1e9a75de6cc82c44a87828ebbb7189
2021-09-28gsm: Mark gsm0858_rsl_ul_meas_enc() pointer param constPau Espin Pedrol2-2/+2
Change-Id: I9b2704250d8a3f6c6fc6cd2a5136b1408c8ed965
2021-09-23ns2: nsvc: add a uptime/downtime to track the last state changeAlexander Couzens5-13/+24
To show adminstrator the last state change of a nsvc add a timestamp and show it on the vty > show ns nsei 1234 NSEI 01234: UDP, DEAD since 0d 0h 1m 42s [...] 4 NS-VC: UNBLOCKED DYNAMIC sig_weight=1 data_weight=1 udp)[]:22000<>[]:23001 ALIVE since 0d 0h 0m 1s UNBLOCKED DYNAMIC sig_weight=2 data_weight=2 udp)[]:22000<>[]:23000 ALIVE since 0d 0h 0m 1s UNBLOCKED DYNAMIC sig_weight=2 data_weight=2 udp)[]:22001<>[]:23000 ALIVE since 0d 0h 0m 1s UNBLOCKED DYNAMIC sig_weight=1 data_weight=1 udp)[]:22001<>[]:23001 ALIVE since 0d 0h 0m 1s Related: OS#5028 Change-Id: Ie3a039a209869295afa5feda39297cee81fedf22
2021-09-23ns2: nse: add a uptime/downtime to track the last state changeAlexander Couzens4-4/+12
To show adminstrator the last state change of a nse add a timestamp and show it on the vty > show ns nse 1234 NSEI 01234: UDP, ALIVE since 0d 0h 0m 16s FSM Instance Name: 'GPRS-NS2-SNS-SGSN(NSE01234-SNS)[0x6120000012a0]', ID: 'NSE01234-SNS' Log-Level: 'DEBUG', State: 'CONFIGURED' Timer: 4 Maximum number of remote NS-VCs: 8, IPv4 Endpoints: 2, IPv6 Endpoints: 0 [...] Related: OS#5028 Change-Id: I8143080a3c5c9a55d37dfad44ba2ac6561daa216
2021-09-23vty: add vty_out_uptime() print the uptime to the vtyAlexander Couzens3-12/+25
vty_out_uptime() calculates the time difference to a given timespec and print it in a human readable format (days, hours, minutes, seconds) to the vty. Related: OS#5028 Change-Id: I264a3f49096b96646e0a1f5366623ac20d860793
2021-09-21osmo-auc-gen: Print RFC3310 IMS HTTP-AKA style base64 nonce/resHarald Welte2-1/+50
This is useful when debugging IMS Authentication which uses RFC3310 representation of the nonce and expected result. Change-Id: Ibfa72410d8ff8e5b42063f1a12bff69ad2bebbb8
2021-09-21base64: reformat using Lindent to conform to our coding styleHarald Welte3-196/+190
Change-Id: I2286fa0d2cba7c11359bb48329135dfcd0d8a948
2021-09-21base64: Migrate over to osmocomHarald Welte8-107/+85
This containts the osmocom changes to the mbedtls base64 code merged in the previous commit. Change-Id: I82c1bf5f827c8def370dbcb80b146e9e4184c4a3
2021-09-21copy base64 implementation from mbedtlsHarald Welte2-0/+370
Using mbedtls commit f9c599cd8ac9d00c484d4f5b027e18c6af4f9fdf before they re-licensed to Apache 2.0, so we have a GPL-v2-or-later bsae64 implementation and avoid having code under a different license in the tree. This code is the unmodified import, so we can record any local changes compared to the original version. Change-Id: I39a9d3ab98257d21b9439b00528c744efa372c14
2021-09-20stats_test: assert counter and stat item val counts separatelyNeels Hofmeyr2-57/+51
Instead of just a send_count, keep one such count for the counter updates, and a separate one for the stat item updates. Print those numbers in the test output. An upcoming patch will tweak stat_item reporting so that only an actually changed value results in sending a new stat value. This patch allows illustrating that change clearly. Related: SYS#5542 Change-Id: I2da003ee6ec15f1c3959efe69e01b4ee24af82bb
2021-09-20stat_item: cosmetic: s/desc/group_desc in osmo_stat_item_group_alloc()Neels Hofmeyr2-10/+10
There also is an osmo_stat_item_desc, so the name 'desc' makes it hard to read the code / the upcoming refactoring patches. It is an osmo_stat_item_group_desc, so call it group_desc. Related: SYS#5542 Change-Id: I07bc011450549a44ebf043e7d8a70718ddfd900e
2021-09-17osmo-auc-gen: Permit specifying the SQN in hex (0x12345) formatHarald Welte1-1/+1
Use base '0' of strtoul to permit both decimal and hexadecimal input to the SQN parameter. Some other tools represent the SQN as hex, so this avoids having to use some external tool to convert and allows you to copy+paste it to the osmo-auc-gen command line. Change-Id: I67c6341a989de433451994b824e12afd0c26cb8a
2021-09-14CTRL: expose stat_item groups on CTRLNeels Hofmeyr1-0/+99
Expose all stat items as RO variables of the form stat_item.last.group_name.N.item_name stat_item.last.group_name.by_name.idx_name.item_name For (possibly contrived) example: stat_item.last.trunk.0.endpoints:used stat_item.last.trunk.by_name.virtual-0.endpoints:used Include the 'last' token to ease future extension, like 'max'. Put this token in the beginning, similarly to rate_ctr variables, which begin with 'per_sec', 'per_hour', ... Related: SYS#5542 Related: I178dcf4516606aa561d47b06061b8a416d3c40cf (osmo-ttcn3-hacks) Related: Ic1b35b7406547f92818afe399a2383d154576409 (osmo-ttcn3-hacks) Change-Id: Idace66b37492fe96b2f2e133a69cac7960ca279c
2021-09-14add osmo_stat_item_get_group_by_name_idxname()Neels Hofmeyr2-0/+21
Add "missing" API for looking up a stat_item_group by its index-name. A subsequent patch, which adds stat_items to the CTRL interface, will use this to look up stat item groups by object name. In stat item groups, there are group names, having a number of indexes denoting different objects. An object can have, besides the index, also a name that is equivalent to the index. Apologies for the weird function name, it's still the best one I could come up with: "group_by_name" refers to the group name, and "idxname" refers to the name that the object index is associated with. We already have osmo_stat_item_get_group_by_name_idx(). Other contestants for name of this new function were: - osmo_stat_item_get_group_by_name_name() because there is a "name" instead of "idx", but I find it confusing. - osmo_stat_item_get_group_by_name_idx_name() but I find that the last "name" should be closer to the "idx". Related: SYS#5542 Change-Id: Ia1a77a1e4657ba624dd4f4bf7ad274e7751d0141
2021-09-12utils: add osmo_str_to_int() and osmo_str_to_int64()Neels Hofmeyr4-3/+413
Properly converting a string to an integer while validating against all possible errors is not trivial. It is a recurring theme in code review, and there are places in osmo code that do it wrong. End this by providing a simple API, if for nothing else then as an example of how to use strol() / strtoul() / strtoll() / strtoull() in an airtight way. A subsequent patch, adding stat items to the CTRL interface, uses this to properly validate indexes in CTRL variables and convert them to int. Related: SYS#5542 Change-Id: I4dac826aab00bc1780a5258b6b55d34ce7d50c60
2021-09-10vty: allow flushingEric2-0/+7
It was so far sufficient to wait for the buffers to drain at some random point in time, but this is not always the case, sometimes it is important that the output is flushed immediately. Change-Id: If984b9ad2eba9f400bc29a7aa8825e241fd1d2a9
2021-09-07gprs_ns2: nsvc: react on STATUS PDUs with cause code NSVC UNKNOWN/NSVC BLOCKEDAlexander Couzens1-0/+27
A STATUS PDU with cause code NSVC UNKNOWN/NSVC BLOCKED informs the other side about a state mismatch between the side. Change-Id: Ib6a2424f3027a30f14ef0a9fc2230e6aae9a2a04
2021-09-07gprs_ns2: fix a white spaceAlexander Couzens1-1/+1
Change-Id: I2207d13ae451ce49482625fac43b6ab1c0f215e8
2021-09-07gprs_ns2: fix NS STATUS validationAlexander Couzens1-4/+3
The wrong TLVs were used. Change-Id: I01339d93469285cc5340500717ab2b696284e12a
2021-09-07ns2: fix a crash when receiving a SIZE while configuredAlexander Couzens1-0/+2
The ns2_vc_force_unconfigured() needs to be protected otherwise it would free gss->nsvc which will be used later. It further would run into another SNS failure which is wrong too. Change-Id: If14b9e3fcd5d139457b10d06517302168091d8d8
2021-09-07ns2: nsvc: reject UNITDATA when the remote BLOCK'edAlexander Couzens1-0/+1
When the remote initiated the BLOCK the nsvc would still accept UNITDATA over this nsvc. Change-Id: I3ed4aa105a84e448082d3028fe844aae7720426b
2021-09-04gprs_ns2: ensure the incoming NSVC is also the outgoing NSVCAlexander Couzens1-2/+1
Previous the SNS NSVC (the NSVC used for all SNS traffic) was never changed except when the choosen NSVC went dead or got freed. When receiving a SNS SIZE PDU over a different NSVC than the current SNS NSVC the answer would be transmitted to a different port. Change-Id: I36cd9488b8bca5cb99dae5cf50a55ee282e0557b
2021-09-04gprs_ns2_sns: ensure the SNS fsm behave correct when no signalling NSVCs are ↵Alexander Couzens1-4/+19
present When no remaining signalling NSVCs are available the SNS must be restarted (BSS) or go into unconfigured state (SGSN). Change-Id: I95e6bbb7a418d647a8426804879571597ae06ff8
2021-09-04gprs_ns2: improve reselection protectionAlexander Couzens1-0/+1
Change-Id: I375a7639fb8e0f92fd67bb4176bd6219978aa428
2021-09-04gprs_ns2: add correct filename/linenr to sns failed log messageAlexander Couzens1-1/+1
Change-Id: I117eaf8340fca50cb14392a3f05ea8feac1af3ed
2021-09-04gprs_ns2: calculate the nse->*_sums before notifing the sns fsmAlexander Couzens1-1/+1
The sns fsm needs these information to determine if there is a signalling nsvc left Change-Id: I7b115921780bd1ae895d8b9d0d4aec3e1cbaaf58
2021-09-04gprs_ns2: also prevent recursive events when SGSN side cleans upAlexander Couzens1-0/+2
When cleaning up the SGSN side (e.g. receiving a SNS SIZE PDU) the clean up will result in a use-after-free bug when the SGSN side is still alive. Change-Id: I0f57dd0577d1fc7bd270f58e15f6f22eb130ef59
2021-09-04gprs_ns2_sns: implement outbound SNS DEL proceduresAlexander Couzens1-9/+95
When removing a bind the remote side needs to be informed via the SNS DELETE procedure. Related: OS#5036 Change-Id: I53cd54dfd262c70c425c3f13dad3b29526daa523
2021-09-04gprs_ns2_sns: implement outbound SNS ADD proceduresAlexander Couzens1-33/+190
When adding a bind, the remote side needs to be informed via the SNS ADD procedure. Related: OS#5036 Change-Id: I71c33200bd1f0307ceb943ee958db5ebe3623d36
2021-09-04gprs_ns2_sns: implement local change weight procedureAlexander Couzens5-9/+460
When changing the bind ip-sns weight, initiate a SNS CHANGE WEIGHT procedure to inform the other side. Related: OS#5036 Change-Id: Icec4dabb46bc198f68f91bfe09ba279fbe68d454
2021-09-04gprs_ns2: don't use llist_for_each when freeing an elementAlexander Couzens3-20/+28
The problem are recursive execution because a free generates an event which could allow the use to free a nsvcs while the llist_for_each() is still running. Change-Id: I902557fb6e56e6588728a46e43a9cbe3215d5c68
2021-09-04gprs_ns2: gprs_ns2_free_bind() should remove itself before removing nsvcsAlexander Couzens1-4/+4
When removing NSVCs before removing the bind from the SNS list, the removing NSVCs could trigger a creation of a new NSVC on the same bind ending in a while(true) loop. Change-Id: I6f497348f75fb479427d8a4c23313e33fbc62036