aboutsummaryrefslogtreecommitdiffstats
path: root/src/hnbgw_hnbap.c
AgeCommit message (Collapse)AuthorFilesLines
2020-03-20Fix compiler warning on signedness of char ptr using OCTET_STRING_fromBuf()Pau Espin Pedrol1-10/+10
rua_msg_factory.c:19:48: warning: pointer targets in passing argument 2 of ‘OCTET_STRING_fromBuf’ differ in signedness [-Wpointer-sign] Change-Id: Ie0a2e8e11902dc56720ff8121edde0e148fa587a
2019-03-08osmo-hnbgw: logging tweaksNeels Hofmeyr1-0/+2
Log about: - sending RESET messages to CN; - accepting a new hNodeB peer on HNBAP. Change-Id: I317831dbc6c463e4d4dcde9e6716431e026c4398
2018-10-21hnbgw_tx_hnb_register_rej(): Missing return statementHarald Welte1-0/+3
Change-Id: I0bdee8ede9ffdc16c16a4f5723acb7b4bceb2158 Fixes: Coverity CID#188869
2018-07-24hnbgw: remove close_cb() to fix a crash when releasing a hnbgwAlexander Couzens1-2/+2
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-02-22ensure unique CellIDs in HNB-GWStefan Sperling1-1/+56
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-01-18hnbap: log errors on decoding/encoding HNB-REGISTER msgsNeels Hofmeyr1-1/+6
Change-Id: I3c039267fa2cc047c5678bcfe4a603f70c21cdd1
2018-01-15cosmetic: hnbgw: hnbap: log rx of unsuccessful outcomeNeels Hofmeyr1-0/+4
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-15hnbgw_hnbap: fix missing return in rx [un]successful outcomeNeels Hofmeyr1-2/+4
Fixes: CID#57732 CID#57733 Change-Id: Iddf76d23c2c7d5824e82708f7da013c88411e832
2017-12-20hnbgw: hnb info: record MCC, MNC, show on 'show hnb'Neels Hofmeyr1-2/+1
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-11-21Fix various compiler warnings in hnb-gw codeHarald Welte1-5/+7
Since we finally started to use -Wall, the related warnings became visible. Change-Id: I516700eab2aa7c3412dd62775c4960aed9d4b682
2016-11-27fix error rc in various ASN.1 decoding functionsNeels Hofmeyr1-1/+1
Fixes: CID#57945, CID#57946, CID#57947, CID#57948, CID#57950, CID#57951 Change-Id: I2d9ee1aa79959c5973041393f4769faa13720898
2016-09-27hnbap: accept UE Register Requests with TMSI and pTMSINeels Hofmeyr1-4/+114
Add the option to allow UE Register Requests with a TMSI identity. Add VTY command to enable this option, 'hnbap-allow-tmsi'. Add hnbgw_tx_ue_register_acc_tmsi(). HNBGW so far keeps track of UEs that have registered, with their IMSI. When a UE registers with only a TMSI, we obviously can't store an IMSI. However, since we're so far never *using* the list of UEs in osmo-hnbgw, we might as well just accept the TMSI registration and carry on as usual. All that is needed for proper operation is a valid UE context. This is aimed at the ip.access nano3G femto cell, as it apparently feeds whichever identification the UE sends through to HNBAP (TMSI+LAI, pTMSI+RAI), instead of an IMSI as expected. So far this caused failures and the need to make the UE clear its TMSI (wait several minutes or attempt to subscribe to a different network), so that UE registration switched back to IMSI. When simply accepting the TMSI in osmo-hngw, no problems are apparent in our current code state. For example, a Samsung Galaxy S4 seems to send a UE_Identity_PR_tMSILAI (CS identity), and a GT-I9100 seems to send a UE_Identity_PR_pTMSIRAI (PS identity) upon first registration to the network. Recording the IMSI in hnbgw: we could use the subscriber list during paging, to page a UE on only its last seen HNB. On the other hand, it doesn't hurt to anyway always page to all HNBs connected to osmo-hnbgw. The paging procedure does include a page-to-all-HNBs in case the first HNB paging fails. But we must be aware that UEs that register by TMSI will simply not have an IMSI recorded in the list of UE contexts, so a lookup based on IMSI may fail. Patch-by: Harald Welte <laforge@gnumonks.org>, me Change-Id: I87bc1aa3e85815ded7ac1dbdca48f1680b468589
2016-09-27hnbgw: UE context: add handling by tmsi identificationNeels Hofmeyr1-1/+1
To prepare for an upcoming commit that accepts TMSI identification upon UE Register Requests: Add tmsi arg to ue_context_alloc(). Add ue_context_by_tmsi(). This is aimed at the ip.access nano3G femto cell, as it apparently feeds whichever identification the UE sends through to HNBAP (TMSI+LAI, pTMSI+RAI), instead of an IMSI as expected. See the upcoming commit that enables accepting TMSI identities for further detail. Change-Id: I138458443319cc4cbea5ee7906cf5dd72d582130
2016-09-27hnbap: add UE Register Reject for pTMSIRAI identityNeels Hofmeyr1-32/+99
This is aimed at the ip.access nano3G femto cell, as it apparently feeds whichever identification the UE sends through to HNBAP (TMSI+LAI, pTMSI+RAI), instead of an IMSI as expected. Sending a proper registration reject speeds up the response seen on the UE and avoids needless waiting. See the upcoming commit that enables accepting TMSI identities for further detail. Change-Id: I03b69613e6ddd8a08d9358ffc2f74954c231fd2c
2016-09-09build: move headers to include/osmocom/*Neels Hofmeyr1-1/+1
This came up while fixing 'make distcheck'; this is certainly not the easiest way but it makes sense to have the headers in include/, like we do in openbsc. The easy alternative might be to add -I$(top_srcdir)/src to src/Makefile.am. Remove -I$(top_srcdir)/src from src/tests/Makefile.am, no longer needed. Change-Id: I5a82e029dcdc4df0a60a31271a4883393fe59234
2016-09-09build: fix ranap gen, use same for gen hnbap and rua genNeels Hofmeyr1-2/+2
fix extraneous rebuild for each make invocation: touch the ranap.stamp file in src/ as the make target suggests. fix for 'make distcheck': ranap gen: move generated sources to builddir, not srcdir. Thus we also -I the builddir include to pick up those headers. hnbap and rua have the same situation as ranap (they generate numerous files from a single make rule). Use the same makefile semantics for those two (commit for ranap gen omitted the same changes for hnbap and rua). The generated headers are thus moved to include/osmocom/*/, so adjust #include statements accordingly (*_common.h, *_ies_defs.h). Also move hnbap_common.h to include/osmocom/hnbap and rua_common.h to include/osmocom/rua, since the *_ies_defs.h want to include them; and since *_ies_defs.h are now in include/osmocom/*, we want a '<foo>' include now. Also adjust gitignore. Change-Id: I32213666fcdfc144008fa7d46497c0938d093e86
2016-09-09UE Register with TMSI: reply with a Register RejectNeels Hofmeyr1-1/+65
When receiving a UE Register Request with TMSI and no IMSI, compose a Register Reject with the same UE Identity and send. The accepting function expects a ue_context argument and composes the message from the IMSI found there. This new rejection message cannot rely on a ue_context struct and hence uses the asn1 uE_Identity directly. Change-Id: Ia47e398e50e316842cd260dc0d9a4e2d8a1c627c
2016-04-25UE Register: fix: free ies when no IMSI is foundNeels Hofmeyr1-0/+1
2016-04-25cosmetic: comments, log typo, explicit pointerNeels Hofmeyr1-2/+4
Fix log typo 'REGSITER' and add some comments on UE Register with TMSI. The container_pair struct starts with 'list', so passing the container_pair pointer is equivalent to passing the list; but instead, explicitly mention the list member to avoid confusion.
2016-01-12Revert "hnbgw_hnbap: Zero IEs_t before decode is called"Daniel Willmann1-5/+0
This reverts commit a8b6b1e3a1fb195d33f2e244494cb902eec5e405. Zeroing is now done inside of the decode function
2016-01-07hnbgw_hnbap: Zero IEs_t before decode is calledDaniel Willmann1-0/+5
This ensures that presenceMask is zero and optional fields will be freed correctly. This needs to happen for ranap and rua as well.
2016-01-07asn1tostruct: Add memory free functions and use them in HNBAPDaniel Willmann1-1/+7
2016-01-07hnbgw_hnbap: Handle hnb deregister message as wellDaniel Willmann1-0/+18
2016-01-07hnbgw: Use libosmo-netif for SCCP connection handlingDaniel Willmann1-1/+3
2016-01-05move ranap_*.h,iu_helpers.h to include/osmocom/ranap/Neels Hofmeyr1-1/+1
A bit hacky: the ranap_ies_defs.h is generated together with the ranap_encoder.c and ranap_decoder.c. See comments in src/Makefile.am and include/osmocom/ranap/Makefile.am.
2016-01-03merge (+rename) iu_helpers.c into libosmo-ranapHarald Welte1-4/+4
2015-12-25Fix typo / spelling mistakesHarald Welte1-2/+2
2015-12-25hnbgw_hnbap: Print HNBAP Cause during UE De-RegisterHarald Welte1-2/+2
2015-12-24hnbgw: Bring all parts togetherHarald Welte1-2/+2
We now have the RUA and SUA parts interconnected by the context ID mapper, and should be able to pass messages back and forward between both sides. Unfortunately this touches a bit of everything, but the structures are all still very much in flux. Hopefully they will start to stabilize at some point soon...
2015-12-23use msgb_sctp_ppid() from libosmo-netif, remove local declarationHarald Welte1-1/+2
2015-12-22hnbgw_hnbap.c: Clean up after encoding a UE register acceptDaniel Willmann1-0/+4
Need to free the ASN.1 structs after using them to encode the UE register accept message.
2015-12-17hnbgw_hnbap: Initialize return value and always return somethingDaniel Willmann1-2/+4
2015-12-17hnbap: Free ASN.1 components after they are no longer neededDaniel Willmann1-0/+4
2015-12-17hnbgw: Change logging priorities and add HNBAP categoryDaniel Willmann1-9/+9
Log hnbap messages to the HNBAP category. Change MAIN category to only log INFO and above and change SCTP notification message to debug.
2015-12-17hnbgw_hnbap: Process UEDeRegister and try to free correct UEDaniel Willmann1-0/+24
2015-12-14asn1helpers: Fix 24 bit conversion function and use it in hnbgw_hnbapDaniel Willmann1-2/+2
The 32 bit int needs to be shifted left one byte so the correct bytes end up at the beginning of the bit string buffer.
2015-12-14asn1helpers: Add 28 bit conversion function and use it for Cell IDDaniel Willmann1-1/+1
The padding bits in the bit string are at the end and the byte-order is MSB-first. This means the number needs to be shifted left so the padding bits are the least significant.
2015-10-06add copyright statement and AGPLv3 headers to source code filesHarald Welte1-0/+20
2015-09-18the Context ID is a 24bit number, we cannot use len = 4 bytes!Harald Welte1-0/+1
2015-09-11various cleanups (compiler warnings, coding style)Harald Welte1-6/+9
2015-09-11move BCD string encoding/decoding functions to iu_helpers.[ch]Harald Welte1-46/+0
2015-09-11hnbap: Print error messages in error casesHarald Welte1-0/+23
2015-09-11respond to HNBAP UE REGISTER REQ withe correspnding ACCEPTHarald Welte1-7/+76
The Accept incudes the IMSI that the phone presented, but somehow we fail to encode the Context ID as bitstring, see ../pcap/20150911-hnbap-ue_register.pcap
2015-09-11introduce ue_context managementHarald Welte1-2/+6
We keep one 'ue_context' structure for every UE that we see a UE REGISTER REQUEST for.
2015-09-07hnbap: Don't enqueue a NULL msgb for transmitHarald Welte1-0/+3
2015-09-07Use implement HNBAP transmit using per-hnb write_queueHarald Welte1-1/+2
2015-09-07hnbgw: zero-initialize the output struct before aper_decode()Harald Welte1-0/+4
asn1c has this strange behavior that the _output_ struct must be zero-initialized.
2015-08-30migration of code from ffasn1c to asn1c + asn1tostruct.pyHarald Welte1-148/+101
2015-08-30hnbgw: Actually link in + call ffasn1c runtime libraryHarald Welte1-2/+81
2015-08-30move asn.1 helper functions to asn1helpers.[ch]Harald Welte1-25/+3