laforge has submitted this change. (
https://gerrit.osmocom.org/c/osmo-bsc/+/28094 )
Change subject: smscb: "Warning Security Information is always present in ETWS
......................................................................
smscb: "Warning Security Information is always present in ETWS
As per TS 48.049 Table 8.1.3.1.1 the WRITE-REPLACE message always
has a Warning Security Information IE if it relates to ETWS. This
is also implemented in the libosmocore CBSP parser.
As the previous Change Id369bb3676ba279bafc234378fbe21dbc7b0614b has
pointed out, the CBSP parser structure doesn't even permit any way
of handing a decoded message to us without the warning_sec_info
static struct member.
So as a result, there's also no need to dynamically allocate
bts_etws_state.input.sec_info via talloc. We can have it in-line
as a static struct member and reduce code complexity and runtime
memory allocations.
Change-Id: Ib1b8e4af37b1f9f9398b81dad29942e82218c70b
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/smscb.c
2 files changed, 4 insertions(+), 12 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index cb20b9e..6df7c61 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -29,6 +29,7 @@
#include <osmocom/gsm/rxlev_stat.h>
#include <osmocom/gsm/protocol/gsm_08_58.h>
#include <osmocom/gsm/protocol/gsm_12_21.h>
+#include <osmocom/gsm/protocol/gsm_03_41.h>
#include <osmocom/abis/e1_input.h>
#include <osmocom/bsc/meas_rep.h>
#include <osmocom/bsc/acc.h>
@@ -1098,7 +1099,7 @@
uint16_t msg_id;
uint16_t serial_nr;
uint16_t warn_type;
- uint8_t *sec_info;
+ uint8_t sec_info[ETWS_SEC_INFO_SIZE];
} input;
/* encoded ETWS primary notification */
uint8_t primary[ETWS_PRIM_NOTIF_SIZE];
diff --git a/src/osmo-bsc/smscb.c b/src/osmo-bsc/smscb.c
index 3a06697..8e2eb0c 100644
--- a/src/osmo-bsc/smscb.c
+++ b/src/osmo-bsc/smscb.c
@@ -70,9 +70,7 @@
osmo_store16be(serial_nr, out);
etws->msg_id = osmo_htons(msg_id);
etws->warning_type = osmo_htons(warn_type);
-
- if (sec_info)
- memcpy(etws->data, sec_info, ETWS_PRIM_NOTIF_SIZE - sizeof(*etws));
+ memcpy(etws->data, sec_info, ETWS_PRIM_NOTIF_SIZE - sizeof(*etws));
return ETWS_PRIM_NOTIF_SIZE;
}
@@ -557,18 +555,11 @@
}
}
- if (bes->input.sec_info) {
- talloc_free(bes->input.sec_info);
- bes->input.sec_info = NULL;
- }
-
/* copy over all the data to per-BTS private state */
bes->input.msg_id = wrepl->msg_id;
bes->input.serial_nr = wrepl->new_serial_nr;
bes->input.warn_type = wrepl->u.emergency.warning_type;
- bes->input.sec_info = talloc_named_const(bts, ETWS_SEC_INFO_SIZE,
"etws_sec_info");
- if (bes->input.sec_info)
- memcpy(bes->input.sec_info, wrepl->u.emergency.warning_sec_info,
ETWS_SEC_INFO_SIZE);
+ memcpy(bes->input.sec_info, wrepl->u.emergency.warning_sec_info,
sizeof(bes->input.sec_info));
/* generate the encoded ETWS PN */
gen_etws_primary_notification(bes->primary, bes->input.serial_nr,
bes->input.msg_id,
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
--
To view, visit
https://gerrit.osmocom.org/c/osmo-bsc/+/28094
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ib1b8e4af37b1f9f9398b81dad29942e82218c70b
Gerrit-Change-Number: 28094
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged