Commit Graph

1737 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther f0b21dfd25 bsc_msc: Handle the loss of the MSC connection better
Instead of simply exiting the application we will handle it by
giving up all SCCP connections, once we have the MSC back we will
send a GSM 08.08 reset message, and we will free all resources
related to these connections. This includes the primary and secondary
lchan of these connections.

While we are not connected to the MSC we will handle each message
that would open a SCCP connection by giving up the lchan. This has
only been compile tested and will need to be manually tested during
a test session.

This also highlights a DoS that could be used against OpenBSC
by setting up a lchan but never send any GSM L3 message. We will have
to fix that at some point.
2010-03-29 10:09:27 +02:00
Holger Hans Peter Freyther e165d1aaa4 [misc] Clean some whitespace in files of this branch. 2010-03-29 08:10:48 +02:00
Holger Hans Peter Freyther 649496eb57 nat: Handle MSC disconnect by closing all NAT connections
When we disconnect from the MSC handle it by pushing the problem
to our connected clients. We will simply close all connections,
reject all new BSC connections and attempt to reconnect to the MSC.
2010-03-29 08:09:29 +02:00
Holger Hans Peter Freyther 135a45c833 msc: Create a real interface for BSC MSC and start handling reconnects
Create a BSC<->MSC interface and use it for the BSC MSC IP and the
BSC NAT to reduce code duplication on handling reconnects to the MSC
and cleaning up the local state. The code is only partially tested
and will contain bugs. Currently both the BSC and the NAT will just
exit on connection loss and this way have the current behavior.
2010-03-26 12:14:37 +01:00
Holger Hans Peter Freyther 1a3d9dbabf bsc_msc: Connect in a non blocking way to the MSC
The latency of setting up of the TCP connection can be quite high,
it is better to connect in a non blocking way. This code is working
by setting the socket nonblocking and temporarily replacing the
bfd callback with the connect handling.
Once the OS has connected our socket we switch back to normal operation.
2010-03-26 10:41:20 +01:00
Holger Hans Peter Freyther a91d15df7e bsc_msc_ip: Keep track of active connections so we could clear them.
Keep track of SCCP connections so we can clear them
when the MSC is going down.
2010-03-26 09:58:40 +01:00
Holger Hans Peter Freyther 3368e2a3d1 nat: Add a warning for an important todo item on connection loss
In case we disconnect with some pending operations we will need to
signal the MSC that something is wrong. This could be by sending a
RLSD directly, or a clear command. Another part of the fix is to
respond with a RLC on unknown RLSD messages.
2010-03-26 09:28:40 +01:00
Holger Hans Peter Freyther 929d788e21 nat: Clear all pending messages in case the BSC disconnected
Throw away all messages we have scheduled but never delivered
to the BSC.
2010-03-26 09:27:08 +01:00
Holger Hans Peter Freyther 6958065f85 nat: Switch downstream over to the write queue 2010-03-26 09:18:02 +01:00
Holger Hans Peter Freyther 097c82b2bc nat: Stop using the input/ipaccess.c method as it will write directly
We want to write everything through the write queue, it seemed the
easiest to copy the bytes here and feed the data into the bsc_write
method.
2010-03-26 07:41:54 +01:00
Holger Hans Peter Freyther abaeb3f55f nat: Make it clear where we want to send these methods 2010-03-26 07:26:18 +01:00
Holger Hans Peter Freyther f42e29c79c nat: Move one more area to the bsc_write method 2010-03-26 07:24:34 +01:00
Holger Hans Peter Freyther 3177580cc1 nat: Move BSC msg sending to a new method.
Move all writes into one place so we can switch to the
write queue more easily in the future.
2010-03-26 07:20:59 +01:00
Holger Hans Peter Freyther cbe77e1657 nat: Start using a write_queue for the BSC connection
We are still writing to the BSC directly and don't make real
use of this feature right now but we will need to do it.
2010-03-26 07:10:22 +01:00
Holger Hans Peter Freyther 3cedc4738f nat: Move MSC write to the write_queue and make it non blocking
Move the MSC code to a non blocking write.
2010-03-26 07:01:28 +01:00
Holger Hans Peter Freyther 0834fd9b85 nat: Rename variable from connection to listen
This is the socket we listen for incoming BSCs.
2010-03-26 06:51:04 +01:00
Holger Hans Peter Freyther 7b65c986eb bsc_msc_ip: Convert the MSC connection to the write queue
The SCCP stack was changed to give the ownership of the msgb
to the system integration, this allows us to use the stock write
queue to queue the write and write the msg to the MSC once we
are connected again.
2010-03-26 06:41:54 +01:00
Holger Hans Peter Freyther 17d751531e Merge branch 'on-waves/sccp' into on-waves/bsc-master 2010-03-26 05:49:34 +01:00
Holger Hans Peter Freyther 3c1221e2b2 sccp: Change the ownership of the msgb passed to the callback
Instead of deleting the msgb within the SCCP library the implementor
of the write callback needs to free it. This is required for non
blocking io with the server.
2010-03-26 05:44:21 +01:00
Harald Welte 92e9caed63 Merge commit '52b4abdcb351830f5493a50c4181ef3947f3feab' 2010-03-26 05:15:27 +01:00
Holger Hans Peter Freyther facb5cdfc2 channel requests: Add configuration to handle paging any with TCH
It is possible that the MSC is not sending the channel type it
needs for the operations it wants to do. Add a configuration option
to assign a TCH in case of paging any requests. It can be a good
idea to leave SDCCHs free for location updating requests.
2010-03-25 05:15:09 +01:00
Harald Welte e95daf1925 convert openbsc to use libosmocore-0.1.1 API
the 0.1.1 API is cleaned up and removes all exported global static
arrays (like rlm_cause_strs).  There are now proper accessor functions.
2010-03-25 12:13:02 +08:00
Harald Welte 52b4abdcb3 replace rsl_rlm_cause_strs with rsl_rlm_cause_name() 2010-03-25 12:11:38 +08:00
Harald Welte 5e6466780f current version needs exactly 0.1.0 version of libosmocore 2010-03-25 12:02:36 +08:00
Harald Welte 9eb6d88d64 replace gsm48_cc_msg_names[] with gsm48_cc_msg_name()
and implement the backend using value_string
2010-03-25 12:00:54 +08:00
Holger Hans Peter Freyther aebea482f5 channel request: Store the to be assigned channel type in the GSM Network
Store the mapping from request to channel type in the GSM Network
struct as there is some policy involved with handling the request.

E.g. in a half rate network we don't want emergy calls to be getting
a TCH/F, or we want to have a different policy for early/late assignment
of phone calls.

Update the table when creating the network and when the neci is changed.
2010-03-25 04:58:08 +01:00
Harald Welte e9e190a8d8 use more value_string in gsm48 and rsl 2010-03-25 11:46:46 +08:00
Harald Welte b59f9350f8 get_value_string(): return "unknown 0x..." instead of "unknown" 2010-03-25 11:46:46 +08:00
Harald Welte 92b1fe4c2d increase the use of 'struct value_string' in abis_nm and gsm_data 2010-03-25 11:45:30 +08:00
Holger Hans Peter Freyther 12f20d369c bsc_msc_ip: Add an option for the global log level 2010-03-25 03:01:24 +01:00
Holger Hans Peter Freyther 2008d3f54c Merge remote branch 'origin/master' into on-waves/bsc-master 2010-03-25 02:58:57 +01:00
Holger Hans Peter Freyther bb7bc1155f debug: Make the global target loglevel overwrite the category level
Together with the previos -e Number option one can easily turn on
debugging without needing to remember the category masks for a quick
check on what is going on.
2010-03-25 02:57:03 +01:00
Holger Hans Peter Freyther 009ad61dab bsc_hack: Add other known options to the list 2010-03-25 02:41:38 +01:00
Holger Hans Peter Freyther 829772d3c4 bsc_hack: Add option to set the global log level. 2010-03-25 02:39:15 +01:00
Holger Hans Peter Freyther a26ebe40f5 bssap: Allow to submit a SMS on the TCH
Similar to the bsc_rll.c code we need to indicate if we want to
send the data on the SACH or on the normal signalling link. For
CC and any other SAPI=0 usage this bits must be zero, whener we
try to do something with SMS this bit needs to be set to one.
2010-03-24 14:21:03 +01:00
Holger Hans Peter Freyther a52f1cacb3 Merge remote branch 'origin/master' into on-waves/bsc-master 2010-03-24 14:16:16 +01:00
Holger Hans Peter Freyther 9cc020ab21 rll_establish: When on a TCH always use the SACH for SAPI!=0
When we are on a TCH/H or TCH/F always use the SACH for SAPI!=0
for the establishment otherwise it will never be answered. This
can be tested by starting to page with a traffic channel and then
trying to submit the SMS.
2010-03-24 14:11:39 +01:00
Holger Hans Peter Freyther f5e71415a2 Merge remote branch 'origin/master' into on-waves/bsc-master 2010-03-24 11:23:01 +01:00
Holger Hans Peter Freyther edee7944a5 ipa: Fix the previous patch and initialize the fds to -1
The code in 354ef81d80 checked
for fd >= 0 but on startup the struct is memset to 0 so this
test is true. Initialize the fds to -1 to make the code work
and be able to handle all ranges of the fd.
2010-03-24 11:20:27 +01:00
Holger Hans Peter Freyther 82a8d6e393 Specify a release reason for the lchan
In case the put_lchan is making the refcount drop to zero use the
release reason specified in the put_lchan call. This is used by the
BSC MSC IP implementation for the assignment handling where the old
channel is getting closed with a local end release (1).
2010-03-24 10:45:07 +01:00
Holger Hans Peter Freyther 1226c93937 Fix DNAT debug.h definition and move it to the enum. 2010-03-24 10:30:37 +01:00
Holger Hans Peter Freyther b9c520f9b3 Merge remote branch 'origin/master' into on-waves/bsc-master
Keep a static version as the shell script is not dealing well
with branch tags/names containing text.

Resolve merge conflict in the Makefile.am by adding both sides
to the list of sources for the libbsc.a

Conflicts:
	openbsc/configure.in
	openbsc/src/Makefile.am
2010-03-24 10:28:43 +01:00
Holger Hans Peter Freyther 8a7ca57d3e bssap.c: Handle an assignment failure correctly
This method should return !0 in case of an failure so
we can send an assignment reject right away.
2010-03-24 10:27:04 +01:00
Holger Hans Peter Freyther f99f0930fd Move the version/copyright string to a separate file
It didn't really belong into the bsc_init.c... now we could
even easily autogenerate this file.
2010-03-24 10:24:38 +01:00
Holger Hans Peter Freyther 3e57388305 Make the compiler happy and use a puts 2010-03-24 10:21:00 +01:00
Holger Hans Peter Freyther 6552d0b596 Include bscconfig.h without ../ for the srcdir != build dir case 2010-03-24 10:20:27 +01:00
Holger Hans Peter Freyther a21a96f987 Move the copyright and version header to bsc_init.c
The copyright/version will be used from within the VTY code
which might be linked into binaries even when bsc_hack.c is
not linked into it.
2010-03-24 10:19:04 +01:00
Holger Hans Peter Freyther 29f9f9fc79 Bump the local version to 0.3.90 in preparation for a 0.4.0 release 2010-03-24 10:13:23 +01:00
Holger Hans Peter Freyther b3121c5b3f ipa: Handle corrupt incoming messages without crashing
Attempt to read the three byte IPA header. If we read 0 then
the socket can be closed otherwise we need to read three bytes, if
we don't we do have a failure.

After having parsed the header we need to evaluate the length,
if the length is bigger than would fit into our buffer we will
ignore that and print an error.

This is fixing a crash when the BTS is crashing...
2010-03-24 08:40:55 +01:00
Holger Hans Peter Freyther f5284ae1cf ipa: Reduce the throttling of the IPA msges
This code used to be a sleep, it was changed to be a timer by Andreas
but this timer does not seem to have any use. When doing the sw load
this timer is increasing the upload time dramatically, reduce it to
make it work faster.
2010-03-24 08:33:22 +01:00