aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2015-01-18sgsn: Integrate the GSUP client into the SGSNJacob Erlbeck6-6/+94
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-18gprs: Add GSUP clientJacob Erlbeck4-2/+179
This commit adds the client code to get subscriber information from a remote server. It provides an IPA over TCP connection to transmit and receive GSUP messages. Sponsored-by: On-Waves ehf
2015-01-18gprs: Clear GSUP message structures before decodingJacob Erlbeck1-5/+5
Currently the message structure is not cleared before the message is parsed which can cause information leaking between messages if the same gprs_gsup_message object is used. Especially list elements (auth tuples and pdp info) are not replaced by an IE, but the IE is appended. This patch uses the assignment operator to clear gprs_gsup_message, gsm_auth_tuple, and gprs_gsup_pdp_info before using them. This also replaces the use of memcpy of the latter. Sponsored-by: On-Waves ehf
2015-01-18gprs: Always reset auth tuples/pdp infos in gprs_gsup_decodeJacob Erlbeck1-0/+3
Currently auth tuples are always appended to the lists when gprs_gsup_decode is called with a gsup_msg structure. This makes a test case fail, where the same gsup_msg is used again and again without clearing it after each use. Sponsored-by: On-Waves ehf
2015-01-18gprs: Handle empty GSUP messages correctlyJacob Erlbeck1-1/+4
Currently, the gprs_gsup_decode function doesn't check the return value of gprs_shift_v_fixed before using the value pointer. The function fails, if the GSUP message length (not including IPA headers) is 0. In this case, a segfault can happen, depending on the value of the uninitialized 'value' pointer. The test case doesn't trigger a segfault, but valgrind complains about reading uninitialized data. This patch adds a check for the return value that would return with an error code if the shift function failed. Sponsored-by: On-Waves ehf
2015-01-18gprs/test: Add tests for invalid GSUP messagesJacob Erlbeck1-0/+92
Currently, the tests only use valid GSUP messages. This does not check the robustness of the parser. This commit adds a test for truncated messages and another for modified messages. Thanks to Holger for the basic truncation test. Sponsored-by: On-Waves ehf
2015-01-18sgsn/test: Fix msgb freeing in mocked bssgp_tx_dl_udJacob Erlbeck1-2/+2
Currently the mocked bssgp_tx_dl_ud function used for testing in sgsn_test.c does not free the msg as it is done by the original function. This leads to a msgb leak in the test. This patch fixes the test code accordingly and uncomments the assertion that checks for left-over msgbs. Sponsored-by: On-Waves ehf
2015-01-18sgsn/test: Add checks and reports to detect msgb leakageJacob Erlbeck1-0/+4
This commit adds talloc reports to log remaining chunks after the testing has been finished. It also adds a (currently disabled) check, that no msgbs are allocated after running the tests. Sponsored-by: On-Waves ehf
2015-01-10gprs: Add subscriber functions to create/handle GSUP messagesJacob Erlbeck5-6/+374
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-10gprs: Add encoder/decoder for the Subscriber Update ProtocolJacob Erlbeck7-4/+662
This patch adds functions to encode and decode GSUP messages. This does not include the layer 1 framing (IPA). The messages so far supported are: send_auth_info_*, update_location_*, location_cancellation_*. Sponsored-by: On-Waves ehf
2015-01-10sgsn/doc: Add IPA default parametersJacob Erlbeck1-0/+6
This commit adds the default protocol identifiers that should be used for GSUP by the IPA protocol. Sponsored-by: On-Waves ehf
2015-01-10sgsn/doc: Add protocol specification for remote subscriber updateJacob Erlbeck1-0/+385
This is the first version of the specification for the GPRS Subscriber Update Protocol. Sponsored-by: On-Waves ehf
2015-01-10sgsn: Fix VTY command error handling (Coverity)Jacob Erlbeck1-3/+3
Currently the result of the osmo_hexparse function in update_subscr_insert_auth_triplet is not handled correctly. There is a misplaced leading exclamation mark in a few conditional expressions. This effectively disables the error checks, as it is noticed by Coverity ("Missing parentheses" followed by "Logically dead code"). This patch removes the exclamation marks. Fixes: Coverity CID 1260435 and CID 1260434 Sponsored-by: On-Waves ehf
2015-01-10meas: Unbreak the build once moreHolger Hans Peter Freyther2-6/+13
The code assumes that sqlite3.h is in the standard include path. Maybe sqlite3 wasn't installed or resides in a non standard (/usr/local) location? Fix the build as it has been broken since 1st of January.
2015-01-05Revert "debug.c: use new libosmocore features to print and save log filter"Harald Welte1-46/+0
This reverts commit c598e6e0a6d00827c2c974010d582815d66d0f14. It introduced a dependency from libcommon to libosmovty, which we don't want
2015-01-05meas_pcap2db.c: Fix build without CDKHarald Welte1-2/+0
Spotted by Jacob Erlbeck.
2015-01-05debug.c: use new libosmocore features to print and save log filterHarald Welte1-0/+46
2015-01-05RSL: Change "... is back in operation" to an INFO level messageHarald Welte1-1/+1
2015-01-05Don't return an error to caller if we are out of lchan on CHAN RQDHarald Welte1-1/+1
This is a normal situation under high load: The BTS is out of resources and the BSC cannot allocate any dedicated channel. We may send an IMM ASS REJECT back to the MS. All well within normal parameters, not an error that needs to be reported back to the caller, who propagates it all the way up to libosmo-abis.
2015-01-05SMS: Attempting to send SMS is not a NOTICEable eventHarald Welte1-1/+1
2015-01-02logging: Only compare the subscr addressHolger Hans Peter Freyther7-33/+71
Move the "logging filter imsi IMSI" into the BTS/NITB code to allow to set the gsm_subscriber and only compare it. This way we simply compare the subscriber address and don't have to care if the subscriber data is still valid.
2015-01-02logging: Set the context for paging requests as well.Holger Hans Peter Freyther2-0/+12
2015-01-02lchan: Remember why a channel is broken using static stringsHolger Hans Peter Freyther5-9/+24
Remember why a channel is being marked as broken. So we can maybe understand what happend.
2015-01-02misc: Ignore new binariesHolger Hans Peter Freyther1-0/+4
2015-01-02Partial revert "Fix most compiler warnings with gcc-4.9.2"Holger Hans Peter Freyther3-17/+17
Most of the "fixes" have nothing to do with gcc-4.9.2 but are a question of ABI/Architecture (e.g. x86 vs. AMD64). Revert these for now. This partially reverts commit 7b1d25a11e44bbc1cb0d2acd9f1a3d4a16ec7c90. abis_test.c: In function ‘test_simple_sw_config’: abis_test.c:68:2: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘int’ [-Wformat=] printf("Start: %ld len: %zu\n", descr[0].start - simple_config, descr[0].len); ^ abis_test.c: In function ‘test_dual_sw_config’: abis_test.c:111:2: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘int’ [-Wformat=] printf("Start: %ld len: %zu\n", descr[0].start - dual_config, descr[0].len); ^ abis_test.c:115:2: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘int’ [-Wformat=] printf("Start: %ld len: %zu\n", descr[1].start - dual_config, descr[1].len); ^ abis_test.c: In function ‘test_sw_selection’: abis_test.c:132:2: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘int’ [-Wformat=] printf("Start: %ld len: %zu\n", descr[0].start - load_config, descr[0].len); ^ abis_test.c:136:2: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘int’ [-Wformat=] printf("Start: %ld len: %zu\n", descr[1].start - load_config, descr[1].len);
2015-01-01Merge branch 'laforge/meas_vis'Harald Welte13-4/+1172
I'm merging this code, as it is proven to be very useful. The only reason to keep it out of master was the fact that the UDP data structures it sends are non-portable, so you can only run it reliably on localhost or between identical systems (hardware/compiler/os). As this hasn't been fixed in the past >= 2 years, I am merging the code now anyway. We can still introduce a portable protocol by increasing the protocol version at a later point. There are two options: a) we make 'struct gsm_meas_rep' portable. This requires an ABI change with libosmocore, as it contains struct gsm_meas_rep_unidir :( b) we introduce a completely separate wire format with corresponding encoding and decoding functions.
2015-01-01meas_feed.c: Fix compiler warningHarald Welte1-1/+1
2015-01-01meas_feed: add osmo-meas-udp2db for realtime feed into databaseHarald Welte2-2/+129
This tool can save the meas_feed messages from UDP port 8888 directly to a sqlite3 database for further analysis.
2015-01-01meas_feed: Add tool to read meas_feed PCAP and write it to sqlite3Harald Welte4-2/+489
In fact, the DB write code has been split out so we could later also have a binary that would listen to realtime meas_feed packets and stuff them into a database without any intermediate PCAP step. The database schema contains a couple of convenience wrapper views, most notably the "overview" view.
2015-01-01build meas_vis only if libcdk is availableHarald Welte2-0/+8
2015-01-01meas_vis: Add header and print TA + TO valuesHarald Welte1-9/+23
2015-01-01meas_vis: assign bar colors depending on level, display RxQualHarald Welte1-4/+53
2015-01-01Initial support for export + curses-visualization of measurementsHarald Welte8-4/+487
This extends osmo_nitb to offer a UDP feed of real-time measurement reports, which can be used by (a variety of) external tools for visualization or other processing. We also add a small ncurses based tool (meas_vis) which shows a baragraph display of the last few mobile stations that were active, indicating their uplink/downlink receive level and quality. <WARNING> This sends non-portable structures like gsm_meas_rep over UDP and assumes the receiver has identical alignment and endianness! Before this feature is merged, it either needs to be converted to a unix domain socket (but they don't do multicast, which would be nice) or the wire format needs to change into something portable with defined alignment and encoding </WARNING>
2015-01-01smscb: Prepare to fill in the info for CBCH in SI4Holger Hans Peter Freyther3-4/+4
Pass the number of bytes the rest octet for si4 should fill.
2015-01-01chan_alloc: remove ts_alloc() and ts_free()Harald Welte2-117/+1
The idea of ts_alloc()/ts_free() dates back to the very early days of OpenBSC, where we didn't yet have a fixed PCHAN type assigned for every lchan in a BTS. However, ever since, PCHAN types (channel combinations) are configured by OML in a certain way, and we only allocate LCHANs inside PCHANs of a matching type. There should be no PCHANs with type GSM_PCHAN_NONE, unless those that you don't want to use for administraive reasons or the like.
2015-01-01convert away from deprecated gsm_7bit_{encode,decode}() functionsHarald Welte2-3/+4
which removes yet another bunch of compiler warnings.
2015-01-01Fix most compiler warnings with gcc-4.9.2Harald Welte8-22/+30
2015-01-01rtp_proxy: Remove dead codeHarald Welte1-15/+0
commit 65be6de155407142ddab44faf8aee5f8d5ebf628 removed the RTP timesetamp mangling and thus the only caller to tv_difference(), which can now be removed, too.
2015-01-01chan_alloc: Fix missing break statementHarald Welte1-0/+1
Fixes: Coverity CID 1261354
2015-01-01chan_alloc.c: Don't remove SDCCH/8 without CBCHHarald Welte1-0/+1
In commit 30f1f376383df3ae8d85e96542bf14d174c25d89 we wanted to add support for SDCCH/8+CBCH, not replace the existing SDCCH/8 with the new CBCH-enabled configuration.
2014-12-30libbsc/chan_alloc: Fix size of pchan to hold the +CBCH channels as wellDaniel Willmann1-1/+1
show net with an CCCH+SDCCH/4+CBCH channel active caused bts_chan_load to read from invalid memory. Fix this by making sure the pchan array is large enough. ==30346==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff9bdc5dc8 at pc 0x5aeece bp 0x7fff9bdc5350 sp 0x7fff9bdc5348 READ of size 4 at 0x7fff9bdc5dc8 thread T0 #0 0x5aeecd in bts_chan_load /home/alphaone/scm/osmo/openbsc/openbsc/src/libbsc/chan_alloc.c:490 #1 0x5af706 in network_chan_load /home/alphaone/scm/osmo/openbsc/openbsc/src/libbsc/chan_alloc.c:511 #2 0x4b7410 in net_dump_vty /home/alphaone/scm/osmo/openbsc/openbsc/src/libbsc/bsc_vty.c:208 #3 0x4b5f23 in show_net /home/alphaone/scm/osmo/openbsc/openbsc/src/libbsc/bsc_vty.c:227 #4 0x7fdabaa425bd in cmd_execute_command_real /home/alphaone/scm/osmo/libosmocore/src/vty/command.c:2042 #5 0x7fdabaa3f124 in cmd_execute_command /home/alphaone/scm/osmo/libosmocore/src/vty/command.c:2077 #6 0x7fdabaa850e9 in vty_command /home/alphaone/scm/osmo/libosmocore/src/vty/vty.c:402 #7 0x7fdabaa75962 in vty_execute /home/alphaone/scm/osmo/libosmocore/src/vty/vty.c:666 #8 0x7fdabaa6d947 in vty_read /home/alphaone/scm/osmo/libosmocore/src/vty/vty.c:1408 #9 0x7fdabaa9165f in client_data /home/alphaone/scm/osmo/libosmocore/src/vty/telnet_interface.c:119 #10 0x7fdaba7860b6 in osmo_select_main /home/alphaone/scm/osmo/libosmocore/src/select.c:160 #11 0x43c656 in main /home/alphaone/scm/osmo/openbsc/openbsc/src/osmo-nitb/bsc_hack.c:355 #12 0x7fdab92604bc (/lib64/libc.so.6+0x224bc) #13 0x43b6cc (/home/alphaone/local/osmo-asan/bin/osmo-nitb+0x43b6cc) Address 0x7fff9bdc5dc8 is located in stack of thread T0 at offset 232 in frame #0 0x4b5faf in net_dump_vty /home/alphaone/scm/osmo/openbsc/openbsc/src/libbsc/bsc_vty.c:182 This frame has 3 object(s): [32, 40) '' [96, 104) '' [160, 224) 'pl' HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext (longjmp and C++ exceptions *are* supported) SUMMARY: AddressSanitizer: stack-buffer-overflow /home/alphaone/scm/osmo/openbsc/openbsc/src/libbsc/chan_alloc.c:490 bts_chan_load
2014-12-30libbsc/system_information.c: Fix off-by-one error in si4 generation with ↵Daniel Willmann1-3/+3
CBCH enabled ==25637==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff3f587c43 at pc 0x5bf591 bp 0x7fff3f587630 sp 0x7fff3f587628 READ of size 4 at 0x7fff3f587c43 thread T0 #0 0x5bf590 in tv_fixed_put /home/alphaone/local/osmo-asan/include/osmocom/gsm/tlv.h:237 #1 0x5b7e14 in generate_si4 /home/alphaone/scm/osmo/openbsc/openbsc/src/libbsc/system_information.c:607 #2 0x5b488b in gsm_generate_si /home/alphaone/scm/osmo/openbsc/openbsc/src/libbsc/system_information.c:882 #3 0x4cb247 in gsm_bts_trx_set_system_infos /home/alphaone/scm/osmo/openbsc/openbsc/src/libbsc/bsc_init.c:166 #4 0x4d3c26 in bootstrap_rsl /home/alphaone/scm/osmo/openbsc/openbsc/src/libbsc/bsc_init.c:272 #5 0x4ced44 in inp_sig_cb /home/alphaone/scm/osmo/openbsc/openbsc/src/libbsc/bsc_init.c:316 #6 0x7f4f15b563d7 in osmo_signal_dispatch /home/alphaone/scm/osmo/libosmocore/src/signal.c:105 #7 0x7f4f156c0e3f in e1inp_int_snd_event (/home/alphaone/local/osmo-asan/lib/libosmoabis.so.4+0x17e3f) #8 0x7f4f156be7e5 in e1inp_event (/home/alphaone/local/osmo-asan/lib/libosmoabis.so.4+0x157e5) #9 0x583a6a in ipaccess_sign_link /home/alphaone/scm/osmo/openbsc/openbsc/src/libbsc/bts_ipaccess_nanobts.c:675 #10 0x7f4f156e63b0 in handle_ts1_read (/home/alphaone/local/osmo-asan/lib/libosmoabis.so.4+0x3d3b0) #11 0x7f4f156e4f4e in ipaccess_fd_cb (/home/alphaone/local/osmo-asan/lib/libosmoabis.so.4+0x3bf4e) #12 0x7f4f15b540b6 in osmo_select_main /home/alphaone/scm/osmo/libosmocore/src/select.c:160 #13 0x43c656 in main /home/alphaone/scm/osmo/openbsc/openbsc/src/osmo-nitb/bsc_hack.c:355 #14 0x7f4f1462e4bc (/lib64/libc.so.6+0x224bc) #15 0x43b6cc (/home/alphaone/local/osmo-asan/bin/osmo-nitb+0x43b6cc) Address 0x7fff3f587c43 is located in stack of thread T0 at offset 483 in frame #0 0x5b712f in generate_si4 /home/alphaone/scm/osmo/openbsc/openbsc/src/libbsc/system_information.c:580 This frame has 8 object(s): [32, 40) '' [96, 104) '' [160, 164) 'rc' [224, 232) 'si4' [288, 296) 'cbch_lchan' [352, 360) 'restoct' [416, 420) 'l2_plen' [480, 483) 'cd' HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext (longjmp and C++ exceptions *are* supported) SUMMARY: AddressSanitizer: stack-buffer-overflow /home/alphaone/local/osmo-asan/include/osmocom/gsm/tlv.h:237 tv_fixed_put
2014-12-30move gsm_bts_get_cbch() to gsm_data_shared() as its needed in osmo-btsHarald Welte4-22/+26
2014-12-30Add basic support for CBCH / SMS-CB (Cell Brroadcast)Harald Welte7-21/+132
We can now configure the pyisical channel types for CBCH either in the CCCH+SDCCH4 or in the SDCCH8 chanel combination. Depending on whether a CBCH exists on the BTS, we also generate the SI4 with matching CBCH channel description to notify the phones of the existance of the CBCH. There is now a VTY command how a SMS-CB message can be sent to a given BTS. We do not yet have any logic at all for actual scheduling of multiple CBCH RSL messages towards one or multiple BTSs yet, though.
2014-12-25rtp: Remove the "correction" of timestampsHolger Hans Peter Freyther1-21/+0
We tend to comment out this code every XXC3, let's just get rid off it. The nanoBTS has a rather odd timing behavior. Jacob has spent hours this summer to trial/document/fix it in the MGCP code and this code is not getting close to working around the ip.access audio issues. If someobody still wants to use the nanoBTS then he should help to have the MGCP MGW use/share code with the rtp_proxy.c
2014-12-25db: Extend the test to mark a SMS as delivered and verify itHolger Hans Peter Freyther1-0/+7
Mark the SMS as delivered, then free it and try to get an undelivered SMS to that subscriber again and make sure it is failing.
2014-12-24sgsn: Add a subscriber based authentication phaseJacob Erlbeck7-82/+311
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-24sgsn: Add support for authentication tripletsJacob Erlbeck6-1/+189
This commit add data structures, functions, initialization, and VTY commands for per subscriber authentication triplets. The following VTY command is added: - update-subscriber imsi IMSI \ insert auth-triplet <1-5> sres SRES rand RAND kc KC Note that the triplets are not really used by the SGSN yet. Sponsored-by: On-Waves ehf
2014-12-23sgsn: Be more tolerant with state and SUSPEND/RESUMEJacob Erlbeck1-2/+4
Currently, when a BSSGP SUSPEND is received and the corresponding MM context is already in the state GMM_REGISTERED_SUSPENDED, a SUSPEND_NACK is returned which is not covered by GSM 08.18, 7.4.1. The same goes for RESUME in the state GMM_REGISTERED_NORMAL. This commit changes gprs_gmm_rx_suspend and gprs_gmm_rx_resume to not complain (and thus answer a NACK) when the MM context is either in GMM_REGISTERED_SUSPENDED or GMM_REGISTERED_NORMAL. Note that GSM 08.18, 7.4.1 and 7.5.1 only mention to send an NACK if the MS is not known. Even with this patch, the SGSN returns a NACK if either the MS is unknown _or_ the MM context ist not in one of the state GMM_REGISTERED_SUSPENDED and GMM_REGISTERED_NORMAL. Sponsored-by: On-Waves ehf
2014-12-23sgsn: Log requested state change in sgsn_auth_updateJacob Erlbeck1-2/+5
Sponsored-by: On-Waves ehf