aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2017-12-20ranap_msg_factory: check IE encoder return codesPhilipp Maier1-7/+40
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-20iu: iu_helpers: add functions to decode ip/port from rab-assPhilipp Maier1-1/+52
add ranap_transp_assoc_decode() to decode the port information from an RANAP_IuTransportAssociation_t field. add ranap_transp_layer_addr_decode() to decode the ip-address from an RANAP_TransportLayerAddress_t field. Change-Id: I3c1a0455c5f25cae41ee19229d6daf299e023062
2017-12-20hnbgw: use proper talloc ctx for vty telnet initNeels Hofmeyr1-1/+1
Change-Id: I355c6e5489f24566612528cd679c5cab21eed008
2017-12-20fix 3 compiler warnings in ranap_common.cNeels Hofmeyr1-2/+2
ranap_common.c:282 col 45: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘RANAP_CauseNon_Standard_t {aka const long int}’ [-Wformat=] ranap_common.c:527 col 15: warning: implicit declaration of function ‘asn1str_to_u16’; did you mean ‘asn_strtol’? [-Wimplicit-function-declaration] ranap_common.c:546 col 11: warning: unused variable ‘addr’ [-Wunused-variable] Change-Id: I0b399e78fa7b202a36e5e4be86f338c0ceb9823e
2017-12-20hnbgw: use proper VTY port number defined in libosmocore (4261)Neels Hofmeyr1-1/+2
We used to have hardcoded 2323 from early development, use the proper libosmocore definition instead. Depends: Ife52a968a41cb286f640006587877971ff66c1a4 (libosmocore) Change-Id: Id67d89695ebdc6288f507338c15ad773b8adf6e4
2017-12-19iu client: store multiple LAC,RAC per RNC = fix paging for multiple RNCNeels Hofmeyr1-86/+131
Introduce a list of LAC+RAC entries for each RNC, hence allow serving more than one LAC per OsmoHNBGW. iu_client is used by OsmoMSC and OsmoSGSN, both will be able to page successfully in a setup with multiple LACs (read: multiple hNodeB) connected to an OsmoHNBGW. Ensure that each LAC,RAC is registered with at most one RNC Id. If a LAC,RAC shows up on a different RNC Id than before, move it over to the new RNC Id. Future patches should probably add: * timeouts of RNC Id / LAC,RAC validity, to remove unused entries. * VTY/CTRL commands to introspect which RNCs and LAC,RACs are listed. * VTY/CTRL commands to remove RNC Id / LAC,RAC entries. Change-Id: I189f8e2663353276b1c615d2f78455dafe568045
2017-12-04osmo-hnbgw: don't configure specific local IP address for STP connectionNeels Hofmeyr1-2/+1
It's not necessary to set a local IP to connect to OsmoSTP with, 'any' is as good as any. Related: OS#2663 Change-Id: If5d0a1500de5e2c4b80acf025761d0264a8a51a0
2017-11-24cosmetic: osmo-hnbgw: log remote SCCP addresses on startupNeels Hofmeyr1-0/+5
Change-Id: I6395dcde35359617cae52ff59d4eb53930097c7d
2017-11-24osmo-hnbgw: auto-config local and remote PCs if omittedNeels Hofmeyr1-5/+15
The current default point-code for OsmoMSC is 0.23.1 and for OsmoSGSN 0.23.4. See https://osmocom.org/projects/cellular-infrastructure/wiki/Point_Codes. Before this patch, osmo-hnbgw requires a cs7 config and explicit point-codes for MSC and SGSN as well as a local one. Provide default config if none is provided: Use above default point-codes if no MSC and/or SGSN address are provided. Also create a default cs7 instance with local PC 0.23.5. This allows completely omitting cs7 instance and SCCP addresses from osmo-hnbgw.cfg in a single-box setup. Change-Id: I056547f26858d3ad52e66a15f7a4273dcc300e97
2017-11-22test_common: fix compiler warning: include ranap_common.hNeels Hofmeyr1-0/+2
test_common.c:85:2: warning: implicit declaration of function ‘ranap_set_log_area’ Change-Id: Ice192e1f7f1bdafe0941160f43e573349aaceb75
2017-11-22ranap_msg_factory: sanitize: memcpy instead of unaligned int copyNeels Hofmeyr1-3/+4
The sanitize build complains about writing to a uint32_t that is not 4-byte aligned. Instead, write the uint32_t by memcpy. For that, move the common ntohl() to the top and store in a local uint32_t, memcpy() from that in both code paths. Change-Id: Iacdd15421f824dd009448a96355b533dff28258b
2017-11-22tests: sanitize: fix mem leaks, clean after testsNeels Hofmeyr5-1/+33
Fix various mem leaks in the testing code. Add test_common_cleanup() in test_common.c, to free talloc contexts; call in test-{helpers,hnbap,ranap}.c. Upon talloc ctx cleanup, ensure that they are actually empty, in order to catch newly introduced mem leaks. If non-empty, print talloc context reports. Change-Id: Ic66c005f2a264774e18bb54e58b87bef5944511c
2017-11-21Fix various compiler warnings in hnb-gw codeHarald Welte9-77/+62
Since we finally started to use -Wall, the related warnings became visible. Change-Id: I516700eab2aa7c3412dd62775c4960aed9d4b682
2017-11-21sccp_sap_up(): Fix never-hit "default" case in switchHarald Welte1-1/+1
As the default was called "defualt", it became a standard C label and was never actually performing any default catch-all behavior. As we didn't use -Wall, gcc never warned us about it so far :/ Change-Id: I9dbad21e75a55ad91b12d3d3ee8bd6dfb5326c3e
2017-11-21hnbgw.c: Remove dead code creating libsctp linker dependencyHarald Welte1-15/+0
Since I8ac15fa2fd25bedb26297177e416976a5389b573 in July 2017 we are not using sctp_*() functions directly anymore but go via libosmo-sigtran. However, some dead code remained in hnbgw.c, which means that linkage will fail if compiled without any optimization, i.e. without -O present. Change-Id: Ifbcb21d43e17bf512bc7b219e590410e06c434ca
2017-11-21Add "-Wall" to the compile rules of the non-asn1c-generated source codeHarald Welte2-2/+2
This is actually default in all other osmocom projects, and it's a big surprise that it hadn't been enabled for osmo-iuh. Now we finally can see that there are e.g. unused static functions in the code. Change-Id: I8d52b11e3f476ffd77f3ab185b679817cd3b2163
2017-11-20api doc: clarify byte order in ranap_new_msg_rab_assign_*Neels Hofmeyr1-2/+4
Change-Id: Ib0d2cc538488a995be5278092d3ac105be8aad33
2017-11-20osmo-hnbgw: drop erratic log line on remote STP addressNeels Hofmeyr1-2/+0
The stp_host is just the *default* that may be overridden by the VTY configuration. Don't log it as the one that is going to be used. It's not trivial to print the actual IP address being used, there may be any number of ASP, theoretically. Hence leave logging up to osmo_sccp_simple_client_on_ss7_id(), after another hypothetical patch. Change-Id: Ia438143606913faccc8cdf4fd5f7d376f93e7891
2017-11-16src/Makefile.am: drop unused COMMON_LDADDNeels Hofmeyr1-2/+2
unused since change-id Ic6a645a93406670d58eb5edf5f2f2e1266168c92 "osmo-hnbgw: Avoid useless linking to libosmogsm and libsctp" Change-Id: I4241a1d84b54a77a6a6dad809f8ec921f45ba4bc
2017-11-08vty: skip installing cmds now always installed by defaultNeels Hofmeyr2-5/+0
vty_install_default() and install_default() will soon be deprecated. Depends: I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b Change-Id: I61b79f633d36814b53e40f1a92b5847c9ff4fde0
2017-11-03Link libosmo-ranap against libosmovtyHarald Welte1-1/+1
This fixes the following dh-shlibdeps warnings: Change-Id: I08be684c45c7e95315dba6ccf9892fe6fc7c3f24 dpkg-shlibdeps: warning: symbol install_element used by debian/libosmo-ranap1/usr/lib/x86_64-linux-gnu/libosmo-ranap.so.1.0.0 found in none of the libraries dpkg-shlibdeps: warning: symbol vty_out used by debian/libosmo-ranap1/usr/lib/x86_64-linux-gnu/libosmo-ranap.so.1.0.0 found in none of the libraries
2017-11-03osmo-hnbgw: Avoid useless linking to libosmogsm and libsctpHarald Welte1-2/+1
This fixes the following dpkg-shlibeps warnings: Change-Id: Ic6a645a93406670d58eb5edf5f2f2e1266168c92 dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/osmo-hnbgw/usr/bin/osmo-hnbgw was not linked against libosmogsm.so.8 (it uses none of the library's symbols) dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/osmo-hnbgw/usr/bin/osmo-hnbgw was not linked against libsctp.so.1 (it uses none of the library's symbols)
2017-10-27Tag/Release 0.2.0 + Update LIBVERSION + Debian packaging0.2.0Harald Welte1-1/+1
Change-Id: I4fe653fdde6acda59485c73cee63bfc5326edf28
2017-10-04Makefile.am: Link libosmo-ranap against libosmo-sigtranHarald Welte1-1/+2
In Change-Id I6a3f7ad15be03fb94689b4af6ccfa828c25f45c0 we introduced the somewhat arguable combination of Iu code in libosmo-ranap. This Iu code uses functions provided by libosmo-sigtran. However, at the time it was overlooked to explicitly link libosmo-ranap against libosmo-sigtran, which caused linking failures of programs using libosmo-ranap, such as the unit tests included in this package. Below example is from building using contrib/jenkins.sh on Ubuntu 17.04: CCLD test-ranap ../../src/.libs/libosmo-ranap.so: undefined reference to `osmo_sccp_local_addr_by_instance' ../../src/.libs/libosmo-ranap.so: undefined reference to `osmo_sccp_tx_unitdata_msg' ../../src/.libs/libosmo-ranap.so: undefined reference to `vty_out' ../../src/.libs/libosmo-ranap.so: undefined reference to `install_element' ../../src/.libs/libosmo-ranap.so: undefined reference to `osmo_sccp_user_bind' ../../src/.libs/libosmo-ranap.so: undefined reference to `osmo_sccp_user_sap_down' ../../src/.libs/libosmo-ranap.so: undefined reference to `osmo_scu_prim_name' ../../src/.libs/libosmo-ranap.so: undefined reference to `osmo_sccp_addr_dump' collect2: error: ld returned 1 exit status Makefile:418: recipe for target 'test-ranap' failed Change-Id: Ibfbcafd31c91dc630d406ec39b3b076bdb1f4c19
2017-08-15hnbgw_cn.c: use new signature of osmo_sccp_addr_name(osmo_ss7_instance *ss7, ↵Alexander Couzens1-1/+1
osmo_sccp_addr *addr) libosmo-sccp introduce the new signature in 564ff618004b ("sccp: make osmo_sccp_addr_name() available") Change-Id: I5c9abba321ec182d293c33bcffea3462f8717045
2017-08-13iu_client: derive local SCCP addr from sccp instanceNeels Hofmeyr2-27/+3
ranap_iu_init() is passed an sccp instance that has a local primary point code. Use this primary PC by default as the local address for IuCS and IuPS clients. Remove the current vty command 'iu local-address point-code PC': - It is possible that we would like to configure a differing local point code at some point; this should then happen via sccp address book entries, not parsing PC directly. - Obtaining the local PC from the SCCP instance makes this command obsolete for all setups we're currently aiming at: one local PC per SCCP instance. - There are vty doc failures in this vty command, which cause osmo-msc and osmo-bsc vty test failures; rather than fixing this, let's drop it entirely until we see a need for it (and then do it properly with the address book). Cosmetic: prefix the local static variable with g_* like g_sccp and g_scu and define it in the same place. No default values are needed anymore, it gets overwritten in ranap_iu_init(). Change-Id: I3bb7fc1cd5261d214c6ba0cccfe95f637e6db087
2017-08-09make point codes configurable by SCCP address bookNeels Hofmeyr4-88/+111
In the vty config, use the SCCP address book to configure the local and remote SCCP addresses. Add VTY commands to set the remote SCCP addresses by name, derive the ss7 instance from these addresses: cs7 instance 1 point-code 0.23.0 sccp-address msc point-code 0.0.1 sccp-address sgsn point-code 0.0.2 hnbgw iucs remote-addr msc iups remote-addr sgsn Enforce that both IuCS and IuPS use the same ss7 instance. In the future, we may add the feature to use two separate instances. Depends: libosmo-sccp I75c67d289693f1c2a049ac61cf2b2097d6e5687d, Ie1aedd7894acd69ddc887cd65a8a0df4b888838c, I85b46269dbe7909e52873ace3f720f6292a4516c Change-Id: I33a7ba11eb7c2d9a5dc74d10fb0cf04bf664477b
2017-07-31move openbsc.git's iu.h, iu.c, iu_vty.c here as iu_clientNeels Hofmeyr3-1/+924
To help split openbsc.git to separate MSC and SGSN repositories, place the common Iu interface related code here in libosmo-ranap. Also apply various improvements while moving (from intermittent code review). The code depends on libosmo-ranap tightly. One reason to want this separate from libosmo-ranap could be that it uses libosmo-sigtran, accepting an sccp instance. However, including in libosmo-ranap is the simplest way to go. The osmo-iuh build depends on libosmo-sigtran anyway because of OsmoHNBGW, and all current users of libosmo-ranap also naturally link libosmo-sigtran already. Apply prefix ranap_iu_ and RANAP_IU_ to allow smooth transition from the openbsc.git iu_ to the libranap ranap_iu_ implementations. Prune unneeded #include statements. Instead of sccp_addr, store an rnc pointer in the ue_conn_ctx. To facilitate, also: - Move iu_rnc struct to iu_client.h (as ranap_iu_rnc). - Instead of sccp_addr, pass rnc to ue_conn_ctx_alloc(). - Pass a local struct new_ue_conn_ctx containing the sccp_addr and conn_id up the RANAP handling stack in case of an InitialUE message. - Separate the InitialUE message handling from cn_ranap_handle_co(), by moving to new and separate cn_ranap_handle_co_initial(), so we can still pass a looked-up ue_conn_ctx to all other cn_ranap_handle_co() code paths. - Allocate the ue_conn_ctx only in ranap_handle_co_initial_ue(), not as early as before. Note that we are not actually ever using the rnc pointer now present in ue_conn_ctx. It could be used for more concise paging, to first page only the RNC where we last saw the subscriber. So far we page all matching LAC/RACs. Tweak error logging: use __func__ instead of writing the function names as string constants. In iu_client_vty.c: - Move the asn.1 debug commands from logging over to the iu node. They are not specific to the logging target. They could qualify for an entirely separate 'asn1' root node, but for simplicity place under 'iu'. - Add the 'asn1' commands to ranap_iu_vty_config_write(), so far missing. - remove the legacy "net." from a VTY error message, it is not known which name the parent node of 'iu' has. Depends: libosmo-sccp I85b46269dbe7909e52873ace3f720f6292a4516c, libosmo-sccp Ie1aedd7894acd69ddc887cd65a8a0df4b888838c Change-Id: I6a3f7ad15be03fb94689b4af6ccfa828c25f45c0
2017-07-27cn unitdata: verify correct remote addrNeels Hofmeyr1-0/+28
When receiving unitdata from the CN, verify that it is indeed coming from the remote address that matches our CS/PS domain settings. This patch came from an earlier stage where the is_ps out-parameter was actually used. While it currently isn't, it doesn't hurt to leave it there. Change-Id: I7190b4c3a05e8bac0eeffa1eab18c9e47429cb17
2017-07-06set RANAP msgb headroom to 512 (times two)Neels Hofmeyr1-1/+1
With a headroom of 256, the SGSN crashes with: msgb(0x6e3b90): Not enough headroom msgb_push (256 < 264) I'm not perfectly sure what amount of headroom is strictly necessary. The only reason to pick 512 is that it is twice the amount of 256. Change-Id: I9a193846902a0477af0873f78283c4f2bedaf5dd
2017-07-05rua_to_scu(): add debug log for calling/called addrNeels Hofmeyr1-0/+10
This might help in resolving whether we are conforming to SCCP specs regarding our calling/called address choices. Change-Id: Ie91953f7e9033419257d556d3a9f14e125f5c60d
2017-07-05rua_to_scu(), rua_rx_init_connect(): add debug loggingNeels Hofmeyr1-2/+21
In rua_to_scu(), log domain indicator and remote address. In rua_rx_init_connect(), add domain indicator to log. Change-Id: Ibe510bf0aca5eadbc0ce6031d3026e770de6559f
2017-07-05sccp_sap_up(): guard against NULL pointersNeels Hofmeyr1-1/+16
Change-Id: Icd64b92b00461cace5c476c8bcf69eec3fdbbdd3
2017-07-05migrate osmo-hnbgw to libosmo-sigtran's SCCP/M3UANeels Hofmeyr6-120/+114
libosmo-sigtran now has a "proper" SCCP/M3UA stack, so we can make our hnb-gw 3GPP compliant by switching from the old SUA code to the new universal SCCP user API with support for (currently) M3UA and SUA. Main changes: Use one cn_link to STP: We will connect to the core network using an (Osmo)STP instance that routes to MSC and SGSN, so we want one SCCP link instead of two. The only difference between IuCS and IuPS is a different remote osmo_sccp_addr. This has various effects through the messaging code; the patch is a bit larger than I would like, but it is hard to separate out truly independent smaller changes. CS or PS domain was previously flagged in the separate cn_link, as ctx pointer for two separate sccp_sap_up()s. Now there's just one such ctx, so determine is_ps from the RANAP Domain Indicator, or from the conn's hnbgw_context_map: - Add is_ps to context_map_alloc_by_hnb(). - To find a matching context, the RUA ID alone is no longer sufficient, also match is_ps (possible optimization todo: separate lists). We would send separate CS or PS Reset messages based on the cn_link, instead send both CS and PS Reset at the same time for the single cn_link. This could be adjusted to detect presence of MSC or SGSN instead. Pending: adjust the VTY config to reflect that there is only one remote address. Place a TODO comment for that. Smaller changes: rua_to_scu(): populate called and calling addresses for N_CONNECT and N_UNITDATA. Remove DSUA. Don't build dummy_cn, which is still implemented on SUA. Mark todo to maybe re-include it based on M3UA later. In hnbgw_cnlink, place sccp related items in a separate sub-struct. Do not keep an llist of cn_links, just have the one. Remove iteration and list management. Change jenkins script to build libosmo-sccp master. Patch-by: hwelte, nhofmeyr Change-Id: I8ac15fa2fd25bedb26297177e416976a5389b573
2017-07-05cosmetic: move callers' common switch() into rua_to_scu()Neels Hofmeyr1-57/+25
Change-Id: If6274e3738dc04646d0dc18332c12237e6910d18
2017-04-06hnbgw: Fix crash if cnlink fails to connectPau Espin Pedrol1-0/+1
Return NULL in the error code path, otherwise an uninitialized pointer is returned and later accessed when a UE tries to register using the cnlink. Change-Id: I4f3e2e0680de3216e2e569958bd64f70dc30c2a3
2017-02-02new_rab_par_voice(): add bitrate params, call with (6700, 12200)Neels Hofmeyr2-8/+9
The guaranteedBitrate lowers from 12200 to 6700, which is mimicking the values found in a trace from a production 3G environment. So far we have no reason to choose these values other than knowing that other operators seem to do this. This came up while trying to fix voice RAB for the nano3G, but this patch had no effect on that. Now that it's here, we might as well keep it. Change-Id: Ia7eecca43d62a6a020466e9b8dc8b566ca988f9f
2017-02-02ranap: make X.213 NSAP 160 bits long, zero paddedNeels Hofmeyr2-12/+16
For IPv4 addresses, only 56bit of X.213 NSAP are used. The sysmocell5000 accepts such a field that is 56bits long, but the ip.access nano3G does not (and crashes instead). Both work when zero-padded to 160bits size. So far we used to send the IPv4 address as "raw" 32bits to the nano3G to avoid the crash. With this zero padding we no longer need such a workaround and can use identical config for both cells. Change-Id: I070bbfe887ab93d08322df30571050a381d082d5
2017-02-01cs RAB: add nAS_SynchronisationIndicatorNeels Hofmeyr2-11/+19
This is mimicking the IEs found in a trace from a production 3G environment. We have no reason to add this other than knowing that other operators seem to do this. This came up while trying to fix voice RAB for the nano3G, but this patch had no effect on that. Now that it's here, we might as well keep it. Change-Id: I14c22b0befb308bac2eded662fe13a58c8478743
2016-12-07log: fix number format for domain indicatorNeels Hofmeyr1-2/+2
CN_DomainIndicator_t is a long, so use %l format. Error was introduced in recent 2b5021fd8d445f0ca4f28e0ea71a19cd52724e57. Fixes: CID#157119 Change-Id: I22f49d45bc87897beb24a6b1eee6c83da3e57b0f
2016-11-27hnbgw: rua rx: fix rc and log unhandled Private MsgNeels Hofmeyr1-0/+3
Fixes: CID#57949 Change-Id: I822888a3cf450e2787fc352e0352aed92236ddb7
2016-11-27fix error rc in various ASN.1 decoding functionsNeels Hofmeyr5-6/+6
Fixes: CID#57945, CID#57946, CID#57947, CID#57948, CID#57950, CID#57951 Change-Id: I2d9ee1aa79959c5973041393f4769faa13720898
2016-11-27hnbgw_rua: reject invalid domain indicatorNeels Hofmeyr1-0/+14
Fixes: CID#135226, CID#135227 Change-Id: I0c44179aac02772585214e528207e959ad168f3c
2016-11-26ue_context_alloc(): Avoid ue->imsi without NULL terminationHarald Welte1-2/+3
Change-Id: I152e84206e0b2b80fa79956f5adbbe84ff10b4ab Fixes: Coverity CID 57625
2016-10-27hnbgw: parameterize IuCS and IuPS ips and ports: add vty cmdsNeels Hofmeyr2-2/+131
Basically copy-paste the Iuh local-ip and local-port code to provide parameterization of the IuCS and IuPS remote addresses. Add IUCS and IUPS nodes, enhance go_parent_cb and config writing accordingly. Change-Id: I2c28977011009df4e1fa472290bbbc359e406971
2016-10-27hnbgw: vty: set explicit go_parent_cbNeels Hofmeyr2-0/+22
A second level of depth will be added to the hnbgw node soon, which will need explicit go-parent logic. Change-Id: I8d1c18a396c215e8425ae49872b5c73316087d7d
2016-10-27hnbgw: parameterize iuh local port: add vty cmdNeels Hofmeyr1-0/+14
For completeness' sake, add VTY command to set the local Iuh port, to go with the command that sets the local IP. Change-Id: I4b5e9fe9fcfa489069a0728d47899ef4a61f7ce5
2016-10-27hnbgw: cosmetic: local-ip config: drop getter functionNeels Hofmeyr1-14/+5
Use the g_hnb_gw->config.iuh_local_ip directly, drop hnbgw_get_iuh_local_ip(). Change-Id: Ie91aea82ae5d128ad735a0857ea814b440c3232c Suggested-by: hwelte
2016-10-13cosmetic: hnbgw: addr related renames, move define, move commentNeels Hofmeyr2-13/+17
Prepare for parameterization of IuCS and IuPS addresses: Conform internal variable naming to local-ip, local-port, remote-ip, remote-port (instead of bind-ip). Rename HNBGW_IUH_LOCAL_IP_DEFAULT to HNGGW_LOCAL_IP_DEFAULT to be more general and move it to the top. Move a function doc comment to the .c file. Change-Id: Ice85941c978498e3ddf41d151248507e7f56cb5d
2016-10-13fix msgb talloc context initializationNeels Hofmeyr4-3/+3
Properly initialize msgb talloc context in hnbgw and all tests, using the new msgb_talloc_ctx_init(). test-ranap.c: since msgb talloc ctx is now in test_common_init(), remove msgb talloc init here. Change-Id: I807c799aff1239184728551ed77fdafa73bd683f