Commit Graph

633 Commits

Author SHA1 Message Date
Harald Welte 92a88ee73f Bump version: 0.3.0.10-9e66-dirty → 0.4.0
Change-Id: Ib2943b7fd0a1f7ca79f761116cba30aa3aa29b88
2019-01-20 21:46:06 +01:00
Oliver Smith 456964fc41 contrib: fix makedistcheck with disabled systemd
EXTRA_DIST files need to be distributed, no matter if the systemd option
is configured or not.

Change-Id: I8e1615793bc89fdc3b0549c150cc10d848e56645
2018-12-06 13:43:26 +01:00
Oliver Smith e9fd1ed4b5 Fix DISTCHECK_CONFIGURE_FLAGS override
Set AM_DISTCHECK_CONFIGURE_FLAGS in Makefile.am instead of
DISTCHECK_CONFIGURE_FLAGS. This is the recommended way from the
automake manual, as otherwise the flag can't be changed by the user
anymore.

Related: OS#3718
Change-Id: I3cfc4ccf799108ee2f411be443069c88a013df5b
2018-12-04 15:31:13 +01:00
Stefan Sperling 319c28581e add a VTY command which shows a specific HNB
Add the 'show hnb NAME' VTY command which displays just
one specific HNB, addressed by its identity string.
This augments the functionality provided by 'show hnb all'.

Change-Id: Iab12aa4ab090b72c472358b84daf6919b30747f6
Related: OS#2774
2018-10-31 12:18:02 +01:00
Harald Welte 9aad185151 hnbgw_tx_hnb_register_rej(): Missing return statement
Change-Id: I0bdee8ede9ffdc16c16a4f5723acb7b4bceb2158
Fixes: Coverity CID#188869
2018-10-21 11:46:14 +02:00
Neels Hofmeyr a770f6967b fix transport layer addr again, for nano3g
The nano3G sends the RAB Assignment Response's Transport Layer Address in X.213
NSAP padded to 20 bytes (160bit). Do not interpret it as 4-byte IP address,
which currently breaks nano3G voice calls (wrong RTP IP address).

Recent commit I2cd1b2d8e1c1ae707cfc0dc7961a2b31ecdf29e0 fixed decoding of X.213
NSAP that is exactly seven bytes, but broke decoding of the padded version from
the nano3G.

A proper X.213 NSAP decoding would still be more welcome than this patching
back and forth, but this is (another) quick fix without spending too much time
on it.

Related: OS#3420
Change-Id: I0ad8bce6fcfd3829394c39490058c1ab85cdfde3
2018-09-30 23:35:35 +02:00
Neels Hofmeyr b876b421e3 hnbgw: vty: add SCCP related vty commands
Depends: I214ea51fc6bfa2a9a4dd7c34b43add0c77ffe22e (libosmo-sccp)
Change-Id: I2f81e078d7a26dd39f8ff9d0f9273ee1a3434232
2018-09-27 03:35:15 +02:00
Pau Espin 37c1ffdadf Install sample cfg file to /etc/osmocom
Change-Id: I7476a1db470d3bc3a833e7657ad29f266df51667
2018-09-12 18:07:50 +02:00
Pau Espin a68b6828c8 Install systemd services with autotools
Change-Id: I90f1efc4433ec641a28931d5c19e2301a67cf1e9
2018-09-10 16:10:03 +02:00
Pau Espin b69c902fe0 debian: package osmo-hnbgw.service
Change-Id: I7b488ddb07916952adab921415ca373aa7c5c1e8
2018-09-06 14:16:01 +02:00
Neels Hofmeyr 236d1d4865 fix decoding of incoming X.213 NSAP addr
Fix ranap_transp_layer_addr_decode() to test == 7 instead of > 7: If a femto
cell sends its Transport Layer Address as X.213 NSAP IPv4, we receive 3 header
bytes and four IP-address bytes, so the length is exactly 7.

This function is very vague on numerous other decoding details, but this patch
only fixes the vital length check that makes 3G usable with X.213 NSAP.

Related: OS#3420
Change-Id: I2cd1b2d8e1c1ae707cfc0dc7961a2b31ecdf29e0
2018-08-20 17:31:58 +02:00
Harald Welte 2d3fae7e36 debian/rules: Don't overwrite .tarball-version
The .tarball-version file should contain the *source version* uniquely
identifying the git commit, and not the Debian package name.

With https://gerrit.osmocom.org/#/c/osmo-ci/+/10343/ there is a correct
.tarball-version file in the .tar.xz of the nightly source packages.

Change-Id: I08fa724a9a70e024845f683fb3f5d245a0bd9aa3
Related: OS#3449
2018-08-06 11:16:08 +02:00
Alexander Couzens ad4ea3b10e hnbgw: remove close_cb() to fix a crash when releasing a hnbgw
The read callback should catch all errors already.
Previous when a read fails it:

* hnb_context_release() -> osmo_stream_srv_destroy() -> hnb_context_release()
On the second hnb_context_release() the hnbgw will crash because calling
llist_del() twice on the same object.

Fixes: OS#3416
Change-Id: Ic84b2184b7fc850c0de2acacf179e86771e17510
2018-07-24 19:08:19 +02:00
Bernhard M. Wiedemann 7a97fcafed asn1tostruct: allow to override build date
in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

Also do not record build user name to not have it vary.

Change-Id: I5cfa465cc82f009f28dd7f12ced0e72a05fda842
2018-05-30 13:21:57 +02:00
Pau Espin ba941e553d Bump version: 0.2.0.57-cf5f-dirty → 0.3.0
Change-Id: Id5d2f749bca46e8b81cc2934447707e3db80ea18
2018-05-03 18:29:14 +02:00
Pau Espin 2b88cc40eb debian/changelog: set prev releases to unstable
Otherwise it fools osmo-release.mk

Change-Id: I6c05bb7f5bb2b3e78283a5eae6ccf95ce86838f8
2018-05-03 18:28:12 +02:00
Neels Hofmeyr cf5fbea78f cosmetic: use osmo_plmn_id instead of mcc,mnc
It's cosmetic since the MCC and MNC in the PLMN aren't actually used,
currently. It makes sense to do it properly anyway, while I'm still in the
3-digit MNC topic, for the future.

Change-Id: I29ebcddd45fe3079f8883589a83cc7216a535475
2018-03-21 15:55:18 +01:00
Neels Hofmeyr 666121a9d9 configure: add --enable-werror
Provide a sane means of adding the -Werror compiler flag.

Currently, some of our jenkins.sh add -Werror by passing 'CFLAGS="-Werror"',
but that actually *overwrites* all the other CFLAGS we might want to have set.

Maintain these exceptions from -Werror:
a) deprecation (allow upstream to mark deprecation without breaking builds);
b) "#warning" pragmas (allow to remind ourselves of errors without breaking
   builds)

As a last configure step before generating the output files, print the complete
CFLAGS and CPPFLAGS by means of AC_MSG_RESULT.

Change-Id: Id659512d2d9fb3f28584ec5f071907f6b6e72e0d
2018-03-05 20:43:10 +01:00
Neels Hofmeyr 3050864b73 hnb-test: log accurate three-digit MNC with leading zeros
Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore)
Change-Id: Ie3dd206bca2f38a0ef7ee7f9d3b6bf2eacc899a4
2018-02-28 19:26:07 +01:00
Stefan Sperling c964a2cfa1 ensure unique CellIDs in HNB-GW
If we receive a HNB-REGISTER-REQ with a cell ID which is already used
by another registered NNB, log an error and send HNB-REGISTER-REJECT.

Tested manually by running two 'hnb-test' programs concurrently (they
need to listen on different telnet ports; this port is hard-coded so
I compiled two different hnb-test binaries).
Then I issued the 'hnbap hnb register' command on the telnet interface
of each, and verified that the correct action is logged by osmo-hnbgw.
Both hnb-test programs can connect, but only one of them can register
at a time. Killing a registered 'hnb-test' program terminates its
connection and allows the previously rejected one to register.

The new rejection log message looks like this:
 hnbgw_hnbap.c:429 rejecting HNB-REGISTER-REQ with duplicate cell
 identity MCC=901,MNC=99,LAC=49406,RAC=66,SAC=43947,CID=182250155
 from (r=127.0.0.1:42828<->l=127.0.0.1:29169)

This change depends on a new API in libosmo-netif, which is added in
https://gerrit.osmocom.org/#/c/6844/

Change-Id: Iffd441eb2b6b75dfbe001b49b01bea015ca6e11c
Depends: I8ed78fe39c463e9018756700d13ee5ebe003b57f
Related: OS#2789
2018-02-22 20:29:06 +00:00
Pau Espin e1c01a0262 contrib: jenkins.sh: Disable doxygen in libosmocore build
Change-Id: I12d995c0c993483ed940fc173904d6e686fbe0ab
2018-02-20 20:22:24 +01:00
Pau Espin aec91ab347 configure.ac: Enable -Wall flag
Change-Id: Ib05f7862081708d578d8f0302d926aab42897dc2
2018-01-22 19:03:37 +01:00
Neels Hofmeyr 2293df070c hnbap: log errors on decoding/encoding HNB-REGISTER msgs
Change-Id: I3c039267fa2cc047c5678bcfe4a603f70c21cdd1
2018-01-18 19:01:09 +01:00
Neels Hofmeyr 8a2b6e2b6f cosmetic: hnbgw: hnbap: log rx of unsuccessful outcome
HNBAP isn't really that important to osmo-hnbgw operation, all we do is service
the few requests so that the other side is happy and uses our Iuh.
Nevertheless, could at least log if an UnsuccessfulOutcome was received.

Change-Id: I3f309dc2d3436798e9e76bcc2ebd82403ea538a1
2018-01-15 23:40:38 +01:00
Neels Hofmeyr 02296af07d hnbgw_hnbap: fix missing return in rx [un]successful outcome
Fixes: CID#57732 CID#57733
Change-Id: Iddf76d23c2c7d5824e82708f7da013c88411e832
2018-01-15 23:30:57 +01:00
Neels Hofmeyr e3644ac476 hnbgw_cn: rx ranap: set rc in all cases
There don't seem to be any evaluations of the rc, nevertheless return
well-defined values.

Fixes: CID#181968
Change-Id: I59295388564e5d270da32db6e7488755231f8a11
2018-01-15 23:28:08 +01:00
Neels Hofmeyr 6814d22d5f hnbgw_rua: fix dereference of unset pointer
In the UNITDATA case, there is no map, so a) initialize map as NULL and b)
print the RUA ctx id directly from local var context_id instead.

Fixes: CID#181969
Change-Id: I73f508b719b61a389e10cbad1bafad1650634abe
2018-01-15 23:28:08 +01:00
Neels Hofmeyr 70d3ece487 hnbgw_rua.c: log: fix integer format for cN_DomainIndicator
Fixes: CID#135219
Change-Id: I32c11100c87a59f34d7c1fefd2f0037e5d63f0e0
2018-01-15 23:28:00 +01:00
Pau Espin e9b4c390b4 iu_client.c: Remove unusued variable
Change-Id: If841d403010a73722ff69617a51719421febab56
2018-01-08 11:07:26 +01:00
Max 9d60ce6107 Enable sanitize for CI tests
Change-Id: I90ca756691e4f644d93af519ed5d54d794d1d401
2018-01-02 07:22:12 +00:00
Max bfeea6713b Expand ctrl interface
Add commands to get number of connected HNBs and identity string of
connected HNB based on Cell ID.

Change-Id: I3a2d6fa3d6d0829ccee4ecc0998d9299c97820e9
2017-12-31 11:02:07 +00:00
Max ef727410b2 Add control interface
* add libosmoctrl dependency
* bind control interface

Change-Id: I4637e88da00bac1ab0237c29ac73806d024863ba
2017-12-31 11:02:07 +00:00
Max 1e57ba503e Use proper package version
Use actual application version instead of hardcoded "0".

Change-Id: I8711b9d819454d810291d57b97119d9fe4a47f8e
2017-12-28 12:27:41 +01:00
Harald Welte f8b73b15c0 hnbgw_vty.c: Fix "-Werror=format-security" failure in vty_out()
We have to use a format string, we cannot directly print "name".

Fixes a build error on our OBS builds:
hnbgw_vty.c:156:5: error: format not a string literal and no format arguments [-Werror=format-security]
which was introduced in Change-Id I3c937306a011715e163a40bc8ef8ec7e8d4e5d08
about one week ago.

Change-Id: I042989c2b7b379284b2ee5fea3bd8f8ce406b09e
2017-12-26 21:41:16 +01:00
Harald Welte 8e88d37cec hnbgw_vty.c: cosmetic: Fix non-tab-indented code
This was introduced a week ago in Change-Id
I3c937306a011715e163a40bc8ef8ec7e8d4e5d08 and is now cleaned up.

Change-Id: Iaadf941aa7f1c5ae05eb02b51cc646b7b5587ba3
2017-12-26 21:41:16 +01:00
Neels Hofmeyr 3bd8a55661 vty typo: 'show hnb': SCTP stream, not SCCP stream
Change-Id: Iceb29af9f4ef6b4b4ed9778bdd683d30c201371d
2017-12-25 15:24:33 +01:00
Neels Hofmeyr 23f3fdc6b2 comments: hnbgw_rua.c: remove obsolete fixmes for asn1 free
The comments are all right above the line that does the proper asn1 free step.

Change-Id: I60e3be8c56ecc75c22e76f9e9dce8c72753e153b
2017-12-25 00:46:12 +01:00
Neels Hofmeyr 4e2681df26 osmo-hnbgw: startup: log the RNC-Id that is going to be used
Change-Id: I8aeb93fe8037e5fdc0784f5fc3bdb527de3b76bd
2017-12-25 00:46:12 +01:00
Neels Hofmeyr da58d26cbc osmo-hnbgw config: add 'rnc-id' config item
So far, the RNC-Id is hard-coded as 23. Still use 23 as default, but allow
configuring by config file. Hence make it possible to run multiple osmo-hnbgw
with differing RNC-Id each.

Change-Id: I374f558cc4bb36055f39efe9c58ae1b9bd49da46
2017-12-25 00:46:12 +01:00
Neels Hofmeyr e045da0261 cosmetic: context_map_tmr_cb(): fix comment
Change-Id: I4dd07a4d09d3cd4dc2a08e42ee48344967e5e3a6
2017-12-25 00:46:12 +01:00
Neels Hofmeyr 1e9f4f5432 rua_to_scu(): don't create a context map for UNITDATA
UNITDATA is connection-less, and as can be observed further below, the 'map'
doesn't get used in the N_UNIDATA case.

Related: OS#2776
Change-Id: Ic35562e6d7bfa54b6be859860657f9a235ad5a50
2017-12-25 00:46:12 +01:00
Neels Hofmeyr b10e2937d9 rua: discard context maps on id-Disconnect
When an id-Disconnect is received, the RUA to SCCP user context becomes unused.
Mark the context map as inactive in that case. It will be cleaned up by the
context map garbage collector.

Related: OS#2776
Change-Id: I9616f72bfa566de081098ee13e720ff0f5266c77
2017-12-25 00:46:12 +01:00
Neels Hofmeyr aa3e9ebcb4 segfault: context_map gc: use llist_for_each_entry_safe()
The context map garbage collector removes entries from the list, hence it must
use llist_for_each_entry_safe().

We haven't hit this before since nothing is yet flagging context maps to be
discarded.

Related: OS#2776
Change-Id: I9d5899923054d1bf862d542fec862fb1e6f07dce
2017-12-25 00:46:12 +01:00
Neels Hofmeyr f33d16404d compiler warning: asn1tostruct.py: return 0 at end of *_free_*()
Part of the resulting diff in the generated code:

--- /tmp/hnbap_decoder.c	2017-12-24 17:06:50.983979866 +0100
+++ /tmp/hnbap_decoder.c	2017-12-24 17:07:10.760223354 +0100
@@ -1179,6 +1179,7 @@
     TNLUpdateResponseIEs_t *tnlUpdateResponseIEs) {

     ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_Context_ID, &tnlUpdateResponseIEs->context_ID);
+    return 0;
 }

 int hnbap_free_tnlupdaterequesties(
@@ -1187,6 +1188,7 @@
     ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_Context_ID, &tnlUpdateRequestIEs->context_ID);
     ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RABList, &tnlUpdateRequestIEs->rabList);
     ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_Update_cause, &tnlUpdateRequestIEs->update_cause);
+    return 0;
 }

 int hnbap_free_errorindicationies(
@@ -1197,12 +1199,14 @@
     if ((errorIndicationIEs->presenceMask & ERRORINDICATIONIES_CRITICALITYDIAGNOSTICS_PRESENT)
         == ERRORINDICATIONIES_CRITICALITYDIAGNOSTICS_PRESENT)
         ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_CriticalityDiagnostics, &errorIndicationIEs->criticalityDiagnostics);
+    return 0;
 }

 int hnbap_free_hnbconfigtransferrequesties(
     HNBConfigTransferRequestIEs_t *hnbConfigTransferRequestIEs) {

     ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NeighbourInfoRequestList, &hnbConfigTransferRequestIEs->neighbourInfoRequestList);
+    return 0;
 }

 int hnbap_free_tnlupdatefailureies(

[etc.]

Related: OS#2670
Change-Id: Ieba12c09c33a81da964bf88a858714d922ced8c0
2017-12-25 00:46:12 +01:00
Neels Hofmeyr 9e17e054e4 osmo-hnbgw: vty: revamp output of context maps on 'show hnb'
Instead of listing each and every context map, rather output a summary of
context counts.

Rationale: in a list of a hundred HNBs, I don't want to also see a dozen (or
potentially thousands of) context map lines for each. Furthermore, the conn IDs
aren't necessarily useful on network traces either.

For example, what was shown as SUA Id is incidentally the SCCP Reference, but
this is not a hard requirement and may change. Also, the reference is shown in
wireshark as a hex in mismatching byte order ... so rather don't bother.

The result now looks like

  OsmoHNBGW> show hnb all
  HNB (r=192.168.0.124:29169<->l=192.168.0.9:29169) "000295-0000152614@ap.ipaccess.com"
      MCC 901 MNC 70 LAC 14357 RAC 11 SAC 1 CID 8595638 SCCP-stream:HNBAP=0,RUA=0
      IuCS: 1 contexts: inactive-reserved:1
      IuPS: 1 contexts: active:1
  1 HNB connected

Related: OS#2772 OS#2773
Change-Id: Iae76b68e85863c8663bb5c508b85534c00e1d2c9
2017-12-25 00:46:12 +01:00
Neels Hofmeyr 140f38c55e vty: tweak / improve HNB and cnlink introspection
Add 'show cnlink' (uses new osmo_sccp_user_name(), see 'Depends' below).

Tweak 'show hnb all'.

The result looks something like:

  OsmoHNBGW> show cnlink
  IuCS: OsmoHNBGW:RI=SSN_PC,PC=0.23.5,SSN=RANAP <-> RI=SSN_PC,PC=0.23.1,SSN=RANAP
        SS7 route: pc=0=0.0.0 mask=0x0=0.0.0 via AS as-clnt-OsmoHNBGW proto=m3ua ASP asp-clnt-OsmoHNBGW (r=127.0.0.1:2905<->l=127.0.0.1:37699)
  IuPS: OsmoHNBGW:RI=SSN_PC,PC=0.23.5,SSN=RANAP <-> RI=SSN_PC,PC=0.23.4,SSN=RANAP
        SS7 route: pc=0=0.0.0 mask=0x0=0.0.0 via AS as-clnt-OsmoHNBGW proto=m3ua ASP asp-clnt-OsmoHNBGW (r=127.0.0.1:2905<->l=127.0.0.1:37699)

  OsmoHNBGW> show hnb all
  No HNB connected

  OsmoHNBGW> show hnb all
  HNB (r=192.168.0.124:29169<->l=192.168.0.9:29169) "000295-0000152614@ap.ipaccess.com"
      MCC 901 MNC 70 LAC 14357 RAC 11 SAC 1 CID 8595638 SCCP-stream:HNBAP=0,RUA=0
      IuCS 24->1002 (RUA->SUA) state=1
      IuPS 24->1003 (RUA->SUA) state=1
  HNB (r=192.168.0.15:29169<->l=192.168.0.9:29169) "000295-0000154153@ap.ipaccess.com"
      MCC 901 MNC 70 LAC 24358 RAC 22 SAC 65535 CID 1048575 SCCP-stream:HNBAP=0,RUA=0
      IuCS 23->1000 (RUA->SUA) state=1
      IuPS 23->1001 (RUA->SUA) state=1
  2 HNB connected

Related: OS#2772 OS#2773
Depends: Ib7abf69cfcf4c56273223054b280458451e6c2f6 (libosmo-sccp)
         Ia0d15a2814b08bc3f052a1ed12dbb68bade55309 (libosmo-sccp)
Change-Id: I3c937306a011715e163a40bc8ef8ec7e8d4e5d08
2017-12-25 00:43:28 +01:00
Neels Hofmeyr 6eeef115a9 hnbap,rua,ranap decode: fix segfault on decode error
Looking at hnbap_decode_hnbregisterrequesties(), I noticed a segfault if
decoding the HNB Register Request PDU fails, which is due to an unchecked
return value in code generated by asn1tostruct.py.

Add return value and NULL pointer checks and hence fix null dereference on
erratic PDUs across HNBAP, RUA and RANAP protocols. Similar checks exist in
other places, this one was simply missing.

Since the result of asn1tostruct.py is not committed, here is an example diff
of the resulting change, of which there are 128 instances in total:

@@ -304,7 +329,12 @@
     memset(hnbRegisterRequestIEs, 0, sizeof(HNBRegisterRequestIEs_t));
     HNBAP_DEBUG("Decoding message HNBRegisterRequestIEs (%s:%d)\n", __FILE__, __LINE__);

-    ANY_to_type_aper(any_p, &asn_DEF_HNBRegisterRequest, (void**)&hNBRegisterRequest_p);
+    tempDecoded = ANY_to_type_aper(any_p, &asn_DEF_HNBRegisterRequest, (void**)&hNBRegisterRequest_p);
+
+    if (tempDecoded < 0 || hNBRegisterRequest_p == NULL) {
+        HNBAP_DEBUG("Decoding of message HNBRegisterRequestIEs failed\n");
+        return -1;
+    }

     for (i = 0; i < hNBRegisterRequest_p->hnbRegisterRequest_ies.list.count; i++) {
         IE_t *ie_p;

Change-Id: I6cb9cc9a88d22f03befa43f0968a874476fa079d
2017-12-20 23:31:45 +01:00
Neels Hofmeyr 66d6d760aa hnbgw: hnb info: record MCC, MNC, show on 'show hnb'
Before, MCC and MNC were always reported as zero, now the output of 'show hnb all' looks like:

  OsmoHNBGW> show hnb all
  HNB "000295-0000154153@ap.ipaccess.com" MCC 901 MNC 70 LAC 11111 RAC 99 SAC 65535 CID 1048575
     HNBAP ID 0 RUA ID 0

Change-Id: Iae094b36fa1cf18e07ed33914b9425368d7cd34b
2017-12-20 23:17:57 +01:00
Philipp Maier aa8d48cbe0 ranap_msg_factory: remove unusued variable
remove variable i in ranap_new_msg_sec_mod_compl() as it is not
used (compiler warning)

Change-Id: I93d9e95109fb78bc6cc161745b9e14de8b623d4f
2017-12-20 16:03:19 +00:00
Philipp Maier 1eb19cf690 ranap_msg_factory: check IE encoder return codes
in many functions, the returncode (rc) from the IE encoder functions
is not checked.

Add a return code check and log error message (like it is already
done in the functions which already check the return code)

Change-Id: I592c0794a94c50fde5c574b1e9bc581eb28af4ae
2017-12-20 16:03:19 +00:00