Commit Graph

1008 Commits

Author SHA1 Message Date
Sylvain Munaut 01e0604637 core/bits: Prevent osmo_revbytebits_buf stack trashing
The second loop in osmo_revbytebits_buf() in src/bits.c grabs
4 bytes each iteration, which can easily go past the supplied
input in some cases.

Compiled with -fstack-protector , I get a "stack smashing detected"
in the bits test.

From: Nils O. Selåsdal <noselasd@fiane.dyndns.org>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-01-03 09:37:16 +01:00
Daniel Willmann 13bb169d71 tests: Don't delete atconfig in clean
This file is created in ./configure so we shouldn't remove it with make.
Otherwise ./configure && make clean && make check fails with:

make[3]: *** No rule to make target `atconfig', needed by `check-local'.
Stop.
2012-12-26 10:56:14 +01:00
Holger Hans Peter Freyther af723a4ed4 lapd: Fix compiler warnings in the lapd code
lapd_test.c: In function ‘ms_to_bts_l1_cb’:
lapd_test.c:192:6: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable]
lapd_test.c:199:1: warning: no return statement in function returning non-void [-Wreturn-type]
lapd_test.c: In function ‘main’:
lapd_test.c:355:2: warning: implicit declaration of function ‘osmo_init_logging’ [-Wimplicit-function-declaration]
2012-12-26 10:51:00 +01:00
Daniel Willmann e523392c2c lapd: Check in rslms_rx_rll() if lapdm context was initialized earlier
This was found while implementing handover on a sysmobts. When we
receive a channel release request for a channel that was never really
activated (set_lapdm_context() was not called) we segfault in
lapd_recv_dlsap().

We now return early with -EINVAL in rslms_rx_rll() if we receive a
message that assumes set_lapdm_context() was already called.

These are:
* RSL_MT_UNIT_DATA_REQ
* RSL_MT_DATA_REQ
* RSL_MT_SUSP_REQ
* RSL_MT_REL_REQ

A test case was added to trigger the issue.
2012-12-26 10:48:01 +01:00
Andreas Eversberg 0167596c2b Add tlvp_val16_unal() / tlvp_val32_unal() to align 16 and 32 bit values
This is required for CPUs < armv6, to access 16 and 32 values at right
memory locations.
2012-12-18 23:47:45 +01:00
Sylvain Munaut 31659f72cb core: Fix missing include in msgfile.c for getline
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-12-12 00:00:43 +01:00
Sylvain Munaut 5689a3b744 build: Don't use the deprecated INCLUDES in the various Makefile.am
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-12-11 23:59:31 +01:00
Sylvain Munaut c44310e351 utils/osmo-arfcn: Implement option to get ARFCN from frequency
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-12-11 23:45:03 +01:00
Sylvain Munaut 5572031749 gsm: Add method to find ARFCN based on frequency
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-12-11 23:44:41 +01:00
Harald Welte 6e264ae3cd osmo-arfcn: add support for PCS band 2012-12-06 20:58:35 +01:00
Holger Hans Peter Freyther 0357e9b375 rsl: Add the 9.3.20 release mode enum to be used in OpenBSC 2012-12-06 11:58:33 +01:00
Holger Hans Peter Freyther 68f9447744 sms: Print 'network' or 'mobile' when creating the SMC/SMR 2012-12-06 11:58:33 +01:00
Sylvain Munaut c1e9be95c2 gsm/a5: Return -ENOTSUP if the selected cipher is not supported
Extracted from a patch by Max Suraev Max.Suraev@fairwaves.ru>

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-12-06 08:23:02 +01:00
Holger Hans Peter Freyther 8c01231681 lapd: Use LOGL_ERROR for messgaes that are wrong in the given context
Log message that are either too big or have the C/R bit set as error.
2012-11-26 16:52:23 +01:00
Holger Hans Peter Freyther 579fb09eac misc: Use static const struct for LAPD and Abis 2012-11-22 10:54:23 +01:00
Holger Hans Peter Freyther 9473c5d75d sms: Mark the state dispatch table as static const
GCC 4.7.2 was already smart enough to see that the table is const
so there is no change in the generated assembly code. For some reason
the dispatch is still going through one relocation.
2012-11-22 10:50:52 +01:00
Holger Hans Peter Freyther 1c4c373b9f sms: Fix typos in the comments and log messages. 2012-11-22 00:41:50 +01:00
Holger Hans Peter Freyther bcf125c524 smr: Introduce an id and prefix all log messages with SMR(ID)
When OpenBSC is handling more than one message at a time it is difficult
to see which log message belongs to which SMR instance. Introduce a
uint64_t id that can be set to the row_id/message_id and prefix all
log messages with SMR(ID).

This change is ABI and API incompatible with previous versions of
libosmogsm.
2012-11-22 00:41:50 +01:00
Holger Hans Peter Freyther 33e8a87cd7 smc: Introduce an id and prefix all log messages with SMC(ID)
When OpenBSC is handling more than one message at a time it is difficult
to see which log message belongs to which SMC. Introduce a uint64_t id
that can be set to the row_id/message_id and prefix all log messages
with SMC(ID).

This change is ABI and API incompatible with previous versions of
libosmogsm.

Example:
SMC(100) instance created
SMC(100) message MNSMS-EST-REQ received in state IDLE
2012-11-22 00:41:49 +01:00
Harald Welte 6643386f3f actually install osmo-arfcn and osmo-auc-gen as part of 'make install' 2012-11-16 21:36:17 +01:00
Steve Markgraf 5905d5be60 msgb: fix msgb_pull_u*()
msgb_pull returns a pointer to the new begin of the
buffer, unlike msgb_get(), where those functions
were originally taken from.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
2012-11-14 20:14:33 +01:00
Holger Hans Peter Freyther 866fc919ac smc: Fix a typo in the smc code 2012-11-14 17:20:33 +01:00
Holger Hans Peter Freyther d38e0ef82a smc: Make it possible to include gsm0411_smc.h as first header file
The code embeds the timer so one needs to include the header file.
2012-11-14 17:20:33 +01:00
Holger Hans Peter Freyther 09161595bd smc: Print the current state of the SMS
When the connection may not released print the name of the current
state to ease with debugging and verification that this is not a
valid state transition.
2012-11-11 10:35:33 +01:00
Holger Hans Peter Freyther e2a7c93da3 sms: Remove the commented out code that was the default in OpenBSC
This code got copied from OpenBSC and we used the network specific
and private numbering plan. Remove it as it can be easily set.
2012-11-11 09:45:40 +01:00
Holger Hans Peter Freyther 7ae3ac8b42 sms: Reduce the logging level to debug
<001c> gsm0411_smr.c:175 TX: MNSMS-REL-REQ adds little value so
I am reducing it to a debug statement.
2012-11-11 09:35:23 +01:00
Holger Hans Peter Freyther 9e6789da18 debian: Create a git-buildpackage based 0.5.3 2012-11-06 14:01:54 +01:00
Holger Hans Peter Freyther b6cb37fec7 debian: Testing was disabled because of a funny x86 compiler issue caused by us
The bits test will fail on Debian Stable for x86. Somehow the load
of a static const array is ending up accessing random memory. This
only happens when not using any -OX options and this is caused by
us. Do not override the default debian CFLAGS.. and the tests will
pass on debian stable.
2012-11-05 21:28:03 +01:00
Andreas Eversberg d430ef443a GSM48: Avoid unaligned access in gsm48_construct_ra
This avoids an unaligned access on platforms that don't support them,
such as ARMv4/ARMv5.
2012-11-05 12:30:09 +01:00
Tobias Engel 6ad25f290e Add "extern" keywords
Without the "extern" keyword the variables in this header file will be
seen as empty definitions when compiled on OSX.
2012-10-27 10:03:12 +02:00
Tobias Engel 597460fd97 Do not use --version-script linker flag on OSX
Add a check to not use --version-script linker flag if compiled on OSX
since it doesn't exist there
2012-10-27 10:03:12 +02:00
Tobias Engel 2db368ee8d Define struct iphdr for OSX
Use FreeBSD struct iphdr definition for OSX also. From the commentary in
the source file:
On BSD the IPv4 struct is called struct ip and instead of iXX
the members are called ip_XX. One could change this code to use
struct ip but that would require to define _BSD_SOURCE and that
might have other complications. Instead make sure struct iphdr
is present on FreeBSD.
2012-10-27 10:03:11 +02:00
Harald Welte 8ec7f901bb logging: Make sure to install standard "end" command in VTY node
When you are in the config-log VTY node, you expect "end" to work
like in any other sub-node of config.
2012-10-22 19:43:26 +02:00
Harald Welte 2da47f1d6b logging: Don't forget to save "logging filter all 1"
Prior to this fix, a persistent file or syslog log configuration
didn't work across an application re-start, as the
"logging filter all 1" was never saved and thus no messages were
logged.
2012-10-22 19:31:54 +02:00
Andreas Eversberg b8d18f32a1 Doc: Adding new parameter descriptions in gprs_bssgp_bss.c 2012-09-30 16:59:33 +02:00
Andreas Eversberg f44ed8cf92 Fix: Correcting bssgp_tx_fc_bvc, bssgp_tx_fc_ms, bssgp_tx_ul_ud 2012-09-30 14:38:20 +02:00
Andreas Eversberg aaccdac55d Fix: gprs_ns_destroy() now frees all NSVCs and its timers
Freeing memory of registered timers and file descriptors cause corrupt
lists.
2012-09-29 20:36:31 +02:00
Holger Hans Peter Freyther 779d2f42a4 logging: Modify the testcase to excercise Nico's fix 2012-09-27 16:31:29 +02:00
Holger Hans Peter Freyther 4b54cab476 logging: Move the logging test from OpenBSC into libosmocore
Add a testcase for the logging facility. The test is coming from
the OpenBSC code.
2012-09-27 16:29:54 +02:00
Nico Golde 0262d3ff9f logging.c: Do not crash on empty category name
log_parse_category_mask(), skip log category name right away if
name is NULL to prevent passing a NULL ptr to strlen.
2012-09-27 13:45:03 +02:00
Nico Golde 5b67a04a34 gsm_utils.c: in 7bit decoding, first check if the last character was an extension character before doing anything else 2012-09-21 09:25:08 +02:00
Harald Welte be55a8b814 gsm_utils: Fix up coding style in previous patch
'if' is not a function, so we have space before parenthesis.
2012-09-20 10:00:25 +02:00
Nico Golde bb67be9bd2 build: fix directory creation for core headers, introduced by d471a219. 2012-09-20 09:58:45 +02:00
Nico Golde c56a56dc0a gsm_utils.c: cleanup + do not use dynamic memory when decoding 7bit messages 2012-09-20 09:58:39 +02:00
Max db75331e06 Fix build with dpkg-buildpackage. 2012-09-17 08:36:46 +02:00
Holger Hans Peter Freyther eacba189b1 git: Ignore generated tests executables 2012-09-11 12:28:09 +02:00
Holger Hans Peter Freyther 7c7d39adac vty: Include osmocom/core/utils.h for the value_string struct 2012-09-11 12:27:03 +02:00
Holger Hans Peter Freyther c302eca2c6 tests: Make the gb test work with srcdir != builddir
* Disable color and printing the filename of the stderr log target,
  update the results
* Add the .ok, .err and .sh files to the extra_dist
* Execute the shell script from the source directory
2012-09-11 11:49:35 +02:00
Holger Hans Peter Freyther db1533651f logging: Introduce a print_filename flag for the logtarget
Introduce a print_filename attribute for each logtarget. Initialize it
with 1 to be backward compatible with earlier versions. The bit is taken
from an existint bitfield. There were at least six bits left of the byte.
2012-09-11 11:24:51 +02:00
Holger Hans Peter Freyther 314c010733 vty: Address compiler warning about the const qualifier
vty.c: In function 'vty_out_newline':
vty.c:294:12: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]
2012-09-11 10:40:07 +02:00