Commit Graph

3932 Commits

Author SHA1 Message Date
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 3a41b80bd7 Merge branch 'zecke/abis-sw-selection' 2012-12-20 18:56:47 +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 1bf6610ce7 Merge branch 'zecke/mgcp-transactions' 2012-12-10 14:53:00 +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 c5903a2b01 Merge branch 'zecke/jolly-sms'
MT-SMS:
Manual test with VTY to phone. Also multiple SMS deliveries on
the same lchan. Manual test with phone to phone.

MO-SMS:
Manual test with phone to phone but only a single SMS at a time,
not testing the special 'CP-ACK' case.

Forced CP timeout using the fakebts SMSTest, not causing a crash.
2012-12-01 12:03:46 +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 6d818839a9 Merge branch 'zecke/mgcp-dtmf' 2012-12-01 10:53:15 +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