Bug #2426

PDP contexts not cleared/released if GGSN is restarted

Added by laforge over 1 year ago. Updated 8 months ago.

Target version:
Start date:
Due date:
% Done:


Spec Reference:


When re-starting OpenGGSN while OsmoSGSN remains running and has PDP contexts established, the PDP contexts are not cleared.

All MS-originated GTP-U messages are rejected by the GGSN with an "Error Indication". This Error Indication is insufficient to close that specific PDP context.

Also the concept of the gsn restart counter doesn't appear to be helping? Let's find out why

Related issues

Related to OsmoGGSN (former OpenGGSN) - Bug #2434: GTP-C Error Indication is missing mandatory IEsClosed2017-08-12


#1 Updated by laforge over 1 year ago

  • Related to Bug #2434: GTP-C Error Indication is missing mandatory IEs added

#2 Updated by laforge over 1 year ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 20

I think the problem is threefold:

  • the SGSN doesn't seem to use the ECHO req/resp procedure to poll the GSN restart counter of the GGSN and thus doesn't know about a restart
  • the GGSN isn't including mandatory information elements in the GTP Error Indication, which would be required to resolve the GTP context that's causing the error (#2434)
  • the SGSN isn't resolving the PDP context on an incoming GTP Error Indication

#3 Updated by laforge over 1 year ago

  • % Done changed from 20 to 50

Change-Id: I3e843f9ef1d6fd7868cc992e083c0891d16b6da9 adresses the libgtp part of matching the PDP context and deleting it:

However, now we have the problem that the SGSN is not properly informing the MS about this, i.e. the MS continues to send packets for that PDP context.

cb_delete_context() is called for PDP context deletion, but this is called for both those PDP contexts that the SGSN has previously requested to be deleted, as well as for those that were "unilaterally" deleted by libgtp. We need to work out something here...

#4 Updated by laforge over 1 year ago

  • Status changed from In Progress to New

#5 Updated by laforge 12 months ago

  • Assignee changed from laforge to pespin

#6 Updated by pespin 9 months ago

  • Status changed from New to In Progress

#7 Updated by pespin 9 months ago

I did some work related to this topic:

remote: New Changes:
remote: sgsn_libgtp.c: Log pointer of deleted context
remote: Maintain per ggsn pdp ctx list
remote: osmo-sgsn: ping GGSN periodically and check for restart counter
remote: Disarm T3395 when dettaching mmctx from pdpctx
remote: examples: Enable by default echo req towards active GGSNs

So basically echo loop seems to be now working for osmo-sgsn. Still need to add support for it in osmo-ggsn. I also fixed some bugs I found while triggering new scenarios.

About the issue mentioned by laforge (#2434), I still need to check if it's actually solved, because i recall seeing some Error Indications without the restart counter

#8 Updated by pespin 9 months ago

I did some TTCN3 work, which is almost working:
remote: lib: GTP_Emulation: Allow receiving packets with TEID 0
remote: sgsn: Add test to verify restart_ctr during echo req/reply.

Problem is code I took from other parts to match against the PDP CTX DEL REQ at the end doesn't match correctly what I see in wireshark (expected result I think). That TTCN3 code is also used in TC_attach_pdp_act but I see that it actuallt is also failing in current master for same reason.

#9 Updated by pespin 8 months ago

Current status:
  • ECHO REQUEST/REPLY seems to be working fine, as well as detection of restartCTR increase and cleanup of pdp ctx.
  • TTCN3 test is working when running standalone, and other tests are not broken (still work) with my changes. However, the 2 already broken tests before my test leave the SGSN in a weird state which then makes my test not pass when run together with them. I'm trying to fix those tests in order to have everything passing.

osmo-sgsn patches can be found in:
libgtp (osmo-ggsn) patches can be found in:
TTCN3 patches can be found in:

- Fix previous failing tests: GTP CTX DEL REQ initiated by GGSN was not implemented. Right now I'm at the point where the REQ arrives to th osmo-sgsn cb_delete_context() func. It needs to forward the message to the PCU now.
- Error Ind probably still don't have the RestartCounter, need to check.

#10 Updated by pespin 8 months ago

  • Status changed from In Progress to Feedback
  • Priority changed from High to Normal
  • % Done changed from 50 to 90

It turns out Error Indications don't include Restart Counter (not even optionally), so GGSN is sending all the correct information. I added a test to verify SGSN deactivates the ctx at receival of ErrorInd in

All related bits from this task are covered in the whole bunch of commits I submitted to osmo-ggsn (libgtp) and osmo-sgsn.

#11 Updated by pespin 8 months ago

  • Status changed from Feedback to Resolved

Merged, closing.

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)