Commit Graph

3344 Commits

Author SHA1 Message Date
Harald Welte 5c5713e869 Bump version: 1.3.0.173-51974 → 1.4.0
Change-Id: I4fc6dd4f727c8ff5a64865bbb87e1d9feb7c5174
2020-08-13 11:06:36 +02:00
Alexander Couzens 8419bb2e9e socket.h: introduce osmo_sockaddr to hold v4 and v6 endpoints
When dealing with IPv4 and IPv6 address, the struct sockaddr
allows to hold IPv4 and IPv6.
However even when struct sockaddr is being used, a cast to the
IPv4 or IPv6 family must happen. To work around this additional code,
use a union for the most common types.

Change-Id: If80172373735193401af872b18e1ff00c93880e7
2020-08-10 23:29:21 +02:00
Pau Espin eb6882fa52 vty: Introduce support to set cpu-affinity and scheduler policy
Process willing to support this kind of configuration through VTY simply
need to call "osmo_sched_vty_init(tall_ctx);" during startup to register
the commands.
For multithreaded processes, new threads willing to get their
cpu-affinity mask according to VTY config should call
osmo_sched_vty_apply_localthread() (potentially after
setting the thread name through pthread_setname_np()).

Related: SYS#4986
Change-Id: If76a4bd2cc7b3c7adf5d84790a944d78be70e10a
2020-08-10 14:11:18 +00:00
Vadim Yanitskiy 7dbae9ea40 configure.ac: print ARM NEON instructions support status
Change-Id: I0e8910d6cf337a95d6b4295f5c425d2d4cfa2b41
2020-08-07 04:01:12 +07:00
Vadim Yanitskiy cab3835805 configure.ac: fix: do not define HAVE_NEON unconditionally
Change-Id: I761a7afaeda9d232ac26edff47949e911f8f1f0c
2020-08-07 03:55:32 +07:00
Vadim Yanitskiy 325d9b32ee configure.ac: clarify description of --enable-neon
Change-Id: Id261dcf396f19a385203ae5f339cc5570efa4aab
2020-08-07 03:53:40 +07:00
Vadim Yanitskiy 9b766bfafe src/Makefile.am: add conv_acc_neon_impl.h to EXTRA_DIST
Change-Id: I641c25f8aec249df43c781debfc967f07e221b9d
2020-08-07 02:45:39 +07:00
Eric Wild 3afc1d1777 libomsocoding: NEON viterbi acceleration
configure flag required to enable this: --enable-neon

Although autodetection according to __ARM_NEON would work because this
is only defined if the fpu is neon neon-fp16 neon-vfpv3 neon-vfpv4
neon-fp-armv8 crypto-neon-fp-armv8 doing that would lead to a unknown
performance impact, so it needs to be enabled manually.

Speedup is about ~1.3-1.5 on a unspecified single core Cortex A9. This
requires handling a special case for RACH with len 14 which is far too
short for neon and would actually incur a performance penalty of 25%.

Related: OS#4585
Change-Id: I58ff2cb4ce3514f43390ff0a2121f81e6a4983b5
2020-08-06 16:47:40 +00:00
Alexander Couzens 2c962f5de1 osmo_sock_init2: improve support for AF_UNSPEC
osmo_sock_init2 abstract two calls of getaddrinfo into one.
While there aren't problems with AF_INET or AF_INET6. When using
AF_UNSPEC there are corner cases when this fails. E.g. calling
local_host with "" and remote_host with an IPv6 only address results in
setting up a local socket with AF_INET while trying to connect from there towards
AF_INET6 will most likely fail.
To prevent such cases with AF_UNSPEC, search prio calling any syscalls if local and remote site
supports AF_INET or AF_INET6. In case both supported, prefer AF_INET6

Change-Id: I397c633931fd00d4f083955a3c49a40fb002d766
2020-08-06 16:41:20 +00:00
Alexander Couzens 6300aff3b2 gsm 12.21: add osmocom specific NM_ATT_OSMO_NS_LINK_CFG
The sysmobts uses the same OML attributes as IP.access. Because the IP.access
attribute only supports IPv4 as NSVC configuration, add an own attribute.

Change-Id: Ic261bc43a07fa741b97a9c6ec5a9ed6f5ecae588
2020-08-06 16:41:20 +00:00
Vadim Yanitskiy 81be7c1175 utils/gsmtap_logread.py: make it executable
Change-Id: I2a3ee31ddc8838ce8e7a58de89a0e606ae918c6a
2020-08-04 14:27:50 +00:00
Alexander Couzens 85a8fd3911 Gb/BSSGP: replace hardcoded Tx into NS library by a callback
Add bssgp_ns_send callback() to set the transmission path into the
NS library. This allows to use the Gb implementation with
the old NS and the new upcoming NS implementation.
Users of the old NS implementation don't have to set the callback as
the default is the old NS implementation.

Only users of the new NS implementation need to set the callback and
the callback data.

Change-Id: I3a498e6a0d68b87fed80c64199b22395796761b4
2020-08-04 10:33:09 +00:00
Harald Welte 44964981c2 i460: Fix bit- and subslots ordering of I.460 mux + demux
When I wrote the new I.460 mux + demux code, I failed to realize that
* bit numbers in relevant ITU specs start with 1 as MSB ... 8 as LSB
* sub-slot 0 is bits 1+2, i.e. the two MSBs of a byte
* bit-ordering within each sub-slot is also MSB first

As a result, the code and test data was broken.

Change-Id: I6df7dbf411efbdeaf516e72ac552432bf5a569d0
2020-08-02 21:57:05 +02:00
Harald Welte b3b474d8ad i460: pass more context to call-back functions
When calling a user-provided call-back function for the i460 mux
or demux, always pass a pointer to the osmo_i460_subchan the callback
relates to.  This way, the user can walk the i460 data structures
to obtain information about which mux/demux instances is calling.

Change-Id: Id842c72ce371a67fe5df6694e195c281aaf607ab
2020-08-02 11:57:55 +02:00
Harald Welte eb8240d564 i460: Add back-pointer from sub-channel to timeslot
A user may want to walk back from a sub-channel to the timeslot
to which it belongs.

Change-Id: Id6e5e208c5daa63fd23ac719d62314622b5d0ed9
2020-08-02 11:57:55 +02:00
Philipp Maier b5518a8f1f i460_mux: add callback to notify empty tx queue
There is no way for the API user to know if the TX queue of the
multiplexer runs empty. However, this is criticil since an empty TX
queue will cause dropout of a TRAU frame, which can have quite severe
effects to the receiving end. Lets add a callback that allows the APU
user to insert appropiate idle frames or silent frames into the queue
before it runs empty.

Change-Id: I88a87724235fe50d55ce6215bb385c044072226e
Related: OS#2547
2020-08-02 11:57:55 +02:00
Harald Welte 2ba641edaa bits.c: Use faster look-up-table approach for osmo_revbytebits_{buf,u8}
Benchmarking has shown that a look-up table based approach is much
faster than the arithmetic approach we used so far.

This is from a Core i7-6600U:

10    bytes, 1     iterations: flip=379, revb=5491; revb = 1448 %
10    bytes, 10    iterations: flip=728, revb=1517; revb = 208 %
10    bytes, 100   iterations: flip=2952, revb=9305; revb = 315 %
10    bytes, 1000  iterations: flip=26305, revb=90953; revb = 345 %
100   bytes, 1     iterations: flip=468, revb=1093; revb = 233 %
100   bytes, 10    iterations: flip=2634, revb=7418; revb = 281 %
100   bytes, 100   iterations: flip=23666, revb=70718; revb = 298 %
100   bytes, 1000  iterations: flip=237595, revb=900555; revb = 379 %
1024  bytes, 1     iterations: flip=3417, revb=11454; revb = 335 %
1024  bytes, 10    iterations: flip=33579, revb=92353; revb = 275 %
1024  bytes, 100   iterations: flip=555399, revb=1196228; revb = 215 %
1024  bytes, 1000  iterations: flip=3478271, revb=9227966; revb = 265 %
1048576 bytes, 1     iterations: flip=10189583, revb=7022193; revb = 68 %
1048576 bytes, 10    iterations: flip=19693347, revb=54389925; revb = 276 %
1048576 bytes, 100   iterations: flip=151308243, revb=454293151; revb = 300 %
1048576 bytes, 1000  iterations: flip=1390338439, revb=4429862642; revb = 318 %

where 'revb' is the old arithmetic approach, and 'flip' the new
look-up-table approach. In our usual cases of 100..1024 bytes in a
single iteration, the old code takes 233..335% of the look-up table.

Benchmarks on an Atom E6xx also show improvements except in one
situation (a single iteration over one 1MB large buffer).

10    bytes, 1     iterations: flip=416, revb=9184; revb = 2207 %
10    bytes, 10    iterations: flip=1960, revb=4024; revb = 205 %
10    bytes, 100   iterations: flip=13624, revb=32408; revb = 237 %
10    bytes, 1000  iterations: flip=160656, revb=361784; revb = 225 %
100   bytes, 1     iterations: flip=3536, revb=4952; revb = 140 %
100   bytes, 10    iterations: flip=12960, revb=20912; revb = 161 %
100   bytes, 100   iterations: flip=122448, revb=215152; revb = 175 %
100   bytes, 1000  iterations: flip=1204928, revb=1647680; revb = 136 %
1024  bytes, 1     iterations: flip=12944, revb=23128; revb = 178 %
1024  bytes, 10    iterations: flip=126192, revb=239784; revb = 190 %
1024  bytes, 100   iterations: flip=1190184, revb=1491672; revb = 125 %
1024  bytes, 1000  iterations: flip=11865872, revb=15113872; revb = 127 %
1048576 bytes, 1     iterations: flip=16288272, revb=15925888; revb = 97 %
1048576 bytes, 10    iterations: flip=121957000, revb=157883384; revb = 129 %
1048576 bytes, 100   iterations: flip=1219264992, revb=1621265216; revb = 132 %
1048576 bytes, 1000  iterations: flip=12219520648, revb=15960035856; revb = 130 %

Change-Id: I25029fe7e54c92979fb0119992fb8dc167e1536e
2020-08-02 11:30:31 +02:00
Philipp Maier 6d21448911 gsm_08_58: add missing RSL error cause codes
The define constants for the cause codes "BTS not equipped",
"remote transcoder failure" and "notification overflow" are missing.
Lets add them including value strings.

Change-Id: Ic3e936da00bd256bae03867887851f1a4e30e218
2020-07-31 21:23:49 +00:00
Pau Espin a184701108 vty: Don't match negative values on purely positive ranges
Without this patch, for instance having a range 0-ULONG_MAX would match
if someones types value -3, which would be converted to unsigned but
that's clearly what is expected here from user point of view.

Change-Id: Ia95f6314a2dd3f94d21fc219cf69bb8d39b8e7f0
2020-07-30 21:02:03 +00:00
Pau Espin 9fdc871532 vty: Allow 64 bit values in numeric ranges if system supports it
This fixes commands not being matched due to providing a range with more
than 10 digits.

The last case (passing -4000 matching 0-ULONG_MAX) shows a different bug
which will be fixed in next commit.

Change-Id: I0afa0caabffe36083c36b92ba90696ded00bb7be
2020-07-30 21:02:03 +00:00
Pau Espin d92be9ad13 tests: vty: Extend test to do some numeric range validations
As per current status, the numeric tests are expected to fail due to a
couple bugs which will be fixed in next commits.

Change-Id: Id5b17bd96d7af4ed9a77ebbea0e6be4b0fcbde6c
2020-07-30 21:02:03 +00:00
Pau Espin eb028fa1df tests/fsm_test.c: Disable use color in logging output
This should avoid other problems in the future.

Change-Id: I81368578c0830477d381566a54671fdde6067b23
2020-07-30 20:33:24 +00:00
Harald Welte 701968f286 gsm0411_{smc,smr}.c: Work around newlib bug
At least on Debian unstable, newlib is [currently?] buggy in that
we need to include sys/types.h before including inttypes.h, otherwise
PRIu64 is not defined.

Change-Id: Ic1c9cdf66cfd5b82bd7e20eaaf05b10e6bdb675e
Closes: OS#4686
2020-07-30 21:35:10 +02:00
Philipp Maier 6509d202d9 i460_mux: correctly reset subchannels
When a subchannel is deleted or created the initalization mainly
consists of a memset over the wohle subchannel struct a message buffer
initailization.

However, when we delete a subchannel we also must take of the resetting
of the related struct. Currently this is done with a memest.
Unfortunately this creates not only a memory leak (there might be still
items in the multiplexer tx queue) but also it makes the application
crash when the message buffer is used the next time since the llist_head
of the tx queue looses its initialization.

Lets fix the memory leak problem and the message buffer problem and put
the reset functionality in a single place.

Change-Id: I937a9d4db95f44a860cd2c5dbb660dc1970b9a49
2020-07-30 10:39:43 +02:00
Alexander Couzens 99c538e4be vty: add a define VTY_IPV46_CMD to require a IPv4/6 address
Allow to use this define in vty definitions when a IPV4/6 address
is required as argument.

Change-Id: I86e399aea86b68b48e627f11e1de48fdfad16525
2020-07-28 13:58:48 +02:00
Alexander Couzens b20d852a95 socket: osmo_sock_local_ip: correct doxygen comment
There is no parameter fd.

Change-Id: I1e31fcbf40d8abf99214b87e70e867b5ab66bd75
2020-07-28 13:58:48 +02:00
Alexander Couzens 03a421359d bts_features: add feature BTS_FEAT_IPV6_NSVC
Previous both the IPA nanobts and the sysmobts has been using the IPv4 only OML
attribute NM_ATT_IPACC_NS_LINK_CFG.
A bts with BTS_FEAT_IPV6_NSVC supports IPv6 for NSVC (PCU<Gb>SGSN) using
the new OML attribute NM_ATT_OSMO_NS_LINK_CFG.

Change-Id: I9ef7949f66764b3c639e45eb440122e318da44a0
2020-07-28 13:58:46 +02:00
Alexander Couzens a087cdfb5b gprs_ns_frgre.h: add missing declaration of structs
Change-Id: I47b3458ff7dc7ab1fcb7e4dd690142e2bc44ed46
2020-07-28 11:47:56 +02:00
Alexander Couzens 9c86a2ce56 gprs_ns: fix typo in comment
Change-Id: Ie9d8decea18542cb0e1641dcb5fca5e4850910eb
2020-07-28 11:44:55 +02:00
Eric Wild 9384ca06c5 pkgconfig/osmocodec/osmocoding: link to talloc
find . -maxdepth 1 -iname "libosmo*so" | xargs -n1 -I\# sh -c "echo \#
&& nm \# | grep 'U talloc'"
tells us that all libs depend on talloc, but pkgconfig omits it for
codec and coding, which sometimes leads to linking issues with libtool
and
lld.

Change-Id: I75a4d39a0c3d53fc4c311e25e933a22832616cea
2020-07-20 23:52:31 +02:00
Daniel Willmann 1a1de33bf9 stats: Add stats commands related to testing
* Allow to set the reporting interval to 0 for manual reporting
* stats reset command to reset all statistics
* stats report command to manually trigger statistics reporting

Change-Id: I9febcb65650abfd538caedfbca77a787e66d517a
Related: SYS#4877
2020-07-17 16:41:31 +00:00
Daniel Willmann ea71b439ec stat_item: Add function to reset stat items and groups
Change-Id: I80fc0ea8865ec4efdcd4c982e69d863275fd9919
Related: SYS#4877
2020-07-17 16:41:31 +00:00
Daniel Willmann 26a9539e18 rate_ctr: Add functions to reset rate counter (groups)
Change-Id: If2f806d044cd0fb6929dac44ef8f8a15941ffe9b
Related: SYS#4877
2020-07-17 16:41:31 +00:00
Pau Espin 0e7349d386 use_count.h: Fix API doc example
Change-Id: Ib28ea88c8e8e9b33d70d58156d03af9a41e9e012
2020-07-15 19:51:22 +00:00
Harald Welte bebec218a7 vty: Avoid ultra-long multi-line strings cluttering talloc reports
The talloc_asprintf() series includes an unconditional call to
talloc_set_name_const(), turning the entire long constructed string
into the name of the talloc object.  That simply doesn't work when
creating kilobytes-sized VTY reference strings including linefeeds.

Let's add an explicit talloc_set_name_const() to prevent this.

Change-Id: Ibd77684b88cc3572047daa98c9a6b9119fba041b
Closes: OS#4668
2020-07-15 12:23:46 +02:00
Neels Hofmeyr 9b35e56e56 fixup for gsm0808_create_common_id(): add API doc, use new MI API
Follows patch I353adc1aa72377f7d4b3336d2ff47791fb73d62c that was merged too
soon. Applying my code review in form of this fixup patch.

Change-Id: I979bca0c6aaa8fe4feddda922bd2e6c1cb49585b
2020-07-14 10:36:17 +00:00
Pau Espin 9a5d90ab96 Revert "gsmtap_makemsg_ex: NULL for unknown chan_type"
Reverting due to being completely normal for some applications to submit
usning this channel type when decoding/parsing failed and hence not
being able to determine channel type.

This reverts Change-Id Ib4147a33a75c3cf425c30da8b0678c7fba8a371d
(commit 12f93be6073ed89055862baafbfe0e08e50ed17a.)

Change-Id: I6ebaa89cc3422df1d7fd2365a6176cb2902d1c67
2020-07-09 11:43:48 +00:00
Alexander Couzens ecbf5a1aa0 gprs_ns.h: add missing prototype gprs_ns_rcvmsg()
gprs_ns_rcvmsg is already exported, but never declared.

Change-Id: I7edc5f4fb6e1fda059e35ea0988d0ef42208aa50
2020-07-04 18:59:34 +02:00
Harald Welte bc1d7152c1 lapd_core: After calling into L3, check if the state has changed
While processing an I-frame we may deliver its payload to L3. After
returning from L3 procesing, we run some additional code, assuming
the LAPD/DL state has not changed meanwhile.

However, if the application destroys the LAPD/DL meanwhile, our state
might be NULL again, and in this state we should not perform any further
action.

This is one of the cases where synchronous in-line dispatch across
various layers is hitting us.  L3 should have an input queue, and only
start processing after all L2 work has completed and we're about to go
back to sleep in select().

Change-Id: I026b64503511002c13c0f4117648c366c48ecc62
Related: OS#1761
Closes: OS#4646
2020-07-04 10:52:13 +02:00
Harald Welte 8617d09ee3 lapd_core: Ensure we always have some tailroom
At some points, e.g. when allocating message buffers from the Tx
history, we used to allocate them exactly as large as the defined
headroom plus the user data.  This means that the underlying PH layer
(E1 mostly) had no tailroom to add anything to the end of the message.

Especially for DAHDI this is a problem, as we need to make space for
two more bytes of frame check sequence (FCS).

So let's simply make sure we always have some extra space at the end
of such buffers.

Change-Id: Id362ce131157c7513d744b0248c7f78fb75c590c
Related: OS#4644
2020-07-03 19:28:53 +02:00
Harald Welte db974f372b vty/ports.h: Add VTY port for osmo-e1d
Change-Id: Ia19b870146334b4ab749f12dc87fb628c1cdcca9
2020-06-29 10:42:02 +02:00
Harald Welte 78af6ba54b gprs_ns: Set sockaddr_in.sin_family for persistent NSVCs
We cannot just set sockaddr_in.sin_addr + sin_port, we also must
initializa sin_family.  The reason this has worked so far is
because we probably always first received a NS packet from the
peer, rather than being the first one to send.

Change-Id: I6cefc2cd5516c7a4c01a2cc040afca454e59dd57
Related: OS#4629
2020-06-26 16:07:15 +00:00
Harald Welte 2d3465fd1c gprs_bssgp: Add bssgp_tx_bvc_reset2()
If a BVC-RESET is sent from SGSN, there must not be a cell ID IE
included.  See "Note 1" of TS 48.018 Section 10.4.12.

Change-Id: I11d4e70d510265b9c09dffccdab10b3f0816715a
2020-06-26 16:07:15 +00:00
Neels Hofmeyr 4247c94abf api comment: fix example of osmo_mobile_identity_encode_msgb
The previous example showed a type == IMSI while setting a TMSI value.
Rather show how to encode IMSI digits.

Change-Id: I41af6bf0d61443465172123297b1228584d791d6
2020-06-24 11:31:56 +00:00
Harald Welte 1bd726a2e4 gsm0808: Add gsm0808_create_common_id()
This function encodes a GSM 08.08 / 48.008 "Common ID" message.

Change-Id: I353adc1aa72377f7d4b3336d2ff47791fb73d62c
Related: OS#2969
2020-06-21 22:06:56 +02:00
Harald Welte 17933347c5 bts_features.h: Introduce BTS_FEAT_PAGING_COORDINATION
This feature indicates if the given BTS supports paging coordination,
that is the transmission of CS paging (received on Abis) to be sent
via PACCH/PCU in PS domain fro MS with active TBF.

Change-Id: Ifb2e83eaf05dd36e5b203ed2de1a74864b039e38
Related: OS#2406
2020-06-21 15:33:55 +02:00
Vadim Yanitskiy ed0445b38b gsm0502: add TDMA frame number constants and modular arithmetic
These TDMA constatns and modular arithmetic operations are used in
a number of osmo-* projects, so it makes sense to have them all
in a single header file, with minimalistic documentation.

Change-Id: Ic291fd3644f34964374227a191c7045d79d77e0d
2020-06-17 21:09:51 +00:00
Neels Hofmeyr 30856ca5cb gsm0408_test: allow deprecated API
This test knowingly calls deprecated functions -- allow that to squelch these
warnings:

warning: ‘gsm48_generate_lai’ is deprecated: Use gsm48_generate_lai2() instead, to not lose leading zeros in the MNC [-Wdeprecated-declarations]
warning: ‘gsm48_decode_lai’ is deprecated: Use gsm48_decode_lai2() instead, to not lose leading zeros in the MNC [-Wdeprecated-declarations]

Change-Id: Ifd618c1b9befa9c9ef0a338ab4aae2b0f796f4c2
2020-06-16 15:17:48 +02:00
Neels Hofmeyr 83025bf1a6 add osmo_mobile_identity API
Implement better API around 3GPP TS 24.008 Mobile Identity coding.

struct osmo_mobile_identity is a decoded representation of the raw Mobile
Identity, with a string representation as well as dedicated raw uint32_t TMSI.
The aim is to remove all uncertainty about decoded buffer sizes / data types.

I have patches ready for current osmo CNI programs, replacing the Mobile
Identity coding with this new API. Deprecate the old MI API.
osmo-bsc: I71c3b4c65dbfdfa51409e09d4868aea83225338a
osmo-msc: Ic3f969e739654c1e8c387aedeeba5cce07fe2307
osmo-sgsn: I4cacb10bac419633ca0c14f244f9903f7f517b49
Note that some GPRS and SGs related coding is done here in libosmocore and
hence currently remains using the old implementation (see previous version of
this patch: Ic3f969e739654c1e8c387aedeeba5cce07fe2307).

New API functions provide properly size-checking implementations of:
- decoding a raw MI from a bunch of MI octets;
- locating and decoding MI from a full 3GPP TS 24.008 Complete Layer 3 msgb;
- encoding to a buffer;
- encoding to the end of a msgb.

Other than the old gsm48_generate_mid(), omit a TLV tag and length from
encoding. Many callers manually stripped the tag and value after calling
gsm48_generate_mid(). The aim is to leave writing a TL to the caller entirely,
especially since some callers need to use a TvL, i.e. support a variable-size
length of 8 or 16 bit.

New validity checks so far not implemented anywhere else:
- stricter validation of number of digits of IMSI, IMEI, IMEI-SV MI.
- stricter on filler nibbles to be 0xf.
As a result, applications using osmo_mobile_identity will be stricter in
rejecting coding mistakes (some of which we currently have in our test suites,
and which we'll need to fix).

Rationale:

While implementing osmo-bsc's MSC pooling feature in osmo-bsc, this API will be
used to reduce the number of times a Mobile Identity is extracted from a raw
RSL message.

Extracting the Mobile Identity from messages has numerous duplicate
implementations across our code with various levels of specialization.
https://xkcd.com/927/

To name a few:
- libosmocore: gsm48_mi_to_string(), osmo_mi_name_buf()
- osmo-bsc: extract_sub()
- osmo-msc: mm_rx_loc_upd_req(), cm_serv_reuse_conn(), gsm48_rx_mm_serv_req(),
  vlr_proc_acc_req()

We have existing functions to produce a human readable string from a Mobile
Identity, more or less awkward:
- gsm48_mi_to_string() decodes a TMSI as a decimal number. These days we use
  hexadecimal TMSI everywhere.
- osmo_mi_name_buf() decodes the BCD digits from a raw MI every time, so we'd
  need to pass around the raw message bytes. Also, osmo_mi_name_buf() has the
  wrong signature, it should return a length like snprintf().
- osmo-bsc's extract_sub() first uses gsm48_mi_to_string() which encodes the
  raw uint32_t TMSI to a string, and then calls strtoul() via
  tmsi_from_string() to code those back to a raw uint32_t.

Each of the above implementations employ their own size overflow checks, each
invoke osmo_bcd2str() and implement their own TMSI osmo_load32be() handling.
Too much code dup, let's hope that each and every one is correct.

In osmo-bsc, I am now implementing MSC pooling, and need to extract NRI bits
from a TMSI Mobile Identity. Since none of the above functions are general
enough to be re-used, I found myself again copy-pasting Mobile Identity code:
locating the MI in a 24.008 message with proper size checks, decoding MI
octets.

This time I would like it to become a generally re-usable API.

This patch was first merged as Ic3f969e739654c1e8c387aedeeba5cce07fe2307 and
caused test fallout, because it re-implemented old API with the new stricter
decoding. In this patch version, old API remains 1:1 unchanged to avoid such
fallout. Applications will soon switch to the new osmo_mobile_identity API and
become stricter on MI coding when that happens, not implicitly by a new
libosmocore version.

Change-Id: If4f7be606e54cfa1c59084cf169785b1cbda5cf5
2020-06-16 15:17:48 +02:00
Harald Welte a13fb75030 Revert "add osmo_mobile_identity API"
This reverts commit d1ceca9d48, as it
introduces regressions in both osmo-msc and osmo-nitb which have been
causing failing builds for several days now.

Change-Id: I4bd958d0cd2ab4b0c4725e6d114f4404d725fcf7
2020-06-16 09:21:08 +02:00