Compare commits

...

9 Commits

Author SHA1 Message Date
Harald Welte
2154607fb0 Bump version: 1.5.0.37-d08a → 1.6.0
Change-Id: I2248595ca11f4d808d38a9e25e7c3d3b64134427
2020-08-13 12:26:20 +02:00
Pau Espin Pedrol
d08a15b343 gtp: queue_test: Fix printf gcc warn under ARM
queue_test.c:39:3: warning: format '%ld' expects argument of type
'long int', but argument 9 has type 'unsigned int' [-Wformat=]

Change-Id: Ie9530cdd191386ca3f6c336684f81c4582c4d962
2020-07-07 16:03:37 +02:00
Harald Welte
4e37fb356a example config: use RFC1918 addresses for GGSN pools
It's 172.16, not 176.16.

Change-Id: I2d83ee747e8987f10c4960d42f3c3f2a723e3f4c
2020-05-23 11:07:34 +02:00
Oliver Smith
6a8a389c47 Makefile.am: EXTRA_DIST: debian, contrib/*.spec.in
Change-Id: Ie9cc3da87dea413408c82b721875e89735a47fcf
2020-05-22 13:39:41 +02:00
Oliver Smith
569e46cbf9 contrib: integrate RPM spec
Remove OpenSUSE bug report link, set version to @VERSION@, make it build
with CentOS 8 etc.

Related: OS#4550
Change-Id: Iba04d5c7b9beee80baca83063f9cb2cd533a0003
2020-05-19 15:25:36 +02:00
Oliver Smith
91d9410157 contrib: import RPM spec
Copy the RPM spec file from:
https://build.opensuse.org/project/show/home:mnhauke:osmocom:nightly

Related: OS#4550
Change-Id: I50a93d2cde429974b059bafd38befa9a189c0e8a
2020-05-15 13:52:17 +02:00
Oliver Smith
065ddb6416 osmo-ggsn.spec.in: remove
Remove old osmo-ggsn.spec.in file from 2017 in favor of the one imported
from mnhauke, which is currently used in openSUSE nightly builds (will
be added in a follow-up commit).

Related: OS#4550
Change-Id: I24794564f0d4d85d3955ab08f4e4c3c05f53a0cd
2020-05-15 13:52:02 +02:00
Philipp Maier
53244a2132 debug: use LOGL_NOTICE instead of LOGL_DEBUG
In debug.c the log category DICMP6 uses LOGL_DEBUG as default. This is
way to verbose, lets use LOGL_NOTICE instead.

Change-Id: I4c6a9165114d1240e7e2cfa98d30d571a3f4e9d2
Related: OS#2577
2020-05-12 11:32:06 +00:00
Dmitri Kalashnik
db98f309a9 sgsnemu: use real tun device name after the device is up.
The device name option could be empty, using it without checking
would crash sgsnemu. Using the real device is better anyway.

Change-Id: Ic3934281bfc2e433323e4ab72cf5be2cbd1c962a
2020-04-28 13:14:52 +04:00
10 changed files with 205 additions and 105 deletions

3
.gitignore vendored
View File

@@ -16,7 +16,6 @@ install-sh
libtool libtool
ltmain.sh ltmain.sh
missing missing
osmo-ggsn.spec
stamp-h1 stamp-h1
INSTALL INSTALL
m4/ m4/
@@ -80,3 +79,5 @@ doc/manuals/generated/
doc/manuals/osmomsc-usermanual.xml doc/manuals/osmomsc-usermanual.xml
doc/manuals/common doc/manuals/common
doc/manuals/build doc/manuals/build
contrib/osmo-ggsn.spec

View File

@@ -10,7 +10,15 @@ $(top_srcdir)/.version:
dist-hook: dist-hook:
echo $(VERSION) > $(distdir)/.tarball-version echo $(VERSION) > $(distdir)/.tarball-version
EXTRA_DIST = git-version-gen .version README.md README.FreeBSD README.MacOSX EXTRA_DIST = \
.version \
README.FreeBSD \
README.MacOSX \
README.md \
contrib/osmo-ggsn.spec.in \
debian \
git-version-gen \
$(NULL)
AM_DISTCHECK_CONFIGURE_FLAGS = \ AM_DISTCHECK_CONFIGURE_FLAGS = \
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)

View File

@@ -259,11 +259,11 @@ AC_CONFIG_FILES([Makefile
doc/manuals/Makefile doc/manuals/Makefile
contrib/Makefile contrib/Makefile
contrib/systemd/Makefile contrib/systemd/Makefile
contrib/osmo-ggsn.spec
tests/Makefile tests/Makefile
tests/lib/Makefile tests/lib/Makefile
tests/gtp/Makefile tests/gtp/Makefile
libgtp.pc libgtp.pc])
osmo-ggsn.spec])
AC_OUTPUT AC_OUTPUT
echo " echo "

123
contrib/osmo-ggsn.spec.in Normal file
View File

@@ -0,0 +1,123 @@
#
# spec file for package osmo-ggsn
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
## Disable LTO for now since it breaks compilation of the tests
## https://osmocom.org/issues/4114
%define _lto_cflags %{nil}
Name: osmo-ggsn
Version: @VERSION@
Release: 0
Summary: GPRS Support Node
License: GPL-2.0-only AND LGPL-2.1-or-later
Group: Productivity/Telephony/Servers
URL: https://osmocom.org/projects/openggsn
Source: %{name}-%{version}.tar.xz
BuildRequires: libtool >= 2
BuildRequires: pkgconfig >= 0.20
%if 0%{?suse_version}
BuildRequires: systemd-rpm-macros
%endif
BuildRequires: pkgconfig(libgtpnl) >= 1.0.0
BuildRequires: pkgconfig(libmnl) >= 1.0.3
BuildRequires: pkgconfig(libosmocore) >= 1.1.0
BuildRequires: pkgconfig(libosmoctrl) >= 1.1.0
BuildRequires: pkgconfig(libosmovty) >= 1.1.0
Obsoletes: openggsn
%{?systemd_requires}
%description
Osmo-GGSN is a C-language implementation of a GGSN (Gateway GPRS
Support Node), a core network element of ETSI/3GPP cellular networks
such as GPRS, EDGE, UMTS or HSPA.
%package -n libgtp6
Summary: Library implementing GTP between SGSN and GGSN
License: GPL-2.0-only
Group: System/Libraries
%description -n libgtp6
libgtp implements the GPRS Tunneling Protocol between SGSN and GGSN.
%package -n libgtp-devel
Summary: Development files for the GTP library
License: GPL-2.0-only
Group: Development/Libraries/C and C++
Requires: libgtp6 = %{version}
%description -n libgtp-devel
libgtp implements the GPRS Tunneling Protocol between SGSN and GGSN.
This subpackage contains libraries and header files for developing
applications that want to make use of libgtp.
%prep
%setup -q
%build
echo "%{version}" >.tarball-version
autoreconf -fi
%configure \
--disable-static \
--docdir="%{_docdir}/%{name}" \
--with-systemdsystemunitdir=%{_unitdir} \
--includedir="%{_includedir}/%{name}"
make %{?_smp_mflags} V=1
%install
%make_install
find %{buildroot} -type f -name "*.la" -delete -print
%check
make %{?_smp_mflags} check || (find . -name testsuite.log -exec cat {} +)
%if 0%{?suse_version}
%pre
%service_add_pre %{name}.service
%post
%service_add_post %{name}.service
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
%endif
%post -n libgtp6 -p /sbin/ldconfig
%postun -n libgtp6 -p /sbin/ldconfig
%files
%license COPYING
%doc AUTHORS README.md
%{_bindir}/osmo-ggsn
%{_bindir}/sgsnemu
%{_mandir}/man8/osmo-ggsn.8%{?ext_man}
%{_mandir}/man8/sgsnemu.8%{?ext_man}
%{_unitdir}/%{name}.service
%dir %{_docdir}/%{name}/examples
%{_docdir}/%{name}/examples/osmo-ggsn.cfg
%dir %{_sysconfdir}/osmocom
%config(noreplace) %{_sysconfdir}/osmocom/osmo-ggsn.cfg
%files -n libgtp6
%{_libdir}/libgtp.so.6*
%files -n libgtp-devel
%{_includedir}/%{name}/
%{_libdir}/libgtp.so
%{_libdir}/pkgconfig/libgtp.pc
%changelog

57
debian/changelog vendored
View File

@@ -1,3 +1,60 @@
osmo-ggsn (1.6.0) unstable; urgency=medium
[ Pau Espin Pedrol ]
* cosmetic: Fix comment typo
* netns: Improve error checking
* sgsnemu: cmdline: Drop unused function cmdline_parser_params_create()
* sgsnemu: Pass array of in64_addr to in46a_from_eua()
* sgsnemu: Rename sgsnemu's libgtp cb_conf
* sgsnemu: Set its default loglevel category to INFO
* Move icmpv6 and checksum files from ggsn/ dir to lib/
* netdev_addaddr6: Use prefixlen arg
* sgsnemu: Avoid adding extra autogenerated local link ipv6 addr to tun iface
* sgsnemu: Fix ping transmitted statistics output
* cosmetic: icmpv6.c: fix typo in comment
* icmpv6.c: Mark internal function as static
* sgsnemu: Get rid of duplicated options.destaddr
* sgsnemu: Get rid of duplicated options.net
* sgsnemu: tun_addaddr: Don't set local addr as dstaddr
* icmpv6.c: Move code generating ipv6 hdr to its own function
* Rename netdev_*route to end in route4
* sgsnemu: Fix build/run against linux < 4.11 (no sysctl addr_gen_mode support)
* sgsnemu: Handle IPv6 SLAAC in tun iface manually
* sgsnemu: Implement ping on IPv6 APNs
* sgsnemu: Fix assumption ipv6 Interface-Identifier of public addr == announced Prefix
* gtp: queue_test: Fix printf gcc warn under ARM
[ Andreas Schultz ]
* add Linux network namespace support for TUN device
[ Vadim Yanitskiy ]
* lib/netns: fix open_ns(): return fd from open()
[ Philipp Maier ]
* doc: do not use random ip address for dns in default conf
* doc: use 127.0.0.2 instead of 127.0.0.6 as bind ip.
* debug: use LOGL_NOTICE instead of LOGL_DEBUG
[ Eric ]
* configure.ac: fix libtool issue with clang and sanitizer
[ Harald Welte ]
* lib/netns.c: Add comments to the code, including doxygen API docs
* lib/netns: OSMO_ASSERT() if user doesn't call init_netns()
* lib/netns: Fix up error paths
* example config: use RFC1918 addresses for GGSN pools
[ Dmitri Kalashnik ]
* sgsnemu: use real tun device name after the device is up.
[ Oliver Smith ]
* osmo-ggsn.spec.in: remove
* contrib: import RPM spec
* contrib: integrate RPM spec
* Makefile.am: EXTRA_DIST: debian, contrib/*.spec.in
-- Harald Welte <laforge@osmocom.org> Thu, 13 Aug 2020 12:26:20 +0200
osmo-ggsn (1.5.0) unstable; urgency=medium osmo-ggsn (1.5.0) unstable; urgency=medium
[ Jan Engelhardt ] [ Jan Engelhardt ]

View File

@@ -42,10 +42,10 @@ ggsn ggsn0
gtpu-mode tun gtpu-mode tun
tun-device tun4 tun-device tun4
type-support v4 type-support v4
ip prefix dynamic 176.16.222.0/24 ip prefix dynamic 172.16.222.0/24
ip dns 0 8.8.8.8 ip dns 0 8.8.8.8
ip dns 1 8.8.4.4 ip dns 1 8.8.4.4
ip ifconfig 176.16.222.0/24 ip ifconfig 172.16.222.0/24
no shutdown no shutdown
apn inet6 apn inet6
gtpu-mode tun gtpu-mode tun
@@ -60,10 +60,10 @@ ggsn ggsn0
gtpu-mode tun gtpu-mode tun
tun-device tun46 tun-device tun46
type-support v4v6 type-support v4v6
ip prefix dynamic 176.16.46.0/24 ip prefix dynamic 172.16.46.0/24
ip dns 0 8.8.8.8 ip dns 0 8.8.8.8
ip dns 1 8.8.4.4 ip dns 1 8.8.4.4
ip ifconfig 176.16.46.0/24 ip ifconfig 172.16.46.0/24
ipv6 prefix dynamic 2001:780:44:2100:0:0:0:0/56 ipv6 prefix dynamic 2001:780:44:2100:0:0:0:0/56
ipv6 dns 0 2001:4860:4860::8888 ipv6 dns 0 2001:4860:4860::8888
ipv6 dns 1 2001:4860:4860::8844 ipv6 dns 1 2001:4860:4860::8844

View File

@@ -29,7 +29,7 @@ static const struct log_info_cat default_categories[] = {
[DICMP6] = { [DICMP6] = {
.name = "DICMP6", .name = "DICMP6",
.description = "ICMPv6", .description = "ICMPv6",
.enabled = 1, .loglevel = LOGL_DEBUG, .enabled = 1, .loglevel = LOGL_NOTICE,
}, },
}; };

View File

@@ -1,90 +0,0 @@
Summary: Osmocom Gateway GPRS Support Node (GGSN)
Name: @PACKAGE@
Version: @VERSION@
Release: 1
URL: https://osmocom.org/projects/openggsn
Source0: http://prdownloads.sourceforge.net/ggsn/%{name}-%{version}.tar.gz
License: GPL
Group: System Environment/Daemons
BuildRoot: %{_tmppath}/%{name}-root
%description
OsmoGGSN is a Gateway GPRS Support Node (GGSN). It is used by mobile
operators as the interface between the Internet and the rest of the
mobile network infrastructure. The project also provides an SGSN
emulator suitable for GPRS core network testing.
%prep
%setup -q
%build
./configure --prefix=/usr --enable-static-exec
make
%install
make install prefix=$RPM_BUILD_ROOT/usr
strip $RPM_BUILD_ROOT/usr/bin/osmo-ggsn
strip $RPM_BUILD_ROOT/usr/bin/sgsnemu
#Copy osmo-ggsn init script in place
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
install -m755 examples/osmo-ggsn.init \
$RPM_BUILD_ROOT/etc/rc.d/init.d/osmo-ggsn
#Copy osmo-ggsn.conf in place
install -m755 examples/osmo-ggsn.cfg \
$RPM_BUILD_ROOT/etc/osmo-ggsn.cfg
#Copy gsn_restart file in place
mkdir -p $RPM_BUILD_ROOT/var/lib/osmo-ggsn
echo "0" > $RPM_BUILD_ROOT/var/lib/osmo-ggsn/gsn_restart
#Clean up unwanted library files
rm -rf $RPM_BUILD_ROOT/usr/include/*
rm -rf $RPM_BUILD_ROOT/usr/lib/*
%clean
rm -rf $RPM_BUILD_ROOT
make clean
%post
/sbin/chkconfig --add osmo-ggsn
%files
%defattr(-,root,root)
/usr/bin/osmo-ggsn
/usr/bin/sgsnemu
/etc/rc.d/init.d/osmo-ggsn
%dir /var/lib/osmo-ggsn
/var/lib/osmo-ggsn/gsn_restart
%doc AUTHORS COPYING INSTALL NEWS README.md
%doc examples/osmo-ggsn.conf
%doc examples/sgsnemu.conf
%doc examples/osmo-ggsn.init
%doc examples/firewall
%doc /usr/man/man8/osmo-ggsn.8.gz
%doc /usr/man/man8/sgsnemu.8.gz
%config /etc/osmo-ggsn.cfg
#/usr/lib/libgtp.a
#/usr/lib/libgtp.la
#/usr/lib/libgtp.so
#/usr/lib/libgtp.so.0
#/usr/lib/libgtp.so.0.0.0
%changelog
* Mon Jun 30 2017 <laforge@gnumonks.org>
- Update to OsmoGGSN
* Mon Jun 30 2003 <jj@openggsn.org>
- Initial build.

View File

@@ -1928,11 +1928,11 @@ int main(int argc, char **argv)
we don't need it. Don't exit on error since this sysctl is we don't need it. Don't exit on error since this sysctl is
only available starting with linux 4.11. */ only available starting with linux 4.11. */
snprintf(buf, sizeof(buf), "%u", IN6_ADDR_GEN_MODE_NONE); snprintf(buf, sizeof(buf), "%u", IN6_ADDR_GEN_MODE_NONE);
if (proc_ipv6_conf_write(options.tun_dev_name, "addr_gen_mode", buf) < 0) { if (proc_ipv6_conf_write(tun->devname, "addr_gen_mode", buf) < 0) {
SYS_ERR(DSGSN, LOGL_ERROR, errno, SYS_ERR(DSGSN, LOGL_ERROR, errno,
"Failed to disable addr_gen_mode on %s, an extra link-local " "Failed to disable addr_gen_mode on %s, an extra link-local "
"ip address will appear on the tun device.\n", "ip address will appear on the tun device.\n",
options.tun_dev_name); tun->devname);
} }
#endif #endif
@@ -1940,9 +1940,9 @@ int main(int argc, char **argv)
if (tun->fd > maxfd) if (tun->fd > maxfd)
maxfd = tun->fd; maxfd = tun->fd;
if (proc_ipv6_conf_write(options.tun_dev_name, "accept_ra", "0") < 0) { if (proc_ipv6_conf_write(tun->devname, "accept_ra", "0") < 0) {
SYS_ERR(DSGSN, LOGL_ERROR, 0, SYS_ERR(DSGSN, LOGL_ERROR, 0,
"Failed to disable IPv6 SLAAC on %s\n", options.tun_dev_name); "Failed to disable IPv6 SLAAC on %s\n", tun->devname);
exit(1); exit(1);
} }
} }

View File

@@ -2,6 +2,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <inttypes.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <osmocom/core/utils.h> #include <osmocom/core/utils.h>
@@ -27,7 +28,7 @@ static void queue_print(struct queue_t *queue, char* str)
OSMO_ASSERT(memcmp(&qmsg_zero, &queue->qmsga[n], sizeof(qmsg_zero)) == 0); OSMO_ASSERT(memcmp(&qmsg_zero, &queue->qmsga[n], sizeof(qmsg_zero)) == 0);
continue; continue;
} }
printf("%d\t%d\t%d\t%d\t%d\t%d\t%u\t%ld\n", printf("%d\t%d\t%d\t%d\t%d\t%d\t%u\t%" PRIuPTR "\n",
n, n,
queue->qmsga[n].seq, queue->qmsga[n].seq,
queue->qmsga[n].next, queue->qmsga[n].next,
@@ -35,7 +36,7 @@ static void queue_print(struct queue_t *queue, char* str)
(int)queue->qmsga[n].timeout, (int)queue->qmsga[n].timeout,
queue->qmsga[n].retrans, queue->qmsga[n].retrans,
queue->qmsga[n].type, queue->qmsga[n].type,
((uintptr_t)queue->qmsga[n].cbp & 0xFFFFFFFF) (uintptr_t)queue->qmsga[n].cbp
); );
} }
printf("======================================================\n"); printf("======================================================\n");