Commit Graph

4173 Commits

Author SHA1 Message Date
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 bac7dcc367 Merge branch 'zecke/feature/improve-audio-codec-selection'
Allow to select the AMR multirate config using the VTY.
2013-01-07 16:22:00 +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 ff799f0912 Merge branch 'zecke/feature/move-calls'
Be able to move a call from one MSC to another MSC based on a regexp
for the phone number and pre-defined dial plan.
2013-01-07 15:50:38 +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 ea46b77f3e Merge remote-tracking branch 'origin/zecke/barr-subscribers'
Allow to merge barr certain subscribers with a given error code
2013-01-07 15:03:29 +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
Holger Hans Peter Freyther b5ae7288a9 Merge branch 'daniel/t3212-work'
This implements exipiry of subscribers, requires a schema change. A permanent
attachment (time set to 0) is not supported any more and would require some
more work. This code was used at the 29C3.
2013-01-01 17:31:07 +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 7d0f60dce6 Merge branch 'zecke/channel-release'
Merge the channel release re-work. The most notable change is that
SAPI > 0 will now be released on the local end and that the release
process should be both more fast and more standard conform. With SMS
spamming/mass sending the nanoBTS is crashing but this does not appear
to originate from any of these changes. I used git rebase to go through
each of the change to see where the nanoBTS is crashing but couldn't
reproduce it. It might be a general overload or something generated by
the modems of the sysmocom modem bank. Merge it before the 29C3 so we
can test this code some more.
2012-12-23 20:21:15 +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