Commit Graph

6091 Commits

Author SHA1 Message Date
Neels Hofmeyr ac45b664b1 rewrite README
Change-Id: If78b74494a00ad230aec94e03b2fe4e905473897
2017-09-06 16:47:47 +02:00
Neels Hofmeyr 1e52928ad9 drop files unrelated to osmo-sgsn
These either remain from openbsc.git or slipped in while applying recent
patches from openbsc.git and do not belong in osmo-sgsn.

Change-Id: Ie9dc7514c3850010d0e9b3ab716b4f4e8d83594f
2017-09-06 16:47:47 +02:00
Neels Hofmeyr 075cac02b0 debian: fix osmo-sgsn.install, tweak VCS link and descriptions
Change-Id: I6493a7ca7d996fab00d99652a74a709c860a3de7
2017-09-06 16:47:47 +02:00
Neels Hofmeyr e269d181b0 jenkins: fix build: remove unused dependencies
Change-Id: Ice81f8541eda2cd5beeacbfd481f3e4283211331
2017-09-03 22:51:13 +02:00
Alexander Couzens 508c763e7f rework /debian support to match new osmo-sgsn
Remove old leftover from split of osmo-sgsn out of openbsc.

Change-Id: Ic0135a1118a115e8f053154e280f60674390f43a
2017-08-30 14:18:04 +02:00
Neels Hofmeyr 0010b7e59a sccp init: pass no local m3ua addr to use defaults
Remove the FIXMEs because these addresses are configurable via the cs7 /
{as,asp} vty commands.

Change-Id: Ibafda0a9097183c26b21f3380d24dbe293e132e2
2017-08-30 14:16:56 +02:00
Neels Hofmeyr ee6cfdc0d9 split off osmo-sgsn: remove files, apply build
Change-Id: I5d27ff93e56cd13e0e70edd15e2080201e35e91f
2017-08-30 14:14:58 +02:00
Neels Hofmeyr 6c809185ee add msg type to SMS rx logging
Change-Id: I73ea4eebe57b2d1008045a27f174072178b9f077
2017-08-30 14:12:37 +02:00
Neels Hofmeyr c7b761f303 msc_vlr tests: add IMEISV tests
Change-Id: I752afef2ae3ce04e813c7e9fea0e883e607c0e14
2017-08-30 14:12:37 +02:00
Neels Hofmeyr 94936254eb gsup client: move not-connected to error loglevel
Change-Id: I8290963aedb7237da89c9ff98adf4cd33beb5031
2017-08-30 14:12:37 +02:00
Neels Hofmeyr 34a313f2e2 move to osmo-mgw.git: osmo-bsc_mgcp and libmgcp as libosmo-legacy-mgcp
Rewire build and includes to libosmo-legacy-mgcp.

Drop osmo-bsc_mgcp and related python tests, now found in osmo-mgw.git.

libosmo-legacy-mgcp is installed from osmo-mgw, hence add the dependency to (so far using the pre_release branch).

Change-Id: Ic99d681759edce11564da62500c2aac5cf5fffe2
2017-08-30 14:12:37 +02:00
Neels Hofmeyr 7825a29722 .gitignore: cosmetic: use globs to ignore test binaries
Change-Id: I840e4333a4cad646d751ebafe7e0ef23e7a9c708
2017-08-30 14:12:37 +02:00
Neels Hofmeyr 413ecf6859 cosmetic: msc_vlr_tests: drop unused var
Change-Id: I584c0dfffe005597563dbd72fad8a087c554ba3d
2017-08-30 14:12:37 +02:00
Neels Hofmeyr a7a3947b9b move libiu to osmo-iuh/libosmo-ranap
Remove libiu here, use the functions from libosmo-ranap instead, by applying
the ranap_ / RANAP_ prefix.

Corresponding change-id in osmo-iuh.git is I6a3f7ad15be03fb94689b4af6ccfa828c25f45c0

To be able to run the msc_vlr tests for RAN_UTRAN_IU without Iu client headers
available, add iu_dummy.h, containing mere function signatures that match
iu_dummy.c and a mostly empty struct ranap_ue_conn_ctx.

Make sure we can build with and without --enable-iu: include osmo-iuh headers
only with --enable-iu.

Change-Id: Ib8c4fcdb4766c5e575618b95ce16dce51063206b
2017-08-30 14:12:37 +02:00
Neels Hofmeyr e0437166ff MSC,SGSN: use OSMO_GSUP_PORT == 4222 instead of 2222
In SGSN, actually place the port in the SGSN config by default, so that the
gsup port may now be omitted in the VTY config (the IP address suffices).

Adjust the osmo-sgsn.cfg example.

Depends: I4222e21686c823985be8ff1f16b1182be8ad6175 (libosmocore)
Change-Id: I50f2040e2eb0baacb43849e93cfed10cbc2fc156
2017-08-30 14:12:37 +02:00
Philipp Maier 4179ebdec1 mgcp: add VTY Option to force-realloc endpoints
Currently the force_realloc feature is turnd on and of in a
hardcoded way. This patch makes the option available via VTY.

Change-Id: Ic8740512c5ea0766ff6ceb1c28b9c2b3fe46e75f
2017-08-30 14:12:37 +02:00
Philipp Maier efe85d33d4 Implement AoIP, port to M3UA SIGTRAN (large addition and refactoring)
This was originally a long series of commits converging to the final result
seen in this patch. It does not make much sense to review the smaller steps'
trial and error, we need to review this entire change as a whole.

Implement AoIP in osmo-msc and osmo-bsc.

Change over to the new libosmo-sigtran API with support for proper
SCCP/M3UA/SCTP stacking, as mandated by 3GPP specifications for the IuCS and
IuPS interfaces.

From here on, a separate osmo-stp process is required for SCCP routing between
OsmoBSC / OsmoHNBGW <-> OsmoMSC / OsmoSGSN build from libosmo-sccp and osmo-iuh master branches now for new

Patch-by: pmaier, nhofmeyr, laforge
Change-Id: I5ae4e05ee7c57cad341ea5e86af37c1f6b0ffa77
2017-08-30 14:12:37 +02:00
Max 868dd5d8d3 Use release helper from libosmocore
for details.

Change-Id: I869395d5c9ab5ec1a487aff15418d1517f47e831
Related: OS#1861
2017-08-30 14:12:37 +02:00
Harald Welte 6f750e63b0 Treat SIGTERM just like SIGINT in our programs
When somebody kills the process, it's best to handle the signal
and to use the opportunity for some cleanup.  We always did this
in the NITB on SIGINT, but never on SIGTERM. Let's change it.

Change-Id: Iea6804325a6575ceab5edfd28dd20249462f143b
2017-08-27 17:40:56 +02:00
Harald Welte b1c1a7676a NITB: remove 'help' output about '-a' option that is removed for ages
This option was present in very early versions of the NITB, but
at least since 2011 it is no longer supported.  It's still listed
in --help output, which is wrong.

Change-Id: I1d2cceb588ec5fb34ec5e2c05a7d8c93310bee88
2017-08-27 17:40:56 +02:00
Keith Whyte 5742ab8aab libmsc: Use actual delivery time in delivery reports.
Set the time on the status report to the time the message was delivered, as
this may not be the same as the time when we are delivering the report to the
originating MS.

Change-Id: I9056429d40bf02731f004b7833f1de45a0d1add8
2017-08-27 17:40:56 +02:00
Max a441e9d60b gbproxy: log signal value as text
Change-Id: I6ed923f5c60a8d64305f4b8e90d1362d6510e1c5
2017-08-27 17:40:56 +02:00
Max 537da6cb48 gbproxy: log unhandled BSSGP PDU as text
Change-Id: Ibe3c8bd353b3a178e26b0936f25b2e1959f9990c
2017-08-27 17:40:56 +02:00
Pau Espin 05a1213b29 libmsc: Fix wrong handling of user_message_reference parameter
libsmpp34 already converts received TLV integer values to native
endianess in libsmpp34_(un)pack.

Converting them again at receive time swaps the 2 bytes of
user_message_reference, then using a wrong value. As GSM03.40 spec
uses only 1 byte for the id, then only the high byte of the initial
value is used and eventually sent back to the ESME. Again, at that time,
htons() is not needed because libsmpp34 already handles that part.

See OS-#2429 for more details.

Change-Id: If748548a4a223e529a1110c89e483b599b406e8b
2017-08-27 17:40:56 +02:00
Pau Espin 12ebe7e042 smpp: Fix compilation warning
I already stumbled into 2 compilation environments which had Werror
enabled for -Wmaybe-uninitialized and the build failed, so let's
workaround this warning.

| smpp_openbsc.c: In function 'handle_smpp_submit':
| smpp_openbsc.c:216:9: error: 'sms_msg_len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
|    memcpy(sms->user_data, sms_msg, sms_msg_len);
|          ^
| smpp_openbsc.c💯15: note: 'sms_msg_len' was declared here
|   unsigned int sms_msg_len;
|                ^
| cc1: some warnings being treated as errors

Change-Id: I0901ddadb5f72e1585cb1797ac22c8ab95e83146
2017-08-27 17:40:56 +02:00
Pau Espin 93fd462cd2 sgsn_test: Fix wrong definition of wrap func
Commit 058cd573d8 added 2 new pointer parameters to
gprs_subscr_request_auth_info, but forgot to update wraps of the
function in sgsn_test.

I catched this today because openbsc build test sgsn_test was failing.
Closed look up to the logs showed:
Assert failed (auts != NULL) == (auts_rand != NULL) openbsc/openbsc/src/gprs/gprs_subscriber.c:791

Change-Id: Ie9e4af6da0339536fb20ca0b7bbcf6f485bd522c
2017-08-27 17:40:56 +02:00
Keith Whyte a12df55ce7 LIBMSC: Use sms->text, not sms->user_data to construct report body
gsm_04_11.c sms_report_alloc()

Use the sms->text, not the sms->user_data to construct the report body.
This also prevents the potential output of non printable characters to
the log and or vty.

Change-Id: Id51bc9483ad6f52d6da74135605cfd12434c7c96
2017-08-27 17:40:55 +02:00
Keith Whyte c42b5f0861 LIBMSC: Place correct dst address in status report
gsm_04_11.c: gsm340_gen_sms_status_report_tpdu()

When we construct the status report PDU, use sms->src
instead of sms->dst as the destination address
This way we tell the MS that the message was delivered
to the destination and not to itself.
This is relevant for phones that display a textual
representation of the delivery report.

Change-Id: I2d4f87ac777465de9bfb5a775a789a2691755ee9
2017-08-27 17:40:55 +02:00
Pablo Neira Ayuso 042ffe322c libmsc: use SMPP34_DELIVERY_RECEIPT_* in libsmpp34
Use new definitions in libsmpp34 to set the registered_delivery field
accordingly, as provided by I5b3afff1b3b77cccd949e0606914c7ac3ba6114c.

Moreover, do not set this header field to zero if status reports are
off, the deliver_t structure has been already zeroed so this not

Change-Id: Ie78e17323796120f576b9c0e1bc5ccc32da8ee12
2017-08-27 17:40:55 +02:00
Harald Welte 9b7f16317d increase libsmpp34 version requirement to 1.12
Only 1.12 contains some of the #defines that we're using with recent

Change-Id: I3743b10a1a5d2f1d42a61204273c1d00dc22b600
2017-08-27 17:40:55 +02:00
Harald Welte 7e82b74c75 Migrate from gprs_apn_to_str() to libosmocore osmo_apn_to_str()
In 2015, Jacob moved/copied related functions to libosmocore, but
for some reason didn't remove the copies here.  Let's follow-up on
that and remove duplicated code.

The libosmocore commit introducing osmo_apn_to_str() was

Change-Id: I7315ffcbed8a54cca2056f313bb7783ad82d0ee9
2017-08-27 17:40:55 +02:00
Harald Welte dfbd2c88d2 sgsn_vty: Don't assume pdp->lib is always valid
We can only print libgtp pdp information if a library context is
attached to this pdp context.  This is not always the case,
particuarly during some teardown scenarios.

Change-Id: Ia3184877f9709db65f5f93a98403f2ef5b04a8ca
2017-08-27 17:40:55 +02:00
Harald Welte 619021da9a Fix gsm_pchan2chan_nr() to use RSL_CHAN_OSMO_PDCH
When converting from GSM_PCHAN_PDCH, we should generate
a RSL channel number IE with the osmocom extension
RSL_CHAN_OSMO_PDCH rather than claiming it is a regular
TCH/F channel.

This is important as this function is used by
osmo-bts, too - and it decides which channel number IE is
put in the GSMTAP header for both GSMTAP tracing as well
as the GSMTAP based osmo-bts-virtual.

In order to avoid any unintended effect on libbsc,
we make sure to modify rsl_ipacc_pdch_activate() to
always use GSM_PCHAN_TCH_F in related RSL message.

Change-Id: Ie34219e64a6d89da4a79f2db8ec73d1909fb8280
2017-08-27 17:40:55 +02:00
Harald Welte a4feac25d0 SGSN: Fix RAN information exposed on GTP during PDP CTX CREATE
In the PDP Context Create from SGSN to GGSN, we include information
about the RAN type (GERAN/UTRAN) and the Cell of the MS. This was
all hard-coded to GERAN, and wasn't updated when we added UTRAN
support to the SGSN.

Change-Id: I6c79e42c5e08b28fe8182555302a5505fbbaa313
2017-08-27 17:40:55 +02:00
Pau Espin ecee67d9e8 mgcp: Fix uplink activation of Osmux stream
Commit 5754206379 introduced
OSMUX_STATE_NEGOTIATING to fix a race condition present in osmo-bsc_nat.
However, after this change osmo-bsc_mgcp cannot switch to
OSMUX_STATE_ACTIVATING anymore, which means during osmux_send_dummy time
it won't call osmux_enable_endpoint(), which in turn won't set endp type

If MGCP_OSMUX_BSC is not set, uplink streams are sent using regular RTP
instead of Osmux not matter it is enabled in config or not.

Change-Id: Ibcb59aa1ca25408f82cc88c2d5b81177b5f276dc
2017-08-27 17:40:55 +02:00
Ivan Kluchnikov c7decfe743 handover_logic: set correct link to bts for subscriber_connection in case of moving this connection to another bts
In case of successful completion of handover gsm_subscriber_connection could be moved from one bts to another,
so connection link to bts should be replaced by link to bts, which owns new_lchan.
This bug was detected, because conn->bts->nr is used in call control log messages
and wrong number of bts was observed in these messages after handover.

Change-Id: Idc7dd412b7580c451e716b73ef7549826c60b0d9
2017-08-27 17:40:55 +02:00
Pau Espin a34a419b6e mgcp_osmux: Remove unused parameter
Change-Id: Icb1e7cb15fe04642578f5292124ebc1eac9c9aa3
2017-08-27 17:40:55 +02:00
Alexander Chemeris 6e437b7523 libcommon: Fix log output for bts>0.
Fixes regression probably introduced in c696cc28.

For bts>0 logging doesn't show bts number correctly when printing lchan
identification string - it will always show it as "bts=0". The reason for
this is that the identification string is cached before bts->nr value is
set to a proper value.

This patch sets bts->nr as part of the first step of the bts structure
initialization, before caching happens thus making sure the cached
identification string is cached with the correct values.

Change-Id: I61c18a7f021fcb1ec00d34a745f4e3ab03416c2d
2017-08-27 17:40:55 +02:00
Pablo Neira Ayuso 57edda7fc5 libmsc: use new smpp34 esm_class definitions
Replace magic numbers by esm_class definitions, which
have been added to latest libsmpp34 in Change-Id

Change-Id: I6c458690da60c8f3637680efbd718f6e8c6feb4c
2017-08-27 17:40:55 +02:00
Pablo Neira Ayuso e6ad4c896d libmsc: use smpp34_tlv_for_each() to avoid suboptimal TLV handling
submit_to_sms() now handles two TLVs, so find_tlv() is suboptiomal and
it can be removed, since it would result in two passes on the TLV list.
Use new smpp34_tlv_for_each() helper to iterate over the list of TLVs
that is available since I446929feed049d0411e1629ca263e2bc41f714cc.

Change-Id: I53a65164a6cc4abc6bf57d9a8dc275cf21c90222
2017-08-27 17:40:55 +02:00
Pau Espin 78a0429a59 libmsc: Remove comment not applying anymore
The change-id I7276d356d805a83ebeec72b02c8563b7135ea0b6 added msg_ref to
the databse but forgot to remove the comment stating it's not being

Change-Id: I204f098c8f2a480405446113e2181b2c53700cf3
2017-08-27 17:40:55 +02:00
Pablo Neira Ayuso 0456d2bc32 libmsc: gsm340_gen_oa_sub() may return negative value
gsm340_gen_oa() returns a negative value if the output buffer that the
caller passes is too small, so we have to check the return value of this

Fixes: CID 174178
Fixes: CID 174179
Change-Id: I47215d7d89771730a7f84efa8aeeb187a0911fdb
2017-08-27 17:40:55 +02:00
Pablo Neira Ayuso 170285d236 libmsc: support GSM 03.40 status report for nitb
This patch adds support for GSM 03.40 in nitb mode.

          MS         GSM 03.40          SMSC
           |                            |
           |         SMS-SUBMIT         |
           |     GSM 04.11 RP-ACK       |
           |         SMS-DELIVER        |
           |     GSM 04.11 RP-ACK       |
           |     SMS-STATUS-REPORT      |
           |     GSM 04.11 RP-ACK       |
           |                            |

Change-Id: I5cc7bb4ebadde0940f44d10c3df34707b0615160
2017-08-27 17:40:55 +02:00
Pablo Neira Ayuso 30743ab197 libmsc: handle delivery ack via SMPP SUBMIT SM / send GSM 03.40 status report
This patch adds gsm340_sms_send_status_report_tpdu() to build a
status-report. Moreover, set sms->report field if we see a SMPP
SUBMIT_SM with Delivery Acknowledgment esm_class, so this identifies
that this is a delivery report.

    MS        GSM 03.40           SMSC       SMPP 3.4               ESME
     |                             |                                |
     |                             |           SUBMIT-SM            |
     |                             |    esm_class = Delivery Ack    |
     |                             |<-------------------------------|
     |                             |         SUBMIT-SM-RESP         |
     |                             |------------------------------->|
     |                             |                                |
     |     SMS-STATUS-REPORT       |                                |
     |<----------------------------|                                |
     |     GSM 04.11 RP-ACK        |                                |
     |---------------------------->|                                |
     |                             |                                |

There is a FIXME message in this patch, that I just copied from
gsm340_gen_sms_deliver_tpdu() since TP-MMS is not supported by OpenBSC.

Change-Id: Ib70e534840308ed315f7add440351e649de3f907
2017-08-27 17:40:55 +02:00
Pablo Neira Ayuso 20366613c4 utils: smpp_mirror: bounce Delivery Receipts as Delivery Acknowledgments
Simple patch to test the new status-report support code, remove previous
code before Delivery Acknowledgement support was in place. Use
LOGL_DEBUG for logging messages here as suggested by Neels and Harald.

Change-Id: I877e228d8e174430f700631edbf9955972da7892
2017-08-27 17:40:55 +02:00
Pablo Neira Ayuso 423c0f8c44 libmsc: update database to accomodate SMS status-report fields
SMPP DELIVER_SM messages with esm_class = Delivery Receipt need to send
this message reference (that the mobile phone allocates) to the ESME.
Thus, the ESME propagates it via SUBMIT_SM with esm_class = Delivery
Acknoledgment so that the SMSC sends the GSM 03.40 status-report to the
origin including this. Given this field is useful for status-reports, we
need to store it in the HLR database.

Moreover, we need a new field that specifies if the entry represents a
SMS status-report, to do the right handling from the gsm411_send_sms() -
such new handling comes in a follow up patch entitled "libmsc: handle
delivery ack via SMPP SUBMIT SM / send GSM 03.40 status report".

This patch includes the migration routines to the new database schema
revision 5, it's quite a bit of dbi boilerplate code - copied-pasted and

Change-Id: I7276d356d805a83ebeec72b02c8563b7135ea0b6
2017-08-27 17:40:55 +02:00
Pablo Neira Ayuso 18659327a8 libmsc: add support for SMPP delivery receipts
If the mobile phone requests a status report via SMS, send a DELIVER_SM
with esm_class = Delivery Receipt to ESME to indicate that the SMS has
been already delivered to its destination.

    MS        GSM 03.40           SMSC       SMPP 3.4               ESME
     |                             |                                |
     |       SMS-DELIVER           |                                |
     |<----------------------------|                                |
     |     GSM 04.11 RP-ACK        |                                |
     |---------------------------->|                                |
     |                             |           DELIVER-SM           |
     |                             |  esm_class = Delivery Receipt  |
     |                             |------------------------------->|
     |                             |         DELIVER-SM-RESP        |
     |                             |<-------------------------------|
     |                             |                                |

This patch implements "Appendix B. Delivery Receipt Format" as specified
in the SMPP 3.4 specs. This string is conveyed in the SMS message as
data, and it is only meaningful to the ESME, for logging purposes. The
"submit date" and "done date" are not yet set, and other fields are just
sent with dummy values, so they are left to be finished as future work.

The new SMPP TLV tag TLVID_user_message_reference is added to the SMPP
messages inconditionally now since this information is required by
delivery-reports to associate the status-report with the original SMS.

Change-Id: Ic1a9023074bfa938099377980b6aff9b262fab2a
2017-08-27 17:40:55 +02:00
Pablo Neira Ayuso b35754d5cd utils: smpp_mirror: reflect message reference TLV
Useful to test the delivery receipt support. This TLV contains the
GSM03.40 message reference.

Change-Id: I1b0abaa7e06ffe1bd2242c70813d8b70e9fa954f
2017-08-27 17:40:55 +02:00
Pablo Neira Ayuso e16b1125f8 utils: smpp_mirror: temporarily munch SMPP delivery receipts
Just munch and log SMPP delivery receipts by now, don't mirror this, it
is going to break things in openbsc.

Follow up patch removes this and mirrors this SMPP message as a
SUBMIT_SM with esm_class = Delivery Acknowledgement.

Change-Id: I78e93bc4034679e238c8642ccf6a0e844b1d6d8b
2017-08-27 17:40:55 +02:00
Pablo Neira Ayuso be836ff805 utils: smpp_mirror: set registered_delivery field in SMPP SUBMIT_SM
To test delivery reports using this utility.

Change-Id: I0e477407531fdd4d906e53c9b5a48a79a239966f
2017-08-27 17:40:55 +02:00