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/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/25562 ) Change subject: ns2: message: allow to pass a foreign NSVCI to STATUS PDU ...................................................................... ns2: message: allow to pass a foreign NSVCI to STATUS PDU To answer correct on a BLOCK PDU with a different NSVCI, the STATUS PDU needs also a NSVCI parameter. Change-Id: I373eb48697097cdfa45748a091c11f7b3f0345fa --- M src/gb/gprs_ns2.c M src/gb/gprs_ns2_internal.h M src/gb/gprs_ns2_message.c M src/gb/gprs_ns2_vc_fsm.c 4 files changed, 12 insertions(+), 7 deletions(-) Approvals: laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c index 6bccf65..3bb04ae 100644 --- a/src/gb/gprs_ns2.c +++ b/src/gb/gprs_ns2.c @@ -1356,7 +1356,7 @@ if (rc < 0) { LOGP(DLNS, LOGL_NOTICE, "Error during TLV Parse\n"); if (nsh->pdu_type != NS_PDUT_STATUS) - ns2_tx_status(nsvc, NS_CAUSE_PROTO_ERR_UNSPEC, 0, msg); + ns2_tx_status(nsvc, NS_CAUSE_PROTO_ERR_UNSPEC, 0, msg, NULL); return rc; } return ns2_vc_rx(nsvc, msg, &tp); diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h index a5d78d4..0959d2b 100644 --- a/src/gb/gprs_ns2_internal.h +++ b/src/gb/gprs_ns2_internal.h @@ -439,7 +439,7 @@ struct msgb *msg); int ns2_tx_status(struct gprs_ns2_vc *nsvc, uint8_t cause, - uint16_t bvci, struct msgb *orig_msg); + uint16_t bvci, struct msgb *orig_msg, uint16_t *nsvci); /* driver */ struct gprs_ns2_vc *ns2_ip_bind_connect(struct gprs_ns2_vc_bind *bind, diff --git a/src/gb/gprs_ns2_message.c b/src/gb/gprs_ns2_message.c index de30470..cc95334 100644 --- a/src/gb/gprs_ns2_message.c +++ b/src/gb/gprs_ns2_message.c @@ -432,13 +432,14 @@ * \param[in] cause Numeric NS cause value * \param[in] bvci BVCI to be reset within NSVC * \param[in] orig_msg message causing the STATUS + * \param[in] nsvci if given this NSVCI will be encoded. If NULL the nsvc->nsvci will be used. * \returns 0 in case of success */ int ns2_tx_status(struct gprs_ns2_vc *nsvc, uint8_t cause, - uint16_t bvci, struct msgb *orig_msg) + uint16_t bvci, struct msgb *orig_msg, uint16_t *nsvci) { struct msgb *msg = ns2_msgb_alloc(); struct gprs_ns_hdr *nsh; - uint16_t nsvci = osmo_htons(nsvc->nsvci); + uint16_t encoded_nsvci; unsigned int orig_len, max_orig_len; log_set_context(LOG_CTX_GB_NSE, nsvc->nse); @@ -459,7 +460,11 @@ case NS_CAUSE_NSVC_BLOCKED: case NS_CAUSE_NSVC_UNKNOWN: /* Section 9.2.7.1: Static conditions for NS-VCI */ - msgb_tvlv_put(msg, NS_IE_VCI, 2, (uint8_t *)&nsvci); + if (nsvci) + encoded_nsvci = osmo_htons(*nsvci); + else + encoded_nsvci = osmo_htons(nsvc->nsvci); + msgb_tvlv_put(msg, NS_IE_VCI, 2, (uint8_t *)&encoded_nsvci); break; case NS_CAUSE_SEM_INCORR_PDU: case NS_CAUSE_PDU_INCOMP_PSTATE: diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c index d09c31a..1a632b1 100644 --- a/src/gb/gprs_ns2_vc_fsm.c +++ b/src/gb/gprs_ns2_vc_fsm.c @@ -679,7 +679,7 @@ ns2_tx_status(priv->nsvc, NS_CAUSE_NSVC_BLOCKED, - 0, msg); + 0, msg, NULL); break; /* ALIVE can receive UNITDATA if the ALIVE_ACK is lost */ case GPRS_NS2_ST_RECOVERING: @@ -863,7 +863,7 @@ if (ns2_validate(nsvc, nsh->pdu_type, msg, tp, &cause)) { /* don't answer on a STATUS with a STATUS */ if (nsh->pdu_type != NS_PDUT_STATUS) { - rc = ns2_tx_status(nsvc, cause, 0, msg); + rc = ns2_tx_status(nsvc, cause, 0, msg, NULL); goto out; } } -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25562 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I373eb48697097cdfa45748a091c11f7b3f0345fa Gerrit-Change-Number: 25562 Gerrit-PatchSet: 3 Gerrit-Owner: lynxis lazus <lynxis at fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211008/33c1b88f/attachment.htm>