Commit Graph

31 Commits

Author SHA1 Message Date
Harald Welte 736474ce45 move OAP messages implementations to libosmocore
This corresponds to change-id If5099e60681a215e798b6675f21813f26769c253 in
libosmocore, which is now required to build openbsc.

Related: OS#1592
Change-Id: I2f06aaa6eb54eafa860cfed8e72e41d82ff1c4cf
2016-12-13 14:54:01 +00:00
Neels Hofmeyr 814fef04b0 gprs_gsup_client*: remove the gprs_ prefix
Make sure everything is named gsup_client_ / GSUP_CLIENT_.

Rename static gsup_client_send() to client_send() to avoid clash with public
gprs_gsup_client_send() being renamed to gsup_client_send().

This is in preparation for moving gsup to libcommon, which is in turn
preparation for libvlr. libvlr and osmo-sgsn will use the same GSUP client
code. A number of patches will follow up on this, also for the the OAP client.

Related: OS#1592
Change-Id: I57433973b1c4f6cc1e12e7b1c96b5f719f418b51
2016-12-13 14:54:01 +00:00
Philipp Maier 73f83d533b SNDCP: add V.42bis data compression functionality
- Add compression control for V.42bis Add code to handle compression
   (gprs_sndcp_dcomp.c/h)
 - Add Adjustments in SNDCP
 - Add VTY commands

Change-Id: I6d36cbdf2f5c5f83ca9ba57c70452f02b8582e7e
2016-09-24 03:17:59 +00:00
Philipp Maier d8b45778de V.42bis: integration and unit test
- Edit previously committed V.42bis implementation to function
   outside IAXmodem.
 - Add unit test to verify the correct function of V.42bis

Change-Id: I689413f2541b6def0625ce6bd96f1f488f05f99d
2016-09-24 03:17:59 +00:00
Philipp Maier f1f34360fb SNDCP: add RFC1144 header compression functionality
- Add module to handle compression entities
- Add module to control header compression
- Introduce VTY commands for heade compression configuration
- Add changes in sndcp and llc to integrate header compression

Change-Id: Ia00260dc09978844c2865957b4d43000b78b5e43
2016-09-24 03:17:58 +00:00
Philipp Maier 2c7f83762a RFC1144: integration and unit-test
The previously pushed slhc implementation has been modified to compile
and function outside of the kernel. Also debug log messages were added
and datatypes ware matched. The implementation is now ready to be used

Change-Id: I7a638e88a43b3eb9d006751a03ef2570e36613f0
2016-09-24 03:17:58 +00:00
Philipp Maier 22611be3d9 SNDCP: add SNDCP-XID encoder/decoder and unit test
The SNDCP-XID (or layer-3 xid) is used to exchange layer-3 parameters
such as compression. The encoder encodes a bytestream that is then
sent as regular XID field from LLC.

We will need the SNDCP-XID to negotiate the parameters for our
upcomming GPRS data and header compression features

Change-Id: If2d63fe2550864cafef3156b1dc0629037c49c1e
2016-09-24 03:17:58 +00:00
Alexander Huemer c2f2ad8a5f Build fixes
Some fixes for build environments where dependencies are installed in
distinct directories.

Change-Id: I38808fd2911747b266ee6fde91187a88dd7ae355
2016-09-15 16:02:18 +02:00
Alexander Huemer 7b6673fa06 Consistenly format variables in */Makefile.am files
Change-Id: Ifa21513c007072314097b7bec188579972dc1694
2016-09-15 15:55:02 +02:00
Daniel Willmann 61329d45b8 IuPS: redirect Iu in various places, link Iu in sgsn-test
In gsm48_gmm_sendmsg(), redirect to iu_tx() for both cases of MM context
present or not.

In gsm48_rx_gmm_att_req(), compose an MM context marked as Iu for messages
coming in from a ue_conn_ctx (passed in msg->dst). Also make sure cid is
initialized to avoid introducing a compiler warning.

In gsm48_rx_gmm_ra_upd_req(), look up an Iu MM context based on the presence of
the ue_conn_ctx in msg->dst.

In sgsn-test, add libiu and libasn1c, libosmo-sigtran, libosmo-ranap, which are
now needed for an --enable-iu build.

Change-Id: Ia47ffbfa6fa0f5a0cd76a379c57ef42faa0d80e3
2016-09-01 23:44:45 +02:00
Philipp Maier 4ac3aee711 Adding LLC-XID related modifications in LLC
With this commit the already existing XID mechanism has been
modified to suit the needs for the upcomming SNDCP-XID patches.

This commit should not break anything since it does not alter
the current behaviour (incoming XID is still just echoed, on
GMM-Reset a basic XID message is still echoed)

Change-Id: I65b9d625e72d3d61c99abdc7041773701d694d52
2016-08-27 04:45:55 +00:00
Max 4011e728d2 SGSN: use unique AUTH REQ reference
The A&C reference number specified in 3GPP TS 24.008 § 10.5.5.19
identifies particular request sent by network with the related response
sent by MS. The value transparently copied from request to response by
MS: the spec do not specify what exactly should be in there so we use
rand() to decrease chance for collisions.

Note: variable named 'rand' clashes with standard function rand() so it
was renamed.

Change-Id: I3638821a9b4a0532b28dbbb50faa30c4082579f6
Related: OS#1582
2016-07-16 21:03:30 +00:00
Harald Welte 23d77d56ea Move osmo_gsup_messages.[ch] to libosmocore
This requires the corresponding commit in libosmocore.
2016-04-29 13:10:37 +02:00
Harald Welte 53373bca8f move gsm_04_08_gprs.h to libosmocore
This requres the corresponding commit in libosmocore.
2016-04-29 13:10:37 +02:00
Neels Hofmeyr 9c534fdbe8 gsup/oap: add OAP to GSUP client.
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-02 12:56:47 +01:00
Daniel Willmann 044ce5fb84 gprs: Use RAND_bytes for p-tmsi
[hfreyther: Link to libcrypto, include header, add uint8_t* cast]
2015-10-13 10:00:16 +02:00
Jacob Erlbeck 133e8624ef sgsn/test: Really parse received DL LLC messages
Currently just the number of intercepted downlink messages is counted
and eventually checked. The contents of the messages is lost. The
PTMSI contained in ATTACH/RAU Accept messages is just 'guessed' by
resetting the random number generator after reference PTMSIs have
been generated. While this works with rand_r, RAND_bytes cannot be
forced to recreate a certain number sequence this way (unless the
backend is replaced).

This commit changes that behaviour so that the last received msgb is
kept and decoded. The PTMSI that has been assigned by the SGSN is
then taken in the affected test cases and used instead of a 'guessed'
one. This is similar to how a real MS would react to the Accept
message.

Sponsored-by: On-Waves ehf
2015-10-13 09:59:34 +02:00
Holger Hans Peter Freyther fa07b489dc Revert "gprs: Use RAND_bytes for p-tmsi"
The commit not compiling/linking should have been a strong
indicator that it has not been tested either.

This reverts commit 6cf0249dac.
2015-10-12 09:55:59 +02:00
Daniel Willmann 6cf0249dac gprs: Use RAND_bytes for p-tmsi
[hfreyther: Link to libcrypto, include header, add uint8_t* cast]
2015-10-12 09:05:48 +02:00
Holger Hans Peter Freyther 39c430ee29 sgsn: Allow to resolve the IPv4 address of a GGSN through DNS
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-25 15:57:57 +08:00
Jacob Erlbeck 81ffb740f7 sgsn: Remove inactive LLME/MM after inactivity timeout
Currently old LLMEs and MM contexts that haven't been explicitly
detached or cancelled are not removed until another request with the
same IMSI is made. These stale entries may accumulate over time and
severely compromise the operation of the SGSN.

This patch implements age based LLME expiry, when the maximum age has
been reached, the corresponding MM context is cancelled. If such an MM
context doesn't exist, the LLME is unassigned directly.

The implementation works as follows.
 - llme->age_timestamp is reset on each received PTP LLC message
 - sgsn_llme_check_cb is invoked periodically (each 30s)
 - sgsn_llme_check_cb sets the age_timestamp to the current time if
   it has been reset
 - sgsn_llme_check_cb computes the age and expires the LLME if
   it exceeds gprs_max_time_to_idle()

Ticket: OW#1364
Sponsored-by: On-Waves ehf

[hfreyther: Fix typo in comment LMME -> LLME]
2015-01-26 08:51:50 +01:00
Jacob Erlbeck c157ee7d2c sgsn/test: Add test that intercepts gprs_gsup_client_send
This test replaces gprs_gsup_client_send by a custom function, that
emulates a GSUP remote peer by calling gprs_subscr_rx_gsup_message
with responses for all requests. It then executes a full
Attach/Detach cycle.

Sponsored-by: On-Waves ehf
2015-01-18 18:28:20 +01:00
Jacob Erlbeck afcf23001e gprs: Move protocol value_strings to gsm_04_08_gprs.c
Currently the mapping between GSM 04.08 (GPRS) protocol specific
numbers and their textual description was put into gprs_gmm.c and not
exported.

This commit moves the mappings to a new file gsm_04_08_gprs.c,
renames some of them, and exports them via gsm_04_08_gprs.h.

The following identifiers are renamed to match the corresponding type
names:

  - gmm_cause_names -> gsm48_gmm_cause_names
  - gsm_cause_names -> gsm48_gsm_cause_names

Sponsored-by: On-Waves ehf
2015-01-18 18:13:06 +01:00
Jacob Erlbeck 39f040d62b sgsn: Integrate the GSUP client into the SGSN
This commit adds GSUP client configuration (via VTY), connection set
up, and real message sending.

The following configuration commands are added:

 - gsup remote-ip A.B.C.D            set server IP address
 - gsup remote-port PORT             set server TCP port

Ticket: OW#1338
Sponsored-by: On-Waves ehf
2015-01-18 13:17:50 +01:00
Jacob Erlbeck a6ddc2d99f gprs: Add subscriber functions to create/handle GSUP messages
This patch extends gprs_subscr_query_auth_info and
gprs_subscr_location_update to create GSUP messages with the help of
a static gprs_subscr_tx_gsup_message function. A corresponding
gprs_subscr_rx_gsup_message is added which takes a messages, gets the
subscr, and updates it accordingly.

Sponsored-by: On-Waves ehf

[hfreyther: Added a msgb_free gprs_subscr_tx_gsup_message]
2015-01-10 21:26:18 +01:00
Jacob Erlbeck 98a95ac17f sgsn: Add a subscriber based authentication phase
This implements the MAP way of subscriber validation when the MS
tries to perform an Attach Request:

  1. perform authentication (optionally invoke the sendAuthInfo
     procedure), starts the Auth & Ciph procedure
  2. perform update location
  3. insert subscriber data
  4. finish the update location
  5. Attach Accept / Attach Reject

The authentication triplets are used and eventually updated if all of
them have been used.

This is currently accessible via the VTY interface by the following
commands:

  - update-subscriber imsi IMSI update-auth-info
  - update-subscriber imsi IMSI update-location-result (ok|ERR-CAUSE)

Sponsored-by: On-Waves ehf
2014-12-24 16:50:30 +01:00
Jacob Erlbeck be2c8d9358 sgsn: Integrate subscriber handling into the SGSN
This commit adds a new authorization policy 'remote' and uses
the subscriber cache for authorization when this policy is being used.

Note that there is no remote backend implemented yet. After the
IMSI/IMEI have been acquired, a request would be sent to the remote
peer. The attach/auth-ciph procedure continues when authorization
info has been received from the peer. This means, that
gprs_subscr_update() must be called then to tell the GMM layer
that it can proceed. A later commit will add VTY commands to do this
manually.

Sponsored-by: On-Waves ehf
2014-12-09 09:27:20 +01:00
Jacob Erlbeck 33b6dadc88 sgsn: Add gprs_subscriber.c
This patch adds GPRS specific functions for gsm_subscriber objects
(allocation, retrieval, deletion) and subscriber data
requests/updates. The sgsn_update_subscriber_data callback is used to
notify the sgsn about updates and is extended by a parameter that
passes a reference to a gsm_subscriber.

Sponsored-by: On-Waves ehf
2014-12-09 09:23:11 +01:00
Jacob Erlbeck 3b5d407203 sgsn: Moved IMSI ACL management to sgsn_auth.c
Currently the ACL code is located in sgsn_vty.c.

This commit moves this to a new file sgsn_auth.c as a first step to
make authorization more flexible in order to implement remote
acquisition on subsciber data.

Sponsored-by: On-Waves ehf
2014-10-27 13:06:55 +01:00
Holger Hans Peter Freyther 4299c0560f sgsn: Create testcase that verifies that llmes get deleted
On an "unassignment" this code verifies that the LLME will vanish
from the list of LLMEs. We assume that this doesn't create a
memory leak.
2014-10-09 17:22:34 +02:00
Holger Hans Peter Freyther 68c6f887c2 sgsn: Add boilerplate code for a SGSN test 2014-10-09 17:22:34 +02:00