9
0
Fork 0
Commit Graph

299 Commits

Author SHA1 Message Date
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
Harald Welte d4d6e09fd2 ippool: Extend pool to work with /64 prefixes
In IPv6 GPRS, we actually don't want to allocate an individual v6
address (like in IPv4), but we want to allocate a prefix.  The
standard prefix lengh is 8 bytes, i.e. a /64 prefix.  This patch
extends the pool to be able to work with such v6 prefixes.

Change-Id: I0cf700b6baf195a2e5fbea000531f801acaaa443
2017-08-09 22:37:57 +02:00
Harald Welte 365f8fa462 in46_addr: Add new function in46a_prefix_equal()
This function is used to compare an IPv6 address against another,
using the smaller of the two prefix lengths.

Change-Id: Ic993d8abdc90897cb55276f01ae3b8a5eadf5a0d
2017-08-09 22:09:34 +02:00
Harald Welte d1bf1e11ba ggsn: Send proper errors in create_context_ind()
When we receive PDP context requests for unknown PDP types or if
we run out of dynamic addresses, we need to inform the SGSN that
PDP context creation failed.

Change-Id: Ibf199c1726130d27c8f80230b30ee51101c93b06
2017-08-09 22:09:34 +02:00
Harald Welte a0d281db1c IPv6 support for user IP
This patch enables the use of IPv6 PDP contexts.  The phone will
have to request an IPv6 End-user-Address, and the GGSN will have
to be configured for an IPv6 pool.

The outer transport-layer IP between SGSN and GGSN must still be
IPv4, it is not modified by this patch

Change-Id: I22c3bf32a98e5daf99d6eaeac8c9f95cc7574774
2017-08-09 22:09:34 +02:00
Harald Welte 53165ede24 ippool_new(): const-ify input arguments
Change-Id: If3e53584e8c9c1f06bba4c183c9fd65fae913904
2017-08-09 22:09:34 +02:00
Harald Welte 63ebccdfe3 lib/tun.h: Remove non-endian-safe redefinition of IP header
We can simply use 'struct iphdr' from netinet/ip.h to achieve
the same goal (and be portable).

Change-Id: Ieece22e127dc14a7ffdc3b05656628989ad00b32
2017-08-09 22:09:34 +02:00
Harald Welte d12eab9c4e ippool: Add IPv6 support to IP pool implementation
Extend the IP pool implementation to be able to manage both pools
of 32bit addresses (IPv4) as well as pools of 128bit addresses (IPv6)

Change-Id: Ib98cc4bf634d6be9a7bf8c03a24e629455fcafc8
2017-08-09 22:08:57 +02:00
Harald Welte d9d8862a58 Proper fix for "Force Dynamic IP" in Create PDP CTX
An EUA length of *2* octets indicates dynamic IP address, while
an EUA length of 0 is invalid.  Let's fix this hack (which needs
to finally be removed anyway).

Change-Id: Ib1b57eb0654327882044d6862d955f4b32aa6bcd
2017-08-04 00:23:57 +02:00
Max 283188790b libgtp: improve error logging and propagation
* propagate error code from gtp_new() to caller instead of always
  returning -1
* on socket-related failures log explicitly which kind of socket caused
  error
* log expected GTP version for unexpected packets

Change-Id: Ie07f1e4246eb178838b7df21946a08a1f60f2084
related: SYS#3610
2017-06-09 08:53:10 +00:00
Max 3142d8d30b ctrl: cleanup trap creation
Move common trap create/send code into separate function.

Change-Id: Iaadc921b951aeb9b3ad5ab796e13d52017139468
2017-05-16 17:10:25 +02:00
Daniel Willmann a2861a7428 contrib: Start openggsn after networking
Change-Id: Ic617c618db17e7109ee864c4e6c86f3bee081d02
2017-05-09 17:50:03 +02:00
Harald Welte 19e19e3609 track README.md rename in spec file and debian/docs
When README was renamed to README.md, the debian and rpm packaging
information was not updated.

Change-Id: I3fb3016defb74cf4e9c0a363f70eff9d6f71a5f5
2017-03-18 14:23:01 +01:00
Harald Welte 93c3b386cf Update README with general project information + convert to Markdown
Change-Id: Ib4213388dffab125e75d9b1f7d72319e041059ea
2017-03-17 18:36:14 +01:00
Harald Welte bf6de7a289 Add MAkefile.* to EXTRA_DIST to ensure they end up in tarballs
Change-Id: Ibbae061fda3db49f8ecda263cfc3ca6873c0b1b3
2017-03-17 18:25:03 +01:00
Neels Hofmeyr 1fce2ce0b3 jenkins: add value_string termination check
Change-Id: I7c676debcdfef2471004deb9ef5a63e8f4e97e15
Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8
2017-03-16 19:00:27 +00:00
bjovan a8f71eb24e Code formatted to be in line with formatting rules.
Change-Id: I546dc0a8d814527b9a96943a52f2f6b700285167
2017-02-27 09:56:28 +01:00
Harald Welte 8c25b97d3f Update AUTHORS file to reflect the last 12 years
Change-Id: I0a8f5a69f2a943344331d36ba225c02b0209beeb
2017-02-23 22:10:12 +01:00
Harald Welte a892177dce remove ChangeLog, it hasn't been updated since 2004
We have a detailed log in git instead.

Change-Id: I6a7fe97995b5f65080a04423fee77030dea26b84
2017-02-23 22:10:08 +01:00
Harald Welte 9225bfc48c update version to 0.93
Change-Id: If65b8281933b5833b5ce83239688e775cc267f4c
2017-02-23 21:52:56 +01:00
Harald Welte bf5c0bb4b9 gtp.c: Don't print ""Unknown packet flags" error message in get_seq()
get_seq() is called also from contexts where GTP-U is used, and GTP-U
doesn't have sequence numbers.  Thus, it is perfectly normal if no
sequence number and/or no S flag in the header is present.

Change-Id: Ie19b95bbb4427e547843a019f5213a231a9f83da
2017-02-23 21:11:05 +01:00
Harald Welte 875e4dc8c3 gtp-kernel: Fix tunnel creation/removal for GTP Version 1
When Linux Kernel GTP-U support is enabled, OpenGGSN so far only worked
with GTPv0,but not with GTPv1, as the TEI values were not correctly
configured.  This patch fixes the initialzation of the local and remote
TEI before using libgtpnl to create a tunnel context in the kernel.

Change-Id: I3e953ff5b4ab44c26dbbe20d18b61038fa57ff32
2017-02-23 21:10:48 +01:00
Holger Hans Peter Freyther 68d244d302 abi/debian: Bump ABI version of libgtp after struct size change
The gsn_t changed the size with the addition of the ctrl pointer.
Bump the SO version to not break osmo-sgsn/ggsn on upgrade.

Call the -dev package libgtp-dev to follow the rest of Osmocom and
to ease making releases here.

Change-Id: Iac4d6d2effde1a6b2f60b1e1b49c91513d5ca8c3
2017-01-26 11:14:59 +01:00
Max 7716860845 Integrate Debian packaging changes
debian/control:
    * restructure to make it easier to incorporate further changes
    * update package descriptions
    * update project URL

debian/rules:
    * use proper hardening syntax
    * remove useless comment

debian/copyright: update to match Debian format

Change-Id: Ia7f0a3a583ad63f5c6e5cf5e5de2ff7dd9eed8a9
Related: OS#1694
2016-12-22 14:10:07 +00:00
Harald Welte d37b80a6d2 gtp.c: Improve debug statements about GTP header flags
* as there are muptiple flags in the field, use plural
* print the flags as hex value, not decimal.  Hex is customary for bitfields.

Change-Id: Ib23d80fae32b4e9fa146d82d8f5a1dada1a3cb2b
2016-12-15 20:55:54 +01:00
Max dbd7024919 Only send TRAP for defined PDP peer
Do not attempt to send TRAP message on PDP context deletion if peer is
unknown.

Change-Id: I5e02c1d42bb7aaf1ef81a9824aab7b12047cdd3e
Fixes: Coverity CID 150135
2016-11-02 09:32:31 +00:00
Neels Hofmeyr f41f5866ce gsn_restart file: wrap umask change tightly around file creation
An fopen("w") error used to omit the umask() call to reinstate the previous
umask. Also an fopen("r") at the top will never create a file and hence does
not need a umask set.

Instead, wrap the umask change and change-back tightly around the single
fopen("w") call.

Change-Id: If7d948e2f2ba47ecebba5614f18235a53b273d14
2016-10-14 11:39:49 +00:00
Neels Hofmeyr f7611c3cee fix gsn_restart file buffer overflow and missing path sep
Fix errors during gsn_restart file path composition:

- possible buffer overflow because the wrong remaining length was fed to
  strncat().
- missing path separator: put restart file in dir/gsn_restart instead of
  ../dirgsn_restart.

This assumes that the path separator is '/'.

Use talloc_asprintf() to fix all filename length problems and shorten the code.

In order to free the allocated path, add a free_filename label, and jump there
instead of returning from the fopen("w") failure branch. Also don't return from
"fclose failed" branch in order to free the path, remove the if {} braces.

Change-Id: Idf0a64ff45720aa818f2f9de1e8ba2fe2c82631b
2016-10-14 11:39:49 +00:00
Neels Hofmeyr 38929c9131 configure: check for pkg-config presence
Change-Id: I658152eb24fd783fce9ceac35872ab918c80209a
2016-10-12 23:26:17 +00:00
Neels Hofmeyr ee9d34a9cc build: be robust against install-sh files above the root dir
Explicitly set AC_CONFIG_AUX_DIR.

To reproduce the error avoided by this patch:

  rm install-sh        # in case it was already generated.
  touch ../install-sh  # yes, outside this source tree
  autoreconf -fi

This will produce an error like

  ...
  configure.ac:16: error: required file '../ltmain.sh' not found
  configure.ac:5: installing '../missing'
  src/Makefile.am: installing '../depcomp'
  autoreconf: automake failed with exit status: 1

See also automake (vim `which automake`) and look for 'sub locate_aux_dir'.

Change-Id: I4aef311d7a475800e09f48110a499c3759c69f5d
2016-10-12 23:26:17 +00:00
Max 727417dd28 Add control interface
Only generation of TRAP messages over Control Interface is supported so
far.

Note: requires corresponding version of libosmoctrl.

Change-Id: Ia76f841d2c9cd14394e9316fcd39f4060e23c898
Related: OS#1646
2016-10-12 09:30:30 +00:00
Max cd93f4f4be Add .gitreview to simplify gerrit integration
Change-Id: Ib141dc9ae03c2b10b8925e30a2782bf2d932e192
2016-10-12 09:25:49 +00:00
Max 395e213894 Remove unused function
Change-Id: Iff0f1499660b12a47277b16a435efecb42fab038
2016-10-11 15:31:49 +02:00
BJovke 03dbafb000 Add 'Bearer Control Mode' IE
This IE is known to be sent by a Cisco GGSN, and was added in
ETSI TS 129 060 V7.17.0 (2011-10) /
3GPP TS 29.060 version 7.17.0 Release 7

See https://lists.osmocom.org/pipermail/osmocom-net-gprs/2016-September/000711.html
Subject "sgsnemu failing to create PDP context with Cisco GGSN"
Tue Sep 13 08:00:37 UTC 2016

Tweaked-by: Neels Hofmeyr <nhofmeyr@sysmocom.de>
2016-09-15 13:53:13 +02:00
Alexander Couzens 86540de7f3 gtp/queue/queue_seqdel(): fix element check which was always true
Fix an apparent typo that prevented queue iteration to find the correct item to
be removed. Instead, the first item was always returned. Calling code has been
analyzed to find that mostly this fault is not visible, since usually, the
first item is indeed the correct item to be returned. See mail thread
http://lists.osmocom.org/pipermail/osmocom-net-gprs/2016-June/000618.html
Date: Wed Jun 1 11:51:38 UTC 2016
Subject: "[PATCH] gtp/queue/queue_seqdel(): fix element check which always was true"
2016-06-06 00:45:10 +02:00
Ruben Undheim cc077ae0bc Description: Fix some typos in the man pages and in the binary 2016-05-24 23:31:47 +02:00
Holger Hans Peter Freyther 6bf2f05df6 debian: Bump the version to ease upgrading from Debian
Debian SID has version 0.92-1 and we had 0.92. Bump it to 0.93.
2016-05-24 22:55:38 +02:00