Hi lynxis,
I have reverted your recent commit 38e9ea3 (see below): it introduces a
reproducable segfault in openbsc, because msg->trx is not actually set/used in
the openbsc code paths (it seems only osmo-bts uses msg->trx).
FYI, struct msgb is used very generically in osmocom, and it's dangerous to
assume that any of its members are valid or consistent with other callers,
without fully understanding and testing the surrounding code paths.
commit 38e9ea3f7f385c6660c5958970af5c71adc1682b
Author: Alexander Couzens <lynxis(a)fe80.eu>
Date: Tue Aug 23 06:27:19 2016 +0200
bsc: count the usage of codec by setting the lchan active
we count the codec when the channel was successful setted up
Change-Id: Ifc8a406a11dce16b9e7f3310841e470545550a2c
Backtrace:
20161010011516712 DCC <0001> ../../../src/libmsc/transaction.c:71 subscr=0x813b20,
net=0x7e0150
20161010011516712 DPAG <0007> ../../../src/libbsc/paging.c:291 Start paging of
subscriber 49 on bts 0.
20161010011517034 DRLL <0000> ../../../src/libbsc/abis_rsl.c:1959
(bts=0,trx=0,ts=2,ss=0) SAPI=0 DATA INDICATION
20161010011517034 DRSL <0004> ../../../src/libbsc/abis_rsl.c:2176
(bts=0,trx=0,ts=2,ss=0) IPAC_BIND speech_mode=0x10 RTP_PAYLOAD=3
Program received signal SIGSEGV, Segmentation fault.
count_codecs (lchan=0x1, bts=<optimized out>) at ../../../src/libbsc/abis_rsl.c:104
104 rate_ctr_inc(&bts->network->bsc_ctrs->ctr[BSC_CTR_CODEC_V1_FR]);
(gdb) bt
#0 count_codecs (lchan=0x1, bts=<optimized out>) at
../../../src/libbsc/abis_rsl.c:104
#1 0x0000000000425661 in abis_rsl_rx_dchan (msg=<optimized out>) at
../../../src/libbsc/abis_rsl.c:1516
#2 abis_rsl_rcvmsg (msg=0x8143f0) at ../../../src/libbsc/abis_rsl.c:2611
#3 0x00007ffff71420d0 in handle_ts1_read (bfd=<optimized out>) at
../../src/input/ipaccess.c:271
#4 ipaccess_fd_cb (bfd=0x815af8, what=1) at ../../src/input/ipaccess.c:386
#5 0x00007ffff7779b62 in osmo_fd_disp_fds (_eset=0x7fffffffe590, _wset=0x7fffffffe510,
_rset=0x7fffffffe490) at ../../src/select.c:149
#6 osmo_select_main (polling=polling@entry=0) at ../../src/select.c:189
#7 0x0000000000406fac in main (argc=<optimized out>, argv=0x7fffffffe738) at
../../../src/osmo-nitb/bsc_hack.c:385
(gdb)
Hope you can find a different way to count codec uses :)
~Neels
--
- Neels Hofmeyr <nhofmeyr(a)sysmocom.de>
http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Alt-Moabit 93
* 10559 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschäftsführer / Managing Directors: Harald Welte