Commit Graph

580 Commits

Author SHA1 Message Date
Jan Engelhardt 9ffeb9756a build: remove unused all_includes and use AM_CPPFLAGS
Preprocessor flags are best placed in AM_CPPFLAGS. Remove use of the
unused all_includes variable, which is never set.
2014-10-03 08:48:31 +02:00
Holger Hans Peter Freyther 96af78650d misc: Look into the build directory for generated files
the bits/crc files are not inside the sourcedirectory but will end
in the build directory. Go and look there as well. This somehow
doesn't fail with make distcheck but when building for Yocto Dizzy.
2014-09-25 18:18:49 +02:00
Jacob Erlbeck a39e2deff8 gprs: Set bssgph field in bssgp_msgb_alloc()
Currently the bssgph field is not set when using the bssgp_tx_*
functions. This hinders unit testing of generated messages.

This patch initializes the bssgph field directly after allocation a
new bssgp msgb in bssgp_msgb_alloc() so that it is set by default.

Sponsored-by: On-Waves ehf
2014-09-23 16:30:49 +02:00
Jacob Erlbeck b83b838bd1 gprs: Fix bssgp_rcvmsg to handle signalling msgs with BVCI IE
Currently BSSGP messages with an NS BVCI of 0 (signalling) are
discarded if they aren't RESET messages. Thus valid signalling
messages (e.g. BLOCK) are not handled properly, because the BVCI IE
is ignored if it present. Instead a STATUS message referring to BVCI
0 (instead of the BVCI used in the BLOCK message) is returned.

This patch changes the implementation to use the BVCI contained in
the BVCI IE if that is present in a signalling message.

It fixes BSSGP BLOCK/UNBLOCK for the osmo-sgsn.

Note that signalling messages without an BVCI IE (e.g.
SUSPEND/RESUME) are still rejected.

Ticket: OW#1205
Sponsored-by: On-Waves ehf
2014-09-23 16:29:34 +02:00
Jacob Erlbeck a7165778c6 gprs: Fix and check BVCI in BSSGP STATUS messages
Currently the BVCI is not set in all invocations to bssgp_tx_status()
when the cause is UNKNOWN_BVCI.

This patch adds the argument where it is missing.

It also adds a check for compliance (GSM 08.18, 10.4.14.1) to
bssgp_tx_status() to emit errors when the following requirement is
not fulfilled: The BVCI must be included if (and only if) the cause
is either "BVCI blocked" or "BVCI unknown".

Sponsored-by: On-Waves ehf
2014-09-23 16:27:44 +02:00
Harald Welte de883e7f6c Fix copyright header in gan.c
When I wrote the gan.c, I used the wrong copyright/license header
(AGPLv3+ intead of GPLv2+).  This was a mistake and is fixed hereby.
2014-09-11 13:20:33 +08:00
Harald Welte 468b64331a add missing copyright statements to source code files
Some source code files didn't have the usual copyright and licence
statement at their top.  I'm adding them baesed on information in the
commitlog.
2014-09-11 13:18:08 +08:00
Harald Welte fb84f325b8 logging: Add ability to save/print current log filters
This enables the persistent configuration of let's say
'log filter imsi 012345678' for a given log file in the config
file.
2014-08-25 10:09:42 +02:00
Harald Welte 39c9e7b471 libctrl: Add support for 'deferred control commands'
Sometimes a control interface command cannot be processed
and responded immediately, but we need to process it asynchronously.

In order to support this, we introduce the 'ctrl_cmd_def', which
represents such a deferred command.  It is created by the service
implementing the command using ctrl_cmd_def_make(), and a response is
later sent using ctrl_cmd_def_send().

ctrl_cmd_def_is_zombie() must be called to handle the case where
the control connection has disconnected/died between receiving the
command and sending the response.
2014-08-24 16:52:54 +02:00
Holger Hans Peter Freyther 5e21131c8d ctrl: Attempt fix the build on FreeBSD and add include file
IPPROTO_TCP is defined in netinet/in.h. Include it and hope the
build is fixed for FreeBSD.
2014-08-21 16:33:32 +02:00
Harald Welte 336915aa0a prepare for 0.7.0 release 2014-08-21 15:53:20 +02:00
Harald Welte ae2fcb22cf rename controlif_setup() to ctrl_interface_setup()
which means that all control interface related functions now have
the common ctrl_ prefix.
2014-08-21 15:34:19 +02:00
Harald Welte bfdc259824 libctrl: Make two internal helper functions static 2014-08-21 15:34:18 +02:00
Harald Welte 528134b01c libctrl: Move bulk of control node lookup inti libosmoctrl
The control interface user now only has to register a very short
node lookup function callback.  This function is optional, and only
required if hierarchical command lookup should be supported.
2014-08-21 15:34:18 +02:00
Harald Welte c78e74e3d0 libctrl: remove 'struct gsm_network' references
libctrl doesn't need any knowledge about the type of the user-private
data that it gets passed upon setup time and includes on callbacks.
2014-08-21 15:34:18 +02:00
Harald Welte acbb4c91b6 libctrl: adopt to recent ipaccess/ipa naming change 2014-08-21 15:34:18 +02:00
Harald Welte 3ff81b1a6b libctrl: autotools build system integration
Now we actually build the recently-imported libctrl
2014-08-21 15:34:18 +02:00
Harald Welte 7fd0c830d9 libctrl: Add DLCTRL as logging context for the control interface
... and make libctrl code use it
2014-08-21 15:34:18 +02:00
Harald Welte c9df37d84a libctrl: Avoid using external tall_bsc_ctx
Instead of using one flat talloc context (and one that is specific to
openbsc), we should attach the objects to whatever parent context they
are being used in.
2014-08-21 15:34:17 +02:00
Harald Welte 1238cc64d7 libctrl: remove openbsc headers, convert from make_sock to libosmocore 2014-08-21 15:34:17 +02:00
Harald Welte e1a502b0df libctrl: Remove reference to 'DNAT' in favor of 'DCTRL' 2014-08-21 15:34:17 +02:00
Harald Welte dda4225153 libctr: rename/move control interface to libosmocore naming scheme 2014-08-21 15:34:17 +02:00
Holger Hans Peter Freyther 715e945055 gsm0808: Fix copy and paste pointed out by clang
The element following the identifier list was the
GSM0808_IE_LSA_INFORMATION. It is a TLV type as well
and the issue got introduced in
92107dfd3b.

Fixes:
gsm0808.c:316:40: warning: initializer overrides prior initialization of this subobject
      [-Winitializer-overrides]
                [GSM0808_IE_LSA_IDENTIFIER_LIST]        = { TLV_TYPE_TLV },
                                                            ^~~~~~~~~~~~
gsm0808.c:315:40: note: previous initialization is here
                [GSM0808_IE_LSA_IDENTIFIER_LIST]        = { TLV_TYPE_TLV },
2014-08-21 14:19:37 +02:00
Holger Hans Peter Freyther efe0100189 macaddr: Add some code for FreeBSD (it should work on the others too)
There doesn't seem to be a way to share this code with Linux as
it doesn't have the sockaddr_dl concept inside the getifaddrs.

I manually verified this on a FreeBSD10 box and hex decoding gave
me the correct mac address and rc was 0.
2014-08-21 14:19:37 +02:00
Harald Welte f196a02a65 ipa: use %z as format string whne printing sizeof() result
thanks to Holger for reminding me
2014-08-21 09:42:03 +02:00
Harald Welte 11bca8b8aa ipa: fix compiler warning regarding printf (%d -> %lu) 2014-08-21 02:39:48 +02:00
Harald Welte 78b0868302 macaddr: add #include unistd.h for close() function
this fixes a compile warning
2014-08-21 02:38:34 +02:00
Harald Welte e391996947 ipa: rename functions for consistency
As we are breaking builds by moving functions from libosmo-abis to
libosmocore anyway, we might as well give functions more appropriate
names.  ipaccess is a company, while IPA is the multiplex protocol, and
CCM is the protocol used for establishing identities on the IPA
multiplex.
2014-08-20 23:16:36 +02:00
Harald Welte 28aa991c2f import various generic IPA related functions from libosmo-abis
libosmo-abis is about forming A-bis interfaces/lines by means
of E1 or the IPA multiplex (or possibly other link layers).

The IPA multiplex is used in other contexts, such as the Control
interface, or the A interface.  In that context, it makes sense to
have generic IPA related functions in libosmocore.
2014-08-20 23:16:34 +02:00
Harald Welte fe3e42bdcb Add osmo_get_macaddr() function to obtain etherent mac address
This used to be private in osmo-bts/common/abis.c, where it really
didn't belong.
2014-08-18 19:19:45 +02:00
Harald Welte 40d56f96b9 osmocore: Add function osmo_macaddr_parse() to parse ETH MAC address 2014-08-18 19:03:40 +02:00
Harald Welte 8d5180e003 abis_nm: add abis_nm_msg_disc_names[] value_string 2014-08-17 19:36:26 +02:00
Harald Welte 604d552e49 abis_nm: introduce abis_nm_{osmo,ipa}_magic[]
... used to be oml_{osmo,ipa}_magic in osmo-bts
2014-08-17 18:42:58 +02:00
Holger Hans Peter Freyther 777b056fb4 gprs-ns: Re-initialize the list head and free the unknown_nsvc
Fix re-initialize issue of the GPRS NS. This was found while
working on the GB Proxy tests.

==27800== Invalid write of size 4
==27800==    at 0x403C263: rate_ctr_group_alloc (linuxlist.h:65)
==27800==    by 0x4050974: gprs_nsvc_create (gprs_ns.c:209)
==27800==    by 0x405320D: gprs_ns_instantiate (gprs_ns.c:1330)
==27800==    by 0x804B212: main (gbproxy_test.c:797)
==27800==  Address 0x434173c is 52 bytes inside a block of size 784 free'd
==27800==    at 0x4029DA8: free (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==27800==    by 0x4041BBD: _talloc_free (talloc.c:609)
==27800==    by 0x40432B2: talloc_free (talloc.c:578)
==27800==    by 0x40532D3: gprs_ns_destroy (gprs_ns.c:1363)
==27800==    by 0x804B1FE: main (gbproxy_test.c:791)
2014-07-07 20:00:35 +02:00
Holger Hans Peter Freyther eb55e6aa88 write_queue: Use EBADF instead of EBABDFD for portability
EBADFD is linux specific while EBADF is POSIX. Fix the build on
FreeBSD and use EBADF throughout the file.
2014-07-01 19:42:49 +02:00
Daniel Willmann 77ab2f723e vty: Avoid use-after-free in VTY telnet interface
If the read callback closes the connection conn is already freed so we
can't derefernce it. Instead return -EBADFD in the read function if it
closed the connection and check for that.
2014-06-22 16:57:22 +02:00
Daniel Willmann bd8a89debc write_queue: Avoid possible use-after-free if fd is read-/writable
If the FD is both readable and writable and the read callback closes the
connection (and frees the surrounding structure) we shouldn't call the
write callback (or check anything else in the read fd).

With this patch callback functions can return -EBADFD if they don't want
the FD to be handled any more.
2014-06-22 16:40:59 +02:00
Harald Welte 92107dfd3b update TS 08.08 header + TLV definitions to TS 48.008 / 11.7.0
This adds support for A-over-IP and LCLS related message/IEI
definitions.

Old definitions are in decimal, which is very hard (at least for me)
to compare with the binary tables in the spec.  Hex is much easier
to manually compare for completeness/correctness.  I didn't touch
the existing definitions, but think they should move to hex, too.
2014-06-21 23:16:20 +02:00
Sylvain Munaut 579a7103a1 gsm: Add Kasumi cipher implementation
Submitted-by: Max <max.suraev@fairwaves.co>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-06-16 14:59:30 +02:00
Sylvain Munaut 12ba778afd include: Switch to #pragma once pattern
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-06-16 10:17:27 +02:00
Holger Hans Peter Freyther da73aa640e gsm0411_smr: Fix the size of the array
The code is lacking a "," at the end of a string and we ended up
doing string concatination instead of having an invalid state.

Fixes Coverity CID 1206564
2014-05-23 08:51:22 +02:00
Holger Hans Peter Freyther 61d33925a0 gsm0411_smr: Make the look-up table static 2014-05-23 08:49:34 +02:00
Holger Hans Peter Freyther 8e5435a864 timer: Use the now parameter when it is not NULL
The code would have used an uninitialized current_time in case
"now" was not NULL. As now is const and timersub expects a non
const parameter I decided to copy now into current_time.

Fixes: CID #1040661
2014-05-23 08:37:02 +02:00
Harald Welte 5b5650f3de Fix introducing osmocom speficic OML attributes
Rename NM_ATT_O_REDUCEPOWER to NM_ATT_OSMO_REDUCEPOWER, which
makes it more clear that this is an osmcoom specific attribute.

Also, we cannot simply overload 0x01 as an already defined OML
attribute.  The problem is quite simple: When we use abis_nm_att_tlvdef
during the TLV parse, 0x01 will match to NM_ATT_ABIS_CHANNEL,
which is defined as { TLV_TYPE_FIXED, 3 }.

So instead, we need to introduce a new abis_nm_osmo_att_tlvdef[],
which has to be patched into abis_nm_att_tlvdef[] by the means of
tlv_def_patch(), exactly how we do it for bs-11 and nanobts specific
attributes.

I'm using 0xfe for the attribute, as 0xfe doesn't overlap with the IPA
specific attribues (and we might want to combine/merge the 12.21 plus
IPA plus osmocom spefici attributes)
2014-05-19 11:25:46 +02:00
Holger Hans Peter Freyther 92e1e70dba select: Fix english in comment 2014-05-15 21:40:15 +02:00
Holger Hans Peter Freyther c2c042dfd7 backtrace: Speculative fix for FreeBSD10.0 and execinfo.h
FreeBSD 10.0 ships an execinfo.h but one needs to link to an
additional library for the backtrace functions. Check if there
is a backtrace symbol in libexecinfo and if so link to that
library.
2014-04-17 23:19:10 +02:00
Holger Hans Peter Freyther 0c50b17a26 Release: Prepare the release of 0.6.6 2014-03-31 15:40:46 +02:00
Álvaro Neira Ayuso 5ade61a4f4 src/socket: Adding unix domain socket support
Added some function for adding the unix domain socket support.

Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-03-26 19:50:46 +01:00
Alexander Chemeris cc0645b26d sms: Add missing brackets in the relative validity time calculation. 2014-03-26 19:35:33 +01:00
Daniel Willmann 3dc4e16786 gsm/lapdm: Prevent LAPD tx_queue from filling up in polling mode
If LAPDm receives an I-Frame while there already is an I-Frame in the
tx_queue the code generates an additional RR (to acknowledge the
received I-Frame). Instead, N(R) of the I-Frame in the tx_queue should
be updated to ACK the data.
2014-03-26 18:11:07 +01:00