9
0
Fork 0
Commit Graph

227 Commits

Author SHA1 Message Date
Neels Hofmeyr dce814f71c gtpie_gettlv(): fix return value on specific error.
Make gtpie_gettlv() return an error if gtpie_getie() returned an error.
Previously, openggsn would fail to complain about certain missing elements.

Technically, a missing IE could be detectable from the *length value, but the
code in gtp.c relies on the return value to detect missing elements, which did
not work prior to this commit. For example:

if (gtpie_gettlv(ie, GTPIE_EUA, 0, &pdp->eua.l,
		 &pdp->eua.v, sizeof(pdp->eua.v))) {
	gsn->missing++;
	GTP_LOGPKG(LOGL_ERROR, peer, pack,
		    len, "Missing mandatory information field\n");
	return gtp_create_pdp_resp(gsn, version, pdp,
				   GTPCAUSE_MAN_IE_MISSING);
}

If an EUA were missing in this code path, openggsn would fail to issue an error
message. Since pdp and hence pdp->eua.l is initialized as all-zero, it would
probably not do much harm besides failing to issue an error.

I haven't checked all callers though.
2015-10-19 14:21:48 +02:00
Neels Hofmeyr 9684894586 gitignore: add 'compile' (from autoconf) 2015-10-19 14:21:48 +02:00
Neels Hofmeyr 9036950dea sgsnemu: improve an error message 2015-10-19 14:21:48 +02:00
Neels Hofmeyr 065476d192 cosmetic: gtpie_gettv0(): flow readability 2015-10-19 14:21:48 +02:00
Neels Hofmeyr af9ba522f5 comments: add/replace.
Sponsored-by: On-Waves ehi
2015-10-19 14:20:53 +02:00
Neels Hofmeyr ea600c9c02 comments: fix spelling/punctuation.
Fix spelling/punctuation and one numbering in comments.

Remove an opening brace from a comment to not mix up cindent in vim.

Sponsored-by: On-Waves ehi
2015-10-19 14:20:49 +02:00
Neels Hofmeyr 878e188be7 rename gtp_dublicate (static func).
Fix spelling dublicate -> duplicate in comments and in (apparently only
statically used) gtp_dublicate().

Sponsored-by: On-Waves ehi
2015-10-19 14:07:52 +02:00
Neels Hofmeyr e845cb9505 gtp.c: fix an error log.
Fix: the code handles fd1u but prints fd1c.
2015-10-12 14:23:54 +02:00
Neels Hofmeyr b18e811e24 gtp.h: rename gsn_t.dublicate to duplicate.
Fix spelling dublicate -> duplicate.

This is potentially breaking API compat, but currently, no users of
gsn_t.dublicate are known.
2015-10-12 14:10:27 +02:00
Neels Hofmeyr 9b09738891 gtp.c: improve 3 error logs.
It would print the memory location of the address buffer. Instead, print the
human readable host address and port.

The current code base supports only IPv4, and thread safety is apparently not
required, hence just use inet_ntoa(). (The IPv6 and thread capable version is 4
times longer and harder to read.)
2015-10-12 14:09:57 +02:00
Michael McTernan b07d07072e openggsn: Check return codes and take error paths on failure.
Return early when socket() returns -1, and check return codes
where indicated by some TODOs. This removes 2 TODOs and fixes
a compiler warning about assignment to a variable which then
isn't used.

Signed-off-by: Michael McTernan <mike.mcternan@wavemobile.com>
2015-05-02 07:53:34 +02:00
Holger Hans Peter Freyther 633cc0d7cb debian: Address lintian warning about -dbg package 2015-03-14 20:25:35 +01:00
Holger Hans Peter Freyther 7bfe18039b debian: Require libosmocore 2015-03-14 20:21:44 +01:00
Holger Hans Peter Freyther 0576f3bebf debian: Move to multi-arch support 2015-03-14 20:17:46 +01:00
Holger Hans Peter Freyther 91d0ee5c14 lib: Speculatively add libosmocore cflags to the lib 2014-12-23 19:52:54 +01:00
Holger Hans Peter Freyther 6ab58b466a ggsn: Move printf to DEBUGP statements in the ggsn as well
The specific log statements are not great yet but at least they
will end up in the log file. In the future everything should be
related to the IMSI or at least the tunnel id.
2014-12-04 19:29:57 +01:00
Holger Hans Peter Freyther 8e7e3ef686 ggsn: Remove unused dump/logging method 2014-12-04 19:19:33 +01:00
Holger Hans Peter Freyther c38bf64e3f ggsn: Be able to set the log level for the text file
Fixes: SYS#599
2014-12-04 18:54:58 +01:00
Holger Hans Peter Freyther 9c7fd8edc4 logging: Switch to using libosmocore logging for all the code 2014-12-04 16:51:15 +01:00
Holger Hans Peter Freyther e527ef105f syserr: Remove unused error packet logging code 2014-12-04 16:49:38 +01:00
Holger Hans Peter Freyther 01b40d0690 gtp: Make these regions runtime debuggable 2014-12-04 16:49:37 +01:00
Holger Hans Peter Freyther 752314ac43 gtp: Kill unused and non public method 2014-12-04 16:46:30 +01:00
Holger Hans Peter Freyther 42ca1d1a38 gtp: Move to using LOGP for logging GTP packages
Make libgtp depend on libosmocore and use the generic logging
infrastructure for it.
2014-12-04 16:45:59 +01:00
Holger Hans Peter Freyther ca524ef344 Begin to require libosmocore and libosmovty
We are not too specific about the version yet
2014-12-03 19:59:15 +01:00
Holger Hans Peter Freyther 839c2211dc debian: Attenpt to fix lintian warning on weak-dependency 2014-09-23 16:59:36 +02:00
Holger Hans Peter Freyther 7397b88485 debian: Make it a proper git version 2014-09-23 16:59:36 +02:00
Holger Hans Peter Freyther f97f58deb2 debian: Harden and build debug packages 2014-09-23 16:59:36 +02:00
Holger Hans Peter Freyther 493ec593f7 debian: Modernize/Fix the debian control file
W: openggsn source: ancient-standards-version 3.8.4 (current is 3.9.5)
W: libgtp: package-name-doesnt-match-sonames libgtp0
2014-09-23 16:59:36 +02:00
Holger Hans Peter Freyther 827aec1f31 debian: Add dependency for LSB script
E: openggsn: init.d-script-missing-dependency-on-remote_fs etc/init.d/openggsn: required-start
E: openggsn: init.d-script-missing-dependency-on-remote_fs etc/init.d/openggsn: required-stop
2014-09-23 16:59:36 +02:00
Holger Hans Peter Freyther 0b705bb4d1 debian: Create new changelog entry to please new tools
dpkg-source: error: can't build with source format '3.0 (native)': native package version may not have a revision
2014-09-23 16:59:36 +02:00
Daniel Willmann c190896437 openggsn.service: Add Install section to systemd service file
This way the service can be enabled through
> systemctl enable openggsn
2014-08-21 10:15:33 +02:00
Holger Hans Peter Freyther 5816bcfaff gtp: Speculative FreeBSD compile fix for htobe64 2014-04-04 11:43:09 +02:00
Pablo Neira Ayuso 746b944ad6 gtp: add pdp_set_imsi_nsapi
Encapsulate code to handle the teid with GTPv0.
2014-03-24 17:59:19 +01:00
Holger Hans Peter Freyther 9c0ff4fafe cli: Introduce a logfile command to log errors to a file
The evolution would be to introduce libosmocore and start using
the logging framework. But even then we can map this option to
the file target.

Fixes: SYS#263
2014-03-23 10:29:17 +01:00
Holger Hans Peter Freyther 1c4d9e6d87 cli: Manually patch the generated code to fix compiler warning
cmdline.c: In function ‘cmdline_parser_internal’:
cmdline.c:588:7: warning: variable ‘check_required’ set but not used [-Wunused-but-set-variable]
   int check_required;
       ^
2014-03-23 10:27:21 +01:00
Holger Hans Peter Freyther 6c0b9c2c42 cli: Re-generate the cmdline.c/cmdline.h with newer gengetopt 2014-03-23 10:27:19 +01:00
Holger Hans Peter Freyther 4afb44a25e systemd: Do not restart when the application exits with 1
This is the case of a wrong config or failure to create a tunnel
2014-03-21 18:01:07 +01:00
Holger Hans Peter Freyther 29567ed125 systemd: Add a simple ggsn service file 2014-03-21 18:01:01 +01:00
Pablo Neira Ayuso 1a1ba02292 gtp: fix endianness in teid field of GTPv0 header
This field needs to be in network byte order as well.
2014-03-20 14:11:25 +01:00
Pablo Neira Ayuso 0674f0b56c gtp: fix wrong binary layout for struct gtp0_header in x86_64
struct gtp0_header needs __attribute__((packed)) to make sure that
gcc doesn't add a hole of 4 bytes to align the 64-bits teid, resulting
in 24 bytes instead of 20 bytes. This was breaking gtpv0 in my gprs
testbed with my x86_64 laptop.

While at it, add also attribute packed to other headers just to
make sure that gcc doesn't pad the structures with holes.
2014-03-20 14:11:25 +01:00
Holger Hans Peter Freyther 0382996e10 gtp: Use struct ul16_t/struct ul66_t to avoid compiler warnings in OsmoSGSN
This is fixing various compiler warnings:
In file included from sgsn_libgtp.c:49:0:
include/gtp.h:397:48: warning: ‘struct ul66_t’ declared inside parameter list [enabled by default]
include/gtp.h:397:48: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
include/gtp.h:398:49: warning: ‘struct ul66_t’ declared inside parameter list [enabled by default]
include/gtp.h:399:53: warning: ‘struct ul16_t’ declared inside parameter list [enabled by default]
include/gtp.h:400:53: warning: ‘struct ul16_t’ declared inside parameter list [enabled by default]

include/gtp.h:397:48: warning: ‘struct ul66_t’ declared inside parameter list [enabled by default]
include/gtp.h:397:48: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
include/gtp.h:398:49: warning: ‘struct ul66_t’ declared inside parameter list [enabled by default]
include/gtp.h:399:53: warning: ‘struct ul16_t’ declared inside parameter list [enabled by default]
include/gtp.h:400:53: warning: ‘struct ul16_t’ declared inside parameter list [enabled by default]
2013-07-27 20:02:19 +02:00
Holger Hans Peter Freyther 0527289c2b build: Do not generate a Makefile in the empty src/ directory 2012-11-06 14:32:55 +01:00
Holger Hans Peter Freyther d7566b8280 pdp: Mark the data as static as only pdp.c should access this data 2012-11-06 14:17:45 +01:00
Holger Hans Peter Freyther 0aa17870bc build: Let the system decide where libraries are searched 2012-11-06 14:10:17 +01:00
Holger Hans Peter Freyther e071e30937 build: Remove subdir-objects as it breaks make distclean
We are not using this option in any of our projects and it is breaking
make distclean. Remove the option for now.

make[2]: Entering directory `/openggsn-0.91/_build/ggsn'
Makefile:307: ../lib/.deps/getopt.Po: No such file or directory
Makefile:308: ../lib/.deps/getopt1.Po: No such file or directory
make[2]: *** No rule to make target `../lib/.deps/getopt1.Po'.  Stop.
2012-11-06 13:59:59 +01:00
Tobias Engel 3d7500e686 Remove out-of-bounds write
This removes an out-of-bounds write. The whole statement can simply be
removed since snprintf already adds the trailing 0 byte.
2012-11-05 13:31:25 +01:00
Harald Welte f4594e236b Fix dpkg-buildpackage build for OpenGGSN
Attached is a trivial patch to make
	"dpkg-buildpackage -rfakeroot -uc -us"
work out of the box.

Tested on ubuntu 12.04 x86_64 but should work on any debian-based
distro.
2012-10-27 11:06:17 +02:00
Eric Butler ab9ff093cb Fix init script in debian package. 2012-08-24 21:16:01 -07:00
Eric Butler 235a095d08 Debian package updates.
* Split out a new libgtp-dev package.
* Updated dependencies.
2012-08-14 18:08:41 -07:00
Harald Welte 95848bafce GTP: don't use magic numbers for T3-REQUESTS and N3-REQUEST 2011-11-02 18:17:50 +01:00