Before this patch they were not taken into account, which means some
resp messages could stay more time than required enqueued.
Change-Id: Iebf405b2310a34785f3b363cc2a9f415281f6030
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
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
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
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
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
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
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
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
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
get_seq() is called also from contexts where GTP-U is used, and GTP-U
doesn't have sequence numbers. Thus, it is perfectly normal if no
sequence number and/or no S flag in the header is present.
Change-Id: Ie19b95bbb4427e547843a019f5213a231a9f83da
* as there are muptiple flags in the field, use plural
* print the flags as hex value, not decimal. Hex is customary for bitfields.
Change-Id: Ib23d80fae32b4e9fa146d82d8f5a1dada1a3cb2b
An fopen("w") error used to omit the umask() call to reinstate the previous
umask. Also an fopen("r") at the top will never create a file and hence does
not need a umask set.
Instead, wrap the umask change and change-back tightly around the single
fopen("w") call.
Change-Id: If7d948e2f2ba47ecebba5614f18235a53b273d14
Fix errors during gsn_restart file path composition:
- possible buffer overflow because the wrong remaining length was fed to
strncat().
- missing path separator: put restart file in dir/gsn_restart instead of
../dirgsn_restart.
This assumes that the path separator is '/'.
Use talloc_asprintf() to fix all filename length problems and shorten the code.
In order to free the allocated path, add a free_filename label, and jump there
instead of returning from the fopen("w") failure branch. Also don't return from
"fclose failed" branch in order to free the path, remove the if {} braces.
Change-Id: Idf0a64ff45720aa818f2f9de1e8ba2fe2c82631b
libgtp cannot understand its own update pdp request (in gtp v1)
Only require the conditional and mandatory fields for gtpv1 and not
others.
Refer to 3GPP TS 29.060 Ch. 7.3.4
pdp_getgtp1(&pdp, get_tei(pack)) works like pdp_getgtp0 for gtp0
connections.
Using get_hlen() for gtpie_decaps is used in other places to decode ies
for both version 0 and 1.
With no pdp parameter gtp_req() will send the packet to TEID 0 which is
not what we want. When trying to modify an established pdp context the
correct TEID of that context must be used.
It would print the memory location of the address buffer. Instead, print the
human readable host address and port.
The current code base supports only IPv4, and thread safety is apparently not
required, hence just use inet_ntoa(). (The IPv6 and thread capable version is 4
times longer and harder to read.)