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
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
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
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
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
IPCP data can begin at any byte location in the pco_req->v array.
Casting to a 'struct ipcp_hdr' pointer could lead to unaligned access.
Parse IPCP data with u_int8_t pointers instead to avoid this problem.
Add some length checks while here.
pco_contains_proto() and ipcp_contains_option() now receive the minimum
size of the data the caller is looking for, and only return pointers
to items of sufficient size.
Also fix an inifinite loop in ipcp_contains_option() by refusing
IPCP options with length small than 2. Previously, a zero length
option would trigger an infinite loop in the parser.
Change-Id: Ia1410abb216831864042f95679330f4508e1af3d
Related: OS#3194
struct ipcp_option_hdr and struct ipcp_hdr are not declared as
packed explicitly, but they are used to parse memory blobs by
casting pointers. Add __attribute__((packed)) to ensure that
those structs are stored packed.
Change-Id: I14e10bb3ce482347b3f0c4d3a75168a55df15f20
Related: OS#3288
The abort condition of the while loop in ipcp_contains_option()
is accessing ipcp->len directly. Unfortunately this field is an
uint16_t which as to be interpreted as little endian value. If
it is used without prior conversion the value may appear larger
than actually intended and the loop will then not stop at the
end of end of the buffer.
This can cause unpredictable results when the value given with
the parameter enum ipcp_options opt is not found.
The loop will then eventually cause a segmentation fauld or
is likely to hang as soon as cur_opt->len points to a zero
byte in memory.
- Make sure that ipcp->len interpreted correctly by accessing
it through ntohs()
Change-Id: Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5
Related: OS#3288
This way, the IP address / route handling between TUN devices and kernel
GTP can be shared, which will provide not only a unified codebase but
also a more consistent behavior.
This also paves the road for to use kernel GTP from sgsnemu in the future.
Related: OS#3214
Change-Id: Ic53a971136edd0d8871fbd6746d7b0090ce3a188
tun_addaddr() internally contains a fallback to tun_setaddr() for the
first address, so we can unify the API usage a bit and use tun_addaddr()
from all call sites
Change-Id: I34de003a1a040254bd38b29e48caea34cb0c88d2
There's a problem during the initial start-up of osmo-ggsn in case
of kernel gtp-u: apn->ggsn->gsn is not yet set while parsing the
'apn' nodes from the config file. This member is only set after
the last 'apn' node has been parsed at the end of the 'ggsn' node.
Closes: OS#3217
Change-Id: I022a5e5ebc1f155e8f94938856d310462f79bbe8
Improvements include:
- Use Identifier received from request instead of using hardcoded id=0.
- Don't add DNS to response if they were not included in request.
Change-Id: Ic8aa5d634e526683b2ad8ed5d14088e171c41c98