summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-07-24 14:10:42 +0200
committerHarald Welte <laforge@gnumonks.org>2017-08-09 20:41:57 +0000
commitba12716882059491c6a0923cc061165988df590b (patch)
tree46bbad70f8df07b2c224a1881e0186ada9afeef5
parent50a40f921863500d583eafcf0c4ca5552cb3dc1e (diff)
safer osmo_sccp_make_addr_pc_ssn(): clear all values
Make sure that all values of the resulting sccp_addr are cleared to obtain a clean PC+SSN address. Before this, gt and ip remained unset/random, e.g. in osmo_sccp_tx_unitdata_ranap() Change-Id: I37395169d364050e45e99793c495a9848a4f8601
-rw-r--r--src/sccp_helpers.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/sccp_helpers.c b/src/sccp_helpers.c
index 1e83c8c..4b24392 100644
--- a/src/sccp_helpers.c
+++ b/src/sccp_helpers.c
@@ -38,10 +38,12 @@ static struct msgb *scu_msgb_alloc(const char *name)
void osmo_sccp_make_addr_pc_ssn(struct osmo_sccp_addr *addr, uint32_t pc, uint32_t ssn)
{
- addr->presence = OSMO_SCCP_ADDR_T_SSN | OSMO_SCCP_ADDR_T_PC;
- addr->ri = OSMO_SCCP_RI_SSN_PC;
- addr->ssn = ssn;
- addr->pc = pc;
+ *addr = (struct osmo_sccp_addr){
+ .presence = OSMO_SCCP_ADDR_T_SSN | OSMO_SCCP_ADDR_T_PC,
+ .ri = OSMO_SCCP_RI_SSN_PC,
+ .ssn = ssn,
+ .pc = pc,
+ };
}
void osmo_sccp_addr_set_ssn(struct osmo_sccp_addr *addr, uint32_t ssn)