aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2023-11-23 18:41:59 +0100
committerDaniel Willmann <dwillmann@sysmocom.de>2023-11-24 09:48:22 +0100
commit6a2e82542de6b1f94277291dd93f1d625f31a90e (patch)
tree4f639cdb65735d9a8db02b2fbdfb3e3340d7ef2f
parenta625bdd136a1143e8b5b7453f319dada6de1d17d (diff)
libgtp: Use gtp_cause_successful() instead of GTPCAUSE_ACC_REQ
In some cases the phone requests a PDP context type that isn't available no the PGW/GGSN, e.g. phone requests a combined IPv4/v6 context, but only IPv4 is supported. In that case the GGSN can send a Create PDP Context Response with cause "New PDP type due to network preference" or "New PDP type due to single address bearer only". libgtp should continue handling these cause values like the "Request Accepted" cause. Use the new gtp_cause_successful() function for that. Related: OS#6268 Change-Id: I7dd1e0aa185530e1e2d0402742df833c61a787a7
-rw-r--r--gtp/gtp.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/gtp/gtp.c b/gtp/gtp.c
index 1ebc6dc..43e56b5 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -995,7 +995,7 @@ int gtp_create_context_resp(struct gsn_t *gsn, struct pdp_t *pdp, int cause)
/* Now send off a reply to the peer */
gtp_create_pdp_resp(gsn, pdp->version, pdp, cause);
- if (cause != GTPCAUSE_ACC_REQ)
+ if (!gtp_cause_successful(cause))
gtp_freepdp(gsn, pdp);
return 0;
@@ -1011,7 +1011,7 @@ int gtp_create_pdp_resp(struct gsn_t *gsn, int version, struct pdp_t *pdp,
gtpie_tv1(&packet, &length, GTP_MAX, GTPIE_CAUSE, cause);
- if (cause == GTPCAUSE_ACC_REQ) {
+ if (gtp_cause_successful(cause)) {
if (version == 0)
gtpie_tv0(&packet, &length, GTP_MAX, GTPIE_QOS_PROFILE0,
@@ -1445,7 +1445,7 @@ int gtp_create_pdp_conf(struct gsn_t *gsn, int version,
}
/* Check all conditional information elements */
- if (GTPCAUSE_ACC_REQ == cause) {
+ if (gtp_cause_successful(cause)) {
if (version == 0) {
if (gtpie_gettv0(ie, GTPIE_QOS_PROFILE0, 0,
@@ -1667,7 +1667,7 @@ static int gtp_update_pdp_resp(struct gsn_t *gsn, uint8_t version,
gtpie_tv1(&packet, &length, GTP_MAX, GTPIE_CAUSE, cause);
- if (cause == GTPCAUSE_ACC_REQ) {
+ if (gtp_cause_successful(cause)) {
if (version == 0)
gtpie_tv0(&packet, &length, GTP_MAX, GTPIE_QOS_PROFILE0,
@@ -1997,7 +1997,7 @@ static int gtp_update_pdp_conf(struct gsn_t *gsn, uint8_t version,
/* Check all conditional information elements */
/* TODO: This does not handle GGSN-initiated update responses */
- if (cause == GTPCAUSE_ACC_REQ) {
+ if (gtp_cause_successful(cause)) {
if (version == 0) {
if (gtpie_gettv0(ie, GTPIE_QOS_PROFILE0, 0,
&pdp->qos_neg0,
@@ -2172,7 +2172,7 @@ int gtp_delete_pdp_resp(struct gsn_t *gsn, int version,
gtp_resp(version, gsn, pdp, &packet, length, peer, fd,
get_seq(pack), get_tid(pack));
- if (cause == GTPCAUSE_ACC_REQ) {
+ if (gtp_cause_successful(cause)) {
if ((teardown) || (version == 0)) { /* Remove all contexts */
gtp_freepdp_teardown(gsn, linked_pdp);
} else {
@@ -2198,7 +2198,6 @@ int gtp_delete_pdp_resp(struct gsn_t *gsn, int version,
}
}
}
- /* if (cause == GTPCAUSE_ACC_REQ) */
return 0;
}
@@ -2350,7 +2349,7 @@ int gtp_delete_pdp_conf(struct gsn_t *gsn, int version,
}
/* Check the cause value (again) */
- if ((GTPCAUSE_ACC_REQ != cause) && (GTPCAUSE_NON_EXIST != cause)) {
+ if (!gtp_cause_successful(cause) && (GTPCAUSE_NON_EXIST != cause)) {
rate_ctr_inc2(gsn->ctrg, GSN_CTR_ERR_UNEXPECTED_CAUSE);
GTP_LOGPKG(LOGL_ERROR, peer, pack, len,
"Unexpected cause value received: %d\n", cause);