aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs
AgeCommit message (Collapse)AuthorFilesLines
2015-11-16gtphub: don't always try to do GGSN resolution.Neels Hofmeyr2-29/+8
If a GGSN is already known from unmapping, don't invoke a host resolution. In a live working environment, it wouldn't hurt, because the lookups would mostly return from the cache. But in a testing environment without a name server, it barfs on every packet. Sponsored-by: On-Waves ehi
2015-11-16gtphub: fix numerous segfaults, and other stupidities.Neels Hofmeyr2-6/+7
Initialize llist_heads to empty (2 were missing). Move those for struct gtphub instances to gtphub_zero() (one moved, one added). In from_[gs]gsns_read_cb(), use a return type that can actually reflect negative return values. resolved_addr.buf: no need to take the address of a byte array var (cosmetic). Pass the proper user data address to sgsn_ares_query(), not the address of the pointer holding the user data address. Initialize ggsn_lookup->expiry_entry (was missing). Publish the function for that in gtphub.h so gtphub_ext.c can use it. Sponsored-by: On-Waves ehi
2015-11-16gtphub: Add logging for ares queries.Neels Hofmeyr2-15/+28
Looking for a segfault, I added a lot of logging. This may be useful for live testing ares, leaving it in there for now. Note: I still want to clean up the logging concerning log levels etc. once we're out of alpha. Sponsored-by: On-Waves ehi
2015-11-16gtphub: fix handling of sender from nonstandard port.Neels Hofmeyr1-3/+35
Allow a peer sending from an unknown port but a known address, and just create the port (and unmap the seq nr back to this port later to return the response to the sender). Only an SGSN on the Ctrl plane is allowed to make the very first contact from an unknown address. Sponsored-by: On-Waves ehi
2015-11-16gtphub: fix User plane decoding, add unit test.Neels Hofmeyr1-16/+37
Split decoding return code GTP_RC_PDU in GTP_RC_PDU_C and GTP_RC_PDU_U. Don't do IEs in GTP_RC_PDU_U. Add a unit test for User plane data, expected to fail (nonstandard port case). In gtphub_test.c, tweak logging so that it is easily visible which test produced which output. Also add the global resolved_sgsn_addr and ggsn_sender, symmetrically to resolved_ggsn_add and sgsn_sender. Sponsored-by: On-Waves ehi
2015-11-16gtphub: make test code reusable for future tests.Neels Hofmeyr1-2/+0
Generalize to make the PDP ctx message definitions and "sending" of messages from SGSN->gtphub->GGSN and back reusable in future tests. Publish gsn_addr_from_sockaddr() in gtphub.h for use in gtphub_test.c. Use an osmo_sockaddr for resolved_ggsn_addr, because one is needed for comparison in probably every future test. Add LVL2_ASSERT() to print assertion message and return instead of abort, so that functions can be called from several tests without losing the info of which test caused it from which line. Use globals for struct gtphub and time_t now, to reduce nr of args that need to be passed around when writing tests. Add a default test setup function. Sponsored-by: On-Waves ehi
2015-11-16gtphub: add/fix IMSI and APN IE error handlingNeels Hofmeyr2-22/+72
Sponsored-by: On-Waves ehi
2015-11-16gtphub: fix Echo behavior: respond directly.Neels Hofmeyr1-27/+59
Up to now I used the Echo as a test for sequence nr mappings. But Echos should be handled differently: they are scoped on the link and an Echo response should be sent right back to the requester. Sponsored-by: On-Waves ehi
2015-11-16gtphub: add first bits of GRX aresNeels Hofmeyr5-85/+255
For the resolving function, change the function signature to return a gtphub_peer_port. In consequence, publish two functions concerned with gtphub_peer_port instances for use in test and gtphub_ext.c. Add GGSN resolution queue, callback and cache. Simple implementation: if an SGSN asks for a GGSN, it will first get no answer, and I hope it will ask again once the GGSN is in the cache. Within gtphub_ext.c, have a dummy sgsn struct, as the sgsn_ares code currently depends on it (half the functions pass an sgsn instance pointer around, but the other half use the global one). In the unit tests, wrap away the ares initialization so that they can work without a DNS server around. The netcat test breaks because of this, will remove it. Using sgsn_ares, implement the gtphub_resolve_ggsn_addr() function, I hope: untested. Minor cosmetics just to see if you're paying attention... ;) Sponsored-by: On-Waves ehi
2015-11-16Add GTP hub initial code base.Neels Hofmeyr5-0/+2684
First steps towards a new GTP hub. The aim is to mux GTP connections, so that multiple SGSN <--> GGSN links can pass through a single point. Background: allow having more than one SGSN, possibly in various remote locations. The recent addition of OAP to GSUP is related to the same background idea. (This is a collapsed patch of various changes that do not make sense to review in chronological order anymore, since a lot of it has thorougly transmorphed after it was first committed.) Sponsored-by: On-Waves ehf
2015-11-10sgsn_vty.c: fix typoNeels Hofmeyr1-1/+1
2015-11-10gbproxy: Count more GSM 04.08 messagesHolger Hans Peter Freyther2-0/+62
Extend the ul/dl counting to count the usual messages on the Gb interface. Add counters for the attach, routing area update, pdp context activation and deactivation procedures. Update the test result with the new counters.
2015-11-02stats: Set class_id in rate_ctr group descriptionsJacob Erlbeck3-0/+7
This commit adds the class_id initialiser to all rate_ctr_group_desc definitions. Sponsored-by: On-Waves ehf
2015-11-02stats: Enable stats for sgsn, gbproxy, nitb, bsc, natJacob Erlbeck2-1/+9
This commit initialises and enables the stats subsystem for the given binaries. Sponsored-by: On-Waves ehf
2015-11-02oap: add OAP config to VTYNeels Hofmeyr1-0/+91
Sponsored-by: On-Waves ehf
2015-11-02gsup/oap: add OAP to GSUP client.Neels Hofmeyr2-7/+51
Trigger an OAP registration upon IPA connect. Feed incoming OAP messages to oap_handle() and send replies returned by it. Add oap_config to sgsn_config (todo: vty). Sponsored-by: On-Waves ehf [hfreyther: Fix coding style]
2015-11-02oap: implement initial OAP API.Neels Hofmeyr3-1/+436
Add oap.[hc] and oap_messages.[hc]. Sponsored-by: On-Waves ehf
2015-11-02libcommon: soak up three static functions.Neels Hofmeyr1-29/+1
Add new kitchen sink openbsc/utils.h and libcommon/utils.c to make three so far static functions public (so I can use them in the upcoming OAP code). A place to put them could have been the gprs_utils.h, but all general functions in there have a gprs_ prefix, and todo markings to move them away. All other libcommon headers are too specific, so I opened up this kitchen sink header. Replace the implementation of encode_big_endian() with a call to osmo_store64be_ext(). See comments. Apply the change in Makefiles and C files.
2015-11-02sgsn: Fix up the VTY doc stringsHolger Hans Peter Freyther1-2/+2
The documentation needs to end with a \n and T3316 needs to have some text. I think it is the T3316 timer that has no action on the network side. <command id='timer t3312 &lt;0-65535&gt;'> <param name='&lt;0-65535&gt;' doc='(null)' /> Documentation error (missing docs): <command id='timer t3322 &lt;0-65535&gt;'> <param name='&lt;0-65535&gt;' doc='(null)' /> Documentation error (missing docs): <command id='timer t3350 &lt;0-65535&gt;'> <param name='&lt;0-65535&gt;' doc='(null)' /> Documentation error (missing docs): <command id='timer t3360 &lt;0-65535&gt;'> <param name='&lt;0-65535&gt;' doc='(null)' /> Documentation error (missing docs): <command id='timer t3370 &lt;0-65535&gt;'> <param name='&lt;0-65535&gt;' doc='(null)' /> Documentation error (missing docs): <command id='timer t3313 &lt;0-65535&gt;'> <param name='&lt;0-65535&gt;' doc='(null)' /> Documentation error (missing docs): <command id='timer t3314 &lt;0-65535&gt;'> <param name='&lt;0-65535&gt;' doc='(null)' /> Documentation error (missing docs): <command id='timer t3316 &lt;0-65535&gt;'> <param name='&lt;0-65535&gt;' doc='(null)' /> Documentation error (missing docs): <command id='timer t3385 &lt;0-65535&gt;'> <param name='&lt;0-65535&gt;' doc='(null)' /> Documentation error (missing docs): <command id='timer t3386 &lt;0-65535&gt;'> <param name='&lt;0-65535&gt;' doc='(null)' /> Documentation error (missing docs): <command id='timer t3395 &lt;0-65535&gt;'> <param name='&lt;0-65535&gt;' doc='(null)' /> Documentation error (missing docs): <command id='timer t3397 &lt;0-65535&gt;'> <param name='&lt;0-65535&gt;' doc='(null)' />
2015-10-29SGSN: Fix typo in VTY license statement.Harald Welte1-1/+1
It mentioned AGPLv3+ and refers to the hyperlink of v3, but still stated "Version 2 or later". That was a typo at the time.
2015-10-13gprs/gb_proxy: Use RAND_bytes for gbproxy TLLI/TMSI allocationDaniel Willmann2-6/+14
This change has some implications for the test case. It manipulated bss_ptmsi_state and sgsn_tlli_state variables to make the output of rand_r() and thus the TLLI/TMSI used predictable. This possibility is gone when using RAND_bytes() so instead it is overridden by a function that returns a deterministic sequence of values (0x00dead00, 0x00dead01, ...). The test cases are adapted to expect these values instead of the pseudo random values before. The gbproxy_test stdout file changes as well, but only where the TLLI/TMSI is displayed (in the hex dumps as well as the TLLI cache entries). All other output is the same.
2015-10-13gprs: Use RAND_bytes for p-tmsiDaniel Willmann2-2/+7
[hfreyther: Link to libcrypto, include header, add uint8_t* cast]
2015-10-12sgsn: Fix pattern for too long msisdnHolger Hans Peter Freyther1-1/+1
We don't care how many bytes the length has but the destination we want to copy to. Fixes: CID#1296813
2015-10-12Revert "gprs: Use RAND_bytes for p-tmsi"Holger Hans Peter Freyther2-7/+2
The commit not compiling/linking should have been a strong indicator that it has not been tested either. This reverts commit 6cf0249dacc4ae46eb0857c007906c9a3f128a3e.
2015-10-12gprs: Use RAND_bytes for p-tmsiDaniel Willmann2-2/+7
[hfreyther: Link to libcrypto, include header, add uint8_t* cast]
2015-10-07gsup: factor out header composition & sending.Neels Hofmeyr1-3/+9
Move IPA header composition and sending to new static gsup_client_send() (so I can use it in the upcoming OAP code). Sponsored-by: On-Waves ehf
2015-09-24sgsn_main: in -h, print default config fileNeels Hofmeyr1-1/+1
2015-09-24vty: Change the return type from enum to intHolger Hans Peter Freyther2-2/+2
clang complained that different enums are mixed with the return type and we actually want this to be an int now.
2015-09-24gbproxy: Add quirk commands to allow upgrade from pre-releaseHolger Hans Peter Freyther1-0/+53
The pre-release didn't add a newline after the apn and the patching pattern command. Create a quirk command that combines both. The pre-release didn't include a differentation between routing and patching. The TLLI handling has a different and more generic name now. Make it handle the old one that is actively used. Add a file with the broken format and the standard config file test should pick it up.
2015-08-18Use 'ROUTING AREA' consistently, not 'ROUTEING AREA'Harald Welte1-1/+1
The spec unfortuantely uses both terms and has no consistent spelling, but in our logging output we can at least try to be consistent.
2015-08-18GSM/GPRS 04.08: Don't print numeric mobile identity typesHarald Welte1-6/+7
I guess none of our users knows what a mi_type=0x02 is, but most would know what an IMSI or a TMSI is. So let's use the newly introduced gsm48_mi_type_name() function to fix this.
2015-08-18GMM: fix format string compiler warningHarald Welte1-1/+1
2015-08-18GMM: Don't use DGPRS logging category from GMMHarald Welte1-2/+2
2015-08-18GMM: use MMCTXP whenever possible to include MS identity in log outputHarald Welte1-14/+17
2015-08-18LLC: Don't dispatch XID frames into GMMHarald Welte1-1/+1
For some odd reasons the XID is not a separate SAPI but has been kludged into the GMM SAPI. This means we ahve to be careful not to dispatch XID frames into GMM. We do this by introducing an explicit check for UI frames before the dispatch to GMM. The previous code already was doing "the right thing" but printed occasional messages like "gprs_gmm.c:2082 Unknown GSM 04.08 discriminator 0x01: 01 00 0e 00 32 11 03 16 01 90 63 28 0b". Those should be gone after this patch.
2015-08-18LLC: Don't feed length=0 frames to SNDCP / GMMHarald Welte1-1/+1
2015-08-18GMM: add hexdump in case of unknown pdisc/msgtypeHarald Welte1-6/+6
2015-08-18sgsn: make all SGSN timers configurable via the VTYHarald Welte2-36/+108
2015-06-02sgsn: Simplify finding/using the first address of the resultHolger Hans Peter Freyther1-7/+2
The loop was used to print all returned addresses but we can simply pick the first one. This is fixing a coverity issue that the loop will be executed eaxactly once (and that was on purpose). Simplify the code and just take the first element (which might be NULL). Fixes: Coverity CID#1302852
2015-06-02sgsn: seleted_apn_str might be NULL do not strcpyHolger Hans Peter Freyther1-1/+4
The subscriber might simply not be allowed to use the APN that was specified. So selected_apn_str might very well be NULL. Fixes: Coverity CID#1302853
2015-06-02sgsn: Check the return value of osmo_fd_registerHolger Hans Peter Freyther1-1/+2
We can't do much in case the fd is failing to be registered. There should be a timeout that is catching this and it might be able to repair it self. Fixes: Coverity CID#1302854
2015-06-01sgsn: Do not search the name with the "domain" name attached to itHolger Hans Peter Freyther1-1/+1
In case the query for "hostname" will fail c-ares will append the domain name of /etc/resolv.conf and query again. We don't want that so claim we provide a list of domain names and then don't provide any. I didn't intend to have pushed the c-ares code to master yet.
2015-05-29ggsn: The id is a uint32_t don't print it as signedHolger Hans Peter Freyther2-3/+3
This was noticed as I started to use UINT32_MAX for dynamically created GGSNs.
2015-05-25sgsn: Allow to specify the DNS servers that should be usedHolger Hans Peter Freyther2-1/+25
If no server is specified the default list will be used. This allows to separate the servers for the local network and GRX from each other.
2015-05-25sgsn: Allow to resolve the IPv4 address of a GGSN through DNSHolger Hans Peter Freyther4-11/+181
For real networks we need to check if the requested APN string is allowed and then resolve the GGSN address through DNS. There are countries with two or three digit MNCs and one could either try to keep a list of countries that have two/three digits or just try both of them. I have opted for the later for the ease of the implementation. C-Ares doesn't allow to cancel a request so we will need to have the MMCTX and the Lookup have different lifetimes. We simply set ->mmctx to NULL in case the MMCTX dies more early. The selected and verified apn_str will be copied into the out parameter. In case no static APN/GGSN config is present and the dynamic mode is enabled a request will be made.
2015-05-25sgsn: Integrate c-ares with the osmocom event loopHolger Hans Peter Freyther2-6/+177
c-ares is an asynchronous DNS resolver and we need it to resolve the GGSN address. This is integrating the library into our infrastructure. We will create and maintain a list of registered FDs (c-ares is currently only using one of them) and (re-)schedule the timer after events occurred.
2015-05-25sgsn: Create a copy of the msgb for later usageHolger Hans Peter Freyther1-3/+35
When needing to do an asynchronous DNS query we need to keep the TLV data around. So create a wrapper that takes a copy of it and frees it after the call. I can change the code to add an out parameter to decide if the msgb should be freed or not. Pick network failure in case the msgb could not be cloned in the hope the MS will retry then.
2015-05-25sgsn: Re-factor the activate PDP code for future changesHolger Hans Peter Freyther1-24/+39
A real SGSN will dynamically resolve the APN name into the GGSN IP Address. This means that after we have collected all information we need to start to resolve the GGSN and then can continue.
2015-05-25sgsn: Deal with no static ggsn being configured at allHolger Hans Peter Freyther1-0/+7
In case no static ggsn is configured the code would crash with the assumption that there is always such a GGSN.
2015-05-25sgsn: If there is a subscr don't allow an empty listHolger Hans Peter Freyther1-2/+1
This is a left-over from the initial system where no PDP was provided by the system. For now if there is a subscr attached and no PDP context provisioned. He is not allowed to have a data connection. Update the testcase to create the pdp list entry more early with a wildcard and then change it to a specific match.