Commit Graph

5124 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther c15c61c401 sgsn: Add VTY configuration for the CDR module
Make it possible to set a filename to use for the CDR. By
default no CDR will be generated. Forbid to set the interval
of 0 seconds as this will cause a lot of work. Add a very
basic VTY test.
2015-05-06 17:46:08 +02:00
Holger Hans Peter Freyther 4f5b8237ec sgsn: Create an initial and limited CDR module
This is consuming the new signals and allows to install several
different CDR/observing/event/audit modules in the future. For
getting the bytes in/out the code would have had to undo what the
rate counter is doing and at the same time adding a "total" to
the ratecounter didn't look like a good idea, the same went for
making it a plain counter.

Begin writing the values one by one and open/closing a new FILE
for every log messages. This is not efficient but easily deals
with external truncation/rotation of the file (no fstat for and
checking the links and size). As usual we will wait and see if
this is an issue.

Add some new members to our PDP context structure to see what it
is about.
2015-05-06 17:43:15 +02:00
Holger Hans Peter Freyther b100895557 sgsn: Add various signals consumed by CDR or other client code 2015-05-06 17:14:51 +02:00
Holger Hans Peter Freyther 20de3ae17c sgsn: Extract the MSISDN from the subscr data structure
In case there is a subscr attached to the MM context and there
is an encoded MSISDN we will attempt to decode it and in case
of an international number prepend a '+'. Assume that the array
size of gsm_mmcc_called->number is as big as ctx->msisdn for the
strncpy.
2015-05-06 17:14:51 +02:00
Holger Hans Peter Freyther b448dd849a sgsn: Make the free function internal
All calls should and do go through the
sgsn_mm_ctx_cleanup_free function.
2015-05-06 17:14:51 +02:00
Holger Hans Peter Freyther 4c8e8f990a Merge branch 'zecke/features/gprs-gsup-fixes'
When communicating with a GGSN that is not the OpenGGSN
the PDP context activation does fail. This is because on
the activation of the first PDP context we need to supply
a MSISDN. Extend the protocol, parse the MSISDN and then
send it to the GGSN. The second item is that we have only
forwarded the requested QoS of the subscriber. In most
cases this is 0x0, 0x0, ... which means one requests a
rate 0 byte/sec which the GGSN will not allow. Make it
possible to receive, store and use the subscribed QoS of
the Subscriber.
2015-05-05 21:16:19 +02:00
Holger Hans Peter Freyther d05e06989d sgsn: Show the QoS that has been assigned 2015-05-05 21:15:55 +02:00
Holger Hans Peter Freyther f7b3826f03 sgsn: Dump the E164 (encoded) assigned to the subscriber 2015-05-05 21:15:44 +02:00
Holger Hans Peter Freyther 4bd931f96d sgsn: Handle different levels of QoS
If QoS is only three bytes it does not include the allocation/
retention policy. Otherwise it does. Copy it depending on that.
We should have a macro for the clamping to reduce code duplication.

The insanity does come from the MAP data and this seems to be
the easiest in terms of complexity. It is an array of bytes that
is transported from MAPProxy to the SGSN and then simply forwarded.

The case of more than three bytes is neither unit nor manually
tested so far.
2015-05-05 21:15:20 +02:00
Holger Hans Peter Freyther 8cedded88c sgsn: Store subscribed QoS and attempt to use it
sgsn_create_pdp_ctx should use the subscribed QoS. When selecting
the PDP context we inject the QoS to be used into the TLV structure
and use it during the request. Assume a "qos-Subscribed" structure
only with three bytes and prepend the Allocation/Retention policy
to the request.
2015-05-05 21:11:16 +02:00
Holger Hans Peter Freyther 9ba273d365 sgsn: Copy the msisdn to the sgsn_data and use it in PDP activation
The MSISDN should be present for "security" reasons in the first
activation of a PDP context. Take the encoded MSISDN, store it for
future use and then put it into the PDP activation request.

The MM Context contains a field for a decoded MSISDN already. As
we need to forward the data to the GGSN I want to avoid having to
store TON and NPI in another place. Simply store the data in the
encoded form.
2015-05-05 21:09:53 +02:00
Holger Hans Peter Freyther 49c1a7156c gsup: Extract the QoS field
Add roundtrip test for the new QoS IE. It will be consumed in
later commits.
2015-05-05 21:09:20 +02:00
Holger Hans Peter Freyther b927f1c319 gsup: Extract the new MSISDN string
Extract the new MSISDN IE from the GSUP message and verify that
it is read/written to the message.
2015-05-05 21:08:00 +02:00
Holger Hans Peter Freyther 02d8c472bd gsup: Specify the QoS service for the PDP info
QoS is a mess. In MAP there is qos-Subscribed which is then extended
using ext-QoS-Subscribed, ext2-QoS-Subscribed, ext3-QoS-Subscribed
and maybe even ext4-QoS-Subscribed by now. The MAP ASN1 files defined
how these need to be "linearized". Instead of copying this I have
decided to include the two semantics with/without the Allocation/Retention
policy using the size of the data.
2015-05-05 21:05:25 +02:00
Holger Hans Peter Freyther e448554568 gsup: Document passing MSISDN as part of the response
When asking the GGSN to create/open a PDP context one needs
to send a MSISDN. The MSISDN can only be provided through the
GSUP interface.
2015-05-05 20:57:32 +02:00
Holger Hans Peter Freyther 337343d159 Merge branch 'zecke/features/acc-list'
Integrate the change and see how it is going. The unit tests
for the NAT look good so we might not have regressions.
2015-05-03 22:34:16 +02:00
Holger Hans Peter Freyther d26b8fcbe2 bsc: Send a LU Reject in case it has been filtered
In case we filter the request and it was a Location Updating
Procedure we should reject it.
2015-05-03 22:33:35 +02:00
Holger Hans Peter Freyther ec0cb7c64d bsc: Add access list filtering to the BSC 2015-05-03 22:33:35 +02:00
Holger Hans Peter Freyther d6332809d8 bsc: Add access lists to the MSC and the BSC
It is a bit arbitary to decide which one is the global
and which one is the local one. We might change it around.
I don't think we want to introduce it based on BTS.
2015-05-03 22:32:43 +02:00
Holger Hans Peter Freyther c652913674 filter: Move the con_type into the filter_state 2015-05-03 22:09:02 +02:00
Holger Hans Peter Freyther 06a88fa0ae filter: Move from DNAT to DFILTER category 2015-05-03 22:03:39 +02:00
Holger Hans Peter Freyther 4e8176d0c9 filter: Remove bsc_connection from the filter API
Remove the last occurence of NAT datastructures in the filtering
module and add the ctx to the filter request structure.
2015-05-03 22:01:46 +02:00
Holger Hans Peter Freyther c09f8a3b7f filter: Remove nat_sccp_connection from public API 2015-05-03 21:59:29 +02:00
Holger Hans Peter Freyther 81dbfe412c filter: Remove the bsc_connection from the internal functions 2015-05-03 21:42:29 +02:00
Holger Hans Peter Freyther 71857d7242 filter: Put all the parameters in a struct to avoid order issues
With the "local" and "global" list name we might pick the
wrong argument. Avoid it by passing them as a struct.
2015-05-03 21:42:28 +02:00
Holger Hans Peter Freyther a0478814bc filter: Remove NAT knowledge from auth_imsi
Push back the parameters we need to pass. auth_imsi doesn't
know anything about the nat now.
2015-05-03 21:42:28 +02:00
Holger Hans Peter Freyther 4ba947bf4b filter: Separate SCCP/BSSAP extraction and gsm48 code
For the BSC we will have the gsm48_hdr and don't need to
find data within SCCP. For legacy reasons we need to
initialize con_type, imsi, reject causes early on and
need to do the same in the filter method.
2015-05-03 21:42:28 +02:00
Holger Hans Peter Freyther c36a6d5705 filter: More renaming and remove of "NAT" from it 2015-05-03 21:42:28 +02:00
Holger Hans Peter Freyther 14b2cd9f32 filter: Rename BSC to LOCAL and NAT to GLOBAL 2015-05-03 21:42:28 +02:00
Holger Hans Peter Freyther a1e6bd6768 filter: Remove nat from bsc_nat_acc_lst and replace with msg 2015-05-03 21:42:28 +02:00
Holger Hans Peter Freyther d7e04b9956 filter: Cease out "struct bsc_nat" from the API
This means we need to require a talloc context and
simply operate on the list. I had considered creating
a structure to hold the list head but I didn't find
any other members so omitted it for now.
2015-05-03 21:42:28 +02:00
Holger Hans Peter Freyther d04d009f47 filter: Move VTY code into the filter module 2015-05-03 21:42:28 +02:00
Holger Hans Peter Freyther 4579bb1ed7 filter: Move the access list management around 2015-05-03 21:42:27 +02:00
Holger Hans Peter Freyther 973dbaeebd filter: Move the method definition to the filter module
Move the filter methods to the filter module. This is
still only usable for the NAT and the _dt/_cr filter
routines need to move back to the bsc_nat in the long
run.
2015-05-03 21:42:27 +02:00
Holger Hans Peter Freyther 4247cead2b filter: Move the gsm 04.08 filter to a common place
For customer requirements we want to be able to do
filtering on the BSC as well. The same messages need
to be scanned and the same access-lists will be looked
at. In the future we might even split traffic based
on the IMSI. Begin with moving the code to a new top
level directory and then renaming and removing the
nat dependency.
2015-05-03 21:42:27 +02:00
Holger Hans Peter Freyther 38159428d2 mgcp: Fix compiler warning on 64bit builds
ENDPOINT_NUMBER takes the difference of two pointers. On 64bit
builds the difference is a long and the compiler then complains
about the usage of abs. We will never have thousands of endpoints
so silence the warning by casting the ENDPOINT_NUMBER to int.

mgcp_vty.c:1381:34: warning: absolute value function 'abs' given an argument of type 'long' but has parameter of
      type 'int' which may cause truncation of value [-Wabsolute-value]
                        rtp_port = rtp_calculate_port(ENDPOINT_NUMBER(endp),
                                                      ^
../../include/openbsc/mgcp_internal.h:206:31: note: expanded from macro 'ENDPOINT_NUMBER'
 #define ENDPOINT_NUMBER(endp) abs(endp - endp->tcfg->endpoints)
                              ^
mgcp_vty.c:1381:34: note: use function 'labs' instead
2015-05-02 10:02:38 +02:00
Holger Hans Peter Freyther 4a8b938348 Merge branch 'zecke/features/no-queue'
Let's get bigger exposure of the new implementation
2015-04-29 18:53:40 +02:00
Holger Hans Peter Freyther d6d7affa6e sub: Remove the queue from the subscriber code
The idea of "subscriber_get_channel" was that different
requests would be coordinated. At the same time we have
seen that the "queue" can get stuck at both 31C3 and the
rhizomatica installations.

Voice calls and SMS do not need coordination. We should
be able to send SMS on a voice channel and switch the MS
from a SDCCH to a TCH in case we establish a voice call.
The SMS code itself needs to coordinate to obey the limit
of one SMS per direction but this should be enforced in
the sms layer and not on the subscriber.

Modify the code to have a simple paging coordination. The
subscriber code will schedule the paging and register who
would like to know about success/failure.

This allowed to greatly simplify the paging response
handling for the transaction code (and in fact we could
move the transaction list into the subscriber structure
now). The code gained to support to cancel the notification
of a request (but not the paging itself yet).

TODO: Cancel paging request in case no one cares about it
anymore.
2015-04-29 18:53:28 +02:00
Holger Hans Peter Freyther 0759b1b952 sub: Remove introspection of the "channel queue"
Over the next commits the queuing of commits will be
completely modified to remove the queue and move the
scheduling/limits to the outer callers.
2015-04-29 18:53:27 +02:00
Holger Hans Peter Freyther 0ae564d9b1 sub: Remove paging requests before dispatching
The dispatching might lead to the removal of more
paging requests and makes "request" invalid. Remove
it before calling the callback.
2015-04-29 18:53:27 +02:00
Holger Hans Peter Freyther 1e28eb83c0 mncc: Select the codec similar to the modify handling
In case the default TCH/F codec is "EFR" and we do an early
assignment from SDCCH to a TCH we would assign the TCH/H
codec. This is because the lchan_type will be neither a
TCH/H nor a TCH/F.

At the same time the _gsm48_lchan_modify code to check for
half vs. full-rate is the other way around. Align both.

It is full-rate if it is not a TCH_H. This will have some
other complications down the way (early assignment on
cells with only TCH/H). So the mode should not depend on
the _current_ channel but the kind of channel we want.
2015-04-29 18:53:27 +02:00
Holger Hans Peter Freyther b396b69cb2 debian: Do not depend on shared libraries directly
The debian shlibs:depends macro will add the depends
according to the needed libraries for us. We only need
this for the sqlite3 plugin of libdbi-drivers as there
is no direct linkage.
2015-04-29 18:53:08 +02:00
Jacob Erlbeck ddc0e05604 mgcp/test: Fix mgcp-transcoding assertion (Coverity)
In test_rtp_seq_state an assignment is accidently done within an
assertion.

This commit changes that into a comparison as it was intended.

Fixes: Coverity CID 1295457, 1295458
Sponsored-by: On-Waves ehf
2015-04-29 14:02:40 +02:00
Jacob Erlbeck 5a2484b10e mgcp: Move assignment of src_codec downwards
Currently the src_codec const variable is set to &src_end->codec
before src_end is checked against NULL. Since the assigment is just
an address operation and the memory where it points to is only
accessed after the NULL check, this does not harm technically.
Nevertheless this is potential source for errors if that code is
changed.

This commit moves the definition below the NULL check. This does not
comply with the coding style, but it cannot be split into definition
and a later assignment due to the const qualifier.

Sponsored-by: On-Waves ehf
2015-04-28 09:40:40 +02:00
Holger Hans Peter Freyther cb43a9ac44 mgcp: Allow to disable transcoding for trunks
We might have compiled transcoding into the MGW but
we don't want to enable it for a given user. Add a new
switch that should allow that.

I had manually tested the allow-transcoding/no allow
VTY interface for the primary interface and a new trunk
using show running-config.
2015-04-24 16:10:54 -04:00
Holger Hans Peter Freyther c57b5507b2 mgcp: Ignore the case for finding a codec
It is unlikely that GSM, gsm and GsM refer to different codecs.
The mera mvts does send the audio codecs in lower case even if
RFC 3551 has them in upper case (but copy and paste is sometimes
too hard).
2015-04-24 15:07:20 -04:00
Holger Hans Peter Freyther 7f100c9712 nat: Make mode-set patching optional 2015-04-23 20:27:30 -04:00
Holger Hans Peter Freyther d4b03187c6 sgsn/gtp: Fill out the optional RAT type
Assume we are always a GERAN network right now.
2015-04-23 17:01:17 -04:00
Holger Hans Peter Freyther 8e6ecc9667 misc: Fix warnings about size of size_t in printf
Fixes warnings like:

warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Wformat]
2015-04-23 17:01:09 -04:00
Holger Hans Peter Freyther adc17268fc debian: meas2pcap requires libpcap-dev unconditionally 2015-04-23 17:01:03 -04:00