aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2020-10-15socket.c v4/v6 error logneels/lcsNeels Hofmeyr2-5/+21
Change-Id: I0fd12b08e0788ce3af6dc519ff8c82ad196a115f
2020-10-15new_fsm fuNeels Hofmeyr1-10/+14
Change-Id: Ie3c6e63510a399d57a752a481a032d0022888885
2020-10-15add contrib/new_fsm.pyNeels Hofmeyr1-0/+213
Change-Id: I7781008dffc49dc9a279fa066ad2e0bb7da25dfe
2020-10-15add contrib/ladder_to_msc.pyNeels Hofmeyr3-0/+464
Typing mscgen diagrams, I am hugely annoyed by having to type '[label="..."]' all the time. Also, IMHO the arrows have been chosen in an unintuitive way: in mscgen, '=>>' is the normal arrow, and '->' is a half-headed arrow, etc. I would like to use other arrow symbols. Hence, add script to convert my personal favorite ascii format for message sequence charts to mscgen format. See an example in ladder_to_msc_test.ladder. Change-Id: Iefac4cb91b82c93a64b4999afa62e299479913af
2020-10-15gad.c: fix rc for osmo_gad_enc_ell_point_unc_circle()Neels Hofmeyr1-1/+1
Related: CID#214889 Change-Id: If9bb6ab22280e0dc66ca21bba9409d817603dd4f
2020-10-15gad.c: try to workaround warning for "h.type >= 0"Neels Hofmeyr1-2/+2
The DEC_ERR() macro has a check for a missing type, but when used on the uint h.type variable, emits a warning about an always-true statement. Try to work around that warning with a cast to (int). Related: CID#214888 CID#214890 CID#214891 Change-Id: Ic5fa87d23a6f0ce872de9c1dcfe36023981f70de
2020-10-13contrib: jenkins: Enable parallel make in make distcheckPau Espin Pedrol1-1/+1
Related: OS#4421 Change-Id: I4db992d599bd5cdc16a58729695654d1b759b682
2020-10-13gsm: Fix make distcheck with parallel makePau Espin Pedrol2-1/+4
Change-Id: I0bab4cfbc82d2b0aa7bd07769000ab8e4968a00b
2020-10-12add osmo_sockaddr_to_str_buf/osmo_sockaddr_to_strAlexander Couzens4-0/+151
Add helper to format osmo_sockaddr into a string. Change-Id: I917f25ebd1239eae5855d973ced15b93731e33a0
2020-10-12gprs_ns2: add gprs_ns2_ip_vc_equal()Alexander Couzens3-0/+39
Compare the NS-VC with the given parameter Change-Id: I3a0cd305fd73b3cb9ec70246ec15ac70b83e57f2
2020-10-12cosmetic: vty: Fix trailing whitespacePau Espin Pedrol1-1/+1
Change-Id: Ieea7d13161440326d58f80f1fbc9f7e3fa5a40af
2020-10-12vty: Fix left shifting out of range on signed variablePau Espin Pedrol1-3/+3
Fixes following ASan runtime errors while running vty tests: src/vty/command.c:3088:27: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' src/vty/command.c:3136:23: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' Change-Id: Ie11ff18d6fd9f6e1e91a51b6156fb6b0b7d3a9a8
2020-10-12gprs_ns2: Partial revert 48f63867 allow to create NS_ALIVE NSVCAlexander Couzens1-15/+10
NS_ALIVE can't create new NS-VC. Those NS-VC can be only created by SNS or by vty. Also fixes a crash because the TLV parser tried to retrieve NSEI TLV which doesn't exist on NS_ALIVE PDUs. Related: OS#4792 Change-Id: I16b9d7b2eb7544a83ce871d894887c4b30605b34
2020-10-12gprs_ns2: add gprs_ns2_nse_foreach_nsvc()Alexander Couzens3-0/+28
Allow to loop over all NSVC within a NSE via a callback Change-Id: I5a2bb95d05d06d909347e2fb084a446ead888cb3
2020-10-12gprs_ns2: gprs_ns2_ip_vc_remote() the nsvc can be also constAlexander Couzens2-2/+2
Change-Id: Ia000f535f18f21b41038f2ce7721f0fb59f6a093
2020-10-12gprs_ns2: add gprs_ns2_nse_sns_remote() returns the initial SNS addressAlexander Couzens3-0/+17
Allows the PCU to get the SNS remote address. Change-Id: I54f110acc3acccb362f6e554324d08cc42b7c328
2020-10-12gprs_ns2: add gprs_ns2_ip_vc_local() return the local sockaddrAlexander Couzens3-0/+19
Change-Id: I65a739772596015b90473045d32d4934d924e43f
2020-10-12gprs_ns2: rename gprs_ns2_ip_vc_sockaddr -> gprs_ns2_ip_vc_remoteAlexander Couzens6-10/+10
It's more clear which part of the address is returned. In preparation to add a gprs_ns2_ip_vc_local. Change-Id: I6110ff573362961c713a990da7ef3f3dbedf6c57
2020-10-12gprs_ns2: const the return value of gprs_ns2_ip_vc_sockaddr / ↵Alexander Couzens5-12/+14
gprs_ns2_ip_bind_sockaddr The sockaddr should not be changed. free and create the bind/nsvc if the address should be changed. Change-Id: I371ac2361b569e36722b02fc9cd82ec8da2fa9e3
2020-10-12gprs_ns2: add gprs_ns2_free_nses() to free all NS-EAlexander Couzens3-6/+12
Allow users to clean up most of the state (e.g. the PCU). Change-Id: Ia00753a64b7622a0864341f51ea49b6963543755
2020-10-12gprs_ns2: add gprs_ns2_free_binds() to free all bindsAlexander Couzens3-4/+12
Allow users to clean up all binds (e.g. the PCU). Change-Id: Ic8f6f8aca10da23a18fab8870be7806065a34b47
2020-10-12gprs_ns2: add gprs_ns2_nse_nsei() to get the nsei of a nseAlexander Couzens3-0/+11
Change-Id: I5f67e6a9bf4cb322bd169061fee0a528012ed54d
2020-10-12gprs_ns2: gprs_ns2_ip_bind() check if the bind already existsAlexander Couzens1-1/+8
To prevent adding the same bind twice. It also returns the bind in **result. Change-Id: Ib816f14c387cc6ff86f9c0057daded1d72cee0f5
2020-10-12gprs_ns2: add gprs_ns2_ip_bind_by_sockaddr() to search for binds by sockaddrAlexander Couzens3-0/+29
Change-Id: I48c3f1a82574eee0a49e6941cf9e1365c2302d3b
2020-10-12gprs_ns2: fix empty prefix in TLV Parse errorAlexander Couzens1-4/+4
Those messages were printed without any prefix because LOGPC was used. LOGPC means continue a log line. This must happened while copying this part of code over from ns1 where has been a LOGP in this function. Related: OS#4792 Change-Id: I2672ea0e34d19ea6172cb3458b8ff98d9700b2d0
2020-10-12gprs_ns2: fix SNS_ADD for IPv4Alexander Couzens1-1/+1
The remote must be initialized because the osmo_sockaddr_cmp is using a memcmp() and might fail on spare bytes in the struct. The same was already done for IPv6. Related: OS#4792 Change-Id: Iefeef969bb2b5ae4d5db6a6358293ef9eeda858a
2020-10-10gprs_ns2: gprs_ns2_free(): add missing talloc_freeAlexander Couzens1-0/+2
It clean up all the space except the nsi itself. Change-Id: Ia3fbe5d679d0af75b2b0db020f1eb082d629cf50
2020-10-09doc tweaks for osmo_float_str_to_int(), osmo_int_to_float_str*()Neels Hofmeyr1-2/+10
Drop nonexistent arg from api doc, fix "factor of a million", and explain a bit more. Change-Id: I131e839b6b7dd601b859313b358d346904c0e145
2020-10-09gprs_ns2: make struct osmo_sockaddr pointers constVadim Yanitskiy7-22/+26
Using the 'const' qualifier allows the compiler to spot some programming errors and further optimize the code. Change-Id: I0df6a00ac1830bd64a10b9336b827e113fa772bb
2020-10-09socket: make the arguments of osmo_sockaddr_cmp() constVadim Yanitskiy2-2/+4
Change-Id: Ibfdfdd40c52709b32ac934974cc78ee821fa83ba
2020-10-09gprs_ns2: Fix parsing of SNS-{ADD,DEL,CHANGE_WEIGHT}Harald Welte1-2/+2
Change-Id: I94c12986f8255e4373b13b1a8fae3df08004ad96 Related: OS#4791
2020-10-09gprs_ns2_udp: Avoid dangling freed struct in list if binding failsPau Espin Pedrol1-2/+1
Change-Id: Ic54434b7cfc40136788257e768cae7a2b5d5bc79
2020-10-09osmo_float_str_to_int: When using strtoll(), use LLONG_{MAX,MIN}Harald Welte1-2/+2
When we use strtoll(), the return type is "long long" and we cannot compare against LONG_MAX and LONG_MIN but must compare against LLONG_MAX and LLONG_MIN. Change-Id: I9c18ac237b4aacd56639d1faffa6841c8ad7b8da Closes: OS#4787
2020-10-09bssmap_le/bsslap tests: We must use %td for ptrdiff_t printingHarald Welte2-9/+9
Otherwise we get (valid!) format string warnings like these on 32bit targets: [ 372s] bssmap_le/bssmap_le_test.c: In function 'test_bssmap_le_enc_dec': [ 372s] bssmap_le/bssmap_le_test.c:141:15: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'int' [-Wformat=] [ 372s] printf("[%ld] %s: ERROR: failed to encode pdu\n", (pdu - bssmap_le_test_pdus), [ 372s] ^ Closes: OS#4786 Change-Id: Ib1c16b8adc5c8c0a2b418db51d12089f9b49a844
2020-10-08command: add library command attribute for libosmo-abisPhilipp Maier3-0/+10
Change-Id: I0efc57f2cb54798ba207ae6fef9af4771d96bfa9 Related: SYS#4937, OS#1601
2020-10-08bssgp: Don't include RA-ID in BVC-RESET for BVCI=0 (signalling)Harald Welte1-1/+10
3GPP TS 48.018 is quite clear: The RA-ID must only be included when a PTP-BVCI is being reset [and only if the sender is the BSS]. Before this patch, osmo-pcu is including the RA-ID in BVC-RESET for BVCI=0. Change-Id: Ie87820537d6d616da4fd4bbf73eab06e28fda5e1
2020-10-07add BSSMAP coding for Location ServicesNeels Hofmeyr4-0/+158
BSSMAP: add A-interface messages between MSC and BSC: - Perform Location Request - Perform Location Response - Perform Location Abort Change-Id: I4d7302a4853518916b6b425e710c10568eb2ffe5
2020-10-07add BSSMAP-LE coding for Location ServicesNeels Hofmeyr10-1/+1320
BSSMAP-LE: add Lb-interface messages between BSC and SMLC: - Reset - Reset Acknowledge - Perform Location Request, possibly containing BSSLAP TA Layer3 - Perform Location Response - Perform Location Abort - Connection Oriented Information containing any BSSLAP APDU Add encoding and decoding tests. Change-Id: I271e59b794bafc0a7ae0eabbf58918f6d7df431d
2020-10-07add BSSLAP coding for Location ServicesNeels Hofmeyr11-1/+698
BSSLAP: there are APDUs transferred in BSSMAP-LE Connection Oriented Information messages on Lb between BSC and SMLC. Add BSSLAP coding for these APDU messages: - TA Layer3 - TA Request - TA Response, possibly containing Location Estimate coded in GAD - Reject - Reset (for intra-BSS handover during TA Request) - Abort (for inter-BSS handover) Add encoding and decoding tests. Change-Id: I6409c4bcac402dc7626a3afce9081c59cd715fe8
2020-10-07add GAD coding for Location ServicesNeels Hofmeyr10-1/+1030
GAD, Universal Geographical Area Description: - raw coding for all GAD elements. - SI-units encoding and decoding for Ellipsoid point with uncertainty circle, which I presume is the typical "at most N meters away from cell tower located at X,Y", which corresponds to the TA positioning currently being implemented. - other SI-units GAD element encodings are so far not implemented. Add encoding and decoding tests. In gsm/protocol/gsm_23_032.h are the raw coding structs as defined in 3GPP TS 23.032. In gsm/gad.h are structs carrying consistent units based on meters and degrees, for convenient / less error prone handling of GAD data, and for human readable representations of the GAD data. The separation of the two is desirable because OsmoBSC will receive GAD data from OsmoSMLC on the Lb interface, and pass on this data to the MSC via the A interface. It is better to pass the GAD data as-is without de/encoding. Change-Id: I7a9dd805a91b1ebb6353bde0cd169218acbf223c
2020-10-07add osmo_float_str_to_int() and osmo_int_to_float_str_*()Neels Hofmeyr4-0/+1000
This will be useful to handle latitude and longitude numbers for GAD, which is the location estimate representation used for LCS (Location Services). The OsmoSMLC VTY user interface will provide floating-point strings like "23.456" while GAD stores them as micro-degress 23456000. The osmo_gad_to_str* will also convert latitude and longitude to floating-point string. There was code review concerns against adding this API, upon which I tried to use floating point string formats. But I encountered various problems with accuracy and trailing zeros. For global positioning data (latitude and longitude), even inaccuracy on the sixth significant decimal digit causes noticeable positional shift. To achieve sufficient accuracy on the least significant end, I need to use double instead of float. To remove trailing zeros, the idea was to use '%.6g' format, but that can cause rounding. '%.6f' on a double looks ok, but always includes trailing zeros. A test program shows: %.6g of ((double)(int32_t)23230100)/1e6 = "23.2301" <-- good %.6g of ((double)(int32_t)42419993)/1e6 = "42.42" <-- bad rounding %.6g of ((double)(int32_t)23230199)/1e6 = "23.2302" <-- bad rounding %.6f of ((double)(int32_t)23230100)/1e6 = "23.230100" <-- trailing zeros %.6f of ((double)(int32_t)42419993)/1e6 = "42.419993" <-- good %.6f of ((double)(int32_t)23230199)/1e6 = "23.230199" <-- good It looks like when accepting that there will be trailing zeros, using double with '%.6f' would work out, but in the end I am not certain enough that there aren't more hidden rounding / precision glitches. Hence I decided to reinforce the need to add this API: it is glitch free in sufficient precision for latitude and longitude data, because it is based on integer arithmetic. The need for this precision is particular to the (new) OsmoSMLC vty configuration, where reading and writing back user config must not modify the values the user entered. Considering to add these functions to osmo-smlc.git, we might as well add them here to libosmocore utils, and also use them in osmo_gad_to_str_*() functions. Change-Id: Ib9aee749cd331712a4dcdadfb6a2dfa4c26da957
2020-10-07gprs_ns2_vty_create: remove bind pointer checkAlexander Couzens1-10/+8
The bind pointer can't be NULL because gprs_ns2_ip_bind() is either return 0 and bind is valid or != 0 and returning. Found-by: Coverity Fixes: CID#214854 Change-Id: I11d86c9cb36226701e51942f14d7a6412c3eff26
2020-10-07vty: fix vty_dump_element(): do not print empty <attributes>Vadim Yanitskiy1-1/+5
Some attributes like CMD_ATTR_LIB_COMMAND are not being printed to the XML VTY reference (despite being set), so we should not print empty "<attributes scope='global'></attributes>". Change-Id: Ie7e53b080c10564bfef6f0e8ddeb470e46fad387 Related: SYS#4937
2020-10-07vty/command: restrict the use of '.', '!', and '@' as flagsVadim Yanitskiy5-0/+27
Change-Id: Icb4acbab0a15de2b0ed7b88fb0e227675317146a Related: SYS#4937
2020-10-07vty/command: assign flags to CMD_ATTR_{IMMEDIATE,NODE_EXIT}Vadim Yanitskiy2-17/+57
Change-Id: I77c1ef7ca4c667c769cc53c7ac65c3be5c7e1c86 Related: SYS#4937
2020-10-07tests/vty: verify 'show vty-attributes' / 'list' commandsVadim Yanitskiy2-0/+157
Change-Id: I397cf642b323a9a99b2406aabaa67a7786dc2a50 Related: SYS#4937
2020-10-07vty/command: print attribute flags in the output of 'list'Vadim Yanitskiy1-2/+79
Here is an example: OsmoAPP(config-foo)# list with-flags ... help ... list ... show running-config ... exit ..F lib-command foo (one|two|three) ZB. lib-command bar [zoo] .bf app-command foo-bar z.. app-command zoo .TEXT ... app-command nope A dot indicates that the associated attribute is not set. Note that there is no strict relation between rows and index values of the attributes. In the example above there could be one or more hidden flag rows corresponding to attributes that are not assigned to any of the commands within 'config-foo' node. If neither of the commands belonging to the current node (where 'list' command is executed) has attributes, the output would not contain empty dot-rows. Global attributes (such as CMD_ATTR_IMMEDIATE) are not yet displayed because we still have not agreed on what kind of symbols to assign them. This will be implemented later. Change-Id: I71cef3ec0fab44c7e11fc353b8bc42268a4ee8f0 Related: SYS#4937
2020-10-07vty/command: introduce a command to list attributesVadim Yanitskiy1-0/+97
Here is an example of listing all attributes: OsmoBSC# show vty-attributes Global attributes: . This command is deprecated . This command is hidden . This command applies immediately . This command applies on VTY node exit Library specific attributes: (no attributes) Application specific attributes: o This command applies on A-bis OML link (re)establishment r This command applies on A-bis RSL link (re)establishment or only a specific kind of attributes: OsmoBSC# show vty-attributes application Application specific attributes: o This command applies on A-bis OML link (re)establishment r This command applies on A-bis RSL link (re)establishment Change-Id: I561114d7416e30cc06b7d49c0bc1217a76039c99 Related: SYS#4937
2020-10-06vty: introduce and use VTY_CMD_USR_ATTR_NUMVadim Yanitskiy1-2/+5
Change-Id: Ib4327835f5be264ef67a01d8f4733dd2d091eaf1 Related: SYS#4937
2020-10-06command: add library command attribute for libosmo-sccpPhilipp Maier2-0/+4
Change-Id: I4439a414af05700cb1ccff7e7e5927ffc194d171 Related: SYS#4937, OS#1601