pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/33950 )
Change subject: sndcp: Update n201_u & n201_i indicatd by LLC layer ......................................................................
sndcp: Update n201_u & n201_i indicatd by LLC layer
Change-Id: I7429701ae49c2a694dcad3e3d5ec639ab9927f5b --- M include/osmocom/gprs/sndcp/sndcp_private.h M src/sndcp/sndcp.c M src/sndcp/sndcp_prim.c 3 files changed, 32 insertions(+), 6 deletions(-)
Approvals: laforge: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified pespin: Looks good to me, approved
diff --git a/include/osmocom/gprs/sndcp/sndcp_private.h b/include/osmocom/gprs/sndcp/sndcp_private.h index 43ea7ca..21c6a40 100644 --- a/include/osmocom/gprs/sndcp/sndcp_private.h +++ b/include/osmocom/gprs/sndcp/sndcp_private.h @@ -171,7 +171,6 @@ * originated XID-Request from peer. NULL if not existing (and l3xid_req_len = 0) */ struct llist_head *l3_xid_comp_fields_req_from_peer;
- /* TODO: taken from lle.params and not yet set ever in code! */ uint16_t n201_u; uint16_t n201_i; }; @@ -220,8 +219,12 @@ int gprs_sndcp_sne_submit_snsm_activate_rsp(struct gprs_sndcp_entity *sne); int gprs_sndcp_sne_handle_llc_ll_unitdata_ind(struct gprs_sndcp_entity *sne, struct sndcp_common_hdr *sch, uint16_t len); -int gprs_sndcp_snme_handle_llc_ll_xid_ind(struct gprs_sndcp_mgmt_entity *snme, uint32_t sapi, uint8_t *l3params, unsigned int l3params_len); -int gprs_sndcp_snme_handle_llc_ll_xid_cnf(struct gprs_sndcp_mgmt_entity *snme, uint32_t sapi, uint8_t *l3params, unsigned int l3params_len); +int gprs_sndcp_snme_handle_llc_ll_xid_ind(struct gprs_sndcp_mgmt_entity *snme, uint32_t sapi, + uint16_t n201_u, uint16_t n201_i, + uint8_t *l3params, unsigned int l3params_len); +int gprs_sndcp_snme_handle_llc_ll_xid_cnf(struct gprs_sndcp_mgmt_entity *snme, uint32_t sapi, + uint16_t n201_u, uint16_t n201_i, + uint8_t *l3params, unsigned int l3params_len); int gprs_sndcp_sne_handle_sn_unitdata_req(struct gprs_sndcp_entity *sne, uint8_t *npdu, unsigned int npdu_len); int gprs_sndcp_sne_handle_sn_xid_req(struct gprs_sndcp_entity *sne, const struct osmo_gprs_sndcp_prim *sndcp_prim); int gprs_sndcp_sne_handle_sn_xid_rsp(struct gprs_sndcp_entity *sne, const struct osmo_gprs_sndcp_prim *sndcp_prim); diff --git a/src/sndcp/sndcp.c b/src/sndcp/sndcp.c index 4b54be3..5decfac 100644 --- a/src/sndcp/sndcp.c +++ b/src/sndcp/sndcp.c @@ -979,7 +979,9 @@ }
/* 5.1.2.10 SN-XID.indication */ -int gprs_sndcp_snme_handle_llc_ll_xid_ind(struct gprs_sndcp_mgmt_entity *snme, uint32_t sapi, uint8_t *l3params, unsigned int l3params_len) +int gprs_sndcp_snme_handle_llc_ll_xid_ind(struct gprs_sndcp_mgmt_entity *snme, uint32_t sapi, + uint16_t n201_u, uint16_t n201_i, + uint8_t *l3params, unsigned int l3params_len) { int rc; int compclass; @@ -1005,10 +1007,15 @@ return -EINVAL; }
+ sne->n201_u = n201_u; + sne->n201_i = n201_i; + /* Some phones send zero byte length SNDCP frames * and do require a confirmation response. */ if (l3params_len == 0) { - /* TODO: send empty (len=0) SN-XID.response? */ + /* TS 44.065 6.8: "If the SNDCP entity receives an LL-XID.indication without + * an SNDCP XID block, it shall not respond with the LL-XID.response primitive." + */ return 0; }
@@ -1057,7 +1064,9 @@ /* 5.1.2.12 SN-XID.confirm * (See also: TS 144 065, Section 6.8 XID parameter negotiation) */ -int gprs_sndcp_snme_handle_llc_ll_xid_cnf(struct gprs_sndcp_mgmt_entity *snme, uint32_t sapi, uint8_t *l3params, unsigned int l3params_len) +int gprs_sndcp_snme_handle_llc_ll_xid_cnf(struct gprs_sndcp_mgmt_entity *snme, uint32_t sapi, + uint16_t n201_u, uint16_t n201_i, + uint8_t *l3params, unsigned int l3params_len) { /* Note: This function handles an incoming SNDCP-XID confirmation. * Since the confirmation fields may lack important parameters we @@ -1092,6 +1101,9 @@ return -EINVAL; }
+ sne->n201_u = n201_u; + sne->n201_i = n201_i; + if (sne->l3xid_req && sne->l3xid_req_len > 0) { /* Parse SNDCP-CID XID-Field */ comp_fields_req = gprs_sndcp_parse_xid(NULL, sne, sne->l3xid_req, sne->l3xid_req_len, NULL); diff --git a/src/sndcp/sndcp_prim.c b/src/sndcp/sndcp_prim.c index 80dff8f..e371416 100644 --- a/src/sndcp/sndcp_prim.c +++ b/src/sndcp/sndcp_prim.c @@ -514,6 +514,7 @@ }
rc = gprs_sndcp_snme_handle_llc_ll_xid_ind(snme, llc_prim->ll.sapi, + llc_prim->ll.xid.n201_u, llc_prim->ll.xid.n201_i, llc_prim->ll.l3_pdu, llc_prim->ll.l3_pdu_len); return rc; } @@ -532,6 +533,7 @@ }
rc = gprs_sndcp_snme_handle_llc_ll_xid_cnf(snme, llc_prim->ll.sapi, + llc_prim->ll.xid.n201_u, llc_prim->ll.xid.n201_i, llc_prim->ll.l3_pdu, llc_prim->ll.l3_pdu_len); return rc; }