| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
Add function which adds specified number of bits from each element of
array to the bit vector prefixing each addition with one and finishing
entire sequence with adding 0. This is very common patter for various
repetitive data structures described with CSN.1 in 3GPP standards.
Corresponding test vectors and doxygen headers are added too.
|
|
|
|
|
|
|
|
|
|
| |
For 3G, I need a BCD composer/parser similar to gsm48_generate_lai()/
gsm48_decode_lai(). Those functions also handle a trivial extra
member (lac) which I don't need in this way for 3G.
So create new functions to take on the MCC+MNC BCD handling and call those
from gsm48_generate_lai() and gsm48_decode_lai(). In this way, the 3G code
in openbsc can use only the BCD functionality without code duplication.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add inline functions for both release <= 98 and release >= 99 as well as a
default define. Use the release 98 by default since the current code base uses
the r98 bitmasks.
These inline functions relieve callers of the decision on masking bits of the
protocol discriminator and message type octets.
Also add a define for the protocol discriminator extension to one octet length
(GSM48_PDISC_EXTEND).
Apply new pdisc function in gsm0480.c.
[hfreyther: Make the hdr param const]
|
| |
|
|
|
|
| |
they return an osim_file_desc, and not an osim_file, so fix the naming
|
|
|
|
|
| |
We don't always want to look-up by name, but the latter is the only
implemented 'find' function so far. Let's change that.
|
|
|
|
|
| |
The variable is not used anymore as the decision is done in the
newly added check_log_to_target method.
|
|
|
|
|
|
| |
There doesn't seem to be a reason not to check the filter. Update
and extend the test. Currently the filter function will be called
once for the log check and once for the output of it.
|
|
|
|
|
|
| |
Extract the mapping of the subsystem number and the checking for
the loglevel to a inline method that is shared between the new
and old.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit adds this predicate function which can be used to
avoid the execution of code if a certain log level is not enabled.
The function will only return 0 (false), if it is sure that a logging
call for the same facility and level will not produce any output.
This safety criterion shall ensure, that no logging output is lost
due to the use of this predicate as a guard. On the other hand, even
if the predicate returns != 0 (true), no logging output might get
generated by a similar logging command.
Note that the current implementation is not focussed on performance,
which could be improved by using a lookup table instead of iterating
through every target.
Sponsored-by: On-Waves ehf
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This may seem like overkill for a mere const char * config item, but it makes
the Control interface VTY commands reusable in any main() scope (inspired by
libosmo-abis' VTY config).
Add API functions ctrl_vty_init() and ctrl_vty_get_bind_addr(), in new files
src/ctrl/control_vty.c and include/osmocom/ctrl/control_vty.h, compiled and/or
installed dependent on ENABLE_VTY.
Using these functions allows configuring a static const char* with the VTY
commands
ctrl
bind A.B.C.D
which callers shall subsequently use to bind the Control interface to a
specific local interface address, by passing the return value of
ctrl_vty_get_bind_addr() to control_interface_setup().
Add CTRL_NODE to enum node_type, "eating" RESERVED4_NODE to heed that comment
on avoiding ABI changes.
|
|
|
|
|
|
| |
Make the ctrl interface bind address configurable, so that it may be made
available on other addresses than 127.0.0.1. The specific aim is to allow
running multiple osmo-nitbs alongside each other (commits in openbsc follow).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add VTY command
line vty
bind A.B.C.D
The command merely stores the configured IP-address, which can then be used by
the calling main program to set the telnet port of the VTY line. (Commits in
openbsc and osmo-iuh will follow up on this.)
Add function vty_get_bind_addr() to publish the address in the vty.h API.
Add static vty_bind_addr to store.
For allocation/freeing reasons, a NULL address defaults to 127.0.0.1.
BTW, I decided against allowing keywords 'any' and 'localhost' in place of an
actual IP address to make sure a written config is always identical to the
parsed config.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This function originates from openbsc/src/gprs but is just specific
to BSSGP/Gb on the same level like bssgp_msgb_alloc.
This commit puts the former gprs_msgb_copy function beside
bssgp_msgb_alloc.
Renamed function:
gprs_msgb_copy -> bssgp_msgb_copy
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
| |
int << 31 does not seem to be defined, let's try to make it an
unsigned variable and see if that is pleasing the system.
Fixes:
bitvec.c:219:15: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add bit map encoder and decoder functions: decoder is fully functional
while encoder is good enough for testing - no backtracking to find
the best possible compression is implemented. If somebody is willing to
implement MS side of EDGE than this has to be expanded.
Add corresponding tests.
N. B: the encoding is implemented according to ETSI TS 44.060 which is
slightly different from T4 used for fax according to CCITT G31D (RFC 804).
Ticket: OW#2407
Sponsored-by: On-Waves ehf
Signed-off-by: Max <msuraev@sysmocom.de>
|
|
|
|
|
| |
Add bit filling, shifting and other functions necessary for bit
compression implementation. Add corresponding tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
bitvec_read_field/bitvec_write_field in the PCU used a C++ reference
and when porting to C it was decided to pass the parameter by value
and this lost the "back propagation" of the new index. Change the
parameter to be an in/out parameter and this way do not have a silent
semantic break in the osmo-pcu (where we copy the reference in csn.1
by value) and have a true compile failure.
Add Max's simple test for bitvec_unhex function leaving the checking
of bitvec_read_field and the side effect in the datastructure about
the number of bits still open.
|
| |
|
|
|
|
|
|
| |
bitvec.c: In function 'bitvec_unhex':
bitvec.c:389: error: 'for' loop initial declarations are only allowed in C99 mode
bitvec.c:389: note: use option -std=c99 or -std=gnu99 to compile your code
|
|
|
|
|
|
| |
Allocation, pack/unpack, field access and helper routines used
extensively by Osmo-PCU. Whenever memory allocation happens, alocator
context is passed explicitly by caller.
|
|
|
|
|
|
|
|
| |
Include the headers mentioned by the manpage
ipa.c:346:9: warning: implicit declaration of function 'recv' is invalid in C99
[-Wimplicit-function-declaration]
ret = recv(fd, msg->tail, needed, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
'\0' gets translated to zero but the argument to vector_set is
a pointer and it gets converted to a pointer.
vty.c:985:21: warning: expression which evaluates to zero treated as a null pointer constant of type
'void *' [-Wnon-literal-null-conversion]
vector_set(vline, '\0');
^~~~
vty.c:1095:21: warning: expression which evaluates to zero treated as a null pointer constant of type
'void *' [-Wnon-literal-null-conversion]
vector_set(vline, '\0');
^~~~
vty.c:1097:21: warning: expression which evaluates to zero treated as a null pointer constant of type
'void *' [-Wnon-literal-null-conversion]
vector_set(vline, '\0');
^~~~
|
|
|
|
|
|
|
| |
Use unsigned int for the length throughout the interface. We will
never have a a negative length.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The undefined behavior sanitizer found the 32bit load from an
unaligned memory address. This will cause an exception on ARMv5te
and a manual fix-up.
[hfreyther: On armv6, x86 the usage of memcpy leads to shorter
amount of instructions but on armv5te the memcpy is not expanded
leading to a branch. Use the version of max until we have the time
to benchmark it]
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
| |
This code dealing with bit shifting sometimes gets 1 byte beyond array
boundary while calculating index. This is now explicitly checked and prevented.
Ticket: OW#1198
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new functions bitvec_get_bytes and bitvec_set_bytes copy
byte sequences from bitvecs to uint8_t arrays and vice versa.
While the bytes in the bitvecs do not need to be aligned, the uint8_t
arrays always are. In case the bytes in the bitvec are aligned, the
implementation uses memcpy.
Note that the implementation like the other existing functions assume
MSB first encoding.
[hfreyther: Squash the comment fix into this commit as well]
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
| |
These functions are currently part of openbsc but also needed by
other projects.
The function have been renamed as follows:
gprs_apn_to_str -> osmo_apn_to_str
gprs_str_to_apn -> osmo_apn_from_str
Sponsored-by: On-Waves ehf
|
|
|
|
|
| |
86ec311896dd5d4 adds compiler warnings on 64bit. The build is clean otherwise,
so let's keep it that way.
|
| |
|
|
|
|
|
|
|
| |
This patch makes msgb_hexdump accept out of range lXh pointers and
shows info about them instead of aborting the dump entirely.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These functions originate from openbsc/src/gprs but are generic
msgb helper functions.
msgb_copy: This function allocates a new msgb, copies the data
buffer of msg, and adjusts the pointers (incl. l1h-l4h)
accordingly.
msgb_resize_area:
This resizes a sub area of the msgb data and adjusts the
pointers (incl. l1h-l4h) accordingly.
Sponsored-by: On-Waves ehf
|
| |
|
|
|
|
|
|
| |
The primitives for SUSPEND, RESUME and RECONNECT are only permitted on
the MS side of the LAPDm link, not on the BTS side. So we should check
for this and reject, accordingly.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently the state is assumed to remain the same while the reset
procedure is active. While this works correctly in general, a single
unexpected BLOCK_ACK or UNBLOCK_ACK can change the state but will not
stop the reset procedure. The leads to repeated RESET messages, where
the corresponding RESET_ACK is ignored. This is a stable state which
can only be left by manual intervention or by reception of a RESET
message from the peer.
This commit changes the RESET timeout handler to set the state to
BLOCKED/RESET when sending the new NS RESET message.
Note that this should ensure a clean restart even if the state has been
screwed up. It does not fix the handling of BLOCK_ACK or UNBLOCK_ACK
in abnormal cases.
Addresses:
gprs_ns.c:349 NSEI=8895 Tx NS RESET (NSVCI=8895, cause=O&M intervention)
gprs_ns.c:878 NSVCI=8895 Rx NS RESET ACK (NSEI=8895, NSVCI=8895)
gprs_ns.c:887 NS RESET ACK Discarding unexpected message for NS-VCI 8895 from SGSN NSEI=8895
Ticket: OW#1551
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
| |
stats_statsd.c: In function ‘osmo_stats_reporter_statsd_send_item’:
stats_statsd.c:154:15: warning: initialization discards ‘const’ qualifier from pointer target type
char *unit = desc->unit;
^
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The stat item group is not removed by gprs_nsvc_delete which will
corrupt the group list.
Addresses:
valgrind tests/gbproxy/gbproxy_test
[...]
==4541== Invalid write of size 4
==4541== at 0x4071ACA: __llist_add (linuxlist.h:65)
==4541== by 0x4071ACA: llist_add (linuxlist.h:81)
==4541== by 0x4071ACA: osmo_stat_item_group_alloc
(stat_item.c:112)
==4541== by 0x407EDFD: gprs_nsvc_create (gprs_ns.c:244)
==4541== by 0x408109D: gprs_ns_instantiate (gprs_ns.c:1388)
==4541== by 0x804CFD3: test_gbproxy_ident_changes
(gbproxy_test.c:1501)
==4541== by 0x805FBD3: main (gbproxy_test.c:5803)
Sponsored-by: On-Waves ehf
|
| |
|
|
|
|
|
|
|
| |
This symbol is globally visible and therefore should have an OSMO
prefix like the other identifiers exported by stat_item.h.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
| |
Add OSMO_STAT_ITEM_NO_UNIT for stat items without an unit. The
statsd reporter uses gauges ("g") to report them.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
| |
Shipping our own private copy of talloc was a good idea in 2008,
when it was not readily available on most target platforms. Today,
the situation is quite different, as it is a standard library on
major Linux distributions.
|
|
|
|
|
|
|
|
|
|
| |
Currently the counters are scanned twice, once for interval
computation and once for reporting.
This adds a reminder to move the interval computation code to a
special stats reporter which just shall update the fields.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
| |
Due to prior refactoring, the functions do not have an sensible order
in the file. This commit tries to improve that a little bit.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
| |
This commit moves the stats specific code parts into stats_statsd.c
while keeping the generic parts in stats.c. The code in stats.c no
longer contains references to statsd symbols.
Note that the VTY code still needs to know about every stats reporter
backend.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
| |
CC stat_item.lo
stat_item.c: In function 'osmo_stat_item_group_alloc': stat_item.c:84:28: warning: cast to pointer from integer of different
size [-Wint-to-pointer-cast]
group->items[item_idx] = (void *)items_size;
^
stat_item.c:98:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
((uint8_t *)items + (int)group->items[item_idx]);
^
|
|
|
|
|
| |
This was pointed out by Jaroslav Skarvada during fedora packaging,
and he has a valid point...
|
|
|
|
| |
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently the global stat item index is being advanced in
osmo_stat_item_group_handler, so that the second and further groups
in the list will skip new item values.
This commit moves the call to osmo_stat_item_discard_all into
osmo_stats_report to a place where all groups have been processed
already.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently the reporter loop is aborted, if the event would be ignored
due to an insufficient max_level. Thus the reporters that happen to
be stored afterwards would be skipped even if their level were
sufficient.
This commit replaces the conditional 'return' statement by a
considtional 'continue' statement to ensure the processing of the
list tail.
Sponsored-by: On-Waves ehf
|