Commit Graph

230 Commits

Author SHA1 Message Date
Harald Welte 584427cd04 lapdm: fix memory leak due to unreachable code
detected by Smatch
2011-07-16 12:21:55 +02:00
Harald Welte f4d45ab021 gsm 08.08: use ANSI function definition with (void) 2011-07-16 12:13:00 +02:00
Harald Welte 79599ba0eb tlv: Make tlv parser arrays 256 entries wide to prevent overflow on 0xff
If we encounter a tag with 0xFF, we overflow our existing tlv_parse
array definitions.

Warning: this breaks ABI
2011-07-16 12:08:28 +02:00
Harald Welte 4876dcf12b gprs_cipher_core: Fix potential buffer overflows
detected by Smatch
2011-07-16 12:03:46 +02:00
Harald Welte 2b32215fc3 telnet_interface: if we don't check for the return value, don't use ret 2011-07-16 12:03:46 +02:00
Harald Welte 9c3cbfb01e telnet_interface: get rid of 'const' warning 2011-07-16 12:03:46 +02:00
Harald Welte 95b2b47b26 get rid of non-ANSI function declarations missing (void)
Detected by Smatch
2011-07-16 12:03:46 +02:00
Harald Welte 7e82020259 timer: use (void) for functions that take no arguments
This has been detected by http://smatch.sourceforge.net/
2011-07-16 12:03:46 +02:00
Holger Hans Peter Freyther 128d9e2343 osmo_hexdump: Fix segfault when input is too long.
In snprinftf the size is a size_t (unsigned) in case we want
to write more than we have available, len_remain will be < 0.

This was spotted while removing hexdump from simtrace and comparing
it to our implementation.

int snprintf(char *str, size_t size, const char *format, ...);
2011-07-15 16:07:23 +02:00
Harald Welte 0c83670a59 GSM 08.08: Fix generation of CIPHER MODE REJECT
The message has a total length of 4 octets, so don't allocate only 3 in the
msgb.
2011-07-12 00:02:27 +02:00
Harald Welte 9b837e6fda gsm 08.08: add value_strings and gsm0808_msg_name() function 2011-07-11 17:45:31 +02:00
Harald Welte da127cbb3e fix against corrupted output in parallel logging
In 8256076722 it was attempted to fix
a bug previously introduced by logging related changes.  The problem
is that a va_list can be corrupted after it has been used once, so
we need to va_copy before each successive use.

And if we copy it, we also need to use the copy, and not the original ;)
2011-07-02 21:51:32 +02:00
Harald Welte 8264e09ca2 lapdm: make sure we flush all queues whenever entering IDLE state
this fixes a memory leak where the final UA would always remain
in memory after a LAPDm entity has been disconnected.
2011-06-29 19:22:47 +02:00
Harald Welte 9e1f0604b5 add msgb_set_talloc_ctx() to set the talloc context for msgb allocations 2011-06-29 18:46:10 +02:00
Harald Welte 7721a77eaf make sure abis_nm <-> osmocom pchan type conversion always works 2011-06-29 18:44:06 +02:00
Harald Welte 7ca604bcd3 LAPDm: Uplink SACCH frames use format B, not format B4 2011-06-29 12:13:51 +02:00
Harald Welte 6420774b3b LAPDm: When Rx DATA from L1, L1 does not know the SAPI
We have to determine the SAPI ourselves inside the LAPDm header.
2011-06-27 23:32:14 +02:00
Harald Welte ce9fec3e89 Fix the generation of the log_categories string + LAPDM
... I should do more testing :(

Conflicts:

	src/logging.c
2011-06-27 23:19:06 +02:00
Harald Welte 9fe1652212 logging: make sure to add the internal categories, as intended 2011-06-27 23:17:35 +02:00
Harald Welte 1f0b8c26f7 add LAPDm code from osmocom-bb into libosmocore 2011-06-27 10:51:37 +02:00
Harald Welte b43bc048eb logging: introduce library-internal logging categories
We do this by using a trick: library-internal log categories use
negative subsystem numbers, which are converted into positive
array indexes at the time of logging.

library-internal log categories need to be knwo at compile-time,
while application-specified categories now are of unlimited number,
as they are dynamically allocated.
2011-06-27 10:40:25 +02:00
Harald Welte ea19c97816 import gsm0502_calc_paging_group() from openbsc 2011-06-26 14:47:16 +02:00
Harald Welte 94df39e905 add some utility functions for paging related calculation (TS 05.02) 2011-06-26 14:40:12 +02:00
Harald Welte 2aee7b14ca add gsm48_number_of_paging_subchannels() function
(from openbsc's rsl_number_of_paging_subchannels)
2011-06-26 14:20:04 +02:00
Harald Welte 32e1f239b3 merge process.[ch] with application.[ch] 2011-06-26 14:14:05 +02:00
Andreas Eversberg 2a68c7c8cd gsm/utils: Adding conversion of "mobile power class" to dBm
Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-06-26 11:41:48 +02:00
Harald Welte 620f7ab350 sysinfo: add EXTENDED MEASUREMENT ORDER / MEASUREMENT INFO to SI types
those two are used in the RSL SACCH FILLING messages and delivered
like SI5 / SI6.
2011-06-25 21:39:18 +02:00
Harald Welte cf7e5dad45 add value_string definitions for RSL message types 2011-06-23 20:44:03 +02:00
Pablo Neira Ayuso 0849c9af2a socket: add OSMO_SOCK_F_[CONNECT|BIND|NON_BLOCK] flags
This extends the socket infrastructure in libosmocore to allow
to create non-blocking sockets.

Basically, it replaces the connect0_bind1 parameter by one
flags parameter.
2011-06-13 19:15:59 +02:00
Harald Welte f9e0746add socket: getaddrinfo(): set AI_PASSIVE if we want to bind
This will tell getaddrinfo() that we want a INADDR_ANY style socket
2011-05-31 17:47:54 +02:00
Sylvain Munaut 3710e462f8 gsmtap_util: Remove msg_free from the wq call back
write_queue already frees the message after the callback is called.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-05-29 19:48:15 +02:00
Sylvain Munaut f2699501bc gsm/sysinfo: Fix rsl2sitype array size
0xff is the maximum value ... so there is 256 elements.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-05-29 15:39:48 +02:00
Harald Welte 8c6be75d4f gsm/sysinfo: don't include netinet/in.h 2011-05-29 15:37:49 +02:00
Harald Welte 08de66dd5e socket: remove unused IPv4 related header includes 2011-05-29 15:26:48 +02:00
Harald Welte 4d3a7b124e socket: Skip ifa's without ifa->ifa_addr
Apparently getifaddrs() returns ifa's without an ifa_addr set.
2011-05-24 21:46:07 +02:00
Harald Welte 11c7193ad8 Import abis_nm_{chcomb4pchan,pchan4chcomb}() from openbsc 2011-05-24 17:22:55 +02:00
Harald Welte b5503136fa Import sytem information related definitions + code from openbsc 2011-05-24 15:01:53 +02:00
Harald Welte ea4b12aa5d abis_nm: remove abis_nm_obj_class_name / abis_nm_adm_state_name
and export the underlying raw value_string arrays instead:
abis_nm_obj_class_names / abis_nm_adm_state_names.

This permits the caller to use get_string_value() as well as
get_value_string().
2011-05-23 20:41:31 +02:00
Harald Welte 61dc63e354 rename abis_nm_adm_name() to abis_nm_adm_state_name() 2011-05-23 20:30:17 +02:00
Harald Welte f7a1bcce0c abis_nm: import definitions and common code on A-bis OML from OpenBSC 2011-05-22 22:45:16 +02:00
Harald Welte 68b1574257 socket: use listen() and SO_REUSEADDR, new osmo_sock_init_ofd() function
osmo_sock_init_ofd() is a wrapper around osmo_sock_init() which will
take care of initializing and registering a 'struct osmo_fd' for the
newly-created socket.
2011-05-22 21:47:29 +02:00
Harald Welte 8265939c5e remove debug printf from socket.c 2011-05-22 20:30:18 +02:00
Harald Welte 13692a6bd3 gsmtap: deal with apps that call gsmtap_send*() with NULL gsmtap_inst 2011-05-22 20:06:11 +02:00
Harald Welte b62b04bbf3 vty: print actual application name rather than always OpenBSC on connect 2011-05-22 19:15:07 +02:00
Harald Welte e476442cf0 GSMTAP/socket code: Check for sys/socket.h and conditionally compile 2011-05-22 12:25:57 +02:00
Harald Welte 33cb71ac91 gsmtap: rework GSMTAP API to be more future-proof
* use write_queue where applicable
* provide functions that work on raw FD and those with osmo_fd
* add support for multiple gsmtap instances (no global variables)
2011-05-22 11:43:23 +02:00
Pablo Neira Ayuso 8256076722 logging: fix corrupted output
Harald reported a problem in the logging:
http://lists.osmocom.org/pipermail/openbsc/2011-May/002896.html

Reverting 81e9636454 seems to
fix the problem. However, that workaround looks ugly.

Holger gives us another clue on what was wrong:
http://lists.osmocom.org/pipermail/openbsc/2011-May/002905.html

While digging in the manpage, I found this:

"The functions vprintf(), vfprintf(), vsprintf(), vsnprintf()
are equivalent to the functions printf(), fprintf(), sprintf(),
snprintf(), respectively, except that they are called with a
va_list instead of a variable number of arguments. These functions
do not call the va_end macro. Consequently, the value of ap is
undefined after the call. The application should call va_end(ap)
itself afterwards."
2011-05-19 08:55:32 +02:00
Holger Hans Peter Freyther ba01fa44fe app: Introduce some routines to help with application startup
The plan is to collect structs and routines for application
setup and remove many copies of the boilerplate code we have
right now. This starts with routines to ignore certain signals
and the stderr init code.

Increment the age of the library because a new interface was added.
2011-05-12 15:43:47 +02:00
Harald Welte 7533705ab1 libosmocore: bump library interface version to '1' for new osmo_ names 2011-05-08 14:35:40 +02:00
Pablo Neira Ayuso 1b4a42c3b1 msgfile: use namespace prefix osmo_* and use more descriptive names
Summary of changes:

s/msg_entry/osmo_config_entry/g
s/msg_entries/osmo_config_list/g
s/msg_entry_parse/osmo_config_list_parse/g

minor glitch included in this patch while I was at it:

-#include "linuxlist.h"
+#include <osmocom/core/linuxlist.h>
2011-05-07 13:14:41 +02:00