Commit Graph

485 Commits

Author SHA1 Message Date
Harald Welte 7e1175f6d8 sgsnemu: Fix gengetopt package name
gengetopt by default picks the program name from PACKAGE (autotools),
which is osmo-ggsn and is obviously wrong in case of sgsnemu.

After this patch, "sgsnemu --help" no longer shows "osmo-ggsn" but
"sgsnemu" at the top of the help text.

Change-Id: Ifabc2435a503ef71aa5a002ca46833f329068b37
2017-09-24 10:53:53 +08:00
Harald Welte f621498129 sgsnemu: Re-generate cmdline.[ch] using gengetopt
This will replace the manual additions to cmdline.[ch] with
auto-generated code from gengetopt.  We need to fix-up the RAT Type in
sgsnemu.c as the manually-added code diverged from what gengetopt
generates.

Change-Id: Ia687e13d5cec1655a57078a767d2123aa022842c
2017-09-24 10:27:07 +08:00
Harald Welte 7c20148e39 sgsnemu: Fix up gengetopt file for --norecovery
In commit 3a4c67b4bf we introduced the
--norecovery command line option, but this was apparently done by
manually editing the C source code rather than adding it to the .ggo
and letting gengetopt do its magic.  Let's fix this up.

Change-Id: I1698280a699b17cea65651c3736ef149aba7e432
2017-09-24 08:56:14 +08:00
Harald Welte b6fc227763 sgsnemu: Fix up gengetopt file for RAI
In commit 41af5691ef we introduced the
--rai command line options, but this was apparently done by
manually editing the C source code rather than adding it to the .ggo
and letting gengetopt do its magic.  Let's fix this up.

Change-Id: Iaab404c3bcfc0c3943764f6616763f4f407d5644
2017-09-24 08:53:58 +08:00
Harald Welte 1d94585f96 sgsnemu: Fix up gengetopt file for rattype, userloc, mstz, imeisv
In commit 944dce3e66 we introduced various
command line options, but this was apparently done by manually editing
the C source code rather than adding it to the .ggo and letting
gengetopt do its magic.  Let's fix this up.

Change-Id: Ib8e7ef1cad5fc4423a1a4af628950aa93a4e073a
2017-09-24 08:51:02 +08:00
Harald Welte 05ac095006 sgsnemu: Fix up gengetopt file for QoS Extensions of 24.008
In commit 11a398fbc3 we introduced the
--qose{1,2,3,4} command line options, but this was apparently done by
manually editing the C source code rather than adding it to the .ggo
and letting gengetopt do its magic.  Let's fix this up.

Change-Id: I4cd827a96ac17f6eb9f824342f195727426d0e20
2017-09-24 08:41:14 +08:00
Harald Welte 73d28c9dda sgsnemu/cmdline.ggo: Remove 'unsigned' which is no longer supported
It seems like modern gengetopt no longer supports 'unsigned int'
argument types, and we need to use 'int' instead.  tested with 2.22.6

Change-Id: I34ca86cb3cc482400a7c4b3bf77c8668aaef562e
2017-09-24 08:34:36 +08:00
Max ea70f3619a Fix leftovers after rename
* Use proper name in jenkins test
* Fix naming in systemd service
* Fix git-review config

Change-Id: I934f897002215d7d4e610cbd312383181bbe97c9
2017-09-15 12:19:23 +02:00
Harald Welte 98146776dd ggsn: Add ability to specify local IP addresses for GTP-C and GTP-U
In case the GGSN is behind some kind of DNAT, the public GTP-C and
GTP-U IP addresses as exposed inside the GTP payload information
elements are different from the (internal, behind-nat) IP address
to which it listens/binds.

Change-Id: I548c9011c9abd66d46f963b1def61575f3dabb89
2017-09-06 12:22:31 +02:00
Harald Welte b5b02c2a51 Bump version: 0.94.34-23e4 → 1.0.0
Change-Id: I00a00a7d537fd3c1ff8f8fe128c5bf82d39bda76
2017-09-06 12:22:28 +02:00
Harald Welte bd60930f36 libgtp: Bump major LIBVERSION for recent API/ABI breakage
in Change-Id I68ae49a765828fa681054c68bf7f5e74dbe48ad2 we introduced
a new struct member that breks ABI and API.

Change-Id: Ie631880155513b1b78d1e9dd473dc5dc50e05943
2017-09-06 12:22:05 +02:00
Harald Welte 720c939799 clarify relationship of OsmoGGSN to OpenGGSN.
Change-Id: If0e18fb02a7dcc472f5f5fbfaf53a107382ef7e5
2017-09-06 12:11:44 +02:00
Harald Welte 4aa22db1b4 debian: fix name of config file
Change-Id: I9e563d41b74c334fd98bb71fad946e93f214fa34
2017-09-06 10:54:14 +02:00
Harald Welte db08819f85 debian: Remove no longer existing NEWS file from 'docs'
Change-Id: Ieb319ea29179ed97d746e13a9e63b3ceea2b917a
2017-09-06 10:54:13 +02:00
Harald Welte 8fcfe58269 debian: Fix debian/copyright syntax
Change-Id: I819ca05440cca041f26e7800821f4763f887c08b
2017-09-06 10:54:11 +02:00
Harald Welte ce316f4962 Move examples to doc/examples and include them in DIST
Change-Id: I0846e21ac63774939934ab629c6d7212269be9a6
2017-09-06 09:17:15 +02:00
Harald Welte 59ffc89d42 remove bogus 'version' script
Change-Id: I3977cd4777aa4cf37a1d6e21eba0bc37d61421f3
2017-09-06 09:17:15 +02:00
Harald Welte 632e843e5f Rename OpenGGSN to OsmoGGSN
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
2017-09-06 09:17:15 +02:00
Harald Welte e80494726c ggsn: Handle SIGTERM like SIGINT and terminate
Change-Id: I0c8773bd6ef41332b91b5b025aef9ef129af8289
2017-09-06 09:17:15 +02:00
Harald Welte 3591437e0f Documentation update: Remove NEWS, README.Solaris, update README.md
* README.Solaris is obsolete and related code has been removed
* NEWS file was unmaintained for more than a decade, remove it
* Remove "Performance" chapter about 550MHz Athlon
* gengetopt is no longer needed for ggsn
* remove compilation/installation instructions horribly out of date
* command line syntax of 'ggsn' program has changed

Change-Id: I45d627911503c7b733cae6a1396ca4d69a9994db
2017-09-06 09:17:15 +02:00
Harald Welte dda21ed7d4 Introduce a VTY, factually turning OpenGGSN into an Osmocom program
Change-Id: I9613ca3436e77ea132c47f0096df7c5050d7e826
2017-09-06 09:17:11 +02:00
Harald Welte 2778ae2b8f lib/tun: Mark internal helper functions 'static'
Change-Id: I53a8a89abb0080a39a153e9d3864c17b29aa193c
2017-09-05 23:13:14 +02:00
Harald Welte 1b6e8e7b5e Remove __sun__ code that is unmaintained
We haven nobody maintaining this platform, let's remove it.

In fact, only Linux and FreeBSD are part of the jenkins build tests,
so even Apple/MacOS is up for disposal.  However, as it's more
popular, let's keep the code.

Change-Id: Id6b8179259bacade52c39f96e688f828eff164ac
2017-09-05 23:13:14 +02:00
Harald Welte e257be1d69 libgtp: Add back-reference to gsn from pdp context
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
2017-09-05 23:13:14 +02:00
Harald Welte 8a03ea8a32 libgtp: Remove ctrl_handle from gsn_t, replace with private context
The control interface handle never belonged into libgtp in the first
place.  Commit 727417dd28 should not
have added this to the shared library (used by sgsnemu, osmo-sgsn, ...),
but to some private state of the GGSN.

Introducing a private context pointer at the same location will keep
ABI compatibilty.

Change-Id: I4f17516dae3e04114564828a3e5f6e2ea54212a5
2017-09-05 23:13:10 +02:00
Harald Welte 9e6dfa0558 lib/tun.c: Proper cleanup during tun_new() error paths
Change-Id: I285be20df76774ac7258b6edb3d4f2d28703757d
2017-09-05 22:42:18 +02:00
Harald Welte 4857f3c2f3 lib/ippool: Move ippool_aton() out of ippool_new()
we rather pass the in46_prefix directly into ippool_new()

Change-Id: Iadf6274e881a9bfc75eb41f9380f5ae2d8c92a0f
2017-09-05 22:42:18 +02:00
Harald Welte b513b951bd lib/ippool: Add back-pointer from pool member to pool
This allows us to remove pool members without having to keep
a pointer to the pool around.

Change-Id: I9042eb85989c5451d7894678eca110dd19e78002
2017-09-05 22:42:17 +02:00
Harald Welte 33520b43ec lib/in46_addr: Avoid ASSERT() when in46a_ntop() is called on uninitialized address
Change-Id: I42d41ec1370b9cc15d372b649d8e1bc78e76af9b
2017-09-05 22:42:17 +02:00
Harald Welte 7fc8694b97 lib/in46_addr: Add 'struct in46_prefix' to represent addr + prefix
Change-Id: I797d105117e81951732bcfc2cc26a8d00fd69443
2017-09-05 22:42:17 +02:00
Harald Welte b62983d3c3 lib/in46_addr: Add in46a_ntoa() function, similar to inet_ntoa()
Change-Id: I752b7033a106a74dc219047da5c3a7ad3cd3602e
2017-09-05 22:42:17 +02:00
Harald Welte 881e97ed00 lib/tun: Add 'void *priv' pointer to tun_t
This allows the application to attach some private state to the tun
device, such as the context from which it was created/allocated

Change-Id: Ief43b9b5fab5830fa8e28362c795f88f0b4d353b
2017-09-05 22:42:17 +02:00
Harald Welte c55ece8d91 lib/tun: Add missing #include to net/if.h for IFNAMSIZ
Change-Id: I979867d643c9fa912884fe55105333dbad39ab97
2017-09-05 22:42:17 +02:00
Harald Welte 8ffd7fc782 gtp-kernel: Remove dependency to cmdline.[ch]
Change-Id: I760f25df609c309eba4d5716f3e23b49320449bf
2017-09-05 22:42:17 +02:00
Harald Welte e57cbe2e74 update jenkins.sh to conform with current build environment
Change-Id: I999d35cdffbdb61984da15d616f675005aa0688c
2017-09-05 22:42:17 +02:00
Pau Espin 0ab62fe081 ggsn: Fix DNS not sent in PDP context response
During IPv6 support implementation, helper function pco_contains_proto
was added which contains an error: It is only capable of finding first
protocol correctly, and as a consequence, in my setup DNS servers where not
sent back to the SGSN/MS, resulting in phone being able to connect to
IPs but not to domain names which required DNS resolution.

The condition in the while loop is also changed to match the increment
of the variable inside the loop to make it easier to understand at first
glance.

Fixes: 1ae98777d9

Change-Id: Icc2e6716c33d78d3c3e000f529806228d8aa155e
2017-08-30 15:56:27 +02:00
Max bdc504e29c Use release helper from libosmocore
See
https://osmocom.org/projects/cellular-infrastructure/wiki/Make_a_new_release
for details.

Change-Id: Icdcb388ad22b0c009dac7968408d1e2504c838c1
Related: OS#1861
2017-08-28 12:29:28 +02:00
Max b87da75ae4 Use value string check from osmo-ci
Change-Id: I036ed452826b9a6848d22d45bdcc95e20a110b8b
2017-08-26 06:10:17 +00:00
Max 14b1b63710 libgtp: expand logging
* print destination address on sendto error
* print address length on conversion error
* log listening address
* log GTP version on PDP context errors
* fix incorrect logging message for unknown GSN peer

Related: SYS#3610
Change-Id: I0f8ad8687acb7f6f0eeeb962f007e87cca0c4c27
2017-08-22 10:07:28 +00:00
Harald Welte 367baa3776 update debian/changelog to 0.94 + fix pkg-config version
This updates the debian changelog to 0.94 and adds some logic
to debian/rulres which fixes the version of the libgtp.pc file
built as part of our OBS builds (used to be UNKNOWN since
commit 23eea1d132)

Change-Id: I883feaef35ff5ffd1b22fb255b7c36112b4a8f3b
2017-08-14 00:21:57 +02:00
Harald Welte 37d5b1557b libgtp: Delete PDP context on receiving GTPv1 Error Indication
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
2017-08-13 00:01:35 +02:00
Harald Welte 54d082e5e8 libgtp: Add missing mandatory IEs in GTP Error Indication
Change-Id: Iadd1fe3de7c476576a4409f22f5e84e9eade6b6e
2017-08-12 22:53:59 +02:00
Harald Welte b10ee08c2f Properly format IMSI before using it in trap
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
2017-08-12 22:53:54 +02:00
Harald Welte 23eea1d132 Use osmocom-style git-version-gen / .version magic
This generates the version number from the latest tag + git history

Change-Id: I71e1c3f8f534d9e9690c94068eccdee29a6fee12
2017-08-11 13:48:14 +02:00
Harald Welte 81bc2aea53 tun_new(): Fix array overflow in FreeBSD related code
Change-Id: I096e3b614e82e402886163274cfcf9355bd57580
2017-08-11 13:12:09 +02:00
Harald Welte ab6d189f8f replace hand-coded tun_gifindex() with standard POSIX if_nametoindex()
Change-Id: I738472765ab09f530dcf071455e1bb4e6fb3f6e5
2017-08-11 13:12:09 +02:00
Harald Welte 2e48a44952 Support setting TUN device IPv6 address + prefix
As we can now have PDP contexts with IPv6 user IP payload,
it is useful to extend the TUN related code to be able to
configure the tun device IPv6 address + prefix length

Change-Id: I899d21e52d02e0b8384af29ddd489ff19c8f2cf6
2017-08-11 13:12:04 +02:00
Harald Welte 72a38b55e3 IPv6: in46_addr: OSMO_ASSERT() in case of unsupported calls
There's a bit of trickery with the ip_pool and it's "lengty=8" IPv6
prefix handling, let's make sure we don't accidentially call any
support functions with addresses of wrong length.

Change-Id: I444c190bdcd18780344e1f0dad4faf3bcf9da5a5
2017-08-11 10:46:00 +02:00
Harald Welte 1ae98777d9 IPv6: Support PCO for IPv6 DNS addresses
In IPv6, DNS server information is not passed along as IPCP6 like
in IPv5 with IPCP.  The reason is that IPCP6 (for PPP) doesn't
support passing DNS server information.  Rather, the relevant RFCs
indicate DHCPv6 should be used even over point-to-point links.

3GPP decided to avoid DHCPv6 dependency for stateless autoconfiguration
(the only mandatory IPv6 configuration mechanism) and added some new
non-PPP-style PCO information elements ("containers") which can among
other things inform a MS about IPV6 DNS servers.

That same mechanism can also be used to inform the MS about IPv4 DNS
servers, so for IPv4 there are now two competing mechanisms: IPCP and
the new "native" PCO container.  With this patch, we support both
for IPv4.

Change-Id: I21499afd61def8c925f7838bde76f34d28214b56
2017-08-11 10:46:00 +02:00
Harald Welte d46bcd236e IPv6: Implement IPv6 prefix assignment via ICMPv6 router advertisement
The 3GPP specs are quite strange when it comes to how an IPv6 address
or rather prefix is assigned to an IPv6 PDP context.  The designated
method for allocating the IPv6 address via the PDP EUA (End User
Address) Information Element in the GTP signalling plane is *not*
used to allocate the address/prefix.  Instead, the EUA is used to
allocate an "interface identifier" to the MS, which it the uses
to derive its link-local source address to send a router solicitation.

The GGSN subsequently answers witha router advertisement, advertising
a single/64 prefix, whihcthe MS then uses to generate it's real IPv6
source address for subsequent communication.

Change-Id: Icddf7d30e01d76a4784bcef5787b36f52f703a9f
2017-08-11 10:45:56 +02:00