Commit Graph

3464 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther c9251fa8c9 ipaccess: The proxy code checked the array but not the element
Array compared against 0 (NO_EFFECT)
array_null: Comparing an array to null is not useful: "ipbc->bsc_rsl_conn".

Fixes: Coverity CID 1040718
2013-07-14 09:04:50 +02:00
Holger Hans Peter Freyther 3aedba66bd ipaccess: Fix a resource leak in case the stat is failing
Close the file when the stat is failing.

Fixes: Coverity CID 1040711
2013-07-14 09:04:50 +02:00
Holger Hans Peter Freyther 5ccd015371 nitb: The subscr->imsi is an array will never be NULL
Array compared against 0 (NO_EFFECT)
array_null: Comparing an array to null is not useful: "subscr->imsi"

Fixes: Coverity CID 1040716
2013-07-14 09:04:50 +02:00
Harald Welte 995ff35f39 Fix license header at smpp_openbsc.c and smpp_smsc.c
As Holger pointed out, they contained a GPLv2+ disclaimer rather than
the AGPLv3+ which we use for OpenBSC.  This is not an incompaibility,
but was done unintentionally.  The code was always mean to be under
AGPLv3+.

Nevertheless, anyone using those two files in a version up to this
commit have the right to use it under GPLv2+ as well.  This is not
applicable for any versions after this commit.
2013-07-13 16:35:32 +02:00
Harald Welte 4c5babc06c smpp_openbsc: Fix parsing of 03.38 data coding scheme in MO case 2013-07-11 14:29:31 +02:00
Andreas Eversberg 641475cb81 Fix: Handle CM service request on already secured channel correctly
A CM service request must be acknowledged also, when encryption is already
enabled.

Without encryption enabled, the security status is GSM_SECURITY_NOTAVAIL,
which causes a CM service acknowledge. On initial CM service request, the
security status is GSM_SECURITY_SUCCEED, if encryption is enabled. This
will not lead to an acknowledge, because the cyphering command implies an
acknowlege. An additional CM service request requires an acknowledge, so
I added a new security status: GSM_SECURITY_ALREADY
2013-07-11 08:27:26 +02:00
Pablo Neira Ayuso 46bd4244a1 libmgcp: add enum mgcp_type and use it
This patch replaces the field 'is_transcoded' in the mgcp_endpoint
structure by the enum mgcp_type, that can be further extended with
new types.
2013-07-08 16:46:06 +02:00
Holger Hans Peter Freyther 1e61b25661 mncc: Remove what we believe to be a tautology from the MNCC code
Coverity pointed out that we use trans->subscr after a NULL check,
it is our believe that every transaction will have a subscriber.
Remove the check and add an assert before we are dispatching things.

Fixes: Coverity CID 1040740, CID 1040739
2013-07-06 11:45:38 +02:00
Holger Hans Peter Freyther 096dc3a466 nat: The con variable is not assigned at this point
Coverity pointed out that this code is logically dead. Quickly
judging the code we will forward the RSLD message anyway. Remove
the code for now and next time I work on the NAT/USSD bridge I
will have a look at the flow of the RLSD messages.

Fixes: Coverity CID 1042327
2013-07-05 08:22:03 +02:00
Holger Hans Peter Freyther 7346081ba3 nat: number could point to an address on the stack that can be reused
The number = int_number assignment will make the number point to
the stack and as the int_number goes out of scope at the end of
the if statement other code could re-use this stack for other memory.

Fixes: Coverity CID 1042325
2013-07-05 07:50:30 +02:00
Holger Hans Peter Freyther 9bec10ecd3 nat: Address coverity warning about uninitialized addr
Use memset on the addr to initialize the entire structure.

Fixes: Coverity CID 1042324
2013-07-05 07:48:04 +02:00
Holger Hans Peter Freyther b0b8a34dd5 nat: Please coverity and initialize the saveptr to NULL
Coverity complains about the saveptr used in the strtok_r. This
is not a bug because we pass a string as part of the first call
to strtok_r but it is easier to just initialize it.

Addresses: Coverity CID 1042323
2013-07-05 07:45:08 +02:00
Holger Hans Peter Freyther 9feef48eaf nitb: Add a missing NULL check for searching the subscriber
"subscriber " SUBSCR_TYPES " ID sms pending-send

could fail with an invalid ID/IMSI for the subscriber.

Fixes: Coverity CID 1040715
2013-07-04 20:34:46 +02:00
Holger Hans Peter Freyther e885951f27 db: Fix an issue with the memset
We want to memset the entire area of the atuple and not just the
first four/eight bytes of the data.

Fixes: Coverity CID 1040708
2013-07-04 20:24:02 +02:00
Holger Hans Peter Freyther 81cff91ec0 gsm_subscriber: Fix compiler warning of the printf string
This fixes both a GCC and a Coverity warning:

GCC:
gsm_subscriber.c: In function ‘subscr_expire_callback’:
gsm_subscriber.c:389:2: warning: format ‘%i’ expects argument of type ‘int’, but argument 8 has type ‘long long unsigned int’ [-Wformat]

Coverity:
CID 1040712
2013-07-04 20:22:27 +02:00
Holger Hans Peter Freyther 7b76934f03 nat: The second call didn't really add anything to the test.
Avoid: Coverity CID 1042323
2013-07-04 20:19:44 +02:00
Holger Hans Peter Freyther b18c7456cb ipaccess-config: Add missing break to parsing the -L option
Fixes: Coverity CID 1040738
2013-07-04 18:51:07 +02:00
Holger Hans Peter Freyther 7d8139a42e ipaccess-config: Fix a resource leak in an error path
Fixes: Coverity CID 1040710, CID 1040711
2013-07-04 18:49:04 +02:00
Holger Hans Peter Freyther aa63d70f39 sgsn: Fix the unimplemented/uninstalled show ggsn command
This is fixing a GCC and Coverity warning.

GCC:
sgsn_vty.c: At top level:
sgsn_vty.c:308:1: warning: ‘show_ggsn_cmd’ defined but not used [-Wunused-variable]

Coverity: CID 1040727
2013-07-04 18:45:31 +02:00
Holger Hans Peter Freyther 80e036560d sgsn_vty: Fix uninitialized variable in the gprs_apn2str method
This is fixing a GCC and Coverity warning:

GCC:
sgsn_vty.c: In function ‘vty_dump_pdp’:
sgsn_vty.c:64:5: warning: ‘i’ may be used uninitialized in this function [-Wmaybe-uninitialized]
sgsn_vty.c:49:15: note: ‘i’ was declared here

Coverity: CID 1040706
2013-07-04 18:44:16 +02:00
Holger Hans Peter Freyther 3a708afe63 sgsn: Fix logically dead code in regard to the osmo_fd_register
The code was written like checking the return value of the
osmo_fd_register but the rc variable was not assigned for the
subsequent calls.

Fixes: Coverity CID 1040741
2013-07-04 18:39:52 +02:00
Alexander Chemeris 84402c0c82 sgsn: Fix lengths of MS Network Capability and MS Radio Access Capability elements.
Original code was inconsistent about lengths and could lead to out
of bounds write. Lengths were also inconsistent with the TS 24.008.

Fixes: Coverity CID 1040714.
2013-07-04 18:34:49 +02:00
Holger Hans Peter Freyther f0167ddfc2 hsl: Remove the support for the HSL bts from OpenBSC
The support has been implemented for an old model, we were told that
newer versions would be made incompatible with OpenBSC. Ther are
various warnings in the code and coverity has found some new ones.

Just remove the code as we don't know of anyone using this code.
2013-07-03 16:19:41 +02:00
Holger Hans Peter Freyther a164d5291e nat: Fix compiler warning and cast uint16_t to uint8_t 2013-07-03 16:18:37 +02:00
Holger Hans Peter Freyther 1eba7de0c2 mgcp: Make sure the save pointer is initialized with NULL.
Coverity is not happy about it but it doesn't appear to be a real
issue as the data will not be NULL on the first call.

Addresses: Coverity CID 1040704
2013-07-03 10:23:35 +02:00
Holger Hans Peter Freyther d5c270e71c ipaccess-find: Address a warning by coverity of unitialized memory
Use a memset on the sockaddr_in to make coverity happy.

Fixes: CID 1040705
2013-07-03 10:19:37 +02:00
Holger Hans Peter Freyther 8690b98e7c isdnsync: Remove a double close of the isdn device
The fd is already closed above the if statement and Coverity
detected this as a double close.

Fixes: Coverity CID 1040703
2013-07-03 10:17:37 +02:00
Holger Hans Peter Freyther 8bb0720ebb nanobts: Do not crash on an invalid TRX number
In case the specified trx number is not configured, do not crash
but return NULL from the function. The libosmo-abis library should
close the connection for us then.
2013-06-30 20:11:46 +02:00
Holger Hans Peter Freyther eb0acb6e02 tests: Add a custom test runner to test the VTY functionality.
Begin with the NAT code. It is not clear yet if we will have one
file with all the tests or will have a sub directory with *.py files.
In the long run the base class will move to the osmo-python-tests
module.
2013-06-24 16:13:55 +02:00
Holger Hans Peter Freyther 9e22e69266 misc: Ignore compiled python code and another test case 2013-06-24 14:04:55 +02:00
Katerina Barone-Adesi e0aee7aaa9 Introduced support for external python tests
The test scripts warn about missing documentation, untested configs,
check common errors, and stub out testing individual VTY commands.
The scripts have been moved to the another osmocom repository,
python/osmo-python-tests

The features were requested by zecke.
2013-06-24 13:22:34 +02:00
Harald Welte cc6b2d2fa3 ctrlif: Flush/Clear write_queue when closing the control socket 2013-06-24 10:59:40 +02:00
Harald Welte 1304b35a64 bsc_vty: Print human-readable string version of NM ADM STATE 2013-06-24 10:59:33 +02:00
Harald Welte abadd54346 GPRS LLC: Add non-standard method of sequence number recovery
In some situations (like MS reboot without prior DETACH or SGSN reboot
without prior MS detach), the LLC sequence numbers for UI mode could
be different on both sides.

The LLC spec unfortunately doesn't permit us to send something like a
FRMR in this case, but instructs us to silently discard the frame.  At
that time the remote LLC entity will re-transmit the frame with the same
seqeunce number over and over again, which we will drop again and again.

The mthod used now will keep track of the last received UI sequence
number.  If that number is retransmitted for three times in a row, then
we accept this sequence number and recover from that point on.
2013-06-21 14:06:18 +02:00
Harald Welte 22ce59826a osmo-bsc VTY: fix saving of codec-list
the codec-list parser expects only spaces between the elements of the
list, while the 'save' code is putting ", " between the elements
2013-06-19 15:42:44 +02:00
Holger Hans Peter Freyther b0bf1da4c8 smpp: Only write the systemd-id if it is not empty
system_id is a char array, which makes the NULL check a tautology,
so we should check with strlen if the string is empty or not.

This is fixing the "write" command of VTY that would otherwise
create a config file that can not be parsed.
2013-06-12 09:35:43 +02:00
Alexander Huemer a1c09a401d Makefile.am: Use AM_CPPFLAGS
Since automake 1.13 INCLUDES is depricates and causes a warning
2013-06-12 09:16:27 +02:00
Holger Hans Peter Freyther 846d8dca9f vty: Print the state of all GPRS OML objects in show bts
For debugging GB-proxy/IPA issues it is nice to see the state of
the OML objects.
2013-05-29 16:37:27 +02:00
Harald Welte c75ed6d593 SMPP: Add new 'dcs_transparent' ESME setting
If an ESME has the dcs_transparent config flag, then the TP-DCS
of MO-SMS is transparently passed to SMPP and not converted to SMPP
specific data_coding values.

This is needed in cases where ESMEs actually care about the exact
TP-DCS, as the conversion from TP-DCS to SMPP data_coding is not
bijective.
2013-05-28 20:59:25 +02:00
Harald Welte 27d5e65640 SMPP: Pass on 0xFx style DCS from SMPP to GSM
There are multiple ways how the TS 03.38 TP-DCS can indicate 8bit or
7bit messages.  SMPP has it's own data coding specification, which is
different from TS 03.38.

However, some SMPP ESMEs want to be able to have fine-grained control
over the TP-DCS indicated in the TPDU header.  If such values like 0xF6
are used in SMPP, we now transparently pass them on to the GSM side.
2013-05-28 20:37:07 +02:00
Harald Welte 61e1935a5f SMPP: Respond with BIND_TRX_RESP to BIND_TRX, not BIND_TX_RESP 2013-05-26 14:40:14 +02:00
Holger Hans Peter Freyther 9f3835b988 mgcp: Initialize the tone to CHAR_MAX as this might not be a request
The RQNT message might not contain a 'S:' line with the actual tone
to play. Instead of calling the callback with the 0 as tone just leave
early.

Example:
X: 6B9519B88F0
R: D/[0-9#*](N), G/ft, fxr/t38
2013-05-21 17:04:35 +02:00
Pablo Neira Ayuso 0a244b40c9 nat: fix use after free in forward_sccp_to_bts
valgrind detected an use after free in the path of forward_sccp_to_bts.
The 'parsed' object is referenced from update_con_authorize.
2013-05-13 01:13:27 +02:00
Holger Hans Peter Freyther 2177624ca9 channels: Mark channels as broken that time out on activation/release
A channel that fails to send an ACK/NACK/REL within the four second
timeout is now marked as broken. In case the release comes in late
it will be ignored. The lchan should already been freed and for now
we don't want to trust the channel.

In the future we might want to send a "release" for a channel that
got activated ack late and just set the state to none on a channel
that is released acked late.

The late ACK and REL has been tested with two manual tests using the
fakebts. The channels remained blocked even after having received
the ACK message here. The NACK case has not been manually tested.
2013-05-02 19:36:29 +02:00
Holger Hans Peter Freyther e48c1871af ipaccess: Remove the ipaccess_gsmnet and assume there is a bsc_gsmnet
Assume that there is a bsc_gsmnet and modify the ipaccess-config to
provide this symbol. If a bsc_gsmmnet is not available when linked
the linker will complain and fail.

E.g. give an error like this:
../../src/libbsc/libbsc.a(bts_ipaccess_nanobts.o): In function `ipaccess_sign_link_up':
src/libbsc/bts_ipaccess_nanobts.c:550: undefined reference to `bsc_gsmnet'
2013-04-29 20:44:42 +02:00
Holger Hans Peter Freyther 4b0e36ae7f sysmobts: Make the nanoBTS NM code work for the sysmobts
Use the is_ipaccess_bts method to check if this is either is
nanoBTS or sysmoBTS. The sysmobts type can now be used to bootstrap
a bts.
2013-04-29 20:44:42 +02:00
Holger Hans Peter Freyther 84b033f8c7 sysmobts: Initialize the NM signal handler only once in a mixed network
Make sure that the bts_ipa_nm_sig_cb is only installed once. In
a nanoBTS + sysmoBTS network the _start method will be called
for each mode leading to the handler being registered twice.

Make sure that there is only one handler registered by unregistering
a previously installed handler. The osmo_signal_unregister_handler
will remove 0 or 1 handlers per invocation and we only add one
handler in this file so it is always balanced.
2013-04-29 20:44:42 +02:00
Holger Hans Peter Freyther e84dd98d26 sysmobts: Avoid a crash when trying to look-up a BTS
The nanoBTS code is trying to find a struct gsm_bts based on
the ipaccess_gsmnet and the ipaccess_unit data. The pointer is
not initialized in the case of a sysmoBTS leading to a classic
NULL pointer dereference.

Move the feature init into the _init method. This way we can
re-use the start code of the nanoBTS. This ensures that the
ipaccess_gsmnet pointer is properly initialized and that the
signal handlers are installed.
2013-04-29 20:44:42 +02:00
Holger Hans Peter Freyther 7a0010bdd4 nat: Include LAC/CI as TV values at the end of the 'status' message
Extend the status message and send LAC/CI as part of the status
message. It is using TV to allow sending more fields in the feature.
We only need to encode the data and this is why there is no tlv
description yet.
2013-04-29 20:40:44 +02:00
Holger Hans Peter Freyther d7b22c624b smpp: Attempt to fix a memory leak of the msgb
The smpp_pdu_rx method does not free the msgb. Introduce an
annotation (currently defined to nothing) to indicate what
will happen to a msgb.
2013-04-29 14:00:59 +02:00
Holger Hans Peter Freyther 2bc90c274d nat: Use memcmp for the token on the USSD interface as well
This is similar to the token on the A-interface. There are no more
token based authentication in the NAT.
2013-04-22 10:54:32 +02:00
Holger Hans Peter Freyther ab22335378 nat: Move the callstats to a new header file due sccp usage
The bsc_nat.h is included by common_vty.c so we may not used
sccp_types.h in the bsc_nat.h header file. Move the callstats
to a new file and include it where it is needed.
2013-04-22 09:07:39 +02:00
Holger Hans Peter Freyther 7e9b039a94 nat: Add an example for a black list 2013-04-18 15:11:49 +02:00
Holger Hans Peter Freyther 70c58ef03b ctrl: Provide a reply in case the range check failed 2013-04-17 14:34:36 +02:00
Holger Hans Peter Freyther d38cf50d0a ctrl: Make the commands static to not pollute the namespace
We do not need to access these commands from another compilation
unit and can just make it static.
2013-04-17 14:34:26 +02:00
Holger Hans Peter Freyther b2b291d3ef nat: Extract the LAC/CI from the Complete Layer3 Information
Find the Cell Identifier from the Complete Layer3 Information and
store it for future reference. We could begin to verify that the
LAC/CI used really belongs to the BSC.
2013-04-16 14:14:17 +02:00
Holger Hans Peter Freyther c279e39c12 nat: Rename "struct sccp_connections" to "struct nat_sccp_connection"
The name sccp_connection is used in the osmo-sccp code, sccp_connections
was used in the NAT for tracking a sccp_connection. Rename it so it is
obvious that the struct belongs to the nat.

The rename was done with sed:
$ sed -i s,"struct sccp_connections","struct nat_sccp_connection",g \
		include/openbsc/*.h src/osmo-bsc_nat/* tests/*/*
2013-04-16 09:53:13 +02:00
Holger Hans Peter Freyther dbd9449a16 nat: Allow to re-write international numbers in the CC Setup messages
Prepend the international number with a '+' and then do the normal
re-writing on it. There are a couple of ways to handle this:

	\+([0-9]), \+[0-9][0-9]([0-9]), \+49([0-9])

Add a test case for the international re-write based on an already
internationalized number.
2013-04-16 09:20:06 +02:00
Holger Hans Peter Freyther 27b6184225 nat: Allow to daemonize the NAT process
Add handling for the 'D' option
2013-04-16 09:20:00 +02:00
Holger Hans Peter Freyther ac04d8d55e nat: Name the variable more properly and begin with net.1.bsc.%d
We can identify the NAT and BSC given the types of the variable,
no need to put them into the value itself.
2013-04-16 09:17:21 +02:00
Holger Hans Peter Freyther 7d7054eafa nat: Include the sccp_src_ref and sccp_dst_ref for this call
This can help with some post analysis for failed calls and helps
finding the connection in the pcap trace.
2013-04-16 09:17:21 +02:00
Holger Hans Peter Freyther 7c831ecd19 nat: Do not allow the amount of pending responses to grow infinitely
Limit the amount of pending DLCX responses to three times the amount
of available endpoints. Currently all MGCP messages are sent and handled
in sequence.
2013-04-16 09:17:21 +02:00
Holger Hans Peter Freyther 931ad6ac33 nat: Reword the log messages as this is normal operation
The bsc_mgcp_dlcx method is called from the mgcp policy callback
but also from inside the nat core when the SCCP connection is going
away.
2013-04-16 09:17:21 +02:00
Holger Hans Peter Freyther 462b7d7158 nat: We want the remote to respond to our DLCX request
We want to send a TRAP with the MGCP statistics from the NAT and
the connected BSC. The BSC endpoint can be either released because
of a DLCX from the MGCP CallAgent or the SCCP Connection release on
the A-link.

This is why we need to queue the statistics when the deleting the
endpoint on the BSC. The processing is continued once the response
arrives. This code assumes that the response of the DLCX will be sent
by the remote side. The current amount of outstanding responses can be
seen on the VTY. This assumption is based on the fact that the BSC has
already responded to the CRCX and maybe to the MDCX.

The MGCP RFC is bended to prefix the transaction identifier with "nat-"
to easily detect the response and hand it to the handler. This will
then parse the response and generate the TRAP. The current version is
v1. We assume that the transaction space is big enough and we will
not re-assign the transaction identifier too early.
2013-04-16 09:17:21 +02:00
Holger Hans Peter Freyther c327187259 nat: Make it possible to send MGCP messages through the IPA multiplex
Instead of handling MGCP through the UDP socket, read and write messages
through the ipa connection to the MSC.
2013-04-16 09:17:21 +02:00
Holger Hans Peter Freyther 77956aa034 nat: Move all methods sending a response to the callagent to a single place
For testing it can be nice to handle MGCP messages through the IPA
protocol. Prepare the code to send the messages through other means.
2013-04-16 09:17:21 +02:00
Holger Hans Peter Freyther 6de9d0ba35 nat: Address the FIXME and send the MDCX down to the BSC 2013-04-16 09:17:21 +02:00
Holger Hans Peter Freyther 30156e1eea sysmobts: Add the necessary data structure and init for the SAPI queue
The sysmobts is now having a SAPI queue with all pending SAPI operations
on the BTS. Add the llist_head to the lchan and make sure it is initialized
by the shared code.
2013-04-05 18:41:45 +02:00
Holger Hans Peter Freyther d34adb2f9f nat: Fix authentication by-pass using shorter tokens
The token was compared with the configured one but only up to a
user supplied length. Compare the token sizes and then use memcmp
for the actual comparison to make sure to compare the right ammount
of characters.

There is no unit-test but there should be one.
2013-04-02 10:10:21 +02:00
Holger Hans Peter Freyther 8ae35c1606 bsc-ctrl: Fix a potential memory leak on failed verification
It was possible that the tmp was strduped but not freed, e.g. when
the number of commas was not right. It would evenutally be freed at
the time the cmd is freed thanks to the talloc hierachy.
2013-03-28 17:13:01 +01:00
Holger Hans Peter Freyther 0c908b6e72 db: Link to the VTY library for the vty_config_unlock symbol
Linking started to fail for me due the symbol coming from the
vty library and the db code not linking to it.
2013-03-21 11:12:56 +01:00
Andreas Eversberg 0c8f9ca30b Add VTY option to set GPRS network-control-order to enable MS measurements
In order to enable GPRS downlink measurements at mobile, the
network-control-order must be set to nc1.
2013-03-17 14:37:16 +01:00
Harald Welte 7159e8bea3 Fix osmo-nitb build without libsmpp 2013-03-13 15:40:14 +01:00
Harald Welte 3f78600346 SMPP: Implement SMPP Osmocom Estensions on MO-SMS
An ESME can now be configured in the VTY to enable osmocom-extensions,
which will add vendor-specific SMPP TLVs for RxLev/RxQual/ARFCN/IMEI and
transmit power to the SMPP DELIVER-SM message type.
2013-03-13 15:30:48 +01:00
Harald Welte 76afa16d04 SMPP: Fix crash on delivery of incoming SUBMIT-SM
As bsc_gsmnet is NULL at the time we call smpp_openbsc_init(),
we later run into segfaults with subscribers that don't have a
subscr->net set.

However, we cannot delay smpp_openbsc_init() until after
bsc_bootstrap_network(), as we then fail to parse the SMPP specific
VTY/config file options...
2013-03-13 15:30:48 +01:00
Harald Welte 8b29180cad IPA: Allow RSL connection to different IP address as OML
This patch adds a new VTY command "ip.access rsl-ip A.B.C.D" at the
BTS level.  If you set this IP address, the BTS will be instructed to
establish the RSL link to the indiciated IP address, rather than using
the same as for the OML link (default).

Use "ip.access rsl-ip 0" to disable the feature.
2013-03-12 13:58:30 +01:00
Andreas Eversberg 1af682adb9 BTS: Add S counter for link loss criterion to lchan structure 2013-03-11 11:50:50 +01:00
Holger Hans Peter Freyther f876c39887 si: Another round of PCS related fixes
Inside the SI1 rest_octets we will need to indicate if the ARFCN
is band 1800 or 1900. If the BTS is either 850 or 1900 we assume
we are running a PCS network, otherwise it is a DCS network.

The band indicator is not documented in GSM 04.08 but it is in the
GSM 05.14 version 6.1.0 Release 1997.
2013-03-10 17:39:50 +01:00
Holger Hans Peter Freyther e1145cf0f9 rsl: Properly initialize the cm structure with memset
abis_rsl.c:332:23: warning: 'memset' call operates on objects of type 'struct rsl_ie_chan_mode'
      while the size is based on a different type 'struct rsl_ie_chan_mode *'
      [-Wsizeof-pointer-memaccess]
        memset(cm, 0, sizeof(cm));
               ~~            ^~
abis_rsl.c:332:23: note: did you mean to dereference the argument to 'sizeof' (and multiply it
      by the number of elements)?
        memset(cm, 0, sizeof(cm));
                             ^~
1 warning generated.
2013-03-09 17:53:50 +01:00
Harald Welte e972dba8dd bsc_vty: Prevent printing -1 as unsigned integer for timeslot TSC 2013-03-08 07:45:29 +00:00
Holger Hans Peter Freyther 9b5192b153 bsc: Stop "show paging" from crashing before the first paging
The paging structure is still initialized lazily and we attempt
to traverse it before it is ready. The crash was discovered by
Katerina. Removing the lazy initialization will take a bit of work
as the gsm_data_shared is used by the osmo-bts and the OpenBSC but
paging is different.
2013-03-03 11:08:22 +01:00
Holger Hans Peter Freyther f4be327b4c doc: Do not have examples with accept-all in our repository
We do not want to tell random users to run a network with the
accept-all. This was pointed out by Katerina.
2013-03-03 09:56:25 +01:00
Holger Hans Peter Freyther 63b0e44f65 vty: Document some previously undocumented parameters
Katerina pointed out that some nodes are not fully documented and
proposed some messages. The token/timeout messages were correct, I
have modified the other messages. I removed the full-stop from the
PING/PONG documentation as we are normally not using a full sentence.
2013-03-03 09:48:20 +01:00
Holger Hans Peter Freyther 456fccf697 doc: Create a documentation on the SCCP/lite implementation we have
Describe how we handle/dispatch SCCP messages in the osmo-bsc.
2013-02-26 11:51:25 +01:00
Harald Welte b02fc1e9bb VTY: backwards compatibility for 'logging level sms'
when the SMS code was moved into libosmocore, its logging prefix was
changed from 'sms' to 'lsms', which breaks existing config files.

This introduces a deprecated/hidden vty command to make sure those
config files are still parsed OK, and will simply print a warning
message about the config needing some update.
2013-02-12 11:15:49 +01:00
Andreas Eversberg 75e13a41dc Fix of IMMIDIATE ASSIGNMENT REJECT message
The message was corrupt at several points. They are fixed now and
successfully tested.

A default T3122 timer value of 10 is defined by default now. If set to 0,
the reject message will not be sent. Note that when using existing configs
with T3122 value set to 0.
2013-02-08 08:25:17 +01:00
Harald Welte 647db848e3 add some more docbook snippets 2013-02-07 15:03:08 +01:00
Harald Welte ce1d742f27 dump_all_docs.py: Also extract documentation for SGSN 2013-02-07 15:00:31 +01:00
Harald Welte af33e1d3a1 fix osmo-bsc example configuration file 2013-02-07 15:00:18 +01:00
Holger Hans Peter Freyther 0a7c6a3549 doc: Add some documentation on how the paging system is working 2013-02-06 12:04:32 +01:00
Holger Hans Peter Freyther dc030960fc bsc: Allow to page a BTS that is excluded from the RF lock
The RF lock excluded BTS was not paged at all. Now forward the
paging message to the handler and call a function that will check
if this LAC can be paged right now. Introduce a new paging method
that allows to page on a dedicated bts, refactor the code to use
this method for paging.
2013-01-28 15:41:27 +01:00
Holger Hans Peter Freyther 3d119f1de4 bsc: A BTS excluded from the RF lock should be allowed to make a connection
When introducing the exclude for the BTS lock the RF stayed up but
all connections were immediately released. Optionally pass the BTS
as second parameter and check the exclude bit.

Tested-with: rf-lock-exclude/RFLockExcludeTest.st
2013-01-28 15:41:27 +01:00
Holger Hans Peter Freyther e30d40de0e bts: Allow to exclude a BTS from the global RF lock handling
Some BTS might be in locations where they can run all the time,
allow to exclude them from the global lock handling.
2013-01-28 15:41:26 +01:00
Andreas Eversberg e7ea08379e CC: gsm48_cc_tx_release() must not remove callref
If after release has been sent, the call control layer waits for:
- reception of release complete
- or timeout
- or release of transaction (due to radio link failure)
In this case, an MNCC_REL_CNF is sent to upper layer. The callref must
still exist, so the upper layer can handle this confirm.
2013-01-25 08:43:01 +01:00
Andreas Eversberg 1590727b64 CC: mncc_release_ind() must send MNCC_REL_CNF in state N19
If transaction is destroyed, but callref still exists, the
mncc_release_ind function is called. If the upper layer already sent an
MNCC_REL_REQ, the state N19 was entered. In this case it expects an
MNCC_REL_CNF.
2013-01-25 08:38:29 +01:00
Andreas Eversberg c5e0851054 CC: Be sure to allocate call instance with talloc_zero() 2013-01-25 08:36:32 +01:00
Harald Welte b862cef60d smpp_vty: Ensure to not print 'system-id' in openbsc.cfg if its empty
... as an empty system-id would render the openbsc.cfg unparseable on
next openbsc start.
2013-01-24 09:54:04 +01:00
Holger Hans Peter Freyther 6a85c15eea smpp: Fix a memleak of the SMS on the submit path 2013-01-20 19:21:48 +01:00
Holger Hans Peter Freyther b5a4edd09b SMPP: Inform the SMS Queue that a SMS was submitted to kick the queue
Work on the 'forward' part.. tell the sms queue that something has been
submitted for it..

Conflicts:
	openbsc/src/libmsc/smpp_openbsc.c
2013-01-20 19:21:34 +01:00
Holger Hans Peter Freyther d4d1d5e751 si: Deal with DCS1800 and PCS1900 have overlapping ARFCN ranges
For PCS1900 the SI1 does not contain the ARFCN of the serving cell.
This is because the arfcn2band method will return GSM_BAND_1800 and
not GSM_BAND_1900. The academic fix would be to set the ARFCN_PCS bit
but this would require increasing the bitvector sizes from 1024/8 to
(0x8000 + 1024) / 8. This would increase the storage size for each
bitvector by three.

It is not possible to have DCS1800 and PCS1900 in one network so we
can avoid increasing the memory usage and check if the ARFCN resolved
to 1800 and then check if the BTS is a 1900 BTS and then claim that
this is compatible.
2013-01-17 19:31:49 +01:00
Holger Hans Peter Freyther 9e1952a901 si: Share the ARFCN selection condition between the two statements
This makes reading the condition more easy and allows me to fix it
for GSM1900 more easily and I can remove one level of indention.
2013-01-17 19:30:05 +01:00
Holger Hans Peter Freyther 164ee307b2 rsl: Properly parse the RLM cause from the error indication
The code predates the TLV parser and we were parsing the RLM from the
wrong offset. In general we were using the length of the TLV which
happened to be equal to the T200 indication.

After consulting the RLM cuases not every of them should generate a
BSC_RLLR_IND_ERR_IND as these are forwarded to the MSC as a SAPI reject
right now.

TLV parsing now generates this due a bug in the osmo-bts code:
abis_rsl.c:1605 (bts=0,trx=0,ts=2,ss=0) SAPI=0 <0000> abis_rsl.c:1547 (bts=0,trx=0,ts=2,ss=0) ERROR INDICATION cause=Fraeme not implemented
2013-01-16 21:07:43 +01:00
Daniel Willmann 69665f8722 osmo-bsc: Add ctrl cmd bts RF state
Returns opearional, administrational state and RF policy
2013-01-15 22:19:44 +01:00
Daniel Willmann 7d10983865 osmo-bsc: Add VTY command show position 2013-01-15 16:53:51 +01:00
Holger Hans Peter Freyther 2a896070a7 bsc: Auto RF Off in case of missing MSC connection
For short IP failures we want the RF to stay up and wait for
the re-connect but in case the A-link is gone too long it is
good to switch off the RF and wait for commands to enable it
again.
2013-01-15 13:52:00 +01:00
Holger Hans Peter Freyther 036b25fb7f nat: Fail if the control interface can not be initialized 2013-01-15 13:48:18 +01:00
Holger Hans Peter Freyther 431ceada36 bsc: Create a better error message for when RF commands are rejected
Provide an error message that makes it more clear that the command
is rejected because RF handling is not enabled in the BSC.
2013-01-15 11:27:28 +01:00
Holger Hans Peter Freyther 25eca0bfdc bsc: Simplify the trap sending by using the location state method 2013-01-15 11:27:28 +01:00
Holger Hans Peter Freyther 23446844a8 bsc: Send a TRAP with the locations on a MSC connection
Send the current position when the MSC connection is established.
2013-01-15 11:27:28 +01:00
Holger Hans Peter Freyther 7b6ea56f41 bsc: Use the BSC RF CTRL to change the RF state of the TRXs
Use the delayed scheduling feature of the osmo_bsc_rf class to
avoid crashing the site controller of the nanoBTS.
2013-01-15 11:27:28 +01:00
Holger Hans Peter Freyther baa1a2df20 bsc: Do not re-start the grace timer when we are in the grace period 2013-01-15 11:27:28 +01:00
Holger Hans Peter Freyther ed0374ffeb bsc: Introduce an authenticated signal for the MSC connection
Send the signal whenever a MSC appears to be authenticated.
2013-01-15 11:27:28 +01:00
Holger Hans Peter Freyther ba36bf4c5d sms: Avoid infinite CP-ERROR/CP-ACK loop with sms.
The issue can be reproduced by typing the following 9 or more times.
 OpenBSC> subscriber id 2 sms sender id 2 send bla

For some unknown reason the phone sends us a CP-ERROR for a transaction
identifier we have allocated and used but don't remember. Due the way
we use the SMC/SMR we 'establish' the machine and this results in a CP-ACK
being sent out. But the CP-ERROR is not having the content we want for
an establish so we send out a RP-ERROR. This will result in a CP-ERROR
because the phone does not know the transaction...

Avoid the issue by checking the direction of the transaction. If we do
not know the transaction and it is supposed to be allocated by us then
just ignore it and do not create a new transaction.
2013-01-13 17:30:00 +01:00
Holger Hans Peter Freyther 30a3d2f0fe debug: Fix typo in the debug category 2013-01-11 18:11:21 +01:00
Holger Hans Peter Freyther 4babba62b8 ctrl: Work on the cmd->node instead of the data pointer passed
Make the macros use the cmd->node instead of the data pointer. The
naming of the variable inside the macro already indicates that it
should use the nodes data structure.
2013-01-11 18:11:13 +01:00
Holger Hans Peter Freyther 3749dc93a3 ctrl: Fix the signature of the string control commands
Like with all type unsafe callbacks we will need to cast from
void to the dtype. This addresses some compiler warnings.

Make it possible to only include the control_cmd.h to use the
macros defined in this file.
2013-01-11 18:11:05 +01:00
Andreas Eversberg f2621e506d si: Do not schedule SI1 to SI4 on the second TRX 2013-01-08 19:34:24 +01:00
Holger Hans Peter Freyther 608ac2a8a4 abis: Fix the verification of BCCH/SDCCH8 on TRX != 0 for the BS11
The SDCCH8 is only allowed on trx 0 if there is no BCCH/SDCCH4 on it.
2013-01-08 19:30:14 +01:00
Holger Hans Peter Freyther 75077955e9 audio: Make AMR multirate configurable for the osmo-bsc
Provide VTY options to allow/forbid the usage of a
specific multirate option.
2013-01-07 16:14:08 +01:00
Holger Hans Peter Freyther 25aa749f10 audio: Make the BSC handle the new mr_config request of the BSC API
Handle the mr_config request and set the AMR multirate config for
the given MSC. Initialize the mr_config with the AMR5.9 default we
have been using until now.
2013-01-07 16:10:31 +01:00
Holger Hans Peter Freyther 0b19d55dd6 bsc: Blind fix to deal with phones sending a dialplan of 0 2013-01-07 15:50:14 +01:00
Holger Hans Peter Freyther c7db4dce4a bsc: Fix crash when the new route is not available
When we are asked to route calls on a local link and
the link is not available we would crash when trying
to send a packet over a deadline. When we have decided
to move a connection it is guranteed that the current
SCCP connection will vanish, we either migrate to another
MSC or the RSL/subscriber connection will be closed.
2013-01-07 15:50:14 +01:00
Holger Hans Peter Freyther d5edc4f84d bsc: Add VTY code for the local area prefix 2013-01-07 15:50:14 +01:00
Holger Hans Peter Freyther 83d2d38a3c bsc: Inspect a CC Setup message and attempt to reroute the traffic
Inspect the CC Setup messages and if the dialed number is matching
the regexp of the local MSC the connection will be rerouted. The
original MSC will get a GSM0808 CLEAR REQUEST, a new connection with
a CC Setup message will be opened.
2013-01-07 15:47:32 +01:00
Holger Hans Peter Freyther aa191adce6 nat: Send a CM Service Reject for NAT_CON_TYPE_SSA as well
For USSD we remember that it is a supplementary service but this
means we sent no CM Service Reject down to the subscriber. Treat
NAT_CON_TYPE_CM_SERV_REQ and NAT_CON_TYPE_SSA the same and send
a cm service reject.
2013-01-07 15:02:34 +01:00
Holger Hans Peter Freyther 1f8276e588 nat: Introduce a global IMSI barr list using red-black trees 2013-01-07 15:02:34 +01:00
Holger Hans Peter Freyther 0434faedc9 nat: Simplify the code and call auth_imsi from the main method
Do the auth check in bsc_nat_filter_sccp_cr, remove the cause from
the signature again. For the bsc_nat_filter_dt restructure the flow
but leave the auth inside the id response message.

Return 1 when the IMSI has been extracted as indicator for running
the auth check. 1 has not been used before and is safe to be used
as this indicator.
2013-01-07 15:02:34 +01:00
Holger Hans Peter Freyther 184950e298 nat: Get the cause into the imsi_auth method in preparation
For the new barr feature get the cause struct down to the imsi_auth
code so we can add the blacklist there.
2013-01-07 15:02:34 +01:00
Holger Hans Peter Freyther bdf764a025 nat: Allow the filter to select the reject cause
In preparation for another kind of black-list allow the filter code
to decide how the connection should be rejected. Introduce a new struct
that will carry the reject causes for certain operations.
2013-01-07 15:02:34 +01:00
Holger Hans Peter Freyther adc2e87372 nat: Move the IMSI/TMSI filtering to a new and dedicated file
Move all routines related to filtering to a separate file.
2013-01-07 15:02:34 +01:00
Holger Hans Peter Freyther 6fbd864a65 nat: Fix a typo in the log message for out of memory 2013-01-07 15:02:34 +01:00
Holger Hans Peter Freyther 6ecb3cb599 nat: Extract the message re-writing from the utils to a dedicated file
Move the code around to make it more clear what the routines should do.
2013-01-07 15:02:34 +01:00
Holger Hans Peter Freyther b9b828b1e5 Revert "libbsc: With the new SAPI states we don't need sacch_deact anymore"
For now we need to keep the sacch_deact in OpenBSC as we couldn't get
the new activation/de-activation code working.

This reverts commit 0c282f5268.
2013-01-01 19:20:51 +01:00
Jan Luebbe 1c201c6055 osmo-nitb: Add a timer to regularly expire 2013-01-01 17:19:47 +01:00
Jan Luebbe bfbdeec714 libmsc: Track and update the location update expiry
Set the subscriber expiry timeout to twice the duration of the location
update period and provide functions subscr_expire() and
db_subscriber_expire() to mark subscribers offline that have missed two
location update periods.

This patch increases the DB revision to 3, so the hlr will be
incompatible with prior versions.

We should allow 0 for T3212 as well to disable the location update
period. In that case we will need a way to indicate that in the
database.
2013-01-01 17:19:47 +01:00
Daniel Willmann 4d62d63151 Stricter limits for T3212 (location update period)
libcommon: Default to 30min location update period
libbsc: Limit VTY value for periodic update and disallow the value 0

According to GSM 04.08 Table 10.5.33 "The value 0 is used for infinite
timeout value i.e. periodic updating shall not be used within the cell."

This was the default value until now, but the code that deals with
expiring inactive subscribers in the next commit can't handle that case
so this remains a TODO for now.
2013-01-01 17:19:46 +01:00
Holger Hans Peter Freyther 4d2a68cf11 misc: Do not use else when using return in the previous branch 2013-01-01 17:18:27 +01:00
Sylvain Munaut 39c31dea2e libbsc: Make argument optional in some 'show' commands
The actual command implementation was already for this, but some
bad vty parsing prevented optional range arguments from working
properly.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-01-01 17:04:52 +01:00
Sylvain Munaut 01c13a3a45 libmsc: Allow to set sender id when sending SMS from the VTY
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-01-01 17:04:38 +01:00
Sylvain Munaut 11c1b6e014 libmsc: Refuse service to anyone not attached
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-01-01 17:03:15 +01:00
Daniel Willmann 977cd13741 gsm_04_08: Display debug message correctly on DETACH INDICATION
Log messages would get mangled before if we receive detach by TMSI or
IMSI.
2012-12-29 12:47:31 +01:00
Daniel Willmann 0c282f5268 libbsc: With the new SAPI states we don't need sacch_deact anymore 2012-12-29 12:42:29 +01:00
Daniel Willmann 324c8052ae gsm_data_shared.h: Keep a list of SAPI states per lchan 2012-12-29 12:42:16 +01:00
Holger Hans Peter Freyther 4173b174eb libmsc: One of assign_compl and assign_fail will always be called
Remove the log messages and comments as they are wrong for now. Even
for the mode modify we will get the assign complete call.
2012-12-26 21:44:12 +01:00
Daniel Willmann 56260b648c 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 12:26:09 +01:00
Holger Hans Peter Freyther cf77b3a2cf abis_test: Fix the test case and calculate the right offset
We parse the load_config, take the ptrdiff_t from start and load_config
and from the previous array as the alignment can differ on different ABIs.

This was found by Daniel when executing the tests on a 64 bit userspace.
2012-12-26 12:19:53 +01:00
Holger Hans Peter Freyther c121bb3188 handover: Fix the handover signalling for IP based BTSes
This was reported by Kevin when he was testing handover. The problem
is the order of the signal handlers for S_ABISIP_CRCX_ACK. Right now
the handover signal handler is called before the one inside the libmsc
gsm_04_08.c. This means S_HANDOVER_ACK is signalled _before_ there is a
rtp socket created for the channel. The result is that the MDCX will
never be sent and the called will not be properly switched _after_ the
handover detection.

I do not want to play with the order of signal handlers, remove the
CRCX ack handling from the handover_logic.c and force the NITB (and
later the BSC) to check if the lchan is involved with a handover and
do the switching in there. This means right now we do what two signal
handlers did in one.

Reproduced and tested with the FakeBTS Handover test.

Log message:
<0004> abis_rsl.c:1954 (bts=1,trx=0,ts=3,ss=0) IPAC_CRCX_ACK ...
<000c> gsm_04_08.c:1400 no RTP socket for new_lchan
<001a> rtp_proxy.c:533 rtp_socket_create(): success
<001a> rtp_proxy.c:615 rtp_socket_bind(rs=0x48703c8, IP=0.0.0.0): ...
2012-12-26 10:32:02 +01:00
Holger Hans Peter Freyther 006e3d87e0 gsm: Do not attempt to release SAPI=0 if it was never allocated
In case of handover (but probably on RACH) we would send a RLL for
SAPI=0 even if this SAPI was never established. After we have released
all SAPI>0 locally check that SAPI=0 is established and if not release
the rf channel directly.
2012-12-26 00:20:18 +01:00
Sylvain Munaut 48ea4e8aec libbsc: Fix DL QUAL decoding from measurement reports
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-12-26 00:13:51 +01:00
Jan Luebbe 6e300682df gsm_subscriber: change subscr_bsc_active_subscriber to plural
This was requested by Holger Freyther <zecke@selfish.org>.
2012-12-25 19:08:46 +01:00
Holger Hans Peter Freyther 4485321219 nitb: Add a VTY command to initiate a handover to another BTS 2012-12-25 08:37:36 +01:00
Holger Hans Peter Freyther b348939d86 lchan: Introduce T3109 handling for the release procedure
T3109 is started when the SACCH is deactivated. It is stopped when
the phones sends the DISC/UA/UM on LAPDm for the main signalling
link. In case of timeout the abnormal release procedure will be
initiated. Make sure to not issue the SACCH Deactivate twice to
avoid confusing the equipment.

This is still not fully spec compliant. In case of a timeout the
abnormal release handling will be started which involves starting
T3111+2. The error handling should be split out of the rf channel
release method, e.g. lchan_release should be called and check if
the channel release was already initiated.
2012-12-23 20:20:38 +01:00
Holger Hans Peter Freyther 638da51a78 lchan: Introduce a BROKEN state for the lchan
If the CHAN ACTIV is NACKED we set the state backto NONE. This is
problematic as our channel allocator will allocate from the front
or from the back and if the channel is early in the list it might
cause permanent failures. Introduce a BROKEN state and use it when
the channel activation is failing for an unknown reason. Copy the
cause so it can be inspected later.
2012-12-23 20:18:18 +01:00
Holger Hans Peter Freyther 9d50a27695 lchan: Document the behavior/quirks for abnormal channel release
Deactivate the SACCH and release all SAPIs locally as of GSM 04.08. Add
documentation to the code and explain what will happen as part of the
release process.
2012-12-23 20:18:18 +01:00
Holger Hans Peter Freyther 8582535c82 lchan: Release the lchan more quickly, align with GSM 04.08
* Release all channels with SAPI > 0 with the "local end release"
  (as of NOTE 1 of GSM 04.08).
* No need to wait for all SAPIs to be torn down and the normal
  REL_IND/REL_CONF will call rsl_handle_release and the channel
  should be released.
* Update the documentation
2012-12-23 20:18:18 +01:00
Holger Hans Peter Freyther 960c4044e6 lchan: Release all higher sapis on the local end.
According to GSM 04.08 3.4.13.1.1 RR connection release in NOTE 1
one should release all non main signaling links using the local end
link release.
2012-12-23 20:18:18 +01:00
Holger Hans Peter Freyther 93599a2c2c rsl: Cosmetic changes to the release code
Put the idiom that sets the lchan state to none and respecting the
error state into a shared method. This way the special handling for
the abnormal case is just in one place.
2012-12-23 20:18:18 +01:00
Holger Hans Peter Freyther d66777f9cf rsl: Call the release function with the enum name and not the number
Done with the semantic patch:
@rule1@
expression E;
expression F;
@@
- lchan_release(E, F, 1);
+ lchan_release(E, F, RSL_REL_LOCAL_END);

@rule2@
expression E;
expression F;
@@
- lchan_release(E, F, 0);
+ lchan_release(E, F, RSL_REL_NORMAL);
2012-12-23 20:18:18 +01:00
Holger Hans Peter Freyther 5ca825e431 rsl: Rename the reason to release_mode and use the enum value
The API with 0 and 1 as legal values is hard to understand. Use the
recently introduced enum values instead.
2012-12-23 20:18:18 +01:00
Holger Hans Peter Freyther 1411c066cc rsl: Use LOGL_ERROR instead of LOGL_NOTICE act/deact timeouts
It is a grave error when the BTS does not respond to the ACT/DEACT
requests, use LOGL_ERROR for such conditions.
2012-12-23 20:18:17 +01:00
Holger Hans Peter Freyther 10049bc3b7 paging: Do not page when there is no OML link
Avoid printing error messages when paging while the BTS is down. In
case a BTS is going down it is best to just let the timers expire
normally. We can not expire them right away as multiple BTS could be
paged and we do not want to interfere with that. There is no need to
stop the queue right now.
2012-12-22 19:27:27 +01:00
Holger Hans Peter Freyther 3e9b2ec257 libmsc: Avoid a crash on lchan release during call control
If subscriber A is calling B and has sent a CC Setup message we will
allocate the MO and MT transaction and link them together. When the
BTS or the lchan is failing the BSC API will send a clear request,
as part of the clear request all pending transactions will be released.

As part of taking down the transaction, the remote leg will be informed
and will send a MNCC_REL_REQ. This results in a call to trans_free. The
llist_for_each_entry_safe does not handle removing other elements from
the list and we would segfault.

One way to fix this is to move the transaction list into the subscriber
connection. This might require to create the subscriber connection for
MT handling earlier. Otherwise one could have one transaction list inside
the subscriber connection and a global list for MT- transactions.
2012-12-22 18:45:27 +01:00
Holger Hans Peter Freyther 405824c057 libmsc: Set trans->subscr = NULL after we release it
This is a cosmetic change and should happen to find use after free
of the subscriber.
2012-12-22 18:16:47 +01:00
Holger Hans Peter Freyther 25b70cea9d autoconf: Fix the --disable-* case for the AC_ARG_ENABLE macros
--disable-smpp would actually not disable SMPP but enable it. Correct
it for all usages of AC_ARG_ENABLE.

Move the unconditional invocation of PKG_CHECK_MODULES before the
conditional one to make it work as the pkg-config m4 macro appears
to expand the first usage differently and searches for the pkg-config
exuable.

Use "$enableval" to see if the feature should be enabled or disabled
and then search for the module afterwards.
2012-12-21 00:04:57 +01:00
Holger Hans Peter Freyther 0e0a09c610 osmo-bts: Include lapdm.h to fix autoconf usability test
Include the LAPDm header file so the size of struct lapdm_channel
is known and gsm_data_shared.h can be included by itself.
2012-12-20 19:03:18 +01:00
Holger Hans Peter Freyther 2f25747e3f abis: Activate the newest available installed on the BTS
Select thew newest software from all available file versions.
2012-12-19 16:37:55 +01:00
Holger Hans Peter Freyther bce5675e5f abis: Create a routine that can parse all SW Descriptions of a SW Config
Be able to parse the entire SW Config IE. Parse the SW Descruption
into a struct provided by the caller.
2012-12-19 16:37:55 +01:00
Holger Hans Peter Freyther c751cf92cb misc: Fix compilation now that the method is located in libosmocore
These TLV helper functions are now located in libosmocore.
2012-12-19 16:18:44 +01:00
Holger Hans Peter Freyther 408208d887 nitb: Do not crash on IMSI Detach messages from a phone
This has been reported and analyzed by Tobias Engel. The IMSI Detach
is dispatched as part of the complete layer3 message. I had patched
the code to release the anchor and call msc_release_connection to
release the connection as fast as possible (otherwise the anchor would
trigger in a couple of seconds).

With commit 70ae5d3000 I made this more
generic to release the connection immediately if there are no operations,
no transaction and no silent call. This leads to the subscriber connection
being released twice and eventually causing a segfault. Remove the
msc_release_connection invocation from the IMSI Detach code as the connection
will be taken down by the BSC API.

This has been tested using the FakeBTS and an IMSI Detach message. The
channel is released immediately and the nitb does not crash.
2012-12-16 14:12:38 +01:00
Holger Hans Peter Freyther 5ea1bc77a3 mgcp: Allow to freely control the a=fmtp line for experiments
In case of AMR one can specify the available codecs out-of-band. Allow
to configure this line statically in the configuration file.
2012-12-16 13:18:08 +01:00
Holger Hans Peter Freyther 7e7ee5f8c6 mgcp: Fix the vary large jump detection in the code
GCC 3.x on PowerPC correctly highlights that the code is fishy.
Re-reading the RFC 3550 shows that we should subtract it and then
we are in the 16bit range. The probation and re-sync code is still
missing.

GCC:
mgcp/mgcp_network.c:200: warning: comparison is always true due to limited range of data type
2012-12-16 13:11:50 +01:00
Holger Hans Peter Freyther ce55361e93 mgcp: Test and implement re-transmission handling
MGCP is used over UDP and a response might be lost. The MGCP RFC
asks for keeping a list of responses and then using the previous
response to answer a duplicate request. I tried to conserve memory
and just wanted to remember the last transaction identifier and
result-code and re-generate the result from that. This made the
code look bad and this is why the entire response will now be stored.
It sadly increases the memory usage but can not be avoided at this
time.

Remove the msg->l3h pointer for the RQNT callback as strtok has
modified the content of it.
2012-12-10 14:46:00 +01:00
Holger Hans Peter Freyther 29de346b32 mgcp: Change the flow of the code when handling a MGCP response
Attempt to detect a response and return only then. Remove one level
of tabls in preparation for the re-transmission handling.
2012-12-10 13:36:00 +01:00
Holger Hans Peter Freyther a769dcb889 mgcp: Methods generating a response now include the endpoint pointer
This is required for remembering the last result in a central place
and is required to properly implement detection of re-transmissions.
2012-12-10 13:36:00 +01:00
Holger Hans Peter Freyther cf2f158caa mgcp: Add testdata for MDCX handling 2012-12-10 13:35:53 +01:00
Holger Hans Peter Freyther d267f4d685 mgcp: Test the second CRCX as a CRCX and not as a re-transmission
The second CRCX would be mostly ignored and be handled by the
retransmission layer of MGCP.
2012-12-10 12:16:23 +01:00
Holger Hans Peter Freyther 0d904e004a mgcp: Fix a typo.. it is msg and not mgs 2012-12-10 12:16:23 +01:00
Holger Hans Peter Freyther 01d315f19c mgcp: We do not need to check for talloc_free
Simplify the code and remove null check for the two strings.
2012-12-10 12:16:23 +01:00
Holger Hans Peter Freyther 3d4d79d890 bsc: Fix compiler warning and return from the method with a value. 2012-12-10 12:09:22 +01:00
Holger Hans Peter Freyther d2361d970a bsc: Send the USSD message after the location updating accept.
Make sure to accept the phone first before sending the USSD message.
2012-12-03 15:32:54 +01:00
Holger Hans Peter Freyther f589221ed0 msc: Add debug messages when not sending a USSD welcome message 2012-12-03 14:39:19 +01:00
Holger Hans Peter Freyther b3089e437d bsc: Fix a brown paper bug and most likely fix the USSD welcome issue 2012-12-03 14:39:11 +01:00
Holger Hans Peter Freyther 383d3c33e6 bsc: Call the variable with a more appropriate name. 2012-12-03 14:38:59 +01:00
Holger Hans Peter Freyther 536a10b63b sms: Kill the linkid as we are using SAPI=3 all the time
For GSM (not GPRS) we will never use a SAPI!=3. Simplify the code
and remove the link_id=0.
2012-12-01 11:49:33 +01:00
Andreas Eversberg bc6c43f759 sms: Replaced the SMR process by new implementation in libosmocore
Rebased, tested and fixed by Holger Freyther. Release the transaction
only once the SMC is asking for the release and set the cb's to NULL
to catch a use after free early.
2012-12-01 11:49:33 +01:00
Andreas Eversberg f7396eac2f sms: Replaced the SMC process by new implementation in libosmocore
This has been rebased and fixed by Holger Freyther. The change of
the debug area was split out in a previous commit and the is_mt was
put back into the transaction code.

The transaction is now freed from the RELEASE_REQ sent by the SMC
layer and not inside the error path. When clearing the SMC instance
we also clear the callbacks.
2012-12-01 11:49:15 +01:00
Holger Hans Peter Freyther 07dec137de sms: Remove the susbcr_put_lchan logic from the SMS code
This should and does happen as part of the trans_free/msc_release_connection
code. There is no easy way to determine that the lchan is now 'free' for other
things.. Let the transaction code sort this out. This code just needs to make
sure that transactions are always freed.
2012-12-01 11:33:00 +01:00
Holger Hans Peter Freyther 70ae5d3000 nitb: Release the channel if there is nothing on it
This is more a work around and one still needs to implement a
proper dispatch on the opening of the connection. If there is no
operation left, no transaction and no silent call, close down the
channel.
2012-12-01 11:32:47 +01:00
Holger Hans Peter Freyther 8d0be259cb mgcp: Begin handling of the RQNT message as needed for DTMF
Introduce a callback for the request and forward the signalrequest
to the callback. This is not a full implementation of MGCP RQNT.
2012-11-29 19:56:22 +01:00
Harald Welte 0d0c9ec5c5 use DLSMS and not DSMS in SMPP related code (merge with master) 2012-11-24 11:13:19 +01:00
Harald Welte c6483683eb tests: Fix build of 'db' test after smpp merge 2012-11-24 11:11:59 +01:00
Harald Welte b8a1f967c5 SMPP: fix handling of UDH / multi-part for 7-bit messages
... I would have never believed it is such a broken mindfuck.
2012-11-24 11:09:21 +01:00
Harald Welte c0de14da8f SMPP: add small utility program 'smpp_mirror'
This program binds as ESME transceiver to a SMSC and simply mirrors back
all SMS that it receives.
2012-11-24 11:09:21 +01:00
Harald Welte e07b6a77e5 SMPP: Implement support for MO SMS
Each ESME can have a number of prefix-matching routes, or it can
be a 'default route' to whcih all otherwise unknown SMS destinations
are routed.
2012-11-24 11:07:30 +01:00
Harald Welte 338e3b3b4b SMPP: VTY configuration of SMPP code, authentication support 2012-11-24 11:07:29 +01:00
Holger Hans Peter Freyther eff4094950 sms: Use the DLSMS instead of the DSMS category throughout our code 2012-11-21 21:33:03 +01:00
Holger Hans Peter Freyther 366c33185b sms: Use the definitions from the libosmogsm
Use the code that is shipped inside the libosmogsm library. Right now
the signature (besides the static) and the implementation is the same.
This makes using the libosmogsm SMC code more easy in the near future.

For the gsm340_gen_oa we are now using a small wrapper to generate the
proper type and numbering plan.
2012-11-21 21:31:47 +01:00
Harald Welte 6c7680d726 SMPP: build the smpp interface only in case of ./configure --enable-smpp 2012-11-16 22:16:46 +01:00
Harald Welte 1a2993adb7 SMPP: fix subscriber reference leak.
subscr_get_by_* is already increasing the refcount, we shouldn't
do that a second time (thanks, Holger).
2012-11-16 22:00:10 +01:00
Harald Welte 9122c13933 SMPP: More logging in error cases, fix UDH in 7bit ASCII 2012-11-16 22:00:10 +01:00