Commit Graph

140 Commits

Author SHA1 Message Date
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 1f8276e588 nat: Introduce a global IMSI barr list using red-black trees 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 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 98da544992 nat: Move the ctrl handling code into a separate file
Move to the control command handling out of the main file into
a dedicated module. There are still some calls embedded into the
main code but it will be moved soon.
2012-11-12 10:49:10 +01:00
Daniel Willmann 6fc4a98fc5 libctrl: Change controlif_setup so it returns the ctrl handle
nat: Catch up with controlif_setup API change
We now save a control handle reference in the nat
osmo-bsc: Catch up with controlif_setup API change
We now save a control handle reference in the gsm network
2012-09-11 12:52:23 +02:00
Holger Hans Peter Freyther 8e60f629e2 nat: Prepare to rewrite the TP-DA number of a SMS submit.
Introduce number rewriting of SMS-SUBMIT. Introduce a new list,
move code around to help with finding a new number, somehow the
number encoding for TP-DA is borked, 03.40 references 04.11 but
the length appears to be strlen(number) without taken the type
field into account.
2012-01-18 20:14:58 +01:00
Holger Hans Peter Freyther 68368dd99a nat: Implement clearing of TP-SRR flags from TPDUs
Match IMSI and destination address against a set of entries, if it
is matching the header will be modified and no sender report will be
requested. Change the test case to request the sender report and then
verify that this bit is reset to 0.
2012-01-10 22:45:24 +01:00
Holger Hans Peter Freyther 06c9da6c22 misc: Move the bsc_parse_reg to libcommom and name it gsm_parse_reg
Move the regexp parsing code from the NAT to libcommon as it will
be used by the NAT and BSC code. This also adds the #include <regex.h>
include to gsm_data. This header should be split up.
2011-08-22 18:21:33 +02:00
Daniel Willmann a86bc39cc9 nat: Use libctrl and add command forwarding to osmo-bsc
Passes commands beginning with "bsc.<num>" to the bsc that is
responsible for LAC <num>.
2011-07-13 14:07:11 +02:00
Holger Hans Peter Freyther acc4031cf5 nat: Look into the TPDU/SMS-SUBMIT and use the TP-DestAddress for matches
Match the used SMSC and the destination of the SMS and change
the SMSC address if both are matched.
2011-06-01 20:45:12 +02:00
Holger Hans Peter Freyther 9c20571280 nat: Patch the destination SMS address of a message
Use the same filtering infrasturcture to patch the SMSC
address in a CP-DATA/RP-DATA message. Add a very simple
testcase for this code.
2011-06-01 20:45:03 +02:00
Holger Hans Peter Freyther df8e6e9e4a nat: Prepare to patch more than the CC Setup message
Refactor the code to allow having different handlers. The goal
is to be able to patch some SMS messages too.
2011-06-01 20:41:30 +02:00
Holger Hans Peter Freyther ad75eababc nat: Allow to have a regexp to match the MSISDN
The idea that MCC and MNC is enough to classify a subscriber
turns out to be wrong. Certain operatos license a number range
of IMSIs to others. When we see a '^' in the MCC field we treat
it as a regexp. The code now turns the MCC/MNC into a regexp
for the IMSI. It is not using extended POSIX regexp to match
the behavior of the access list.
2011-06-01 20:40:35 +02:00
Pablo Neira Ayuso ab46cf38d4 src: rename msg_entr* to osmo_config_*
Summary of changes:

s/msg_entry_parse/osmo_config_list_parse/g
s/msg_entry/osmo_config_entry/g
s/msg_entries/osmo_config_list/g
2011-05-07 13:15:11 +02:00
Pablo Neira Ayuso dfb342c19a src: use namespace prefix osmo_counter*
Summary of changes:

s/struct counter/struct osmo_counter/g
s/counter_inc/osmo_counter_inc/g
s/counter_get/osmo_counter_get/g
s/counter_reset/osmo_counter_reset/g
s/counter_alloc/osmo_counter_alloc/g
s/counter_free/osmo_counter_free
2011-05-06 12:14:16 +02:00
Pablo Neira Ayuso e1273b1f3c src: use namespace prefix osmo_wqueue*
Summary of changes:

s/struct write_queue/struct osmo_wqueue/g
s/write_queue_init/osmo_wqueue_init/g
s/write_queue_clear/osmo_wqueue_clear/g
s/write_queue_enqueue/osmo_wqueue_enqueue/g
s/write_queue_bfd_cb/osmo_wqueue_bfd_cb/g
2011-05-06 12:12:49 +02:00
Pablo Neira Ayuso 4db9299286 src: use namespace prefix osmo_fd* and osmo_select*
Summary of changes:

s/struct bsc_fd/struct osmo_fd/g
s/bsc_register_fd/osmo_fd_register/g
s/bsc_unregister_fd/osmo_fd_unregister/g
s/bsc_select_main/osmo_select_main/g
2011-05-06 12:11:23 +02:00
Pablo Neira Ayuso bf540cb7c3 src: use namespace prefix osmo_timer* for timer functions
Summary of changes:

s/struct timer_list/struct osmo_timer_list/g
s/bsc_add_timer/osmo_timer_add/g
s/bsc_schedule_timer/osmo_timer_schedule/g
s/bsc_del_timer/osmo_timer_del/g
s/bsc_timer_pending/osmo_timer_pending/g
s/bsc_nearest_timer/osmo_timers_nearest/g
s/bsc_prepare_timers/osmo_timers_prepare/g
s/bsc_update_timers/osmo_timers_update/g
s/bsc_timer_check/osmo_timers_check/g
2011-05-06 12:11:06 +02:00
Holger Hans Peter Freyther 6860c44071 nat: Create a Paging Group that BSCs can refer to
Introduce a paging group that a BSC can refer to and is used
during the LAC lookup. This way paging can be flooded through
the network and just filtered at the last element in the core.
2011-05-02 19:19:15 +02:00
Holger Hans Peter Freyther 474698abef nat: Introduce the concept of a paging group and use it
A paging group is a list of LACs, different BSCs can point
to a paging group and use it for the LAC lookup.
2011-05-02 19:19:15 +02:00
Holger Hans Peter Freyther 1ffe98c175 nat: Rewrite the paging handling.
The current code tries to find _one_ bsc for a paging message
and then continues. The new code will try to find multiple BSCs
for each LAC. This is done in preparation of having two BSCs
handle the same LAC. This code right now is O(m*n) but it will
be worse once paging groups are landed.
The code to test the function was reduced to just test the lac
lookup code as the other part can not be tested in a standalone
setup anymore.
2011-05-02 19:19:15 +02:00
Holger Hans Peter Freyther e188010512 bsc: Allow to have a list of MSCs/MUXs to connect to
Be able to configure a list of destinations (duplicates allowed)
that will be tried in a round robin fashion. The change is in
the bsc_msc_connection to operate on a list. We achieve the
round robin nature with the same trick used in the paging code
to delete and append the current entry. The nat code was updated
to compile but one can only configure one destination.
2011-04-26 09:36:19 +02:00
Holger Hans Peter Freyther de2b860dff nat: Introduce a block on the NAT to slowly get rid of BSCs
For restarting the NAT we can now block it, it will not accept
new connections and for existing connections it will attempt
to drop them over time. A blocked NAT will end up with no BSC
connections left and then can be safely restarted.
2011-04-26 09:33:47 +02:00
Holger Hans Peter Freyther 91b9a45be4 nat: Inform the USSD Provider about lost connections 2011-04-18 17:32:40 +02:00
Holger Hans Peter Freyther e5d324981d nat: Remove magic numbers, use enum values for conn classification
Remove the usage of 0, 1, 2 and start using enum values. We can
still assume con_local is a number.
2011-04-18 17:32:38 +02:00
Holger Hans Peter Freyther a8a09df6a6 misc: Remove sys/types.h includes from the files
These are not needed any more. We used them for u_int
types but we now use uint which comes from stdint.h
2011-04-18 17:31:39 +02:00
Holger Hans Peter Freyther 4c9557ef24 nat: Bail out if the regexp fails to compile and avoid a crash
If the regexp fails to compile the internal dfa is NULL and a
regexec will crash nicely. Fail and free the string if the regexp
fails to compile.
2011-04-04 19:19:26 +02:00
Holger Hans Peter Freyther a18b11602c nat: Make the USSD number matching a regexp
This allows to match multiple numbers and multiple patterns
2011-04-01 17:32:21 +02:00
Pablo Neira Ayuso 136f453dd2 src: use new library libosmogsm and new path to headers in libosmocore
libosmogsm is a new library that is distributed in the libosmocore.
Now, openbsc depends on it. This patch gets openbsc with this
change.

This patch also rewrites all include path to the new
osmocom/[gsm|core]

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-03-23 18:17:56 +01:00
Holger Hans Peter Freyther 9212d9d636 nat: Fix some corruption in the test case 2011-02-27 11:18:41 +01:00
Holger Hans Peter Freyther 9ec030d32d nat: Change number of multiplexes to the max-endpoints 2011-02-27 11:05:18 +01:00
Holger Hans Peter Freyther a9e9331285 nat: Allocate endpoints from multiple multiplexes.
This code allocates endpoints from multiple multiplexes but
will always leave 0x0 and 0x1f unassigned in the multiplex.
2011-02-26 11:38:00 +01:00
Holger Hans Peter Freyther 7b07b2dcff nat: Start making the number of multiplexes configurable
Introduce a VTY setting that right now needs to be set to
one. To make updating this setting possible we will now store
the number of endpoints in the bsc connection as well.
2011-02-26 10:42:01 +01:00
Holger Hans Peter Freyther ed500e3877 nat: Allocate the endpoint status dynamically
Allocate the status for an endpoint dynamically. We will support
BSCs with different amount of multiplexes and need to have this
flexibility in the future. Add the proper null checks to the
current users of this code.
2011-02-26 10:35:33 +01:00
Harald Welte 9af6ddfcec License change: We are now AGPLv3+ instead of GPLv2+
The reason for this is quite simple: We want to make sure anyone
running a customized version of OpenBSC to operate a network will
have to release all custom modifiations to the source code.
2011-01-01 15:39:34 +01:00
Holger Hans Peter Freyther 732d9c19bf Merge branch 'zecke/number-rewrite' 2010-10-27 12:41:19 +02:00
Holger Hans Peter Freyther 54f5352e07 nat: Close SCCP connections when the USSD Provider is closed.
Send a RLSD down to the BSC in case the USSD Provider is gone. It
is not sending a Clear Command and ut depends if the BS+ will
like this kind of behavior. At least the data on the NAT will
be freed soon afterwards due the RLC message.
2010-10-27 11:01:55 +02:00
Holger Hans Peter Freyther 73bbf89245 nat: Implement rewriting, have a very basic test for that feature 2010-10-27 10:40:44 +02:00
Holger Hans Peter Freyther a914daf174 nat: Add hook for rewriting a setup message
Create a new function, hand the data to this function, take back
a possible modified msgb and invalidate parsed at this point.
2010-10-27 10:40:44 +02:00
Holger Hans Peter Freyther 76424392e0 nat: Add vty option for number rewriting
Parse a msg file in case we do have a list.
2010-10-27 10:40:43 +02:00
Holger Hans Peter Freyther c16c2dc5d3 nat: Implement accepting a USSD Provider connection, do authentication 2010-10-25 21:06:03 +02:00
Holger Hans Peter Freyther e393f273e7 nat: Keep a ussd token in the config
We will have the USSD provider connecting to us and we
will use the IPA protocol, including the auth mechanism.
2010-10-25 21:04:46 +02:00
Holger Hans Peter Freyther c1578bc747 nat: Add an option to set the query string to match
Allow the query string to be set. The ussd matching code
will check for this string and then forward it to the bypass.
2010-10-25 21:04:46 +02:00
Holger Hans Peter Freyther c1cac1e31a nat: Make the imsi checking function public.
We will use this method in the USSD module to check if the
IMSI should be handled for USSD queries.
2010-10-25 21:04:45 +02:00
Holger Hans Peter Freyther d1effd835f nat: Provide a USSD access list to check for which to play HLR. 2010-10-25 21:04:45 +02:00
Holger Hans Peter Freyther 17870cf533 nat: Create a USSD module to filter out USSDs... 2010-10-25 21:04:45 +02:00
Holger Hans Peter Freyther 74dc303134 nat: Introduce a new connection type for Supplementary Services
If we have a CM Service Request we will look into the message
to see if it is a Supplementary Service Activation.
2010-10-25 21:04:44 +02:00
Holger Hans Peter Freyther a3967579f8 nat: Move the DTAP unpacking into a new method
DTAP unpacking will be used by the USSD checking code
2010-10-21 12:23:27 +02:00