9
0
Fork 0
Commit Graph

60 Commits

Author SHA1 Message Date
Pablo Neira Ayuso 3f58223436 ggsn: add support for GTP kernel data encapsulation
This patch adds the -g, --gtpnl=device option that allows you to
enable the GTP kernel tunneling mode in openggsn. You have to specify
the real downlink device that will be used to tunnel traffic, eg.

	-g=eth0

This means that the gtp0 device will be created and it will use eth0
as the real device to encapsulate packet coming from the Internet that
are addressed to the MS (so the tunnel devuce encapsulates these IP
packets in GTP packets when traveling to the SGSN).

Alternatively, you can also add this to the ggsn.conf configuration file:

	gtpnl eth0

The device has to be the real device that can route packets to the SGSN,
if you select the wrong device, the kernel routing code may not find a
way to reach the SSGN, you've been warned.

Therefore, if this option is set, the operational becomes the following:

1) A gtp0 device is created via rtnetlink and configure the socket
   encapsulation infrastructure in the kernel.
2) Whenever a PDP context is created, this adds the necessary tunnel
   configuration via genetlink GTP interface.
3) Whenever a PDP context is destroyed, this deletes the tunnel via
   genetlink GTP interface.
4) Destroy the gtp0 device if ggsn is stopped, including all of the
   existing tunnels.

You require the osmo-ggsn.git tree, which contains the kernel module
gtp.ko and the libgtpnl library that you have to compile and install.
Make sure you have loaded the gtp.ko kernel module before launching
the ggsn daemon using the kernel driver mode, otherwise you will get
a nice "operation not supported" error message ;-).

This patch also adds supports for "ipup" configuration option to invoke
an external script after the gtp0 device has been brought up. Typical
command to add the route to reach the MS behind the GGSN is required,
eg. ip route add 10.0.0.0/8 dev gtp0.

The (horrible) ggsn parser has been manually extended to support the
new configuration option. That code doesn't look nice, but it just
mimics what we already have there for consistency, please don't blame
me for that.

If you want to run in debugging mode, I suggest you to use:

	sudo ggsn -c ggsn.conf -f -d

Note that you do have to run openggsn as root to bring up the gtp0
device. You have to see this message that announce that the GTP kernel
mode is enabled.

openggsn[1106]: ggsn.c: 656: Using the GTP kernel mode (genl ID is 25)

This patch also automagically sets up route to reach MS from Internet
just like tun mode does. This is fundamental to get this working,
better don't leave to the admin, he may forget to add this route.

In this patch, I tried to encapsulate this new feature as much as
possible as Harald initially suggested.

To compile this feature, you have to pass --enable-gtp-kernel, ie.

./configire --enable-gtp-kernel

Otherwise, the code to interact with the gtp kernel part is not compiled.
2014-03-24 19:20:26 +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 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
Harald Welte bed35df298 Convert all code to Linux coding style
After so many years of silence, we don't expect the original author to
return to the project.  To make things a bit simpler for us, we convert
the coding style to what we are used to (Linux style).

The conversion was made using the 'Lindent' script which is part of the
Linux kernel.
2011-11-02 13:06:18 +01:00
Harald Welte 6fc42401b9 properly build a library for the content of the lib directory 2011-05-10 17:44:39 +02:00
Emmanuel Bretelle 91384a4cb0 Do not exceed 80 characters per line
Signed-off-by: Emmanuel Bretelle <chantra@debuntu.org>
2010-10-20 11:04:51 +02:00
Emmanuel Bretelle 2a103687b6 Move common sgsnemu/ggsn files to directory "lib"
Some files like in sgsnemu and ggsn directory where exactly the same.
They are now moved to the same directory for easier maintenance

Signed-off-by: Emmanuel Bretelle <chantra@debuntu.org>
2010-10-20 11:04:51 +02:00
Emmanuel Bretelle 68521860e0 Fixed compile warning,exit if cant daemonize
Relevant output of make:

ggsn.c: In function ‘main’:
ggsn.c:436: warning: ignoring return value of ‘freopen’, declared with
attribute warn_unused_result
ggsn.c:437: warning: ignoring return value of ‘freopen’, declared with
attribute warn_unused_result
ggsn.c:438: warning: ignoring return value of ‘freopen’, declared with
attribute warn_unused_result
ggsn.c:439: warning: ignoring return value of ‘daemon’, declared with
attribute warn_unused_result

Signed-off-by: Emmanuel Bretelle <chantra@debuntu.org>
2010-10-20 11:04:51 +02:00
Harald Welte 841dd49086 fix 'make distcheck': add lookup.h to Makefile.am 2010-05-24 11:02:33 +02:00
Harald Welte 1b3e577017 Use newer gengetopt which also frees memory
Taken from http://sourceforge.net/tracker/index.php?func=detail&aid=1811521&group_id=68956&atid=522957
2010-05-04 11:13:56 +02:00
Harald Welte 5701b0f647 GGSN: free the ippool memory before exit
Taken from http://sourceforge.net/tracker/index.php?func=detail&aid=1811518&group_id=68956&atid=522957
2010-05-04 11:12:23 +02:00
Harald Welte f54a1f4d43 Fix various compiler warnings throughout the code
Mostly signed/unsigned and typecasting issues

Taken from http://sourceforge.net/tracker/index.php?func=detail&aid=1811517&group_id=68956&atid=522957
2010-05-04 11:08:38 +02:00
Harald Welte 5d064ecb84 GGSN: Fix select() error case, we need to FD_ZERO() again
Taken from http://sourceforge.net/tracker/index.php?func=detail&aid=1811515&group_id=68956&atid=522957
2010-05-04 11:04:54 +02:00
Harald Welte c3dcba0fa6 Fix GGSN signal handling
In order te exit gracefully (closing the tun devices), we install a SIGINT
handler and note its occurrence in a global variable.

This fix is from http://sourceforge.net/tracker/index.php?func=detail&aid=1811513&group_id=68956&atid=522957
2010-05-04 11:02:54 +02:00
Harald Welte c5ef88ce71 remove autotools-generated files
All those will be re-generated by "autoreconf -i" anyway, so
there's no point in keeping them in the repository.

Also, the 'bootstrap' script is no longer working with recent
autotools versions anyway.
2010-05-04 10:48:23 +02:00
jjako acba8e6c62 Added new version of autotools 2005-03-14 21:53:10 +00:00
jjako e31b2401ab 0.84 release 2004-12-30 23:07:42 +00:00
jjako 3544abfaad 0.84 2004-12-30 20:32:34 +00:00
jjako c49cb30222 Added lookup.c 2004-12-30 16:40:17 +00:00
jjako ada9ffaf9e QA on ippool 2004-12-30 16:39:11 +00:00
jjako bd937b7290 Minor fix 2004-12-30 16:22:42 +00:00
jjako 163b455be8 Fixed delete route on freebsd et. al. 2004-12-30 15:33:58 +00:00
jjako 0fe0df0079 qos length bugfix and apple support plus header cleanup 2004-09-17 11:30:40 +00:00
jjako 12f9e6e263 QoS length bugfiz 2004-09-17 10:28:25 +00:00
jjako 77edc82781 Improved configure script under Solaris 2004-09-10 17:19:31 +00:00
jjako c3213960d4 Hash table bugfix and improved logging 2004-09-09 20:23:50 +00:00
jjako c6762cfc27 Solaris tun interface 2004-04-28 14:52:58 +00:00
jjako 1f1586458f Added IP address alias capability for FreeBSD 2004-02-05 20:39:57 +00:00
jjako 409b855839 tun.c cleanup and support for setting multiple addresses on FreeBSD 2004-02-04 22:57:41 +00:00
jjako 3cfb81cee9 Lookup in ippool made static 2004-01-29 09:13:55 +00:00
jjako 1ea6634851 Added FreeBSD route capability 2004-01-28 09:27:34 +00:00
jjako 3eaf453e06 FreeBSD route 2004-01-27 19:47:49 +00:00
jjako 243bfe643f FreeBSD port 2004-01-26 23:06:05 +00:00
jjako 06e9f12588 FreeBSD porting and IMSI bugfix 2004-01-19 18:37:58 +00:00
jjako ff9985cb36 Improved Solaris support 2004-01-16 11:05:22 +00:00
jjako 1d3db978f4 Improved solaris compatibility 2004-01-16 09:56:56 +00:00
jjako 76032b9028 Changet inet_aton to inet_pton for Solaris compliance 2004-01-14 06:22:08 +00:00
jjako ec89e9fca9 Updated to use solaris api for tun 2004-01-10 06:38:43 +00:00
jjako 0141d20232 Changes to allow compilation under Solaris 2004-01-09 15:19:20 +00:00
jjako 08d331db63 First attempt at a GTP1 implementation 2003-10-13 20:33:30 +00:00
jjako 504ee45408 ippool update to allow for gateway address 2003-08-20 15:25:54 +00:00
jjako a9639f3e00 doc in makefile.am 2003-07-07 15:30:11 +00:00
jjako 1db1c81302 Improved GTP error handling 2003-07-06 20:53:57 +00:00
jjako 88c2216e8e ippool improved 2003-07-06 19:33:18 +00:00
jjako e014978dfb Improved option checking in ggsn 2003-07-06 17:07:04 +00:00
jjako a7c3381c2b Corrected pointer error in ggsn.c 2003-04-11 11:51:39 +00:00
jjako 9c7ff083bd added pco DNS support 2003-04-11 10:01:41 +00:00
jjako a760e322fe added syserr.h and syserr.c 2003-04-11 09:43:22 +00:00