Commit Graph

2089 Commits

Author SHA1 Message Date
Harald Welte bc43a62f41 socket: Allow disabling multicast loop on socket creation
This introduces a new flag OSMO_SOCK_F_NO_MCAST_LOOP, which can be used
to disable the looping back of multicast packets transmitted throug this
socket to other local sockets on the machine.

As this looping-back is active by default, a single option to deviate
from the default is deemed sufficient.

Change-Id: I24a5b1ebc3f84d2d5d4734e54df50efaea26490b
2017-07-13 16:53:41 +02:00
Harald Welte c47bbda78c socket: Unify listen() calls and check for erroneous returns
We had three places at the end of socket initialization functions
calling listen().  Let's unify that and fix some bugs:
* close + return error in case of bad listen() result
* don't call listen() on AF_UNIX SOCK_DGRAM sockets

Change-Id: I7e8dbe3c0486bb3b9810b0add1331e93fc106d82
2017-07-13 16:53:41 +02:00
Harald Welte e30d7e6018 socket.c: Add multicast related convenience functions
Change-Id: Id703e7a7a1e065181a4c76c088b8dcc1b7fe15a2
2017-07-13 16:53:37 +02:00
Harald Welte ea91a51ebe select: Add new osmo_fd_close() function
This is a convenience helper that will both close a fd, mark it as
closed and unregister it from the event loop abstraction.  In most
cases, you probably actually want to use it instead of manually closing
and calling osmo_fd_unregister().

Change-Id: Icd0933eed6a24edde7cdcb378e138897ecc5332c
2017-07-13 16:03:37 +02:00
Harald Welte aa3ba46e0f gsmtap: Add value_strings for GSMTAP_TYPE and GSMTAP_CHANNEL
Change-Id: Iaf8a99912f42a56ef785a1642e18238c0b67cf68
2017-07-13 00:03:29 +02:00
Harald Welte 93713a55b9 gsmtap_util: Add chantype_gsmtap2rsl() as inverse of chantype_rsl2gsmtap()
Change-Id: Ie1bc00670887064da0fea61c3dab036c23ceea25
2017-07-13 00:03:27 +02:00
Philipp Maier b808da44ab utils: add function gsm_fn_as_gsmtime_str()
Convert a given frame number into a printable string that displays
the sub components of the frame number.

Change-Id: I8015d2ded3940b01b35df7b72fc35c70c25e9926
2017-07-11 06:11:37 +00:00
Harald Welte 1389e86d11 Add pseudo-random bit sequence generator to libosmcoore
These PRBS sequences are specified in ITU-T O.150.  They are typically
used as test data to be transmitted for BER (bit error rate) testing.

Change-Id: I227b6a6e86a251460ecb816afa9a7439d5fb94d1
2017-07-10 23:42:02 +02:00
Harald Welte 548e371200 gsm_04_08.h: Add struct for 9.1.13b GPRS suspension request
Change-Id: I90113044460a6c511ced14f588876c4280d1cac7
2017-07-10 23:42:02 +02:00
Max ed0eda236c Ignore broken everything log level
* when reading config file (or vty command) ignore "logging level
  .. everything" level
* when writing config file, skip "logging level .. everything" level

In both cases print corresponding deprecation warning. The "everything"
level is not working as advertised for quite some time anyway.

This will allow us to gradually deprecate broken "everything" parameter
giving users enough time to update their config files before removing it
entirely.

Change-Id: I73d5c4f238beb88981ad25caa69f64ad6fb7209f
Related: OS#71
2017-07-10 11:33:14 +02:00
Pau Espin 363130f3a1 gsm_utils: Add osmo_dump_gsmtime
Used by osmo-bts, moved from osmo-bts l1sap.c:dump_gsmtime.

Change-Id: Ib5452e2c20f53006c0f6d197fb055728947125d8
2017-07-10 07:44:11 +00:00
Holger Hans Peter Freyther 5a54dcbc38 gsm_04_08/sgsn: Add another IE for internal usage in the sgsn
The PDP charging characteristics will be returned from the PDP
selection code and be used in the SGSN. It is following the same
approach as the QoS and PDP addr. It is a bit of a pity that we
have to define this in a different project.

Change-Id: I7815c5dfd7b7fb0ea78d816ebfb3abfbf0090afe
2017-07-09 12:46:08 +02:00
Max 15b6d4131c Deprecate wrappers around loglevel_strs
Add deprecation notice for public API use: it shouldn't be used outside
of libosmocore anyway.

Change-Id: I792e30dc44f027fd94e1f65af19fe08bac52b95c
Related: OS#71
2017-07-08 10:39:45 +00:00
Holger Hans Peter Freyther eb55c0d4da gsup: Add encoding/decoding for the pdp charging characteristics
These fields can be in the ISD and the PDP Context inofmration. Store
pointers to this IE in both cases. It needs to be used by the SGSN
when opening a PDP context.

Change-Id: Iedc7c02adcf77ca5c9545119e19c968dfbbb3e6b
2017-07-07 21:54:38 +02:00
Pau Espin 639c408ec1 configure.ac: Add --disable-doxygen flag
This flag, when set, allows to unconditionally disable doxygen
documentation generation, even if doxygen command is found.

Change-Id: Iba1440292116af27b267c7a1fbec1c2336784efe
2017-07-06 10:45:26 +02:00
Neels Hofmeyr 1f82d0aecf osmo_sock_get_name(): clearly indicate local and remote
In a string like

  127.0.0.1:2905<->127.0.0.1:60661

it is hard to tell which is the local part. I'd have expected it on the left,
but it is actually on the right.

To avoid doubt and bypass bikesheds on which side should be what, clearly mark
the two sides as remote and local.

  (r=127.0.0.1:2905<->l=127.0.0.1:60661)

Change-Id: I43dcc6a1906429bd0955fd7fe2eb5b8495b592d8
2017-07-03 17:29:05 +00:00
Max 4aaa8abcab Add missing BSSGP cause values
Add values from 3GPP TS 48.018

Change-Id: Ie39a6c91a46d179392d861805a106743a07c6fb0
2017-07-01 07:40:09 +00:00
Pau Espin 411402b4df l1sap.h: Add ber10k and lqual_cb to ph_tch_param
These fields are required in osmo-bts to do low link quality checks in a
generic way.

Change-Id: If4ae20c22b881e94585dad710f17b9e37f77bf82
2017-06-30 12:06:06 +02:00
Max 590c402e6c BSSGP: handle BVC-RESET-ACK
That's necessary for SGSN to properly handle BSS response to reset
procedure initiated by SGSN (foe example via 'bssgp bvc nsei 101 bvci 0
reset' command).

According to 3GPP TS 48.018 §8.4 "after performing the BVC Reset
procedure all affected BVCs are assumed to be unblocked at the SGSN" so
there's no need in any special handling.

Change-Id: I90dfbd0195a8403406429ccc746299d072445f7b
Related: OS#1638
2017-06-28 12:45:22 +00:00
Max 70861e33d2 deb: fix build by adding libosmogb doc package
Change-Id: I3fe45feaee4033c17e25c4c0552d54a81d9b44f5
Fixes: OS#2340
2017-06-27 13:57:56 +02:00
Neels Hofmeyr 52a881e98a doxygen: gsm: do not exclude include/gsm/protocol/*
Clear out the EXCLUDE tag to not exclude anything.

Tried to add API doc to gsm/protocol/gsm_08_08.h and after a long time found
out why they are not appearing in the API doc.

The original reason to exclude these files was that we were not going to
copy-paste descriptions from the 3GPP specs. Nevertheless, for an API doc
reader it is helpful if all data structures are listed and linked.

Change-Id: Ib569a46f00866bdaa4017f803d85f625ae011316
2017-06-25 18:49:15 +00:00
Vadim Yanitskiy 56ebc6fd37 gitignore all tests using mask
Use the 'tests/*/*_test' mask to ignore all test binaries
instead of specifying each of them.

Change-Id: If85e665d1c2a0b55d23937db5725768cdbf14f58
2017-06-24 16:20:44 +07:00
Pau Espin 0d119ef8b3 contrib: Enable -Werror by default
Change-Id: I1752cad1e34cb6e5f36edf3f538d803eff29d18c
2017-06-23 15:41:49 +02:00
Pau Espin 1349249f88 configure.ac: Fix C(PP)FLAGS for BSD build
If we pass CFLAGS params to configure, then the CFLAGS set inside
configure.ac are not applied and the build fails if -Werror is enabled
because then BUILDING_LIBOSMOCORE is not defined.

Seeing the following output at configure time in FreeBSD build:
./configure: CFLAGS+= -fsanitize=address -fsanitize=undefined: not found
./configure: CPPFLAGS+= -fsanitize=address -fsanitize=undefined: not found
./configure: CFLAGS+= -DBUILDING_LIBOSMOCORE -Wall: not found
./configure: CPPFLAGS+= -DBUILDING_LIBOSMOCORE -Wall: not found

Change-Id: I692bbc66e5343998eec360a02a3a1fe73478c5c6
2017-06-23 15:41:49 +02:00
Pau Espin 56c5b949fa jenkins.sh: Disable sanitize for FreeBSD
Our current build server uses clang-3.4.1 and FreeBSD10.3, and
AddressSanitizer support is not good yet on those versions, triggering
some link issues when it is enabled.

I tested using newer clang 3.7.1 in the same FreeBSD version but another
compiler error related to __builtin_cpu_supports is triggered.

Conclusion: Explicitly disable AddressSanitizer until we move to
FreeBSD11 with clang 3.8. Before this commit, AddressSanitizer was
implicitly disabled due to a shell compatibility issue which is fixed
in next commit in the series, thus we need to explicitly disable it here.

Change-Id: I0db497045a2ebf7877232b28ae1fcf1fd89fb3f3
2017-06-23 15:41:49 +02:00
Pau Espin 8aa85bd31a control_cmd.c: Fix unsigned comparison against < 0
Fixes following warning:
control_cmd.c:294:16: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
        if (cmd->type < 0 || cmd->type == CTRL_TYPE_UNKNOWN) {

Change-Id: I3df8a4f646222337927d9e3cac6d09a8a05cb20c
2017-06-23 15:41:39 +02:00
Pau Espin b3be964d1c abis_nm.c: Fix implicit enumeration type conversion
Fixes following warning message:
abis_nm.c:101:2: warning: implicit conversion from enumeration type 'enum abis_nm_msgtype_bs11' to different enumeration type 'enum abis_nm_msgtype' [-Wenum-conversion]

Change-Id: Icb0ed423febf1ceb6626e256d32011b4118fc527
2017-06-23 12:57:20 +02:00
Pau Espin ea809df904 serial.c: Use pragma message instead of warning
Change-Id: I65b1ef6e4b9ba0bf0c3c2f03311250f31ddb308a
2017-06-23 11:06:37 +02:00
Pau Espin 40e629bd66 configure.ac: Enable -Wall by default
Change-Id: I70f917e05ad46049487710d1752aad2505c96696
2017-06-23 10:21:54 +02:00
Pau Espin 29b7d53239 gsm0411_utils.c: Fix compilation warnings
gsm0411_utils.c:102:2: warning: #warning find a portable way to obtain timezone offset [-Wcpp]
 #warning find a portable way to obtain timezone offset

gsm0411_utils.c: In function 'gsm338_get_sms_alphabet':
gsm0411_utils.c:260:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]
    return 0xffffffff;

Change-Id: I1d6cb31f38721f79e2cf93f9b8e4776f3720aa07
2017-06-23 10:21:54 +02:00
Pau Espin 399a6f09ff Fix warnings: tolower() and similar require uchar
utils.c: In function 'osmo_str2lower':
utils.c:277:3: warning: array subscript has type 'char' [-Wchar-subscripts]
       out[i] = tolower(in[i]);

And according to man:
If c is neither an unsigned char value nor EOF, the behavior of these func‐
tions is undefined.

Change-Id: I3fed2ab6a4efba9f8a21fcf84a5b3a91e8df084f
2017-06-23 10:21:54 +02:00
Pau Espin 4573502a1c Fix compilation warnings: use correct log type for uint32_t
Change-Id: Ic1e3255800999669ca9619bfceb4124c773eff2d
2017-06-23 10:21:54 +02:00
Neels Hofmeyr c977984ecd fix map entry for gsm0808_speech_codec_from_chan_type
Recent commit 884ba0f2bc adds function
gsm0808_chan_type_to_speech_codec() but adds a mismatching name in
libosmogsm.map. openbsc.git's aoip branch can't build with this.

This must have been an on-the-fly rename that wasn't properly tested. Always
test your patches!

Change-Id: I68feb14f7bcb2f62b89f9b2d8c085d6824b493bc
2017-06-23 02:58:07 +02:00
Neels Hofmeyr 9a391e2edf fix map entry and .h declaration for gsm0808_chan_type_to_speech_codec()
Recent commit 3149b0d076 adds function
gsm0808_chan_type_to_speech_codec() but adds a completely mismatching name in
libosmogsm.map, as well as a definition with a typo in the name.

Fix the entry in libosmogsm.map.

Add the missing 'c' in gsm0808_utils.h

Change-Id: I5a621fa5ef6b632eabbe224f3dd383eacaffb695
2017-06-23 02:55:26 +02:00
Neels Hofmeyr 95efc6993f doxygen: config: one enum val per line
In the generated API doc, do not print multiple enum values on the same line,
because this makes the lists pretty much unreadable.

Change-Id: I63d6f42567f532851e19eb8a6c842e418ce666af
2017-06-23 00:18:24 +00:00
Neels Hofmeyr 17518fe393 doxygen: unify use of \file across the board
Considering the various styles and implications found in the sources, edit
scores of files to follow the same API doc guidelines around the doxygen
grouping and the \file tag.

Many files now show a short description in the generated API doc that was so
far only available as C comment.

The guidelines and reasoning behind it is documented at
https://osmocom.org/projects/cellular-infrastructure/wiki/Guidelines_for_API_documentation

In some instances, remove file comments and add to the corresponding group
instead, to be shared among several files (e.g. bitvec).

Change-Id: Ifa70e77e90462b5eb2b0457c70fd25275910c72b
2017-06-23 00:18:23 +00:00
Neels Hofmeyr 33370cb18d doxygen: various fixes in core/timer.h
Move a longish comment to the timer group so that it appears in the API doc.

Un-doxygen some floating comments that were associated with unrelated code
items ('/**' --> '/*').

Add braces to some function names so that the API doc will render as reference
links.

Change-Id: I3ea5b88cbe9cb54702429158bf47e768e04e8fe7
2017-06-23 00:18:23 +00:00
Neels Hofmeyr fc47b03f33 api doc typo fix in core/logging.h
Change-Id: I3f1cd5b10e7beccb61f370d7f8fa2666e56542cf
2017-06-23 00:18:23 +00:00
Neels Hofmeyr 87e4550585 doxygen: enable AUTOBRIEF, drop \brief
Especially for short descriptions, it is annoying to have to type \brief for
every single API doc.

Drop all \brief and enable the AUTOBRIEF feature of doxygen, which always takes
the first sentence of an API doc as the brief description.

Change-Id: I11a8a821b065a128108641a2a63fb5a2b1916e87
2017-06-23 00:18:22 +00:00
Neels Hofmeyr 249fb71a2e doxygen: add missing gb API doc generation
Files in include/osmocom/gprs/ and src/gb/ are not included in any doxygen
generated API docs. Add Doxyfile.gb.in and adjust configure.ac and Makefile.am.

Change-Id: Ieb64f497f55368e396872083237c9ff28da2dd93
2017-06-23 00:18:21 +00:00
Neels Hofmeyr 51816479bc doxygen: include all undocumented items in the API doc
Currently, files that omit the \file directive and all functions, enums,
structs lacking a doxygen style comment are completely missing from the doxygen
API docs.

Set EXTRACT_ALL = YES so that all files and code items are at least listed in
the doxygen API.

Change-Id: I39f558ec0a33a61a1fcec0554f53c8e7668733de
2017-06-23 00:18:21 +00:00
Neels Hofmeyr 6a494f1ada doxygen: drop INPUT gsm/protocol, already part of gsm/
include/osmocom/gsm/protocol is also implicitly included in its parent dir
because of the recursive rule. Naming it again makes doxygen use it twice. It
doesn't seem to be harmful, but not needed either.

Change-Id: I5dc22ca65740a88540dacc61c0742fede172de9c
2017-06-23 00:18:21 +00:00
Philipp Maier 452a6bb347 comments: gsm0808_utils: mention various 3GPP specs
Tweaked-by: nhofmeyr
Change-Id: I990dfe9eeaf96f377484b828143935240a937226
2017-06-23 00:37:47 +02:00
Philipp Maier 17778bda23 gsm0808: fix length check of the element decoder functions
The length check of the decoder functions is not entirely
correct. The check also checks for values below zero,
which does not make sense, since the length is encoded
as uint8_t.

For some elements a minimum length is known (in most cases
this is 1), so checking for zero is sufficient but in some
cases (e.g. channel type) the spec mentions a minimum and
maximum length. This is now also reflected in the code.

Tweaked-by: nhofmeyr
Change-Id: I78bc887f68d1963d28c6fcd631ac20ccd893d6d6
2017-06-23 00:30:01 +02:00
Pau Espin 00f4ef7262 pseudotalloc: Add simplistic implementation of talloc_asprintf
fsm.c uses this function. When compiled with --enable-embedded, it
triggers a warning:

fsm.c: In function 'osmo_fsm_inst_alloc':
fsm.c:213:4: warning: implicit declaration of function 'talloc_asprintf' [-Wimplicit-function-declaration]
    fi->name = talloc_asprintf(fi, "%s(%s)", fsm->name, id);

Change-Id: I61cd83d4c8570af1e452c945ac6f194baf7e6ac4
2017-06-22 18:14:18 +00:00
Pau Espin ffa41ca665 osmo-sim-test.c: Remove unused functions
Change-Id: I3060cfee8ece86c4c89a65f93c9f5424df0c410b
2017-06-22 18:14:18 +00:00
Pau Espin 4f8857e50a fsm.c: Fix compilation warning: Use PRIu32 for uint32_t
Change-Id: I4c441b20b250c34656f1e8330d6bb4b1ce2b8423
2017-06-22 18:14:18 +00:00
Pau Espin 648f87883a timer_gettimeofday.c: Fix implicit use of timeradd
timer_gettimeofday.c: In function 'osmo_gettimeofday_override_add':
timer_gettimeofday.c:54:2: error: implicit declaration of function 'timeradd' [-Werror=implicit-function-declaration]
  timeradd(&osmo_gettimeofday_override_time, &val,
  ^

Change-Id: Iced451be255cfde8a6cf38380bef71ef29673994
2017-06-22 18:14:18 +00:00
Pau Espin fc1911c0f4 sercomm_test.c: return correctly in main
Change-Id: I57fd3e1bf74ec24dec692710359a1ce00ecde75a
2017-06-22 18:14:17 +00:00
Philipp Maier 4703fd215f cosmetic: remove API documentation strings in header file
Typically we don't place comments with the function declarations
in .h files. Not sure why this file has comments for each. The
API doc belongs in the .c file as proper doxygen comments,
and shouldn't be duplicated in the .h file.

In this particular case, doxygen comments are added in the
corresponding c file recently.

Change-Id: I5c4cb55be5ec59a6945b1720b875c5987f1cfaad
2017-06-22 17:08:16 +00:00