Currently, osmo-ggsn doesn't implement PDP contexts with static IP
addresses. The code for specifying ranges that can be used for
static IPs was always present even from OpenGGSN days, but we never
really treated them. Let's not raise the impression we do by
warning accordingly if the user configures them.
Change-Id: I7787dae037c46c0c5052aa6dd000be330984f144
Related: OS#5097
We don't implement handling of static IP addresses for now,
let's properly reject those rather than allocating a dynamic address
anyway.
Change-Id: Iac8868438655fe4e5e07d167d7dbd6273dbb7678
Related: OS#5097
Check if tun-device is defined and give the user a hint that it is
missing instead of segfaulting with gtpu-mode kernel-gtp:
20210205141701206 DGGSN <0002> ggsn.c:186 APN(internet): Starting
20210205141701206 DGGSN <0002> ggsn.c:204 APN(internet): Opening Kernel GTP device (null)
Segmentation fault
With gtpu-mode tun it didn't segfault, but still tried to open the NULL
device:
20210205141557598 DGGSN <0002> ggsn.c:186 APN(internet): Starting
20210205141557599 DGGSN <0002> ggsn.c:189 APN(internet): Opening TUN device (null)
20210205141557599 DTUN <0001> tun.c:195 errno=1/Operation not permitted ioctl() failed
Related: OS#3208
Change-Id: I9f71af65cc0eed71728c04b774e5c08352947913
Previous code relied on abort() switching sigaction to SIG_FDL +
retriggering SIGABRT in case the signal handler returns, which would
then generate the coredump + terminate the process.
However, if a SIGABRT is received from somewhere else (kill -SIGABRT),
then the process would print the talloc report and continue running,
which is not desired.
Change-Id: I7acfdfe5020320d853cba98b5add7479f8aaaf39
Fixes: OS#4865
Fix test for return value from gtp_pdp_getimsi() so
we do not call show_one_pdp() with an uninitialised pdp_t
Change-Id: Ic40429939b185f97c020dd3904e054fe860b91e8
The PDP context is searched on the hash which is generated
on context creation from the IMSI in gtp format. - A hash
created from "human-readable" IMSI does not match.
Check user input for length then convert the IMSI to gtp format
before continuing.
Change-Id: Icd2e2bc6068c06fbf5d5fe905ebcda8954f33f04
Disable IPv6 automatic SLAAC by linux kernel and handle it manually.
This allows us gaining control on local address acquisition and set
addresses and routing properly. It will also allow us to run in ping
mode without a tun iface.
Related: OS#4434
Change-Id: Iae59cf6ffb181357e10b3080a5c751bd454f4a1f
Update documentation since nowadays there are more paths calling
ggsn_close_one_pdp() (because we now close pdp contexts during sgsn
timeouts).
Switch pdp_freepdp() to gtp_freepdp() since in the event we ended up
there in the future we want to go through normal delete_ctx_cb to free
related application data structures.
Change-Id: I7d9ae9a27390498ba387797aac6651e32fa44f29
This patch is quite big because implementing echo req/resp and recovery
requires having knowledge and managing differentiated state for each GSN
peer attached/connected to osmo-ggsn. This kind of information was not
available in osmo-ggsn nor in libgtp.
So osmo-ggsn is now able to track GSN peers connected to a
ggsn_ctx (associated gsn_t from libgtp) by means of "sgsn_peer" data
structure, and accessible from the ggsn through a list. The instances of
sgsn_peer are currently allocated and destroyed dynamically based on
discovered peer who have at least a pdp context attached to us (we are
not interested in peers without pdp contexts because we don't need to
send echo requests/responses and maintain state in that case).
A new private pointer (pdp_t->priv) data structure struct pdp_priv_t is
added to be able to relate a pdp_t to an sgsn as well as the already
existing pointer to an apn.
An "echo-interval <0-36000>" VTY command is added which allows
configuring time wait between echo requests being sent to each
sgsn_peer. Transmission of echo requests is disabled by default.
Finally, a new "show sgsn" VTY command is introduced, and its output is
also printed during "show ggsn".
Related: OS#4165
Change-Id: Id2c84165dc59dff495106758146a701ca488834f
GTP version and primary/secondary information is printed now for each
pdp context.
Related: OS#4154
Change-Id: If9682fe343e9a1e78175a12538fb80d4bda54802
Fixes potential duplicates when calling following VTY cmd:
show pdp-context ggsn NAME
show pdp-context ggsn NAME apn APN
Related: OS#4154
Change-Id: I98db39a710a72a1438d71aabaf4f8227984643e3
in46a_from_eua() API documentation clearly states an array of 2 items
should be passed as pointer, but show_one_pdp() was passing only one,
which would end up in out-of-bounds writes on v4v6 EUAs.
Let's better use ippool to print allocated ip addresses instead of
parsing EUAs we sent some point in the past.
Related OS#4154
Change-Id: Ia34939957bb7856388cb52a741cec0c015a08c70
This way ggsn.c is shrinked in size and get rid of a lot of code there,
which is of no interest unless the reader is interested in that really
specific part.
Change-Id: Ieaa7e71f17c7fd9377c76ef53362eab596d669a6
It's clearer having size-related checks in one place for a data structure
in46_addr, instead of spread around the code.
Change-Id: Idc94bf0c8c01bb5a30e36d3c284b99f66b972abb
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
Since March 15th 2017, libosmocore API logging_vty_add_cmds() had its
parameter removed (c65c5b4ea075ef6cef11fff9442ae0b15c1d6af7). However,
definition in C file doesn't contain "(void)", which means number of
parameters is undefined and thus compiler doesn't complain. Let's remove
parameters from all callers before enforcing "(void)" on it.
API osmo_stats_vty_add_cmds never had a param list but has seem problem
(no "void"), so some users decided to pass a parameter to it.
Change-Id: I0a89586ce683ad060212355b37470c349992ec49
Related: OS#4138
Some modems are configured to use PAP as an additional authentication
mechanism beyond the GSM authentication that's part of GMM. Let's
handle such PAP authentication requests by simply acknowledging them
all, without actually checking any credentials database.
This is the most sane thing we can do for now, without adding external
requirements / interfaces like radius servers or the like.
Closes: OS#3914
Change-Id: I81875f30f9f1497199253497f84718510747f731
Other similar commands already do it. This way we also get rid of
deprecated APIs, supporting search when more than one GSN is set up.
Related: OS#2873
Change-Id: I8357e20076348c8ded5e9f5b8e7252566b0fbfea
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
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
Instead of printing subscriber's MSISDN as a hex-string, let's
attempt to decode it using gsm48_decode_bcd_number2().
Change-Id: I3f3a105dc8d0d582f2b9d8e1ff6c5785369e569b
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
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
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
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
Parse multiple IPCP IEs embedded in Protocol Configuration Options,
and return IPCP responses for all of them. Makes the associated
TTCN3 GGSN test pass.
Depends: Ia1410abb216831864042f95679330f4508e1af3d
Change-Id: I51ecab4e35f3ee638e68ca773b0da90cc0294ab0
Related: OS#3319