Commit Graph

709 Commits

Author SHA1 Message Date
Pau Espin 0d0b0592f0 gtp: Refactor code to use gtp_freepdp(_teardown) APIs
* 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
2019-05-31 16:34:32 +02:00
Pau Espin aad77a0acf gtp_create_pdp_ind: simplify code by reordering and compacting parsing
Move all parsing with same conditions under same blocks to make code
easier to follow and make it more compact.

Change-Id: I52d5a3543ce6cf764bd84303b5a0d8b0643d998d
2019-05-31 16:34:32 +02:00
Pau Espin 9ee8d3264b pdp: Introduce new API pdp_count_secondary
Change-Id: Id2d84ad1cdb0f3b500efeda4cc0fbccb24ae0c61
2019-05-31 16:34:32 +02:00
Pau Espin de72d26f49 gtp: Fix typo dublicate->duplicate
Change-Id: Ic572c216e74fa937dfd12f9f3dc03de18b6b123e
2019-05-31 14:25:57 +00:00
Pau Espin ceac078d77 gtp: Take queue_resp into account to schedule retrans timer
Before this patch they were not taken into account, which means some
resp messages could stay more time than required enqueued.

Change-Id: Iebf405b2310a34785f3b363cc2a9f415281f6030
2019-05-31 14:25:57 +00:00
Pau Espin cd87c5f963 ggsn: Start gtp retrans timer during startup
This timer was added in osmo-ggsn.git
dda21ed7d4,
but it was never initially started since it was introducing, and as a
result retransmissions never being triggered.

Also as a consequence, gtp_retrans is never called. That function is
responsible from triggering retransmissions and to free old responses
waiting in the resp queue (to check for duplicates). Since it's never
called, the retransmit resp queue will grow over time.

Fixes: dda21ed7d4
Fixes: OS#3997
Change-Id: Ie4adc52829446539fbbb5e9e0cf75a04f91c7eea
2019-05-31 14:25:57 +00:00
Oliver Smith 154f93da51 debian: create -doc subpackage with pdf manuals
I have verified, that the resulting debian packages build in my own OBS
namespace (see the -doc packages):
https://download.opensuse.org/repositories/home:/osmith42/Debian_9.0/all/
https://build.opensuse.org/project/show/home:osmith42

Depends: Ib7251cca9116151e473798879375cd5eb48ff3ad (osmo-ci)
Related: OS#3899
Change-Id: I5563e023dc3c8b158a79ce0c9e1478e117b0ec37
2019-05-31 14:25:07 +00:00
Pau Espin 742a6b55ce gtp: Document spec reasoning drop of Rx DeleteCtxReq
Change-Id: I563fc0b48595d71ebdf56a50f4e9984eee423676
2019-05-30 13:36:56 +02:00
Pau Espin 72ab4bc547 ggsn: Drop unused param force in apn_stop()
Change-Id: I920679c7062d480c1cfaa3d89c90a0ed4a2ef58b
2019-05-29 19:09:02 +02:00
Vadim Yanitskiy fb62504160 osmo-ggsn: properly show subscriber's MSISDN in the VTY
Instead of printing subscriber's MSISDN as a hex-string, let's
attempt to decode it using gsm48_decode_bcd_number2().

Change-Id: I3f3a105dc8d0d582f2b9d8e1ff6c5785369e569b
2019-05-19 02:00:41 +07:00
Vadim Yanitskiy d7030d268c osmo-ggsn: print requested / actual APN in PDP info
An actual APN can be different from the one that was requested by
user, e.g. when 'default-apn' VTY parameter is used. The one that
was requested is already being stored in the PDP context state.
Let's also store a chosen APN in create_context_ind().

Change-Id: I9cbe195f64e5b83d5158c175aad2e81ba2487850
2019-05-14 08:33:25 +00:00
Vadim Yanitskiy 2e8e57a3de osmo-ggsn: check result of osmo_apn_to_str()
Change-Id: I03d0eb266dca176f342e77a54f0291cc5bd7df43
2019-05-13 22:09:15 +07:00
Vadim Yanitskiy ca276e01eb osmo-ggsn: add VTY command to show PDP context by IPv4
Change-Id: Iad60de34c562803a1a1fc024287d1a60e071afab
2019-05-13 15:37:02 +07:00
Vadim Yanitskiy 977b339abe osmo-ggsn: fix VTY command for getting PDP contexts by APN
Change-Id: I0a7f4b245c4664afdae83c660358acb1a5f88ce5
2019-05-13 15:36:58 +07:00
Harald Welte 9272d212c3 ggsn.c: Refactor PCO processing during PDP activation
The existing PCO processing is implemented in a rather convoluted
way.  We scan the list of PCO elements several times for different
PCO protocols.  Let's change to a straight-forward model where we
simply do one iteration over the list of PCO elements and generate
responses step by step.

Change-Id: I4a7d09279b6b259e2b95f1f51159b16838b2d94c
2019-04-11 19:41:00 +02:00
Harald Welte f653c5bc33 ggsn: Fix build_ipcp_pco() in presence of invalid IPCP content
When build_ipcp_pco() iterated over the PCO list, it didn't use
the "outer" pco length as an increment, but used the "inner" IPCP
length.

If an IPCP message with an invalid "inner" length was being processed
(see pcap file attached to OS#3914), the PCO iteration beyond that
broken IPCP would fail, possibly rendering false hits.

Let's make pco_contains_proto() return a pointer to the the pco_element,
so that the caller can use the outer length as an increment.

Change-Id: I8e9cffde092c8c5824abfaeecb742afcf949802c
Related: OS#3914
2019-04-11 19:27:17 +02:00
Harald Welte 549417e675 ggsn: Remove magic numbers from ipcp_contains_option()
Let's remove some magic numbers and use a data structure instead.

Change-Id: I5b1abc6f403f85986407e9e8359924dfcb58031a
2019-04-11 19:27:17 +02:00
Harald Welte 42c9fa4958 ggsn: const-ify input / read-only arguments of PCO related functions
Change-Id: Ia0877988180ded4e3c033d7f1fb6e1c2acd60163
2019-04-11 19:27:17 +02:00
Harald Welte df404c4296 ggsn: Remove magic numbers from pco_contains_proto()
Let's remove some magic numbers and use a data structure to describe
the PCO element header.

Change-Id: I9871ffced677320aa82438332bfdb951ab129f04
2019-04-11 19:27:17 +02:00
Harald Welte ffa227307c process_pco() const-ify 'apn' argument
Change-Id: I2a96b0fbe077c7c49342553de0880bfc58318669
2019-04-11 14:59:51 +00:00
Max 3fc9cc97de Don't return error on normal shutdown
Previously we've always returned error code from main() even in case of
regular expected shutdown. Let's not confuse it with actual error
shutdown and return 0 by default.

Change-Id: I7fe0d3e052953d5b87ce65649d88d83476fee3c0
2019-03-14 11:16:55 +01:00
Harald Welte f5a268a96d Bump version: 1.2.2.44-6da8-dirty → 1.3.0
Change-Id: Ie12af1d57df178a9ab27937ef0b764c98dd96e32
2019-01-20 21:34:23 +01:00
Oliver Smith 6da888c5d0 contrib: fix makedistcheck with disabled systemd
EXTRA_DIST files need to be distributed, no matter if the systemd option
is configured or not.

Change-Id: Ibd348eac3adca88663bd510172efbe4ec0bf3599
2018-12-06 13:43:26 +01:00
Oliver Smith 33c537e5a7 contrib/jenkins.sh: build and publish manuals
Add new environment variables WITH_MANUALS and PUBLISH to control if
the manuals should be built and uploaded. Describe all environment vars
on top of the file.

When WITH_MANUALS is set, install osmo-gsm-manuals like any other
dependency and add --enable-manuals to the configure flags (for "make"
and "make distcheck"). Add the bin subdir of the installed files to
PATH, so osmo-gsm-manuals-check-depends can be used by ./configure.

Related: OS#3385
Change-Id: I43e3b592c593237eb4df2d70c926c031ddb7b20b
2018-12-05 13:16:14 +01:00
Oliver Smith aa69034c00 Fix DISTCHECK_CONFIGURE_FLAGS override
Set AM_DISTCHECK_CONFIGURE_FLAGS in Makefile.am instead of
DISTCHECK_CONFIGURE_FLAGS. This is the recommended way from the
automake manual, as otherwise the flag can't be changed by the user
anymore.

Related: OS#3718
Change-Id: I810b2b96ea077e8bd5ab01df5137e214a4349628
2018-12-04 15:33:20 +01:00
Oliver Smith bf47f71785 build manuals moved here from osmo-gsm-manuals.git
Moved to doc/manuals/, with full commit history, in preceding merge commit.
Now incorporate in the build system.

Build with:

$ autoreconf -fi
$ ./configure --enable-manuals
$ make

Shared files from osmo-gsm-manuals.git are found automatically if
- the repository is checked out in ../osmo-gsm-manuals; or
- if it osmo-gsm-manuals was installed with "make install"; or
- OSMO_GSM_MANUALS_DIR is set.

Related: OS#3385
Change-Id: I14533676d5774ee0d0ee5054ba77d7dac32cff43
2018-11-27 18:28:24 +01:00
Neels Hofmeyr 2b7a860ffb Merge history from osmo-gsm-manuals.git
Change-Id: Ic7cebd4e6f2836be80a6186939f98057969207d4
2018-11-27 18:27:58 +01:00
Neels Hofmeyr 932eeec240 ggsn: update vty reference
Change-Id: I8a5c37505c0180d5c04c7792d6d0afdb0dffb282
2018-11-27 18:27:47 +01:00
Harald Welte 6f7aabf6a3 vty-ref: Update URI of docbook 5.0 schema
... to match the /etc/xml/catalog file on debian (no "www" in hostname)

Change-Id: Id9f3579c7f2bc3af13fe30b5268f249b6f59ed0d
2018-11-27 18:27:47 +01:00
Neels Hofmeyr a491e42129 OsmoGGSN: update vty reference
Add new (generic) logging commands, talloc context print commands.
Add the jitter buffer logging category.

Change-Id: Ifdc735df6221bf6e9b6247912f2958974dcfc4f2
2018-11-27 18:27:47 +01:00
Neels Hofmeyr 1ce111f72b OsmoGGSN: fix VTY additions' node IDs
Change-Id: I8cd5eb64300151d0de8023ed019568cfdc4fe453
2018-11-27 18:27:47 +01:00
Neels Hofmeyr e010dea56e OsmoGGSN vty: update VTY reference
Apply VTY reference changes from libosmocore: change node IDs from index
numbers to meaningful names from VTY node prompts.

Introduce section with common commands, do not repeat the common commands on
each child node.

Populate section names (so far empty).

Add apn / gpdu VTY reference.

This is generated using the recent libosmocore vty doc patches that conclude in
libosmocore change-id Iedd67750539b676271de0e0e9316d4e6f794406a.

Change-Id: Ia269c4bda0aa0b905abcccc75338f5f808e01727
2018-11-27 18:27:47 +01:00
Neels Hofmeyr f4530447f6 OsmoGGSN VTY ref: prep: convert newlines to unix
To omit whitespace changes in an upcoming patch that updates the VTY reference
and will use '\n' line breaks, convert line breaks from '\r\n' to '\n' without
any other changes.

Change-Id: Id0d1a3a82c3d670cbb041884554b5d79fdfb0f28
2018-11-27 18:27:47 +01:00
Neels Hofmeyr e7361067ac OsmoGGSN: typo: priveleges
Change-Id: Id7e59f5dfcbb632fde6c35ef014e9b85099fe06d
2018-11-27 18:27:47 +01:00
Neels Hofmeyr 606837597f OsmoGGSN: add Routing section for IP forward and masquerading
Change-Id: Ie49ca7a45113f49e89ce09017500008cbec757f5
2018-11-27 18:27:47 +01:00
Neels Hofmeyr 5f8b332e6b OsmoGGSN: multiple instances: mention GTP port
Change-Id: I781feeb955ace17d93206bc98d12bc423584ce32
2018-11-27 18:27:47 +01:00
Neels Hofmeyr 43001cbc7a OsmoGGSN: more info on non-root operation / tun creation
Add examples for 'ip addr add' and mention correspondence to config file,
add examples for enabling masquerading and IP forwarding,
place the non-root config in its own section and highlight the diffs.

Add tiny hint at systemd-networkd.

Change-Id: I02bd9cfa35c7f2fb338d5d92c2e968fe80574a78
2018-11-27 18:27:47 +01:00
Neels Hofmeyr 65d61c347b GGSN: don't say 'NITB'
Change-Id: I960ce8ee749621176ceaa556a1fe93b54e08b6fc
2018-11-27 18:27:47 +01:00
Neels Hofmeyr c8ca02b937 refactor Makefile build rules, don't use the FORCE
The initial goal was to make sure we don't have overall FORCE rules causing
unnecessary rebuilds -- annoying while writing documentation. As I looked
through possible dependencies, I finally understood what's going on here.

Remove code dup and nicely sort which belongs where in build/Makefile.*.inc. In
each, describe in a top comment how to use it, and also unify how they are
used:

- Rename Makefile.inc to Makefile.docbook.inc and refactor
- Add Makefile.vty-reference.inc
- Add Makefile.common.inc

Make sure that we accurately pick up all dependencies.

Drop use of the macro called 'command', that silenced the actual command lines
invoked and replaced them with short strings: it obscures what is actually
going on and makes the Makefiles hard to read and understand.

Each manual's makefile is greatly reduced to few definitions and a Makefile
include, e.g. one for asciidoc, one for VTY reference.

Move common/bsc_vty_additions.xml to OsmoBSC/vty/libbsc_vty_additions.xml, link
from OsmoNITB. It applies only to OsmoBSC and OsmoNITB.

Add a script that combines a VTY reference file with *all* additions files
found in a manual's vty/ dir. Call this from Makefile.vty-reference.inc.

Change-Id: I9758e04162a480e28c7dc83475b514cf7fd25ec0
2018-11-27 18:27:47 +01:00
Harald Welte 3ce5a3648a GGSN: Document how 'ip tuntap' is used for non-root; call netdev 'apn0'
* Some people want to manually create/configure their tun devices,
  show them how to do this using ip with the correct parameters
* Let's not call the network device 'ggsn' but rather 'apn0', as
  the device has a 1:1 correspondence to the APN, not to the GGSN.

Change-Id: I2fef818bfcb8cb521397136539f492922d5f6def
2018-11-27 18:27:47 +01:00
Max a4cb02699e Expand OsmoGGSN manual
* add cross-references
* add example of running without root priviledges

Change-Id: I1743f370ee2b351d2847f2e29e0f59f35cd401f4
2018-11-27 18:27:47 +01:00
Harald Welte f0fb2c2ddd OsmoGGSN: Add VTY reference manual
Change-Id: Iddf6fe26689172d7db001198943c816eaaed7931
2018-11-27 18:27:47 +01:00
Harald Welte 8a1e7b8658 initial version of OsmoGGSN user manual
Closes: OS#1721
Change-Id: I7cdf150e8dd4f9dfc5e6d28e780d05dc1e1e5458
2018-11-27 18:27:47 +01:00
Neels Hofmeyr b7782d4d41 Importing history from osmo-gsm-manuals.git
Change-Id: I79f406ae78de4a82966cffebac0dcec2abab21c2
2018-11-27 18:27:29 +01:00
Stefan Sperling b0b9c28284 properly store IPv6 addresses in struct tun_t
All addresses in struct tun_t were stored as an in_addr.
But IPv6 addresses need an in6_addr, so switch tun_t addresses
to the in64_addr wrapper struct.

This is an ABI break, as documented in TODO-RELEASE.

Fixes an out of bounds memcpy() identified by Coverity.

Change-Id: Idd2431ad25d7fa182e52e2bd5231ceb04d427c34
Related: CID#174278
2018-11-22 14:12:40 +00:00
Stefan Sperling 3730c550cd fix a format string directives in queue_seqset()
Coverity pointed out that a format string used inappropriate
format string directives for variables of type size_t.

Change-Id: I889019aad963932fdc032421e60a72c809a93bca
Related: CID#135197
2018-11-22 13:17:18 +00:00
Stefan Sperling cc8181fefe fix format string error in ippool_printaddr()
The variable this->listsize is an unsigned int, but the format
string assumed ptrdiff_t. Found by Coverity.

Change-Id: Ib2a55907adae98f8aa7b079f1c9a3b4fc5f67fc5
Related: CID#188879
2018-11-22 13:17:01 +00:00
Stefan Sperling 7327360d10 initialize local variable addr in ippool_new()
Coverity points out that addr.len was potentially being used
uninitialized, via calls to in46a_inc(&addr).

Change-Id: Idb67394e5f4c2072380a33f46c848d92c4317245
Related: CID#174189
2018-11-22 13:16:50 +00:00
Stefan Sperling e405c2f196 replace bogus memcpy() call in ippool_newip()
When copying an address to a reused static hash table member
with memcpy(), this code mistakenly passed the size of a
pointer as the amount of bytes to be copied, rather than
the actual size of the address.

This means the IP pool could contain bogus IP addresses because
only addr->len (a uint8_t) and 3 further bytes of the address
were actually copied on 32 bit platforms. On 64 bit platforms,
a sufficient amount of bytes were copied for IPv4 to work
correctly, but too few bytes were copied for IPv6.

This problem was found by Coverity.

Replace the bogus memcpy() call with direct assignments to the
appropriate struct in64addr union members, and assert that the
length recorded for the address actually corresponds to the
length used by the address family (IP4, IPv6).

Change-Id: Ic21560f7519e776107485a8779702fb1279d065c
Related: CID#57921
2018-11-22 13:16:29 +00:00
Stefan Sperling 411ff3b984 fix allocation of ippool's hash table
The calloc() call in ippool_new() had two problems.

The first problem is benign: The order of arguments were reversed.
Pass the number of elements in the array first, then the size of
each element, as calloc() expects.
This problem was found by me. There are more instances of this
problem in this file, which I'll address in follow-up patches.

The second problem is that the requested allocation was larger than
necessary: The hash table is an array of pointers to ippoolm_t, not
an array of struct ippoolm_t. Fix the required size passed to calloc().
This problem was found by Coverity.

Change-Id: I93fa5bc539771ca19714f6a665558c9140e2ce07
Related: CID#57920
2018-11-22 07:00:54 +00:00