Commit Graph

767 Commits

Author SHA1 Message Date
Pau Espin 9fbcb10568 gtp: Make use of new libgtp APIs with multi-gsn support
Drop use of deprecated APIs everywhere in libgtp and use the new ones instead.

Related: OS#2873
Change-Id: Ibf56a063f01d1f95a2a3271416da6e062e85fdfa
2019-06-04 17:45:06 +02:00
Pau Espin eefa30dce8 gtp: Introduce new pdp APIs (and deprecate old ones) to support multiple GSN
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
2019-06-04 17:42:16 +02:00
Pau Espin 5560001af5 ggsn: Fix undefined behaviour shifting beyond sign bit
Fixes following ASan complaint during VTY "show running-config":
osmo-ggsn/ggsn/ggsn_vty.c:657:37: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

Change-Id: I2b8d163dbc108b0fb5a1e820dc23181835d12869
2019-06-04 08:43:03 +00:00
Pau Espin a469a90d5e cosmetic: gtp.h: Remove trailing whitespaces
Change-Id: I60f8cf5e36bcef767f90b150a488a800445bf744
2019-05-31 16:44:01 +02:00
Pau Espin 84515f4b8b pdp: Drop unused code for haship
Nowadays we have one tun device per APN, so we don't need this hash
table because we use the ippool of the APN to find the related PDP ctx
pointer.

Change-Id: Ife3f222daa87f0630ff34ffc3e63f4dad2ad914b
2019-05-31 16:44:01 +02:00
Oliver Smith 1cde2c1691 ggsn: Use gtp_delete_context_req2() everywhere
Replace calls to gtp_delete_context_req() with
gtp_delete_context_req2().

Related: OS#2741
Change-Id: Iecc8c5ac45207e7e20129559c4ac7f3c67dfb36a
2019-05-31 16:44:01 +02:00
Pau Espin 93dd798a99 gtp: Re-arrange free pdp ctx code in non-teardown scenario
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
2019-05-31 16:42:07 +02:00
Pau Espin 8651573632 cosmetic: gtp: Document free pdp ctx in non-teardown scenario
Change-Id: Ia47ac792111fe1e9aa68222b32b5da823642206b
2019-05-31 16:40:39 +02:00
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