pespin has submitted this change. (
https://gerrit.osmocom.org/c/osmo-hnodeb/+/28250 )
Change subject: llsk: Validate received SAPI versions at startup
......................................................................
llsk: Validate received SAPI versions at startup
Change-Id: I172abfee3bfadb383aa6bce6fe76306291c7cd7f
---
M include/osmocom/hnodeb/hnodeb.h
M include/osmocom/hnodeb/llsk.h
M src/osmo-hnodeb/llsk.c
3 files changed, 36 insertions(+), 3 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
osmith: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
diff --git a/include/osmocom/hnodeb/hnodeb.h b/include/osmocom/hnodeb/hnodeb.h
index 5503020..986c638 100644
--- a/include/osmocom/hnodeb/hnodeb.h
+++ b/include/osmocom/hnodeb/hnodeb.h
@@ -92,6 +92,9 @@
struct osmo_prim_srv_link *link;
struct osmo_prim_srv *srv;
uint8_t valid_sapi_mask;
+ uint16_t sapi_version_iuh;
+ uint16_t sapi_version_gtp;
+ uint16_t sapi_version_audio;
struct osmo_timer_list defer_configure_ind_timer;
} llsk;
diff --git a/include/osmocom/hnodeb/llsk.h b/include/osmocom/hnodeb/llsk.h
index 78eb065..d9e1a69 100644
--- a/include/osmocom/hnodeb/llsk.h
+++ b/include/osmocom/hnodeb/llsk.h
@@ -37,8 +37,8 @@
int ll_addr2osa(enum u_addr_type t, const union u_addr *uaddr, uint16_t port, struct
osmo_sockaddr *osa);
enum u_addr_type osa2_ll_addr(const struct osmo_sockaddr *osa, union u_addr *uaddr,
uint16_t *port);
-
-
+#define LLSK_SAPI_IUH_VERSION_MIN 0
+#define LLSK_SAPI_IUH_VERSION_MAX 0
extern const struct value_string hnb_iuh_prim_type_names[];
int llsk_rx_iuh(struct hnb *hnb, struct osmo_prim_hdr *oph);
int llsk_iuh_tx_configure_ind(struct hnb *hnb);
@@ -50,12 +50,15 @@
uint32_t data_len);
struct hnb_iuh_prim *hnb_iuh_makeprim_unitdata_ind(const uint8_t *data, uint32_t
data_len);
-
+#define LLSK_SAPI_AUDIO_VERSION_MIN 0
+#define LLSK_SAPI_AUDIO_VERSION_MAX 0
extern const struct value_string hnb_audio_prim_type_names[];
int llsk_rx_audio(struct hnb *hnb, struct osmo_prim_hdr *oph);
int llsk_audio_tx_conn_data_ind(struct rtp_conn *conn, uint8_t frame_nr, uint8_t fqc,
uint8_t rfci,
const uint8_t *payload, uint32_t len);
+#define LLSK_SAPI_GTP_VERSION_MIN 0
+#define LLSK_SAPI_GTP_VERSION_MAX 0
extern const struct value_string hnb_gtp_prim_type_names[];
int llsk_rx_gtp(struct hnb *hnb, struct osmo_prim_hdr *oph);
struct hnb_gtp_prim *hnb_gtp_makeprim_conn_data_ind(uint32_t gtp_conn_id, const uint8_t
*data, uint32_t data_len);
diff --git a/src/osmo-hnodeb/llsk.c b/src/osmo-hnodeb/llsk.c
index 89e8364..b56cae7 100644
--- a/src/osmo-hnodeb/llsk.c
+++ b/src/osmo-hnodeb/llsk.c
@@ -146,6 +146,33 @@
struct hnb *hnb = (struct hnb *)osmo_prim_srv_get_priv(prim_srv);
if (sapi > sizeof(hnb->llsk.valid_sapi_mask)*8 - 1)
return -1;
+
+ switch (sapi) {
+ case HNB_PRIM_SAPI_IUH:
+ if (rem_version < LLSK_SAPI_IUH_VERSION_MIN)
+ return -1;
+ if (rem_version > LLSK_SAPI_IUH_VERSION_MAX)
+ return LLSK_SAPI_IUH_VERSION_MAX;
+ hnb->llsk.sapi_version_iuh = rem_version;
+ break;
+ case HNB_PRIM_SAPI_GTP:
+ if (rem_version < LLSK_SAPI_GTP_VERSION_MIN)
+ return -1;
+ if (rem_version > LLSK_SAPI_GTP_VERSION_MAX)
+ return LLSK_SAPI_GTP_VERSION_MAX;
+ hnb->llsk.sapi_version_gtp = rem_version;
+ break;
+ case HNB_PRIM_SAPI_AUDIO:
+ if (rem_version < LLSK_SAPI_AUDIO_VERSION_MIN)
+ return -1;
+ if (rem_version > LLSK_SAPI_AUDIO_VERSION_MAX)
+ return LLSK_SAPI_AUDIO_VERSION_MAX;
+ hnb->llsk.sapi_version_audio = rem_version;
+ break;
+ default:
+ return -1;
+ }
+
hnb->llsk.valid_sapi_mask |= (1 << sapi);
/* Defer CONFIGURE.req after we have confirmed the versions */
--
To view, visit
https://gerrit.osmocom.org/c/osmo-hnodeb/+/28250
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnodeb
Gerrit-Branch: master
Gerrit-Change-Id: I172abfee3bfadb383aa6bce6fe76306291c7cd7f
Gerrit-Change-Number: 28250
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged