Age | Commit message (Collapse) | Author | Files | Lines |
|
Currently each user (application) of libgtp needs to manage its own
timers in order to call gtp_retrans_timeout() and gtp_retrans() and
maintain retransmit and duplicate queues working correctly. This adds
unnecesary complexity to applications since nowadays, as a libosmocore
user, libgtp can handle this internally in an easy way.
Furthermore, keeping the timers internal to the library allows for
easier extension of features as well as re-implementation of related
code in the future.
Last but not least, it was detected that existing known applications
(osmo-sgsn, osmo-ggsn, sgsnemu) are not using correctly the API, since
they should be updating their timers through gtp_retrans_timeout()
everytime a message is enqueued/transmitted, otherwise they may fire
gtp_retrans() for retransmition too late in some cases.
Related: OS#4178
Change-Id: Ife7cfd66d6356f413263fe5bda9e43091f5c9e98
|
|
Change-Id: I39e92f25ed51665c8a615826ed52f35024bdd54b
|
|
This change fixes the following compiler warnings (found by Clang):
gtp.c:2747:13: warning: variable 'pdp' is used uninitialized
whenever 'if' condition is false
[-Wsometimes-uninitialized]
} else if (version == 1) {
gtp.c:2781:14: note: uninitialized use occurs here
OSMO_ASSERT(pdp);
^^^
Shall not happen in general, but let's make Clang happy.
Change-Id: Id471b22afd4c45435589a4edda0a804e66be3a7a
|
|
As stated in the comment above, we need to use the tunnel identifier
to find a GTP context, and derive both IMSI and NSAPI from that TID,
when speaking GTP version 0.
This change fixes the following warnings (found with Clang):
gtp.c:2115:22: warning: variable 'pdp' is uninitialized
when used here [-Wuninitialized]
pdp_set_imsi_nsapi(pdp, tid);
^^^
gtp.c:2118:34: warning: variable 'imsi' is uninitialized
when used here [-Wuninitialized]
if (gtp_pdp_getimsi(gsn, &pdp, imsi, nsapi))
^^^^
gtp.c:2118:40: warning: variable 'nsapi' is uninitialized
when used here [-Wuninitialized]
if (gtp_pdp_getimsi(gsn, &pdp, imsi, nsapi))
^^^^^
Change-Id: I8f1c8d0ba2e8189d97fe1bb5c872680e5ad1cd7a
|
|
Change-Id: I1f85c7cc7684e146fca4f17914927d45410dbb84
|
|
That code was commented out in 0b076a331e1e7f955580313a5da416c170b3b4ce
(year 2003), and indeed it makes no sense to call those in current pdp
lifecycle (they are expected to be freed by the application).
Change-Id: I096d8cb8d749ff9b737d6f3f96b1d423660ece37
|
|
Change-Id: Ie768ddb45313582b4b5358b97a981080be64fd42
|
|
Since osmo-ggsn can manage several GSN structures simultaneously, it
needs the gsn_t pointer to know the ggsn it should forward the call to.
Related: OS#4165
Change-Id: I33b4fe594d5833993af01cce34737e61e597b320
|
|
The libgtp application may have already allocated related resources
associated to the pdp context, so we need to signal its deletion in
order to let the application free the resources.
This should fix the duplication of pdp contexts seen in osmo-ggsn when
"show pdp-context" related VTY commands are used.
It was spotted due to some MS requesting a v4v6 context on a
v4-only APN, where first v4 address was allocated, and then upon v6
allocation create_context_ind() called
gtp_create_context_resp(GTPCAUSE_MISSING_APN) but the first address was
not freed. Upon receiving the callback, osmo-ggsn should now free the
related resources.
Related: OS#4154
Change-Id: I6c6215a4ce478afabc78ffaf5ffb0cf829e41226
|
|
Doing so should avoid the crash seen in OS#3956, where a message is
received in osmo-sgsn gtp iface after having received a DeleteCtxAccept
message where pdp and associated cbp is freed. As a result, when new
confirmation arrives, it can still be matched against an old request and
be sent to upper layers providing an already freed cbp.
With this patch, since all queued messages belonging to that pdp are
dropped, confirmation won't find a match and be discarded in libgtp.
In order to be able to drop all req messages belonging to a pdp, a new list
is added to pdp_t and qmsg_t are added to that list when inserted into the per-gsn
req transmit queue. This way upon pdp free time it's simply a
matter of iterating over that list to remove all messages.
There's no need to do same for resp queue, and it'd be actually
counter-productive, because it wouldn't be possible to detect and
discard duplicates anymore after pdp ctx has been freed.
Related: OS#3956
Change-Id: Id86d0b241454d3ad49c64c28087fd2710fa2d17a
|
|
Drop use of deprecated APIs everywhere in libgtp and use the new ones instead.
Related: OS#2873
Change-Id: Ibf56a063f01d1f95a2a3271416da6e062e85fdfa
|
|
Move static global pdp storage arrays to be per GSN. This way now
several GSN per process are supported without collisions.
* pdp_init() is defined in public API but it's actually only intended
for use (and currently only used) internally in gtp_new(). So let's
document that and re-use it for backward compatibility with now
deprecated API, where only one GSN per process is supported.
* Back pointer to gsn_t (pdp->gsn) moved from gtp.c:gtp_new() to
gtp_pdp_newpdp(), since it makes more sense to have it there. This way
backpointer is always set, even in case were app calls pdp_newpdp() API
directly instead of creating them through gtp.c, like osmo-sgsn does.
* Create new versions of required APIs with a pointer to gsn_t where the
pdp ctx is to be created/found. Some APIs receiving a pointer to a pdp
ctx can be left intact because we have a backpointer to its gsn_t.
* pdp_getpdp() is nowhere used, and makes little sense now that we have
pdpa reachable in gsn->pdpa, so let's deprecate it without adding a
replacement.
* Deprecate gtp.h gtp_newpdp(), since it's nowhere used and useless
(does same as new gtp_pdp_newpdp() and doesn't allow for old_pdp to be
passed as parameter).
Fixes: OS#2873
Change-Id: I653cbdc185165592d985e3efab6e3f1add97877b
|
|
Replace calls to gtp_delete_context_req() with
gtp_delete_context_req2().
Related: OS#2741
Change-Id: Iecc8c5ac45207e7e20129559c4ac7f3c67dfb36a
|
|
Code modified actually behaves the same, since gtp_freepdp() also calls
delete cb, and this way it's more consistent with rest of the code base.
Change-Id: I299765816e9d885497110d2e834f7ccdc943052c
|
|
Change-Id: Ia47ac792111fe1e9aa68222b32b5da823642206b
|
|
* API gtp_freepdp was already there but was not really being used by
anyone currently, so we can change its behaviour to call cb_delete_ctx.
It makes sense to call the cb in there too to be consistent with rest of
APIs.
* Add API gtp_freepdp_teardown, which calls gtp_freepdp on pdp and its
secondary contexts. It will also be used later on by osmo-ggsn.
* Use new APIs in internal code to simplify it.
Change-Id: I9f0b774e9385a7a8d81ec9702f158e2f9a50d571
|
|
Move all parsing with same conditions under same blocks to make code
easier to follow and make it more compact.
Change-Id: I52d5a3543ce6cf764bd84303b5a0d8b0643d998d
|
|
Change-Id: Id2d84ad1cdb0f3b500efeda4cc0fbccb24ae0c61
|
|
Change-Id: Ic572c216e74fa937dfd12f9f3dc03de18b6b123e
|
|
Before this patch they were not taken into account, which means some
resp messages could stay more time than required enqueued.
Change-Id: Iebf405b2310a34785f3b363cc2a9f415281f6030
|
|
Change-Id: I563fc0b48595d71ebdf56a50f4e9984eee423676
|
|
Clearing the request and response queue is useful for debugging
to reset "some" state. Otherwise some tests will get un-expected
packets.
Change-Id: I279d1d7cbf5d37dd5609c2b968f317fe9a0e348d
|
|
Sometimes the originating pdp ctx causing the Recovery Procedure is
required, in order to drop all pdp ctx but this one, which specs specify
should be handled as valid:
"""
The SGSN receiving the Recovery information element shall handle it as when an
Echo Response message is received but shall consider the PDP context being created as active if the response indicates
successful context activation at the GGSN.
"""
Change-Id: I53e92298f2f6b84d662a3300d922e8c2ccb178bc
|
|
With this API, user is expectd to free the PDP ctx when the confirmation
for the release has been received (cb_conf time). This way user can
maintain the pdp ctx alive during all this time. Extra code is added to
gtp_delete_pdp_resp() since it's now possible to match it and push it up
to the user cb_conf.
This way, cb_conf() can be used for locally-initiated DEL CTX REQ, while
delete_context() cb is left for remotely-initiated DEL CTX REQ. In this
later case, when the DEL CTX RESP is sent the ctx is deleted and the
delete_context() is called, where the user can do related actions or
trigger consequence events (in the case of SGSN, it will drop all
related GGSN bits for that PDP ctx and forward the DEACT PDP CTX to the
MS).
Change-Id: I29d366253bb98dcba328c7ce8aa3e4daf8f75e6c
|
|
Change-Id: Ic950c04d309d5686bfbeab332f79c48678e743ae
|
|
According to 3GPP TS 29.060 section "7.3.5
Delete PDP Context Request", both directions are valid in both GSNs.
This allows osmo-sgsn receive delete ctx indication (cb_delete_context)
in order to implement GGSN initiated requests.
Change-Id: I6927c07be4ddf74defe338d01d947056e15cd14d
|
|
Change-Id: Iae0f045e4128cf97aa7824d7d774b59bf966cbe8
|
|
Closes: OS#2422
Change-Id: Ie658a7f161103bb6f631ab0508e45e55fb42a442
|
|
Change-Id: I9afc36e2304f1060615219e88dd28821fb74e300
|
|
Functions not exported in gtp.h should be static.
There's no need to mark functions as extern in the .c file.
Change-Id: Ie61d5c6e0ae45ef3885911cedf71c826ed1705d0
|
|
Change-Id: I0d7493404ea05ce2e795958041bbb6cb75a04d31
|
|
If the version received is not known, pdp is then uninitalized so we
should not be using it. Let's return an error to inform the caller.
Change-Id: Ib3e23b61a3521bd3c9002d3165ca8eff4361a35e
|
|
Change-Id: I99b73f7a6d4100789fa92021c6ec9117869c881b
|
|
Change-Id: Idbc6e4c912b958bde5916b87ec53c3c4db70bee0
|
|
Change-Id: I843071a090e877fd529e1e0b799df3585bf836d8
|
|
Change-Id: I636c81d0c0ff53c97e6aedbc00f90c1325a3d607
|
|
Change-Id: I65eb80db4bcdc6da4d267bef3b907d3f98942a2e
|
|
Change-Id: I09e37e25fd118ac0a54ab788304d3f5083463050
Fixes: Coverity CID#174335
|
|
The string buffer allocated for the IMSI must be sized for a length
twice the number of input bytes (each byte has two nibbles) plus 1
byte for NUL. We missed the "twice" part :/
Change-Id: I1ecaa811815ae522af71feabc5d0c1ea8b4edde9
Fixes: Coverity CID#174336
|
|
Change-Id: I33f65e404217e717bd795e5229c8d9456a7b3739
|
|
GTP sequence numbers on GTP-U are optional for G-PDU type messages (i.e.
user-ip messages). Let's allow the user to specify this behavior by
a new pdu_t.tx_gpdu_seq flag. The flag is enabled by default to stay
compatible with the prior behaviour.
Related: OS#2519
Change-Id: Icf22a2ddd5c4a968ef5bda7c202b921d93fb49e6
|
|
Let's introduce a couple of #defines that make the code much more
readable.
Change-Id: I3635d679fd54507274b46e99a02bdbbe41d7684e
|
|
Adresses two "TODO Should be avoided" comments about an extra memcpy()
before sendto() that can be replaced by a single sendmsg() call with an
iovec array: 1 record for the GTP header + 1 record for the user payload.
Change-Id: Ie332a6b15972330fcf540753898eb84ecb84fe24
|
|
Osmocom has maintained this program since about 7 years now, while
the original author / copyright holder has completely disappeared.
With the introduction of Osmocom-style CTRL and VTY interfaces,
the way how the program is used and configured has substantially
changed. In order to avoid confusion in terms of configuration file
format etc, let's rename it to OsmoGGSN.
Change-Id: I2da30f7d4828e185bfac1a4e2d8414b01cbe4f9d
|
|
This is required once one wants to support multiple GSNs in a single
application.
WARNING: This breaks ABI compatibility, LIBVERSION must be adjusted
Change-Id: I68ae49a765828fa681054c68bf7f5e74dbe48ad2
|
|
* print destination address on sendto error
* print address length on conversion error
* log listening address
* log GTP version on PDP context errors
* fix incorrect logging message for unknown GSN peer
Related: SYS#3610
Change-Id: I0f8ad8687acb7f6f0eeeb962f007e87cca0c4c27
|
|
When a peer GSN receives a GPDU for an unknown PDP context, it sends
a GTP Error Indication. This Error Indication should be used to
delete the offending PDP context locally.
In GTPv1, the Error Indication contains some mandatory IEs using
which we can look up the PDP context and delete it.
The existing code only dealt with GTPv0 Error Indications which lack
those IEs and use the TEI in the header instead.
Change-Id: I3e843f9ef1d6fd7868cc992e083c0891d16b6da9
Closes: OS#2426
|
|
Change-Id: Iadd1fe3de7c476576a4409f22f5e84e9eade6b6e
|
|
For some reason Max' commits introducing the CTRL/trap interface
about one year ago didn't convert the IMSI to its actual textual
representation before usign it in the CTRL interface.
Let's clean that up by properly interpreting the IMSI.
Change-Id: I8b20d2e47a29de266d93a7ddd5e6877f7e346a63
|
|
* propagate error code from gtp_new() to caller instead of always
returning -1
* on socket-related failures log explicitly which kind of socket caused
error
* log expected GTP version for unexpected packets
Change-Id: Ie07f1e4246eb178838b7df21946a08a1f60f2084
related: SYS#3610
|