Commit Graph

1296 Commits

Author SHA1 Message Date
Harald Welte 534163bade remove doxygen_sqlite3.db during 'make clean' 2014-10-26 20:09:17 +01:00
Harald Welte 6729a9776a make sure to register DF.TELECOM and DF.GSM for SIM, USIM + TSIM
before we only did it partially, and by exporting data from sim,
rather than the new osim_int_cprof_add_{gsm,telecom}() functions.
2014-10-26 19:50:55 +01:00
Harald Welte db2b52ee84 sim: More talloc return NULL checking 2014-10-26 19:50:55 +01:00
Harald Welte 67354b1b4e sim: add missing const to reader_ops member of reader_handle 2014-10-26 19:50:55 +01:00
Harald Welte 55790aa09a sim: Prepare infrastructure for protocols != T=0 and other drivers 2014-10-26 19:50:51 +01:00
Harald Welte 586d710e05 sim: More comments in sim.h 2014-10-26 19:09:24 +01:00
Harald Welte aad7e0664b sim: Make TETRA SIM (TSIM) support compile 2014-10-26 19:09:24 +01:00
Harald Welte 30115dbd72 sim: Only one default_decode() function for all card types 2014-10-26 19:09:24 +01:00
Harald Welte 171c5b1ec7 sim: Add 3GPP TS 31.103 ISIM definitions 2014-10-26 19:09:24 +01:00
Harald Welte bb5f3c7e04 sim: Update to latest SIM/USIM specs and include size information 2014-10-26 19:09:23 +01:00
Harald Welte 3fc3f068b3 sim: Make osmo-sim-test compile again 2014-10-26 19:09:23 +01:00
Harald Welte 0d24644f52 sim: reader_pcsc.c: Avoid compiler warnings by using pcsc-lite LONG 2014-10-26 19:09:23 +01:00
Harald Welte e8dd2bd4b5 sim: mark osim_msgb_cb as __may_alias__ to avoid gcc warnings 2014-10-26 19:09:23 +01:00
Harald Welte 2656e65bed sim: Add sfi to EF_*() macros 2014-10-26 19:09:23 +01:00
Harald Welte 1e0dfdad69 sim: Add minimal/recommended size of file / record 2014-10-26 19:09:23 +01:00
Harald Welte d83d29610a sim: further updates/fixes 2014-10-26 19:09:23 +01:00
Harald Welte 7674960ffa sim: add decoding of status words 2014-10-26 19:09:23 +01:00
Kevin Redon 43eabeeeaa sim: replaced function/structure comments with doxygen comments
affected files: sim.h, sim/core.c
affected funtions/strucutres: osim_new_apdumsg, osim_apdu_case,osim_apdu_cmd_hdr, osim_msgb_cb
2014-10-26 19:09:23 +01:00
Kevin Redon dede831fcd sim: add comment/explaination for structure osim_msgb_cb 2014-10-26 19:09:23 +01:00
Kevin Redon 1707306da5 sim: add comment/explaination for structure osim_apdu_cmd_hdr 2014-10-26 19:09:23 +01:00
Kevin Redon 5985760a61 sim: added utils/osmo-sim-test to .gitignore 2014-10-26 19:09:23 +01:00
Kevin Redon e07967f689 sim: renamed case to the one defined in ISO7816-3
APDU_CASE_2 becomes APDU_CASE_2S
APDU_CASE_2_EXT becmoes APDU_CASE_2E
APDU_CASE_3 becomes APDU_CASE_3S
APDU_CASE_3_EXT becmoes APDU_CASE_3E
APDU_CASE_4 becomes APDU_CASE_4S
APDU_CASE_4_EXT becmoes APDU_CASE_4E
2014-10-26 19:09:23 +01:00
Kevin Redon 6956ee1ba1 sim: add comment/explaination for structure osim_apdu_case 2014-10-26 19:09:22 +01:00
Kevin Redon 0f0ee32d81 sim: comment/explain signature of osim_new_apdumsg 2014-10-26 19:09:22 +01:00
Harald Welte a5c9255baa sim: strip the SW from the returned data, as SW is passed in msgb->cb 2014-10-26 19:09:22 +01:00
Harald Welte 495fe2682c sim: Use autotools for libpcsc-lite linkage 2014-10-26 19:09:22 +01:00
Harald Welte ad41863b8d sim: add copyright notices and merge file_codec.c into core.c 2014-10-26 19:09:22 +01:00
Harald Welte a0ba4d9438 sim: osmo-sim-test: Also dump binary files 2014-10-26 19:09:22 +01:00
Harald Welte d54c2ee8c5 initial checkin of 'libosmosim' 2014-10-26 19:09:22 +01:00
Harald Welte cac3cd6fcd msgb: make msgb_get() finally work as expected 2014-10-26 19:08:43 +01:00
Holger Hans Peter Freyther 42645d7d78 misc: Ignore the new test file as well 2014-10-25 12:20:24 +02:00
Holger Hans Peter Freyther e0a1a8021f bssgp: Include sys/socket.h for AF_INET on FreeBSD 2014-10-25 12:19:56 +02:00
Jacob Erlbeck b43baf20c5 gprs: Don't discard SUSPEND/RESUME in bssgp_rcvmsg
Currently sending SUSPEND/RESUME messages to this function (like it
is done in the osmo-sgsn) results in STATUS messages complaining
about an unknown BVCI. The reason is, that these messages rely on a
TLLI/RAI pair to identify the context and do not contain an explicit
BVCI.

This patch modifies bssgp_rcvmsg() to only complain about and unknown
BVCI if one is given but a matching context is not found (except for
RESET messages). The ctx argument is removed from the functions
handling SUSPEND and RESUME since it will always be NULL then.

Sponsored-by: On-Waves ehf
2014-10-23 18:53:02 +02:00
Jacob Erlbeck cdebf7484a gprs/test: Add BSSGP tests
This patch adds a test suite for the BSSGP protocol.
The first (and only) test checks the handling of BSSGP
SUSPEND/RESUME.

Sponsored-by: On-Waves ehf
2014-10-23 18:52:56 +02:00
Max 862ba65bd6 Move common socket routine into separate function
Signed-off-by: Max <max.suraev@fairwaves.co>
2014-10-13 21:29:42 +02:00
Holger Hans Peter Freyther 10dd73cf6a bssgp: Free msgb in case of error when calling into gprs_ns_sendmsg
In the OsmoSGSN we have a crash with a DEAD/BLOCKED GPRS-NS and
segmented SN-UNITDATA. For the caller it is not easy to know if
the passed msg buffer has been freed or not. The most easy solution
is to always take the ownership and either pass it on or free it
in case of an error.

Adjust indirect and direct callers of gprs_ns_sendmsg. I found
the following call-chains with an external msgb parameter.

gprs_ns_sendmsg
  <- _bssgp_tx_dl_ud
     <- bssgp_fc_in
        <- bssgp_tx_dl_ud

Update the test to allocate a real msgb because for the test with
'1000' we will msgb_free it right away.

Sponsored-by: On-Waves ehf
2014-10-10 17:55:13 +02:00
Jacob Erlbeck dade018f2f gprs-ns/test: Check the nsvc state explicitely
This patch extends test_sgsn_reset_invalid_state by assertions to check
that nscv->state and nsvc->remote_state have been set as expected.

Sponsored-by: On-Waves ehf
2014-10-09 16:08:44 +02:00
Holger Hans Peter Freyther 84bcce6b4f gprs-ns/test: Re-add return value check for gprs_nsvc_reset
The return value check has been removed in the commit 'Use
gprs_nsvc_reset instead of gprs_ns_tx_reset', because gprs_nsvc_reset
had no return value then. Since a compatible return value has been
added by 'Let gprs_nsvc_reset return a value', the former patch is
partly reverted by this commit.

The printf is now an OSMO_ASSERT. The commit message was taken
from Jacob.

Sponsored-by: On-Waves ehf
2014-10-09 16:08:20 +02:00
Jacob Erlbeck 6ac70a41ee gprs-ns: Fix reset state handling
Currently the NS-VC's state is updated from within gprs_ns_tx_reset,
which can lead to an inconsistent state when the RESET_ACK is lost.
In this state, the NSE_S_RESET bit is set but the Tns-reset timer is
not started.

This patch moves the state update into gprs_nsvc_reset. This way, the
state flags are consistent with the timer.

Addresses:
  SGSN -> BSS       NS_ALIVE
  BSS -> SGSN       NS_ALIVE_ACK
  BSS -> SGSN       BVC_RESET
  SGSN -> BSS       NS_STATUS, Cause: NS-VC blocked, NS VCI: 0x65
  and there is no BSS->SGSN NS_ALIVE

Ticket: OW#1213
Sponsored-by: On-Waves ehf
2014-10-09 07:52:43 +02:00
Jacob Erlbeck 0540d839ac gprs-ns: Let gprs_nsvc_reset return a value
Currently gprs_nsvc_reset does not return any value.

This patch changes the function to return an integer, where a value
less than zero indicates an error. The value is taken from the
gprs_ns_tx_reset function. In case of failure, an error message is logged.

Sponsored-by: On-Waves ehf
2014-10-09 07:47:20 +02:00
Jacob Erlbeck cdb85f58c5 gprs-ns/test: Add test_sgsn_reset_invalid_state
This tests the behaviour for a certain combination of messages and
packet losses that can put the NS-VC object into an undefined state.

In that state, the peer's ALIVE messages are properly answered, but
the local test procedure has stopped, incoming unitdata PDUs are
answered by STATUS(NS-VC blocked) and the unblocking procedure is not
initiated.

Ticket: OW#1312
Sponsored-by: On-Waves ehf
2014-10-09 07:46:22 +02:00
Jacob Erlbeck f1bcbb0f8a gprs-ns/test: Add expire_nsvc_timer
This function forces the expiration of the timer within struct
gprs_nsvc. It is meant to be used for controlled (and faster) timer
expiration in unit tests. The timer_mode of the expired timer is
returned (or -1 if the timer wasn't active).

Sponsored-by: On-Waves ehf
2014-10-09 07:44:47 +02:00
Jacob Erlbeck 2381fded68 gprs-ns/test: Save the last PDU type sent
This records the PDU type of the last message sent to the remote peer
in the global variable sent_pdu_type, which can then be used in
assertions.

Note that sent_pdu_type will remain unchanged if no message has been
sent via sendto.

Sponsored-by: On-Waves ehf
2014-10-09 07:43:54 +02:00
Jacob Erlbeck f357c87724 gprs-ns/test: Use gprs_nsvc_reset instead of gprs_ns_tx_reset
Currently gprs_ns_tx_reset is used to let the NS stack generate
NS_RESET message. This is not adjusting the nsvc state properly.

This patch uses gprs_nsvc_reset instead which starts the full reset
procedure.

Sponsored-by: On-Waves ehf
2014-10-09 07:41:14 +02:00
Jan Engelhardt 1a632552e0 build: resolve compiler warning about implicit delcaration
CC       msgfile_test.o
msgfile/msgfile_test.c: In function "main":
msgfile/msgfile_test.c:48:2: warning: implicit declaration of
function "talloc_free" [-Wimplicit-function-declaration]
  talloc_free(entries);
  ^
2014-10-04 11:49:23 +02:00
Jan Engelhardt c60de4f35f build: fix linker error with kasumi_test
When the osmocore package is configured with --disable-static,
building of kasumi_test fails. This seems quite legit, given
the function _kasumi_kgcore is not exported.
Don't try to workaround the build system. Include the code.

  CCLD     kasumi/kasumi_test
kasumi_test.o: In function `test_expansion':
~tests/kasumi/kasumi_test.c:25: undefined reference to `_kasumi_key_expand'
kasumi_test.o: In function `main':
~tests/kasumi/kasumi_test.c:56: undefined reference to `_kasumi'
~tests/kasumi/kasumi_test.c💯 undefined reference to `_kasumi_key_expand'
~tests/kasumi/kasumi_test.c:112: undefined reference to `_kasumi_kgcore'
[...]
2014-10-03 08:48:31 +02:00
Jan Engelhardt 9ffeb9756a build: remove unused all_includes and use AM_CPPFLAGS
Preprocessor flags are best placed in AM_CPPFLAGS. Remove use of the
unused all_includes variable, which is never set.
2014-10-03 08:48:31 +02:00
Jan Engelhardt a6d83932ba utils: resolve compiler warnings on implicit declarations
CC       osmo-auc-gen.o
	osmo-auc-gen.c: In function 'main':
	osmo-auc-gen.c:216:3: warning: implicit declaration of function
	'time' [-Wimplicit-function-declaration]
2014-10-03 08:46:47 +02:00
Holger Hans Peter Freyther 96af78650d misc: Look into the build directory for generated files
the bits/crc files are not inside the sourcedirectory but will end
in the build directory. Go and look there as well. This somehow
doesn't fail with make distcheck but when building for Yocto Dizzy.
2014-09-25 18:18:49 +02:00
Jacob Erlbeck a39e2deff8 gprs: Set bssgph field in bssgp_msgb_alloc()
Currently the bssgph field is not set when using the bssgp_tx_*
functions. This hinders unit testing of generated messages.

This patch initializes the bssgph field directly after allocation a
new bssgp msgb in bssgp_msgb_alloc() so that it is set by default.

Sponsored-by: On-Waves ehf
2014-09-23 16:30:49 +02:00