From: Max msuraev@sysmocom.de
Right now we do not support multiple SI2quater messages, so return error if either index or count is non-zero. --- src/common/rsl.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/common/rsl.c b/src/common/rsl.c index a503355..ecf570c 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -298,9 +298,10 @@ static int rsl_rx_bcch_info(struct gsm_bts_trx *trx, struct msgb *msg) { struct gsm_bts *bts = trx->bts; struct tlv_parsed tp; - uint8_t rsl_si; + uint8_t rsl_si, si2q_index, si2q_count; enum osmo_sysinfo_type osmo_si; - + struct gsm48_system_information_type_2quater *si2q; + struct bitvec bv; rsl_tlv_parse(&tp, msgb_l3(msg), msgb_l3len(msg));
/* 9.3.30 System Info Type */ @@ -327,6 +328,24 @@ static int rsl_rx_bcch_info(struct gsm_bts_trx *trx, struct msgb *msg) TLVP_VAL(&tp, RSL_IE_FULL_BCCH_INFO), len); LOGP(DRSL, LOGL_INFO, " Rx RSL BCCH INFO (SI%s)\n", get_value_string(osmo_sitype_strs, osmo_si)); + + if (SYSINFO_TYPE_2quater == osmo_si) { + si2q = (struct gsm48_system_information_type_2quater *) + bts->si_buf[SYSINFO_TYPE_2quater]; + bv.data = si2q->rest_octets; + bv.data_len = 20; + bv.cur_bit = 3; + si2q_index = (uint8_t) bitvec_get_uint(&bv, 4); + si2q_count = (uint8_t) bitvec_get_uint(&bv, 4); + if (si2q_index || si2q_count) { + LOGP(DRSL, LOGL_ERROR, + " Rx RSL SI2quater witn unsupported " + "index %u, count %u\n", + si2q_index, si2q_count); + return rsl_tx_error_report(trx, + RSL_ERR_IE_CONTENT); + } + } } else if (TLVP_PRESENT(&tp, RSL_IE_L3_INFO)) { uint16_t len = TLVP_LEN(&tp, RSL_IE_L3_INFO); if (len > sizeof(sysinfo_buf_t))
From: Max msuraev@sysmocom.de
Add missing entries to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/.gitignore b/.gitignore index 3950377..f11bc4d 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ src/osmo-bts-sysmo/l1fwd-proxy src/osmo-bts-sysmo/osmo-bts-sysmo src/osmo-bts-sysmo/osmo-bts-sysmo-remote src/osmo-bts-sysmo/sysmobts-mgr +src/osmo-bts-sysmo/sysmobts-util
src/osmo-bts-trx/osmo-bts-trx
@@ -49,6 +50,7 @@ tests/testsuite.log doc/vty_reference.xml
# Backups, vi, merges +*~ *.sw? *.orig *.sav
From: Max msuraev@sysmocom.de
There are several types of System Information messages with tricky scheduling rules described in 3GPP TS 05.02 § 6.3.1.3. This GNU Awk script takes in .csv file with sequence of scheduled SI messages (for example generated using tshark from GSMTAP capture - see usage note inside the script) and check the scheduling rules compliance. --- contrib/si_check.gawk | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100755 contrib/si_check.gawk
diff --git a/contrib/si_check.gawk b/contrib/si_check.gawk new file mode 100755 index 0000000..0a54ed4 --- /dev/null +++ b/contrib/si_check.gawk @@ -0,0 +1,91 @@ +#!/usr/bin/gawk -f + +# Usage example: +# tshark -2 -t r -E 'header=n' -E 'separator=,' -E 'quote=n' -T fields -e gsmtap.frame_nr -e gsmtap.ts -e gsmtap.arfcn -e _ws.col.Info -Y 'gsmtap' -r test.pcapng.gz | grep Information | env ARFCN=878 ./si_check.gawk +# read summary on number of bis/ter messages and adjust BT_BOTH and BT_NONE environment variables accordingly + +BEGIN { + FS = "," + FAILED = 0 + IGNORE = 0 + BIS = 0 + TER = 0 + QUA = 0 + BT_BOTH = ENVIRON["BOTH"] + BT_NONE = ENVIRON["NONE"] + TC_INDEX = 0 + TC4[4] = 0 +} + +{ # expected .csv input as follows: gsmtap.frame_nr,gsmtap.ts,gsmtap.arfcn,_ws.col.Info + if ("ARFCN" in ENVIRON) { # ARFCN filtering is enabled + if (ENVIRON["ARFCN"] != $3) { # ignore other ARFCNs + IGNORE++ + next + } + } + type = get_si_type($4) + tc = get_tc($1) + result = "FAIL" + + if (1 == check_si_tc(tc, type)) { result = "OK" } + else { FAILED++ } + + if (4 == tc) { + TC4[TC_INDEX] = type + TC_INDEX = int((TC_INDEX + 1) % 4) + if (0 == check_tc4c(type) && "OK" == result) { + result = "FAIL" + FAILED++ + } + } + if (type == "2bis") { BIS++ } + if (type == "2ter") { TER++ } + if (type == "2quater") { QUA++ } + # for (i in TC4) print TC4[i] # debugging + printf "ARFCN=%d FN=%d TS=%d TC=%d TYPE=%s %s\n", $3, $1, $2, tc, type, result +} + +END { + printf "check completed: total %d, failed %d, ignored %d, ok %d\nSI2bis = %d, SI2ter = %d, SI2quater = %d\n", NR, FAILED, IGNORE, NR - FAILED - IGNORE, BIS, TER, QUA + if ((BIS > 0 || TER > 0) && BT_NONE) { printf "please re-run with correct environment: unset 'NONE' variable\n" } + if ((BIS > 0 && TER > 0) && !BT_BOTH) { printf "please re-run with correct environment: set 'BOTH' variable\n" } +} + +func get_si_type(s, x) { # we rely on format of Info column in wireshark output - if it's changed we're screwed + return x[split(s, x, " ")] +} + +func get_tc(f) { # N. B: all numbers in awk are float + return int(int(f / 51) % 8) +} + +func check_tc4c(si, count) { # check for "once in 4 consecutive occurrences" rule + count = 0 + if ("2quater" != si || "2ter" != si) { return 1 } # rules is not applicable to other types + if (BT_NONE && "2quater" == si) { return 0 } # should be on TC=5 instead + if (!BT_BOTH && "2ter" == si) { return 0 } # should be on TC=5 instead + if (0 in TC4 && 1 in TC4 && 2 in TC4 && 3 in TC4) { # only check if we have 4 consecutive occurrences already + if (si == TC4[0]) { count++ } + if (si == TC4[1]) { count++ } + if (si == TC4[2]) { count++ } + if (si == TC4[3]) { count++ } + if (0 == count) { return 0 } + } + return 1 +} + +func check_si_tc(tc, si) { # check that SI scheduling on BCCH Norm is matching rules from 3GPP TS 05.02 § 6.3.1.3 + switch (si) { + case "1": return (0 == tc) ? 1 : 0 + case "2": return (1 == tc) ? 1 : 0 + case "2bis": return (5 == tc) ? 1 : 0 + case "13": return (4 == tc) ? 1 : 0 + case "9": return (4 == tc) ? 1 : 0 + case "2ter": if (BT_BOTH) { return (4 == tc) ? 1 : 0 } else { return (5 == tc) ? 1 : 0 } + case "2quater": if (BT_NONE) { return (5 == tc) ? 1 : 0 } else { return (4 == tc) ? 1 : 0 } + case "3": return (2 == tc || 6 == tc) ? 1 : 0 + case "4": return (3 == tc || 7 == tc) ? 1 : 0 + } + return 0 +}
Hi Max,
I merged all three of your patches in this series.
On Thu, Mar 17, 2016 at 11:37:24AM +0100, msuraev@sysmocom.de wrote:
There are several types of System Information messages with tricky scheduling rules described in 3GPP TS 05.02 § 6.3.1.3. This GNU Awk script takes in .csv file with sequence of scheduled SI messages (for example generated using tshark from GSMTAP capture - see usage note inside the script) and check the scheduling rules compliance.
I think this is overly complicatd and it requires tshark, relies on tshark string output stays constant/backwards-compatible/...
I would have preferred if this was a simple C program that parses the GSMTAP header to detemine frame number and other derived timing information, simply checks for frames sent on BCCH and then checks the L3 msg_type to determine whcih SI message is being sent.
Such a small C-language program could/should be compiled alongside with the other test programs, and wouldn't have any external dependencies or depend on implementation details of those dependencies not changing over time.
I understand that one advantage of using a different tool like tshark is of course that they parse the messages with a different implementation. But then, we only need to extract very few fields, like * arfcn * gsm frame number * channel type BCCH * L3 message ID and there's no real parsing of the SI message content involved.
So next time for similar tasks, please try to avoid constructs like tshark+gawk, particularly if all that's neded would pe possible to do in one relatively simple C source file using the osmocom abstraction for sockets, definition of gsmtap messages, etc.
Regards, Harald