This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/3113 cn unitdata: verify correct remote addr When receiving unitdata from the CN, verify that it is indeed coming from the remote address that matches our CS/PS domain settings. This patch came from an earlier stage where the is_ps out-parameter was actually used. While it currently isn't, it doesn't hurt to leave it there. Change-Id: I7190b4c3a05e8bac0eeffa1eab18c9e47429cb17 --- M src/hnbgw_cn.c 1 file changed, 28 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/13/3113/1 diff --git a/src/hnbgw_cn.c b/src/hnbgw_cn.c index 8124ce5..9921960 100644 --- a/src/hnbgw_cn.c +++ b/src/hnbgw_cn.c @@ -240,6 +240,31 @@ return rc; } +static bool osmo_sccp_addr_match(const struct osmo_sccp_addr *a, const struct osmo_sccp_addr *b) +{ + return (a == b) + || ((a->pc == b->pc) + && (a->ssn == b->ssn)); +} + +static int classify_cn_remote_addr(const struct hnb_gw *gw, + const struct osmo_sccp_addr *cn_remote_addr, + bool *is_ps) +{ + if (osmo_sccp_addr_match(cn_remote_addr, &gw->sccp.remote_addr_cs)) { + if (is_ps) + *is_ps = false; + return 0; + } + if (osmo_sccp_addr_match(cn_remote_addr, &gw->sccp.remote_addr_ps)) { + if (is_ps) + *is_ps = true; + return 0; + } + LOGP(DMAIN, LOGL_ERROR, "Unexpected remote address, matches neither CS nor PS address: %s\n", + osmo_sccp_addr_dump(cn_remote_addr)); + return -1; +} static int handle_cn_unitdata(struct hnbgw_cnlink *cnlink, const struct osmo_scu_unitdata_param *param, @@ -251,6 +276,9 @@ return -1; } + if (classify_cn_remote_addr(cnlink->gw, ¶m->calling_addr, NULL) < 0) + return -1; + return handle_cn_ranap(cnlink, msgb_l2(oph->msg), msgb_l2len(oph->msg)); } -- To view, visit https://gerrit.osmocom.org/3113 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7190b4c3a05e8bac0eeffa1eab18c9e47429cb17 Gerrit-PatchSet: 1 Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>