canghaiwuhen has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/41948?usp=email )
Change subject: Related: OS#6922 Modified to dynamically adjust the returned QoS length to ensure compatibility with older modules. ......................................................................
Related: OS#6922 Modified to dynamically adjust the returned QoS length to ensure compatibility with older modules.
Change-Id: I872d882de4ce186f644b1b3ab684963050709d4f --- M include/osmocom/sgsn/pdpctx.h M src/sgsn/gprs_sm.c 2 files changed, 15 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/48/41948/1
diff --git a/include/osmocom/sgsn/pdpctx.h b/include/osmocom/sgsn/pdpctx.h index c6a43de..ac84a18 100644 --- a/include/osmocom/sgsn/pdpctx.h +++ b/include/osmocom/sgsn/pdpctx.h @@ -65,6 +65,7 @@ uint16_t sapi; /* LLC */ uint8_t ti; /* transaction identifier */ int vplmn_allowed; + uint8_t req_qos_len; /* Original Requested QoS Length (Air Interface) */ uint32_t qos_profile_subscr; //uint32_t qos_profile_req; //uint32_t qos_profile_neg; diff --git a/src/sgsn/gprs_sm.c b/src/sgsn/gprs_sm.c index 919dbf3..51ebdec 100644 --- a/src/sgsn/gprs_sm.c +++ b/src/sgsn/gprs_sm.c @@ -206,11 +206,20 @@
/* FIXME: copy QoS parameters from original request */ //msgb_lv_put(msg, pdp->lib->qos_neg.l, pdp->lib->qos_neg.v); -// msgb_lv_put(msg, sizeof(default_qos), (uint8_t *)&default_qos);
- /* HACK: Force R97 QoS length (3 bytes) to avoid crashing legacy modems - * which cannot handle R99 extensions (14 bytes). */ - msgb_lv_put(msg, 3, (uint8_t *)&default_qos); + /* ANTIGRAVITY PATCH: True Echo. + * Use the explicitly stored original Air Interface QoS length (req_qos_len). + * Modern modules send 14+ bytes (R99) and expect full responses. + * SOLUTION: Reply with exactly the length they asked for. + * Special circumstances force R97 QoS length (3 bytes) + */ + uint8_t qos_len = pdp->req_qos_len; + if (qos_len == 0) + qos_len = 3; // Safety fallback for R97 + if (qos_len > sizeof(default_qos)) + qos_len = sizeof(default_qos); + + msgb_lv_put(msg, qos_len, (uint8_t *)&default_qos);
/* Radio priority 10.5.7.2 */ msgb_v_put(msg, pdp->lib->radio_pri); @@ -328,6 +337,7 @@ pdp->sapi = req_llc_sapi; pdp->ti = transaction_id; pdp->destroy_ggsn = destroy_ggsn; + pdp->req_qos_len = tp->lv[OSMO_IE_GSM_REQ_QOS].len;
return 0; }