laforge submitted this change.

View Change


Approvals: osmith: Looks good to me, but someone else must approve fixeria: Looks good to me, approved Jenkins Builder: Verified
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
---
M gtp/gtp.c
1 file changed, 27 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 @@
/* 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 @@

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 @@
}

/* 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 @@

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 @@

/* 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 @@
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 @@
}
}
}
- /* if (cause == GTPCAUSE_ACC_REQ) */
return 0;
}

@@ -2350,7 +2349,7 @@
}

/* 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);

To view, visit change 35125. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I7dd1e0aa185530e1e2d0402742df833c61a787a7
Gerrit-Change-Number: 35125
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier@sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis@fe80.eu>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-MessageType: merged