Commit Graph

11 Commits

Author SHA1 Message Date
Max a468cfaf2e tests: remove unused definition
Fix compilation warning.

Change-Id: I1c95c6ec8bee68773643f9646b0319a83fbc6cfa
2017-06-22 13:28:39 +02:00
Neels Hofmeyr 78ce59137f main, tests: use msgb_talloc_ctx_init() (new)
msgb_set_talloc_ctx() is deprecated since libosmocore commit
f45334be29016a36594aacc07c90e262e4994525 / change-id
I747fbbf977c4d2c868c8dead64cfc5fd86eb8d4c

Change-Id: I8d40abec428b739460ed545c9983d1b63021bd08
2017-02-08 17:37:55 +01:00
Jacob Erlbeck 0494c75a53 pcu_emu/test: Initialise current_test
Currently the global current_test is not initialised, which leads to
memory access failures. In addition, the variable is signed but used
in comparisons with unsigned values.

This commit changes the type to size_t and initialises the variable
to 0.

Sponsored-by: On-Waves ehf
2015-05-04 10:02:01 +02:00
Jacob Erlbeck 1f33294b1c pcu: Fix non-critical warnings
These fixes do not affect the semantics of the code. They either help
gcc by providing default values that won't be used ("may be
uninitialised"), remove unused variables, or change signed to
unsigned variables to avoid comparison warnings.

Addresses:
  bts.cpp:494:32: warning: 'tbf' may be used uninitialized in this
      function
  emu/test_replay_gprs_attach.cpp:81:27: warning: comparison between
      signed and unsigned integer expressions
  emu/test_pdp_activation.cpp:95:23: warning: unused variable ‘budh’
  emu/test_pdp_activation.cpp:97:6: warning: variable ‘rc’ set but
      not used
  emu/pcu_emu.cpp:109:26: warning: unused variable ‘bts’
  alloc/AllocTest.cpp:74:27: warning: unused variable ‘tbf’
  osmocom/core/utils.h:13:50: warning: comparison between signed and
      unsigned integer expressions
  types/TypesTest.cpp:319:7: warning: unused variable ‘count’
  types/TypesTest.cpp:320:11: warning: unused variable ‘rbb’
  alloc/AllocTest.cpp:74:27: warning: unused variable ‘tbf’
  alloc/AllocTest.cpp:132:11: warning: unused variable ‘ts_no’
2015-05-04 10:01:25 +02:00
Holger Hans Peter Freyther b3a87ced5a test: Remove the side-effect from the assertion
Coverity complains about this code as it doesn't know that the
OSMO_ASSERT is always on. But it is good practice to now have the
side-effect in here.

Fixes: Coverity CID 1080724
2013-12-12 14:42:35 +01:00
Holger Hans Peter Freyther b6acfdaa24 bts: Introduce a singleton for the BTS and use it in the code
Compared to the previous code there will be a branch to get the
global pointer so the code will be slightly slower than the previous
version but it allows us to start creating objects but still use
the code from C. It is best approach I have found so far.

One downside of C++ is that by default talloc will not be used
(unless we override the new operator to use talloc. Right now
we need to memset the C data structure by hand. The benefit of
enforcing a better structure should is more important though.
2013-10-30 21:20:45 +01:00
Holger Hans Peter Freyther 67ed34eedb bts: Move struct gprs_rlcmac_bts and other structs into a bts.h
Begin to make the BTS a real C++ object with real responsibilities.
The biggest issue will be the pcu_vty.c that might not like C++
at all.
2013-10-30 21:20:45 +01:00
Holger Hans Peter Freyther 9d938388f6 emu: Add a crash re-producer for the SGSN (and the concept of tests)
Introduce the concept of tests that will be ran one after the other.
This new test will send static message that will lead to the opening
of a PDP context. At this point one should use ping with a large
packet size and suspend/stop the emulator. Once the NS connection is
considered dead the SGSN will crash with a double free.

Reproduce:
0.) Add IMSI 901700000003094 to the ACL
1.) Stop/Suspend the emulation process so the NS Alive times out
2.) Use ping IP -s 2048

This will create a double free...

 #4  0xb7bb2646 in talloc_abort_double_free () at talloc.c:175
 #5  0xb7bbd41a in talloc_chunk_from_ptr (ptr=0x8091208) at talloc.c:190
 #6  _talloc_free (ptr=0x8091208) at talloc.c:517
 #7  talloc_free (ptr=ptr@entry=0x8091208) at talloc.c:990
 #8  0xb7bb319b in msgb_free (m=m@entry=0x8091208) at msgb.c:72
 #9  0x0804db54 in sndcp_send_ud_frag (fs=0xbfffcc6c) at gprs_sndcp.c:423
 #10 sndcp_unitdata_req (msg=msg@entry=0x808eed8, lle=0x808fbc8, nsapi=5 '\005',
    mmcontext=mmcontext@entry=0x80903e8) at gprs_sndcp.c:471
2013-09-04 21:29:00 +04:00
Holger Hans Peter Freyther bc1e52cfbf emu: Use OpenBSC code to decode the LLC and add assertions
Use the OpenBSC SGSN code to parse the LLC data and look into
the data we receive. Add assertions to verify the the sequence
number is increasing.
2013-09-04 21:28:53 +04:00
Holger Hans Peter Freyther 741481d3e0 emu: Send a static GPRS ATTACH request and wait for the reply.
This will send a static message. It will trigger the GMM code
on the SGSN and might ask us for the IMEI/IMSI or send us an
accept. As we are not replying at all the SGSN needs to send new
requests and we can observe if the sequence number is increasing
like it should.
2013-09-04 21:28:53 +04:00
Holger Hans Peter Freyther 4ea940787e emu: Create an app that allows to communicate with a SGSN
This code can open a BSSGP connection toward a SGSN and will
inititate the unblocking. It does not send any user data.
2013-09-04 21:28:53 +04:00