Commit Graph

1584 Commits

Author SHA1 Message Date
Pau Espin 47de23266d rlcmac: Return error code from csn1 encoder/decoder
Change-Id: I0c5e1b870608b0622b239791effd5c5878e230bc
2020-02-05 17:25:59 +01:00
Pau Espin d636f74923 csn1.cpp: Rework ProcessError() function to print errors
Same API is kept to more easily keep code compatibility with wireshark's
packet-csn1.c implementation.

Change-Id: I1ce2c52e2357841aa1f31babfdce9011435f866b
2020-02-05 11:44:46 +01:00
Pau Espin f960d5bcf4 cosmetic: csn1.cpp: Fix whitespace
Change-Id: I663c5c20a878b3643db6a8ddd58e29bc9fe93d80
2020-02-03 14:39:38 +00:00
Vadim Yanitskiy 3568fcfa7d gprs_bssgp_pcu: fixup: fix length check in gprs_bssgp_pcu_rx_dl_ud()
Change-Id: I7d49b27a615350a7707154aa3cc903db7c1df374
Fixes: I7f84bd776cc780a45880f136107f6e0bc56241d1
2020-02-03 16:39:12 +07:00
Vadim Yanitskiy 3898cd6843 gprs_bssgp_pcu: fix invalid use of non-static data member 'frame'
The 'gprs_llc' is defined as a pure C structure with C++ specific
extensions (methods), so it's rather a class. Accessing its field
'frame' statically causes Clang to throw a compilation error:

  gprs_bssgp_pcu.cpp:111:29: error: invalid use of non-static data member 'frame'
      if (len > sizeof(gprs_llc::frame))

Let's avoid this and use LLC_MAX_LEN as the size limitation.
God knows what to expect from such a mix of C++ and C...

Change-Id: I7f84bd776cc780a45880f136107f6e0bc56241d1
2020-01-29 06:17:50 +07:00
Vadim Yanitskiy 9f62b92258 tests/alloc: fix implicit conversion from 'double' to 'int8_t'
Looks pretty much like a typo. Both '-1' and '.' symbols are
neighbours in QWERTZ keyboard layout, so it must be -1.

Found by Clang [-Wliteral-conversion].

Change-Id: Id4eb2dcc3b44e18096c7b94efb7260e2400c596b
2020-01-29 06:17:50 +07:00
Vadim Yanitskiy f6b83a24a3 encoding: fix log_alert_exit(): do not treat error as format string
This is rather a cosmetic change aimed to make ASAN / Coverity happy.
In general, we never pass any input from an untrusted source.

Change-Id: I26d654da4c3bf5fd86a298c3027fd9820c932308
2020-01-29 06:17:49 +07:00
Vadim Yanitskiy 4590b91728 gsm_timer: fix comparison of constant LONG_MAX with an integer
It does not make sense since INT_MAX is always less than LONG_MAX.
Found by Clang [-Wtautological-constant-out-of-range-compare].

Change-Id: I9934e05aa050bf93b3c795376f5dca3a848a7e11
2020-01-29 06:14:54 +07:00
Vincent Helfre e525bf94ba gsm_rlcmac: add dissection of NAS container
Port from wireshark.git 575e4df4aa3392ffd09ca372859573f09f0a5c57

Ported-by: Pau Espin Pedrol <pespin@sysmocom.de>
Change-Id: I2a05a057b6f441364502a96f9f34872c7e251a36
2020-01-28 18:16:24 +01:00
Pascal Quantin e4a243c02b gsm_rlcmac.cpp: fix an out of bounds access
Port from wireshark.git a4a5adb68b898f770e2addf9168d796979ebe237.

Ported-by: Pau Espin Pedrol <pespin@sysmocom.de>
Change-Id: I23fb2199fc8f9cc3e5bd475e2558ee8d482df1e1
2020-01-28 18:08:29 +01:00
Pascal Quantin 463746917f gsm_rlcmac.cpp: Do not skip too many lines of the CSN_DESCR when the field is missing
Port from wireshark.git c4ead251da7199cfd746d378c51eb8c30d09a6ba.

Ported-by: Pau Espin Pedrol <pespin@sysmocom.de>
Change-Id: Ib9b8eafd69d3b45b0d631ba9635689807b472b73
2020-01-28 18:03:59 +01:00
Anders Broman 8ea3cbe6b2 gsm_rlcmac.cpp: hanged all M_BIT macros to M_UINT, as M_BIT does not use the referenced hf.
Port from wireshark.git e97273a35d101516decbc7d98fcc6c6b3f193962.

Ported-by: Pau Espin Pedrol <pespin@sysmocom.de>
Change-Id: Id20d31e9ebd851b45d5f3280f3e229d8d7ae2cea
2020-01-28 17:42:34 +01:00
Pau Espin 034e32f0eb gsm_rlcmac.cpp: Fix trailing whitespace
Change-Id: I3b50cf386d417ba73b97f48b3000f69d9a54c8c9
2020-01-28 17:14:26 +01:00
Pascal Quantin 29248d6941 gsm_rlcmac: Enhance dissection of PSI1
Port of wireshark.git 7e9411fee3a101b53693210f7a38789fd4c70ba2.

Ported-by: Pau Espin Pedrol <pespin@sysmocom.de>
Change-Id: I89d488c1f349c556e40a9d13895b1309d5140212
2020-01-28 17:13:39 +01:00
Pascal Quantin cc76d412fd gsm_rlcmac.h: Remove Uplink messages from the RlcMacDownlink_t structure
(as they are part of the RlcMacUplink_t structure that is also used to call csnStreamDissector function).

Port from wireshark.git commit 9f8b638cfa8a660fb64c54dcadb83e6747db0a15.

Ported-by: Pau Espin Pedrol <pespin@sysmocom.de>
Change-Id: If46f8cc3f21f527f911dcac6ff1b78f182104a00
2020-01-28 16:46:51 +01:00
Gerald Combs bc4f3930a9 gsm_rlcmac.h: Make sure we have a corresponding 'u' member to RlcMacDownlink_t for every call
Port from wireshark.git commit 6c32ba5ff1a5f5ec2426d1d2c4f4f37fd136bab0.

Ported-by: Pau Espin Pedrol <pespin@sysmocom.de>
Change-Id: I989befc56fa37b8f982301f4f9aa4f4533e3e87a
2020-01-28 16:38:39 +01:00
Bill Meier bcc6408cd1 gsm_rlcmac.h: #if 0 unused stuff
Port of wireshark.git 2ef0c615946cd290aa9463c637169da0a1ca7972.

Ported-by: Pau Espin Pedrol <pespin@sysmocom.de>
Change-Id: Ia2e80664d293a2a95372213b4164c3e72259e0bb
2020-01-28 16:17:41 +01:00
Alexis La Goutte e36fb5b802 csn1: fix this statement may fall through [-Werror=implicit-fallthrough=] found by gcc7
Port of wireshark.git commit fd68c7dfc7d06ce7babe914f2575d9e4f35988ad.

Ported-by: Pau Espin Pedrol <pespin@sysmocom.de>
Change-Id: Ibaf47d7c4fdff326ac1dccf6fff77e2357e6a2bd
2020-01-28 13:45:03 +01:00
Pau Espin 900c2e277a csn1: Drop format_p union from CSN_DESCR
Port of wireshark.git 8626bb4cbb4d9926f7b56663585d9ef66252f93f.
We don't really need the other fields added there, let's keep only the
value out of the union.

Change-Id: Ia8889252ee7518a919a15d749815c2803b4b23cd
2020-01-28 13:43:45 +01:00
Anders Broman 771da85a11 csn1: Try to fix cast discards '__attribute__((const))' qualifier from pointer target type
Port of wireshark.git 1ff6213c949b373bcb7de5c48a5a4f805093066f.

Ported-by: Pau Espin Pedrol <pespin@sysmocom.de>
Change-Id: Ie14c335a904a17333e98ef58bf5e40245444e956
2020-01-28 13:43:24 +01:00
Guy Harris e26467c4ed csn1: Don't cast away constness
Port of wireshark.git commit 8e22ded7f8537e37e89ba558c83702d127443ae8.

Ported-by: Pau Espin Pedrol <pespin@sysmocom.de>
Change-Id: I100d5c43d8878e660035bf4a64718771f41a38a8
2020-01-28 13:42:29 +01:00
Anders Broman 60bf845f25 csn1: Fix warning with -Wmissing-prototypes
Port of wireshark.git 2e52e2ac997ca58caabee3270b5a6c3f96159ff0.

Ported-by: Pau Espin Pedrol <pespin@sysmocom.de>
Change-Id: Ic69a75ce3f01cea326139f678b963110e895c356
2020-01-28 13:41:21 +01:00
Pascal Quantin c515551625 csn1: Fix an infinite loop in CSN.1 dissector when having more than 255 padding bits
Port of wireshark.git 8b5aa913711b32b1e1bc707919d2a98c1875d443.

Ported-by: Pau Espin Pedrol <pespin@sysmocom.de>
Change-Id: I7f6aecc2c0f300c1a77cd683652969d3f1aa5794
2020-01-28 13:40:14 +01:00
Pau Espin 5b71697618 csn1: Fix pedantic compiler warnings in csn.1 dissectors
Port of wireshark.git commit 6aca10831f86c562970b13efa811f46e25ee3091.

    From Mike Morrin:
    Fix pedantic compiler warnings in csn.1 dissectors.

    There is some tricky casting going on in csn.1 structures.  To eliminate all
    the warnings, the function pointers needed to be moved out of the object
    pointer unions.  Fortunately macros (mostly) hide these changes from the
    protocol dissector tables.

    https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7686

    svn path=/trunk/; revision=44899

Change-Id: Ia1a8c50c4b024ca6df4e3fbbf891cd33591ccc9b
2020-01-28 13:38:42 +01:00
Pau Espin 7cce825fa4 csn1: Allow CHOICE elements to re-process the bits used for the choice
This is a port of wireshark.git commit
2f024256bf337400ef3a82fa75e6d48d5707e059.

From 78516187d821b8d19d16987b1d6bc855ee7cbe10 Mon Sep 17 00:00:00 2001
From: Sylvain Munaut <tnt@246tNt.com>
Date: Sat, 4 Feb 2012 10:00:22 +0100
Subject: [PATCH 4/6] packet-csn1: Allow CHOICE elements to re-process the bits used for the choice

We may want to display more detail, or the sub-element should be
displayed with its headers or whatever ...

Change-Id: I3a5a95d5f918b8f17a2400a6d0c4d855ecacea7e
2020-01-28 13:38:42 +01:00
Pau Espin 98e4c53cad csn1: Extend CSN_SERIALIZE to allow 0 bit of length
Port of wireshark.git 2f024256bf337400ef3a82fa75e6d48d5707e059.

From c6ee558d3bb00bfd25cca7c534448bf60df3c7cf Mon Sep 17 00:00:00 2001
From: Sylvain Munaut <tnt@246tNt.com>
Date: Sat, 4 Feb 2012 10:24:01 +0100
Subject: [PATCH 6/6] packet-csn: Extend CSN_SERIALIZE to allow 0 bit of length

In some coding there is no 'length' field at the top of a serialized
block, or it's more complex than a single field, in which case we
have to rely on the serialize decoder to consume the correct number
of bits.

We extend the CSN_SERIALIZE processing so that if a '0 bit' length
field is specified, then the length is not displayed and the
consumed bits by the serialize function is taken as the length
at posteriori.

The processing keeps the same behavior for any length > 0.

Change-Id: I9fadc99218594447001f7bb9943f4514b9877799
2020-01-28 13:38:42 +01:00
Jeff Morriss c0b4f4a633 csn1: shuffle decrements of remaining_bits_len
So that they always occur next to an increment of bit_offset.

Port from wireshark.git 1c81971d4292438ffdf83e9f9b9ab96c133c785b.

Ported-by: Pau Espin Pedrol <pespin@sysmocom.de>
Change-Id: I7474e9d632e068d6e33b0a502b81d4fff1f48802
2020-01-28 13:37:50 +01:00
Anders Broman c0190c8a5a csn1: packet-csn1.c:179: warning: 'pui8' may be used uninitialized in this function
Port from wireshark.git commit fd9f182f4b13a3d81b1b5c797a6e4b9d6d327fdd.

Ported-by: Pau Espin Pedrol <pespin@sysmocom.de>
Change-Id: I37f5f3732f92cd7340af8ac1e04383f3e45e7636
2020-01-28 13:34:36 +01:00
Anders Broman 72c102acf8 csn1: Update M_NULL CSN_DESCR to match wireshark
Port from iwireshark.git commit cc6d4341e65ef2e8d8488fe0ac0f236ece0dd844.
It looks like it makes no difference to us now, but other EGPRS messages
may use it in the future.

Ported-by: Pau Espin Pedrol <pespin@sysmocom.de>
Change-Id: I34039370c292e62790a38abb59f55c69fffa88e8
2020-01-28 13:34:08 +01:00
Pau Espin cdbc5dbd1c tests/rlcmac: Add test to showcase that decode_gsm_ra_cap() fails
Currently code using that function in osmo-pcu is disabled, allegadly
because SGSN was sending incorrect values, but it looks more like a CSN1
issue.

Related: OS#1525, OS#3499
Change-Id: I92c86397f988afaa791871d823a45fa85054f3bb
2020-01-28 13:29:42 +01:00
Pau Espin ea39fade07 tests/rlcmac: Don't check stderr output
Current stderr output is empty anyway, and not checking it allows
enavling different log levels to easily debug issues.

Change-Id: I5b12e919e08a6eeaad31a459e5a15fdee4d76a61
2020-01-24 13:01:23 +01:00
Pau Espin 87bfbe4fe2 tests/rlcmac: Use osmo_hexdump to print buffers
Old method takes lots of lines of codes and prints inn unconfortable way
because left-trailing zeros are dropped, making it difficult to split in
bytes.

Change-Id: I56c24f934824e4e52a91a7273aec384b2e15aa67
2020-01-24 12:42:03 +01:00
Pau Espin 5cb002f0ef tests/rlcmac: Fix missing commas with unexpected results
Change-Id: Ia0f8cc224a4c38e80699f834fd83d4c0d99322ea
2020-01-24 12:42:00 +01:00
Pau Espin 99c437b7c7 tests/rlcmac: Memzero decoded struct
Otherwise final output is undefined.

Change-Id: I9b501b8a99473b4d79279f8a3a9854e0b2eb3284
2020-01-24 12:34:50 +01:00
Pau Espin 54681c3ffe tests/rlcmac: print test name at the start
Change-Id: Ib8f0fcbd6bb68d77727c021f0d90d5248e895772
2020-01-23 21:59:23 +01:00
Vadim Yanitskiy bd0b0b3242 pcu_l1_if.cpp: fix NULL-pointer dereference in imsi2paging_group()
Passing NULL to strlen() would lead to a segmentation fault.

Change-Id: I838e3a21a3b25c2bc8260f67d156c6cc284f4456
Fixes: CID#207484
2020-01-16 00:25:54 +07:00
Pau Espin 771de1f439 Support PAGING-CS and PAGING-PS on on PTP-BVCI
Related: OS#2403
Change-Id: I5c52b5af740460c48bb3ba858243b1d20e624268
2020-01-06 10:26:46 +00:00
Pau Espin 65a0d1d19b Support Gb PAGING-CS
The paging is sent over PACCH towards MS with an active TBF.

Related: OS#2406
Change-Id: I9501e02e1d7f6944497e724dbccb9a19c3f5221f
2020-01-06 10:26:46 +00:00
Pau Espin 5530f12f71 Allow Gb PAGING-PS without P-TMSI
P-TMSI is optional IE, but IE is mandatory and hence always available.
Since the encoding is actually a Mobile Identity, the IMSI is used in
case P-TMSI is not available.

Change-Id: I4dbf8db04e81f98352a42ce34a5d91326be9bfd1
2020-01-06 10:26:46 +00:00
Pau Espin d7c3265223 Pass paging group instead of imsi where later is not needed
Change-Id: Id0663a81f439f2d0b893b0d34f85a6db1927ef8e
2020-01-06 10:26:46 +00:00
Pau Espin b507e428e8 Bump version: 0.7.0.62-fbfa-dirty → 0.8.0
Change-Id: Ic5e69a396df659933fd4d50298b9925e837a6861
2020-01-03 19:40:02 +01:00
Pau Espin fbfab297ee Split identity_lv param into mi+mi_len
It's not really needed to have those together in some function calls,
and makes it more difficult to follow the code. Furthermore, new callers
not having content already aligned (len+value) will be using these
functions in forthcoming commits.

Change-Id: Ifb9d3997bfb74b35366c3d1bc51ce458f19abf16
2020-01-01 16:10:15 +00:00
Pau Espin db12f254ce Log BVCI PTP value upon msg recv
Change-Id: I47c5902112d568cd5a48e003010d8085b02d64e8
2020-01-01 16:10:05 +00:00
Pau Espin 506eb23dc5 fix typo in log message
Change-Id: Ib6fc4625242d855193b62b561624b23b265648b9
2019-12-31 17:01:34 +00:00
Pau Espin 585cfb28b8 Fix trailing whitespace
Change-Id: I0515b5c8f6744fa501de88fa7808b7fc91981f0e
2019-12-10 20:02:21 +01:00
Pau Espin 3f064f516d prs_bssgp_pcu.cpp: Mark priv funcs as static and remove trailing whitespace
Change-Id: I93b7ee33cc33c773675c85ace7b8f1afa86fbf06
2019-12-10 17:09:51 +01:00
Pau Espin 32499b614b pcu_l1_if: Check pag_req id_lv len fits buffer
Related: OS#4316
Change-Id: I803e1d2577a0d210e74feb5ca4c216375a5024ea
2019-12-09 13:55:14 +01:00
Pau Espin 30f6617c79 tbf_dl.cpp: Fix typo in log line
Change-Id: I9fdea4246c95897f3e72604981597db828a219a3
2019-12-04 18:11:52 +01:00
Pau Espin d0fc9e80fe Remove dash from name used in VTY cmd prompt
Others projects don't contain a dash in there, and it seems to cause
problems with TTCN3 VTY expectations.

Change-Id: I3430abb5fc622dec293457466e760de95fa3a05c
2019-12-02 11:14:26 +00:00
Harald Welte 3a61b920f2 manual: Add missing documentation for '-i' command line option
Change-Id: Iec0f2ecd610e63baba46a63d3e1a0979a9d8c5a8
2019-12-01 14:32:54 +00:00