pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/37666?usp=email )

Change subject: gtp: Allow UpdatePDPContext initiated by GGSN
......................................................................

gtp: Allow UpdatePDPContext initiated by GGSN

The Update PDP Context procedure can be initiated GGSN -> SGSN, as
described in TS 29.060 7.3.3.

Related: OS#6512
Change-Id: I1c3441c71b90c5bbf6f4545484586222e6180fe1
---
M gtp/gtp.c
1 file changed, 26 insertions(+), 13 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved




diff --git a/gtp/gtp.c b/gtp/gtp.c
index 8736cad..9b68315 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -1899,8 +1899,9 @@
        }

        if (version == 1) {
-               /* TEID (mandatory) */
-               if (gtpie_gettv4(ie, GTPIE_TEI_DI, 0, &pdp->teid_gn)) {
+               /* TEID (mandatory SGSN->GGSN, Optional SGSN<-GGSN) */
+               if (gtpie_gettv4(ie, GTPIE_TEI_DI, 0, &pdp->teid_gn) &&
+                   gsn->mode == GTP_MODE_GGSN) {
                        rate_ctr_inc2(gsn->ctrg, GSN_CTR_PKT_MISSING);
                        GTP_LOGPKG(LOGL_ERROR, peer, pack,
                                    len, "Missing mandatory information 
field\n");
@@ -1954,9 +1955,10 @@
                                           pdp, GTPCAUSE_MAN_IE_MISSING);
        }

-       /* SGSN address for user traffic (mandatory) */
+       /* SGSN address for user traffic (mandatory SGSN->GGSN, optional 
SGSN<-GGSN) */
        if (gtpie_gettlv(ie, GTPIE_GSN_ADDR, 1, &pdp->gsnru.l,
-                        &pdp->gsnru.v, sizeof(pdp->gsnru.v))) {
+                        &pdp->gsnru.v, sizeof(pdp->gsnru.v)) &&
+           gsn->mode == GTP_MODE_GGSN) {
                rate_ctr_inc2(gsn->ctrg, GSN_CTR_PKT_MISSING);
                GTP_LOGPKG(LOGL_ERROR, peer, pack, len,
                            "Missing mandatory information field\n");
@@ -1966,9 +1968,10 @@
        }

        if (version == 1) {
-               /* QoS (mandatory) */
+               /* QoS (mandatory SGSN->GGSN, optional SGSN<-GGSN) */
                if (gtpie_gettlv(ie, GTPIE_QOS_PROFILE, 0, &pdp->qos_req.l,
-                                &pdp->qos_req.v, sizeof(pdp->qos_req.v))) {
+                                &pdp->qos_req.v, sizeof(pdp->qos_req.v)) &&
+                   gsn->mode == GTP_MODE_GGSN) {
                        rate_ctr_inc2(gsn->ctrg, GSN_CTR_PKT_MISSING);
                        GTP_LOGPKG(LOGL_ERROR, peer, pack,
                                    len, "Missing mandatory information 
field\n");
@@ -1978,7 +1981,7 @@
                                                   GTPCAUSE_MAN_IE_MISSING);
                }

-               /* TFT (conditional) */
+               /* TFT (conditional SGSN->GGSN, optional SGSN<-GGSN) */
                if (gtpie_gettlv(ie, GTPIE_TFT, 0, &pdp->tft.l,
                                 &pdp->tft.v, sizeof(pdp->tft.v))) {
                }
@@ -2100,8 +2103,7 @@
                        }

                        /* Direct Tunnel Flags */
-                       if (gsn->mode == GTP_MODE_GGSN &&
-                           gtpie_gettlv(ie, GTPIE_DIR_TUN_FLAGS, 0, 
&pdp->dir_tun_flags.l,
+                       if (gtpie_gettlv(ie, GTPIE_DIR_TUN_FLAGS, 0, 
&pdp->dir_tun_flags.l,
                                        &pdp->dir_tun_flags.v, 
sizeof(pdp->dir_tun_flags.v))) {
                        }
                }
@@ -2820,8 +2822,7 @@
                }

                if ((gsn->mode == GTP_MODE_GGSN) &&
-                   ((pheader->type == GTP_CREATE_PDP_RSP) ||
-                    (pheader->type == GTP_UPDATE_PDP_RSP))) {
+                   (pheader->type == GTP_CREATE_PDP_RSP)) {
                        rate_ctr_inc2(gsn->ctrg, GSN_CTR_PKT_UNEXPECT);
                        GTP_LOGPKG(LOGL_ERROR, &peer, buffer,
                                    status,
@@ -2831,8 +2832,7 @@
                }

                if ((gsn->mode == GTP_MODE_SGSN) &&
-                   ((pheader->type == GTP_CREATE_PDP_REQ) ||
-                    (pheader->type == GTP_UPDATE_PDP_REQ))) {
+                   (pheader->type == GTP_CREATE_PDP_REQ)) {
                        rate_ctr_inc2(gsn->ctrg, GSN_CTR_PKT_UNEXPECT);
                        GTP_LOGPKG(LOGL_ERROR, &peer, buffer,
                                    status,

--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/37666?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I1c3441c71b90c5bbf6f4545484586222e6180fe1
Gerrit-Change-Number: 37666
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to