AgeCommit message (Collapse)AuthorFilesLines
2017-04-08Add osmo_sock_init2() function, allowing both BIND *and* CONNECTlaforge/sock2Harald Welte5-33/+243
The old osmo_sock_init() function allows only either a bind (for a server socket), or a connect (for a client socket), but not both together. So there's no way to have a client socket that is bound to a specific local IP and/or port, which is needed for some use cases. Change-Id: Idab124bcca47872f55311a82d6818aed590965e6
2017-04-08compiler warnings: take care of compiler warning "unused-result"Thorsten Alteholz1-0/+7
Though it makes no sense to handle the return code of freopen() here, the compiler complains about it. The #pragma statements take care of that. Change-Id: Ia2caadbed2a24f84d1d55a47236b398b74224e82
2017-04-08gsm0808: make gsm0808_create_reset_ack() accessiblePhilipp Maier3-0/+15
The create function to generate the RESET ACKNOWLEDGE message is not accessible from outside, as it does not appear in limosmogsm.map. It also has not testcase. This commit adds gsm0808_create_reset_ack() to the map file and also adds a testcase. Change-Id: I82d3411484f82b4a9205d407fa0442244678f183
2017-04-08gsm0808: Add create functions for BSS_MAP_MSG_ASSIGMENT_RQSTPhilipp Maier5-0/+113
gsm0808.h/c lacks functionality to generate BSS_MAP_MSG_ASSIGMENT_RQST messages. These messages are required if the code is used in an MSC implementation. This commit adds a gsm0808_create_assignment() function, that generates an A/AoiP BSS_MAP_MSG_PAGING message. Change-Id: I4d1d455a1e1cf95407e23ded7b7defbcf2dd6ff0
2017-04-08gsm0808: Add create functions for BSS_MAP_MSG_PAGINGPhilipp Maier5-0/+99
gsm0808.h/c lacks functionality to generate BSS_MAP_MSG_PAGING messages. These messages are required if the code is used in an MSC implementation. This commit adds a gsm0808_create_paging() function, that generates an A/AoiP BSS_MAP_MSG_PAGING message. Change-Id: I9afecf0109305ca5153bf081bb29cd94071dd2b7
2017-04-08gsm0808: Add create functions for CIPHER MODE COMMANDPhilipp Maier5-0/+78
gsm0808.h/c lacks functionality to generate CIPHER MODE COMMAND messages. These messages are required if the code is used in an MSC implementation. This commit adds a gsm0808_create_cipher() function, that generates an A/AoiP CIPHER MODE COMMAND message. Change-Id: I8eb1c357860c3e740b0f5d17e1c256bc87920958
2017-04-08gsm0808: Add utils for Cell Identifier ListPhilipp Maier5-0/+181
The planned support for true A over IP requires the encoding of the a Cell Identifier List element (see also BSS_MAP_MSG_PAGING). This commt adds encoding/decoding functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I625245dd1dd396fc2bc189e8cd2c444a33042528
2017-04-08gsm0808: Add utils for Encryption InformationPhilipp Maier5-0/+131
The planned support for true A over IP requires the encoding of the an Encryption Information element (see also BSS_MAP_MSG_CIPHER_MODE_CMD). This commt adds encoding/decoding functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I8262050a9d9fd3f17462cfbb046c6e034dccc6fb
2017-04-08gsm0808: Add utils for Channel TypePhilipp Maier5-0/+123
The planned support for true A over IP requires the encoding of the a Channel Type element (see also ASSIGNMENT REQUEST). This commt adds encoding/decoding functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: Id0e2164d84b8cbcc6fe6a090fc7f40a1251421d7
2017-04-08gsm0808: Add AoIP specific elements to gsm0808_create_... functionsPhilipp Maier5-7/+195
the classic A implementation in libosmocore lacks support for AoIP message elements. This patch adds support for AoIP by adding a set of new gsm0808_create_..., which support the missing AoIP message elements Change-Id: I77f866abec1822d19871052f3c647ad782785b34
2017-04-08gsm0808: Add utils for Speech Codec List and Speech CodecPhilipp Maier5-0/+355
The planned support for true A over IP requires the encoding and decoding of a so called "Speech Codec Element" element. This commt adds parsing functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I0e1e2edf47adaa45b22d4b0bcae3640dba7ca200
2017-04-08gsm0808: Add utils for AoIP Transport Layer AddressPhilipp Maier6-1/+220
The planned support for true A over IP requires the encoding and decoding of a so called "AoIP Transport Layer Address" element. This commt adds parsing functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I57933b0a06a3f54ec2a41e6ecb6ced9fbbc89332
2017-04-08add VTY port number for osmo-stpHarald Welte1-0/+1
Change-Id: I978e1b73aa8097a7db6318d78f9f93457e6ce2af
2017-04-04select: Find the highest fd when filling the fd_setsHolger Hans Peter Freyther1-1/+12
Instead of returning maxfd, which is the highest fd ever seen, take the highest we have seen on this iteration. This makes a tiny difference for the osmo-sip-connector and its event loop integration. select.c ignores the return value of this function right now. This was seen while debugging the eventloop integration of the osmo-sip-connector before and after a VTY connection. The fds being polled didn't go down. Change-Id: I1a6d7271273ec08bb511c21b936891bc508843e4
2017-04-03logging: Add log_info_cat for DLSS7/DLSCCP/DLSUA/DLM3UAHarald Welte1-0/+20
In Change-Id I61f452208088dc7097165deecef7c058ebb4bd4e we introduced the #defines but didn't introduce the new log_info_cat information. Change-Id: I218aa4cb1fc7640a75663be29bac672dfa8770f5
2017-04-03logging.h: #define DLSS7, DLSCCP, DLSUA, DLM3UA for libosmo-sigtranHarald Welte1-1/+5
Change-Id: I61f452208088dc7097165deecef7c058ebb4bd4e
2017-03-31jenkins: also test build in separate dirNeels Hofmeyr1-0/+12
To make sure that new patches don't break a build done in another dir than srcdir, make jenkins verify that it still works. Even though 'make distcheck' also tests a build from a separate dir, this does not verify that BUILT_SOURCES are generated properly. If these already exist in the source tree from a previous 'make' issued in the source tree, the BUILT_SOURCES are not regenerated during 'make distcheck'. Hence a separate test run is necessary to ensure stability of new patches. Change-Id: I4b31538c155941fd241bcd33b0d39f2f8491ac1e
2017-03-29Fix LAPD UA message buffer memory leak.Jean-Francois Dionne1-5/+5
The state check in lapd_dl_reset causes some buffers never to be released. Using talloc report LAPD UA message buffers are never released after each call and cause a memory leak. Change-Id: I2799b70623f2ec4dbc725eb213e332e98da02a3e
2017-03-23Add support for PCU version reportMax2-0/+2
Expand 3GPP TS 52.021 §9.4.43 Probable Cause with Osmocom-specific value for PCU version reporting to enable sending it via OML alarms. Change-Id: If57459c0610f2c7b36d599b13087c8deef8bdd9e Related: OS#1614
2017-03-22abis: add message type namesMax3-0/+105
Add human-readable names for Message Types from 3GPP TS 52.021 §9.1 Related: OS#1614 Change-Id: Ide8202b4387351f57ceee34a9eb8c30aef09a663
2017-03-21abis: add attribute namesMax3-0/+73
Add human-readable names for Attributes from 3GPP TS 52.021 §9.4 Change-Id: I861247c01557dac7e484ef6fb9b170f69c8a7f55 Related: OS#1614
2017-03-20build: fix distcheck: include gen scripts in EXTRA_DISTNeels Hofmeyr1-0/+2
Change-Id: Id94d2fe83f080a18a2a686206bd21cf5fafe2fa7
2017-03-20build: fix build dependencies for generated sourcesNeels Hofmeyr2-2/+6
Ensure that a changed conv_gen.py and/or conv_codes_gsm.py result in regeneration of the gsm0503* generated sources. Before this patch, manual cleaning of the generated files was necessary to benefit from a code update. Change-Id: Ib4328662c21280c0ea6aa9391a64ada2c6598704
2017-03-20build: conv_gen.py: ensure parent dirs of written files existNeels Hofmeyr1-3/+9
Previously, this would fail when generating to $builddir if that subtree did not exist yet in $builddir. Change-Id: Ia4fba96dcf74a25cf3e515eb3e4f970e0c3cdd54
2017-03-20build: generate gsm0503.h to builddir, not srcdirNeels Hofmeyr1-1/+1
To ensure that a separate build dir keeps the source dir clean of state, generate the gsm0503.h to the builddir instead of the srcdir. Adjustments for everyone to access the right paths were added in previous patches. Change-Id: Ia773ef5893a2018feb416061aefcf51835df18d2
2017-03-20build: coding/gsm0503: fix build in sep. dir: -I builddirNeels Hofmeyr1-0/+1
To allow building coding/gsm0503_interleaving.c which includes the generated bit*gen.h (via bits.h), add -I to the builddir include path in order to find the generated bit*gen.h headers there. Change-Id: I0d465bc109765b1315d615243bea6af027afa368
2017-03-20osmo-auc-gen: fix --sqn limit on 32bit systems, fixing buildNeels Hofmeyr1-3/+1
osmo-auc-gen on 32bit systems allowed only --sqn up to 32bits width. However, the recently added regression test for osmo-auc-gen includes an ivocation with a 48bit wide --sqn, which now causes the builds to fail on 32bit systems. Fix the --sqn argument parsing for larger integers by using strtoull(). Do away with the intermediate variable 'ul' and place the value directly in the auth data struct. Change-Id: Ifb73b3b3de06576e36076ca573d52327f90a1f77
2017-03-17README.md: Make sure all hyperlinks use <>Harald Welte1-7/+7
Change-Id: Ic81b68aef010e17f6b18232064958e0d4193e192
2017-03-16logging: fail gracefully if log_info() was not calledHarald Welte1-0/+21
The logging code crashes if osmo_log_info is not set, which is typically achieved by calling log_init(). Let's fail with a reasonable assert and error message if the user forgets that. Change-Id: If3007860d2efe6ea9aec27e7d7439d44a7cd19c2
2017-03-16jenkins: add value_string termination checkNeels Hofmeyr1-0/+2
Change-Id: I7fe3678b524d602fc6aa14bc0ed06308df809a3e
2017-03-16Add a README file for some background information about this repoHarald Welte2-1/+81
Let's add some general information about this repository, links to redmine, gerrit, the mailing list, etc. Change-Id: If034c6f551ff9bfaff0b8368fd0963f3147155b9
2017-03-16add gsm48_pdisc_msgtype_name()Neels Hofmeyr3-0/+207
Composing the message type string requires knowing the protocol discriminator. To ease printing the message type, add this function to switch between the defined value_string[]s depending on pdisc. Also publish the message type value_string[]s -- without inline functions to access them because it is anyway more convenient to use gsm48_pdisc_msgtype_name() instead. Since gsm48_pdisc_msgtype_name() is nontrivial, do not add as inline function -- in case the message type is not known, it needs a static string buffer. Change-Id: I0fca8e95ed5c2148b1a7440eff3fc9c7583898df
2017-03-16add gsm48_pdisc_names and gsm48_pdisc_name()Neels Hofmeyr3-0/+24
I often want to log the protocol discriminator in the openbsc debug log. It's more useful to get the name directly instead of looking it up every time. Change-Id: I0f053e2a4360b27ffccda7cf82469fb1b1cbb3ae
2017-03-16contrib: add script to find unterminated value_string arraysNeels Hofmeyr1-0/+33
Unterminated value_string arrays are dangerous since get_value_string() and get_string_value() need to know where the struct ends. If the terminator is missing, they might run through and return arbitrary memory locations. Employ some regexes to find such unterminated value string arrays and return nonzero if any are found. This can be used in our jenkins build jobs to avoid committing unterminated value_string arrays. In fact I've found one in current libosmocore: gsm0808_bssap_names in gsm/gsm0808.c, fixed in a separate patch. Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8
2017-03-16auth_milenage: fix check against too large indNeels Hofmeyr1-1/+1
To ensure that the IND index appended to SEQ does not affect the SEQ, the check should read '>= seq_1', not '>'. Change-Id: Ib1251159eee02aa07fae1b429ffec2e4604bf6a8
2017-03-15fix OSMO_VALUE_STRING macro: don't use OSMO_STRINGIFY()Neels Hofmeyr1-1/+1
To be able to use OSMO_VALUE_STRING() on a #defined constant, don't use OSMO_STRINGIFY(): the second indirection resolves the #define to its value, so for example OSMO_VALUE_STRING(GSM48_PDISC_MM) would resolve to { 0x05, "0x05" } When using '#x' directly, this becomes the desired { 0x05, "GSM48_PDISC_MM" } With enum values as we've used until now, this problem does not appear, because enum values are not resolved by the preprocessor. Keep OSMO_STRINGIFY() because it is used directly in openbsc (composing FSM state names). Change-Id: I91ecfcef61be8cf73d59ea821cc4fd9d2ad5c9c7
2017-03-15ctrl_type_vals: explicitly terminateNeels Hofmeyr3-3/+4
Don't use CTRL_TYPE_UNKNOWN as value_string[] terminator, use an explicit, more obvious { 0, NULL } termination. Set an explicit string for CTRL_TYPE_UNKNOWN. No other value_string[]s to date have such a "hidden" terminator. BTW, a { 0, "string" } item is not a terminator, only { 0, NULL } is, so we can set a string for CTRL_TYPE_UNKNOWN == 0. Also, having a string value for CTRL_TYPE_UNKNOWN is not harmful because all code paths explicitly check for the CTRL_TYPE_*s that are valid. Adjust the test expectation. From the ctrl_type_vals enum, remove the = 0, because it is implicitly 0 anyway. One motivation to press this fixup: I am trying to add a script that checks whether all value_string[]s are terminated to our jenkins jobs, and to find that this one is terminated, it would need to interpret the CTRL_TYPE_UNKNOWN constant, which would make things far more complex. At this point, all of the value_string[]s have an explicit termination, and I would like to enforce this from now on -- for readable code and to not spend more time on the validator. The patch adding ctrl_type_vals (Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28) was accepted by another reviewer before I could reconfirm my -1, so this is a fixup to enable the termination checking script patches. Related: I2bc93ab4781487e7685cfb63091a489cd126b1a8 (adds script to libosmocore) I7fe3678b524d602fc6aa14bc0ed06308df809a3e (uses in jenkins.sh) Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28 (adds ctrl_type_vals) Change-Id: Ia99f37464c7b36b587da2cc78f52c82725f02cbc
2017-03-15milenage_test: cosmetic: verify AUTS in commentsNeels Hofmeyr1-0/+56
In a comment and by code #if'd away, illustrate that the AUTS used in the unit test is accurate. Related: OS#1968 Change-Id: Iefeaaf33570f8e40245fdf9b810390ec61cfc7e0
2017-03-15fix wrong return codeThorsten Alteholz1-1/+1
In case we are a daemon, we do not need to daemonize again. On the other hand everything is fine and we also do not need to bail out with an error. The daemonize template at [1] does the same. [1] http://www.itp.uzh.ch/~dpotter/howto/daemonize Change-Id: Ia4dcf7344bd65934faa3d7d46563f6e0532c232e
2017-03-15linuxlist.h: add llist_first/last_entry macrosNeels Hofmeyr1-0/+30
Copy list_first_entry, list_first_entry_or_null and list_last_entry from current linux kernel's tools/include/linux/list.h and rename to llist_*. Slightly adjust API doc but stay as close to the source as possible. This can replace similar implementations in osmo-bts-octphy's l1_if.c, in openbsc's gtphub.c and in osmo-hlr's gsup_server.c. Change-Id: I4eac5be0c0b2cede04464c4c3a0873102d952453
2017-03-15milenage_test: enhance to verify new SQN incrementsNeels Hofmeyr2-0/+31
After the legacy mode incrementing with ind_bitlen == 0 is through, do another AUTS run with sensible ind_bitlen and ind, and then two more normal vector generations to verify proper SQN increments. Related: OS#1968 Change-Id: Id6947899ff7b1c82b939f969e163e51ce282bce2
2017-03-15osmo_auth_gen_vec: UMTS auth: fix SQN as SEQ || INDNeels Hofmeyr3-1/+74
So far we incremented SQN by 1, which doesn't match the procedures described in 3GPP TS 33.102. An IND (index) denotes a non-significant part of SQN, and the significant SEQ part needs to be incremented. In OsmoHLR we furthermore want to use the "exception" suggested in annex C.3.4, so that each HLR's client has a fixed IND index. In other words, we will not assign IND cyclically, but keep IND unchanged per auth vector consumer. Add 'ind_bitlen' and 'ind' to the osmo_sub_auth_data.u.umts structure and increment SQN accordingly. Add a comment explaining the details. Because 'ind_bitlen' is still passed as zero, the milenage_test does not change its behavior, which is a feature I want to clearly show in this patch. The test will be expanded for the newly implemented SQN scheme in a subsequent patch. Adjust osmo-auc-gen.c to still show the right SQN and SQN.MS -- because it is passing ind_bitlen == 0, osmo-auc-gen can rely on single increments and know SQN.MS is sqn - 1. Note that osmo-auc-gen_test output remains unchanged. Related: OS#1968 Change-Id: Ibc97e1736a797ffcbf8c1f7d41c5c4518f4e41bf
2017-03-15osmo_auth_gen_vec: UMTS auth: store last used SQN, not nextNeels Hofmeyr4-10/+18
Prepare for the implementation of splitting SQN increments in SEQ and an IND part; particularly to clearly show where the changes in auth/milenage_test's expectations originate. Rationale: the source of UMTS auth vectors, for us usually OsmoHLR, typically stores the last used SQN, not the next one to be used. Particularly with the upcoming fix of the SQN scheme, this change is important: the next SQN will depend on which entity asks for it, because each auth consumer may have a particular slot in the IND part of SQN. It does not make sense to store the next SQN, because we will not know which consumer that will be for. The milenage_test has always calculated a tuple for SQN == 34. To account for the increment now happening before calculating a tuple, lower the test_aud->sqn by one to 0x21 == 33, so that it is still calculating for SQN == 34. Because we are no longer incrementing SQN after the tuple is generated, milenage_test's expected output after doing an AUTS resync to 31 changes to the next SQN = 32, the SQN used for the generated tuple. (BTW, a subsequent patch will illustrate AUTS in detail.) osmo-auc-gen now needs to pass the user requested SQN less one, because the SQN will be incremented befor generating the auth vector. Also the SQN remains the same after generating, so SQN output needs less decrementing. Note that the expected output for osmo-auc-gen_test remains unchanged, hence the same input arguments (particularly -s <sqn> and -A <auts>) still produce the same results. Note: osmo-hlr regression tests will require adjustments when this patch is merged, because it must now pass desired_sqn - 1 instead of just desired_sqn. See osmo-hlr change-id I4ec5a578537acb1d9e1ebfe00a72417fc3ca5894 . Related: OS#1968 Change-Id: Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3
2017-03-15osmo-auc-gen: clarify SQN output, prepare for SQN changesNeels Hofmeyr2-16/+18
Upcoming patches will change the way SQN are incremented. Change the SQN related output by osmo-auc-gen so that it also makes sense after these changes, and so that its output is proven to remain unchanged for the same arguments: Always show the SQN used for vector generation when a UMTS vector was generated. Don't show the next SQN, it will not make sense anymore (see later patches). The adjustments of expected output of osmo-auc-gen_test illustrates how the output changes. Related: OS#1968 Change-Id: I35d9c669002ff3e8570e07b444cca34ce57c3b0c
2017-03-15add osmo-auc-gen_testNeels Hofmeyr6-2/+134
Add test for osmo-auc-gen invocations to ensure stability across upcoming SQN increment scheme changes. The test comprises of a shell script that invokes the osmo-auc-gen binary with various milenage parameters, of which the stdout/stderr are verified. More osmo-auc-gen invocations could be added, but my main focus is on the SEQ changes. Instead of manually testing that it still works for each SQN patch, I want this test to do it for me. To make sure that osmo-auc-gen is build before the tests are launched, place 'utils' before 'tests' in the root Makefile.am. Related: OS#1968 Change-Id: Ib4af34201cd2e7d76037bcd31dd89ef18c1a9aec
2017-03-15milenage_test: cosmetic fix: shown value is not SEQ.MSNeels Hofmeyr2-2/+4
In the milenage_test, the console output printed "SEQ.MS = 33", but 33 is a) the SQN, not SEQ; b) the SQN *after* the next auth generation, i.e. SQN.MS would have been 31. While at it also use the proper PRIu64 from inttypes.h to output the sqn value. This prepares for upcoming sparation of SQN incrementing by SEQ and IND, particularly to clearly show where the changes in auth/milenage_test's expectations originate. Related: OS#1968 Change-Id: Ie83201f1362f3d793ada774f3fc5f89cc0b3fbb7
2017-03-15lapd_core: Use 'struct value_string' for LAPD state namesHarald Welte1-28/+33
We don't really use state numbers without bounds check into string tables since March 2010, when value_string became part of libosmocore. It's time to catch up, 7 years later... Change-Id: I1dac7b4cb441a1119cc167112521e8b8aae62e63
2017-03-15Doxygen: exclude osmocom/core/gsm/protocol/*Harald Welte1-1/+1
We don't document the header files that define structs/enums/types that are taken 1:1 from the relevant GSM specifications. So let's avoid having doxygen generate tons of warnings for related undocumented members. Change-Id: I231f78972a015902e4085aa80fcbc04009ae9f13
2017-03-14gsm_04_08: add _NUM_CHREQ_T to enumAlexander Couzens1-0/+1
_NUM_CHREQ_T defines the last element of the enum Change-Id: Id67ba8de89dd6288e449197438e9e1c5d7f5a134
2017-03-14gsm0408: add chreq_type for CHREQ_T_PDCH_ONE_PHASE and CHREQ_T_PDCH_TWO_PHASEAlexander Couzens1-0/+2
The previous version of this commit got reverted to avoid a breakage in openbsc. The problem is openbsc use an array of chreq_type with a manual defined size. This array is using enums as index which breaks if any elements got added into the middle, because the size of the array can't hold elements greater or equal than the size. Change-Id: I6676105507fe4e5627f740dfe4c2770f766ad068