aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2017-12-01Split implementation of tun_setaddr6 into a separate modulepespin/split-ipv6Pau Espin Pedrol3-88/+101
Some systems containing specific versions of libc and linux kernel can produce compilation errors due to conflicting definition of structures in different include files. This can be the case when including <netinet/in.h> and <linux/in6.h>. See for more information: https://sourceware.org/glibc/wiki/Synchronizing_Headers I hit this compilation error on the system I'm compiling osmo-ggsn with: arm-poky-linux-gnueabi-gcc ... -c in46_addr.c In file included from /usr/include/linux/ipv6.h:5:0, from tun.c:75: /usr/include/linux/in6.h:30:8: error: redefinition of 'struct in6_addr' struct in6_addr { ^ In file included from tun.c:24:0: /usr/include/netinet/in.h:196:8: note: originally defined here struct in6_addr ^ To fix the issue, this patch moves tun_setaddr6 to its own file which then includes <linux/ipv6.h> (which in turn includes in6.h). Change-Id: Ie161f376edda605e5cd87176169553176235fafd
2017-12-01cosmetic: Reorder tun_addaddr to get rid of decl of tun_setaddr4Pau Espin Pedrol1-172/+169
In any case, if we add support for ipv6 in tun_addaddr we will need tun_setaddr (and also change the API of tun_addaddr to use in46_addr). Change-Id: Iadf51379455174a642b477040ec96f28022c24c7
2017-12-01tun_setaddr6: Fix log typoPau Espin Pedrol1-1/+1
Change-Id: Id7f7d33a33730d57c5ecf7ebf5612f4744cf5163
2017-11-29sanitize build: ensure uint16/32 alignment in gtpie_test and in46a_testNeels Hofmeyr2-6/+8
Fixes sanitize build failures: Testing gtpie_tlv() ../../../../src/osmo-ggsn/tests/gtp/gtpie_test.c:30:2: runtime error: load of misaligned address 0x55c0a0830f21 for type 'uint16_t', which requires 2 byte alignment 0x55c0a0830f21: note: pointer points here 00 00 00 17 00 06 01 02 03 04 05 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ Testing gtpie_tv0() Testing gtpie_tv1() Testing gtpie_tv2() ../../../../src/osmo-ggsn/tests/gtp/gtpie_test.c:76:2: runtime error: load of misaligned address 0x55c0a0830f21 for type 'uint16_t', which requires 2 byte alignment 0x55c0a0830f21: note: pointer points here 00 00 00 2a ab cd 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ Testing gtpie_tv4() ../../../../src/osmo-ggsn/tests/gtp/gtpie_test.c:90:2: runtime error: load of misaligned address 0x55c0a0830f21 for type 'uint32_t', which requires 4 byte alignment 0x55c0a0830f21: note: pointer points here 00 00 00 2a ab cd 01 23 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ Testing gtpie_tv8() ../../../../src/osmo-ggsn/tests/gtp/gtpie_test.c:104:2: runtime error: load of misaligned address 0x55c0a0830f21 for type 'uint32_t', which requires 4 byte alignment 0x55c0a0830f21: note: pointer points here 00 00 00 2a 00 01 02 03 04 05 06 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ ../../../../src/osmo-ggsn/tests/gtp/gtpie_test.c:105:2: runtime error: load of misaligned address 0x55c0a0830f25 for type 'uint32_t', which requires 4 byte alignment 0x55c0a0830f25: note: pointer points here 00 01 02 03 04 05 06 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ Change-Id: I9eb16450af942d6464211e190f6a4d5a1d814842
2017-11-28examples: Add secondary ipv6 google DNS to osmo-ggsn.cfgPau Espin Pedrol1-0/+2
Change-Id: I5efbd1848a7974cb8dc614c4567de2658b9a7269
2017-11-18Merge changes Id4724fe0,I5c619712Harald Welte2-3/+2
* changes: contrib/jenkins.sh: Enable Werror in C(PP)FLAGS ggsn_vty: Stop using deprecated API vty_install_default
2017-11-17add --enable-sanitize config optionNeels Hofmeyr1-0/+12
Change-Id: I439ff2b2cb36a5c29347a914c0f2e21bed598b06
2017-11-16contrib/jenkins.sh: Enable Werror in C(PP)FLAGSPau Espin Pedrol1-1/+1
Change-Id: Id4724fe07f6641e82c3bd9cde2d8d759aa492288
2017-11-16ggsn_vty: Stop using deprecated API vty_install_defaultPau Espin Pedrol1-2/+1
Changes made as requested by the deprecation text. Fixes warning below: warning: ‘vty_install_default’ is deprecated: Now happens implicitly with install_node() [-Wdeprecat ed-declarations] vty_install_default(GGSN_NODE); ^~~~~~~~~~~~~~~~~~~ Change-Id: I5c6197129e0c251a4e8dd174027b011c8f6476c6
2017-11-14contrib/jenkins.sh: Allow jenkins job to specify if kernel GTP is usedHarald Welte1-1/+1
Change-Id: I83319aa6e5e7dde229ae5a036b5a1800879cbf81
2017-11-14gtp-kernel: Add device nime in pdp_debug() log statementsHarald Welte1-4/+5
Change-Id: Iad0e7a9fa48fcddc31b8d555244581efdbd61b4e
2017-11-14gtp-kernel: Add function name to pdp_debug() function callsHarald Welte1-4/+4
This allows us to distinguish "add" from "del" operatons in the log Change-Id: Ibe2e76a6eecc7b5fa5f44ab2c1578597138e30b9
2017-11-14gtp-kernel: Get rid of SYS_ERR where not applicableHarald Welte1-14/+8
SYS_ERR is for logging an error from the (operating) system including the errno value. For general logging, we have DEBUGP/LOGP. Let's convert the gtp-kernel logging over. This also fixes the related line ending mess-up as SYS_ERR adds a LF while LOGP/DEBUGP don't. Change-Id: Idb4069a28227b770e20d62bf306cd294f47146ae
2017-11-14gtp-kernel: proper cleanup in error pathHarald Welte1-0/+2
When genl_socket_open() succeeds but genl_lookup_family() fails, we have to clean up the socket that we just opened. This requires a new version of libgtpnl :/ Change-Id: I31df046530347f88cb7b16c37a899b456ed1b080
2017-11-14gtp-kernel: Make sure repeated calls to gtp_kernel_init() are safeHarald Welte1-15/+25
We have to factor out the "run once" code and make sure to really only run that once, while the per-device code remains in the gtp_kernel_init() function. Change-Id: Iba5bd71e4b725eef59fe4f233fbb965e396a06c3
2017-11-14gtp-kernel: Avoid global state variableHarald Welte2-23/+0
Whether or not GTP kernel support is enabled is the property of a given APN, and not a global state variable. Change-Id: Iff3bd8a52bd6c20f9811ee41ff700486d08591f3
2017-11-14gtp-kernel: Align logging for APN start in kernel-gtp case with that of TUNHarald Welte1-1/+1
Change-Id: Ie53d37f151e8b6448636a8cde5777b3841989d05
2017-11-14gtp-kernel: shut down kernel GTP device in apn_down()Harald Welte1-0/+1
When we take the APN down, we should also take the GTP device down. Change-Id: Idd250dd454a1603834d388884a24a63e044fdd7b
2017-11-14gtp-kernel: Get rid of hard-coded kernel GTP device nameHarald Welte3-27/+25
The existing kernel GTP support code inherited from OpenGGSN was overly simplistic and didn't support multiple GTP devices or user-defined GTP device names. Let's remove that restriction in this patch Change-Id: I51df223788fd5b7cf8099463b8aa0ca4a4fd1c96
2017-11-13gtp-kernel: Re-add support for kernel GTP-U accelerationHarald Welte1-5/+9
When we branched off osmo-ggsn from the old openggsn code base, the support for kernel-gtp got temporarily removed. This patch re-introduces support for handling the GTP-U plane in the Linux kernel by means of libgtpnl + the kernel GTP-U driver. This only works for IPv4 at the moment, until the kernel GTP-U code gains IPv6 support. Kernel GTP currently also is restricted to a single APN per GSN. Change-Id: Ieb1bc1bd0d51d41947f0abd6ebbc2e5d102592d6
2017-11-13gtp_kernel: Change gtp_kernel_init() function signatureHarald Welte2-7/+16
Rather than taking an explicit in_addr, prefix_length and a string-formatted prefix, let's pass in an in46_prefix and derive the other representations from it. Also, don't refer to a no-longer-existing global 'ipup' variable but add it as a function argument. Change-Id: Ife87142c86589b4fa4062d62afe3670467548589
2017-11-13Properly NULL-out blacklist in alloc_ippool_blacklist()Harald Welte1-4/+8
This ensures that in case of error, any caller can still safely call talloc_free() on the blacklist pointerm as free on NULL is well-defined. With the code prior to this patch we fear a double-free. Change-Id: Idc511cb3f0dfb922920aba8f88ea77df1722ecdc
2017-11-13factor out netdev_ip_local_get() from tun_ip_local_get()Harald Welte2-4/+25
netdev_ip_local_get() is a generalized version of tun_ip_local_get() which supports the net device as argument, rather than a tun_t. Change-Id: I072aa1a55e7bf110706e9207021b776d9b977fb6
2017-11-13remove unused argument to alloc_ippool_blacklist()Harald Welte1-3/+3
Change-Id: I4d3ea077ba46446e537ec9a6de6f4080fcaa428c
2017-11-06ippool: Correctly compute size of static poolHarald Welte1-1/+1
* we have to use stataddr, not addr (dynamic) * we have to multiply the length of the address by 8 to get its bit length * we can simplify the -1 +1 logic (like dynamic) Change-Id: I174102051bef95f7df34b7d7c480a00ae408be7d Fixes: Coverity CID#174189
2017-11-06tun: Don't copy 16byte IPv6 address to 'struct in_addr'Harald Welte1-1/+0
The 'struct tun' curently only has an in_addr (v4-only) member to store the address of the tun device, so let's not attempt to store an IPv6 address in it. FIXME: This entire code needs an overhaul. The assumption that there's only one address, and only either v6 or v4 is broken to begin with. Change-Id: If0b626d688841d6e0a3867834f4cb1b70084050e Fixes: Coverity CID#174278
2017-11-06gtp: Explicit OSMO_ASSERT to ensure pdp variable is setHarald Welte1-0/+6
Change-Id: I09e37e25fd118ac0a54ab788304d3f5083463050 Fixes: Coverity CID#174335
2017-11-06gtp: Fix buffer overflow in imsi_gtp2str()Harald Welte1-1/+1
The string buffer allocated for the IMSI must be sized for a length twice the number of input bytes (each byte has two nibbles) plus 1 byte for NUL. We missed the "twice" part :/ Change-Id: I1ecaa811815ae522af71feabc5d0c1ea8b4edde9 Fixes: Coverity CID#174336
2017-11-06sgsnemu: Free strings in error pathHarald Welte1-2/+2
In create_pdp_conf(), we have to free() any strings both in the success and in the error case. Change-Id: If59cc8d6d151c123f46c1d029091209fd82b3c8e Fixes: Coverity CID#187636, CID#187633
2017-11-06sgsnemu: Make sure buffer has space for terminating-NULHarald Welte1-1/+1
In proc_ipv6_conf_read() we allocatea buffer on the stack but forgot the terminating NUL byte. Change-Id: I54126d8bc08c137859f2de4b47ef23fc0714fdd7 Fixes: Coverity CID#178641
2017-11-06sgsnemu: Fix format string in printing tun-device nameHarald Welte1-1/+1
Change-Id: Ie05050a78a135a1a76473337a341fd723bbe4976 Fixes: Coverity CID#178654
2017-11-06sgsnemu: Don't leak FILE handle in proc_read()Harald Welte2-35/+10
Change-Id: Ie22e6a9bc172427e867e7a4001b6c710477a232b Fixes: Coverity CID#178660
2017-10-31fix compiler warnings: return 0 in main(), in 3 testsNeels Hofmeyr3-0/+3
Change-Id: I9e49ceba6b0a8dffd331e5707667d9bb007f3ec7
2017-10-28Tag/Release Version 1.1.01.1.0Harald Welte2-2/+7
Change-Id: I30a9e72fa9c3d6fc755c5531844b663c08c3ac06
2017-10-28Debian: include the systemd service file for osmo-ggsnHarald Welte1-0/+1
Change-Id: I5ebee0135e638b7327a16218bdce466ada9aee56
2017-10-28Debian: package libgtp debug symbols as libgtp-dbgHarald Welte2-1/+19
... and some more Description for debian/control Change-Id: I099735f8550134441a77c29e8c4d4d3c2490e379
2017-10-28Debian: libgtp is libgtp2 for some time, not libgtp1 anymoreHarald Welte2-3/+3
In Change-Id Ie631880155513b1b78d1e9dd473dc5dc50e05943 we changed LIBVERSION but didn't update debian/control. Change-Id: I7a1349e9609cb455c0fe9d63d085e7c44dff96ef
2017-10-27jenkins: use osmo-clean-workspace.sh before and after buildNeels Hofmeyr1-1/+4
See osmo-ci change I2409b2928b4d7ebbd6c005097d4ad7337307dd93 for rationale. Depends: I2409b2928b4d7ebbd6c005097d4ad7337307dd93 Change-Id: I1424dff06c7d4f695af0936671ad6faa504aaf16
2017-10-17ippool: Implement and use blacklist instead of blindly using IPPOOL_NOGATEWAYPau Espin Pedrol6-32/+365
Commit dda21ed7d4a897c9284c69175d0da598598eae40 modified previous calls to ippool_new() removing the pass of flags to avoid allocating certain problematic IPs from the pool to MS, such as the network, gateway and broadcast IPs. Today I did some unsucessful tests with osmo-ggsn with a pool "ip prefix dynamic 176.16.222.0/24", and thus IP 176.16.222.0 was being assigned to the MS. De-capsulated DNS packets were received in the tun interface, but the Linux system in there was unable to correctly forward the packets to the gateway interface connected to the Internet. However, adding a second MS which got 176.16.222.1 had its packets forwarded correctly. However, previous implementation relies on flag IPPOOL_NOGATEWAY flag to blindly blacklist first IP after the network ip (ie, .0 and .1 are removed), which limits the IP reserved for the tun device to be .1. If a different IP in the range is assigned, it may cause issues. As a result, a blacklist is introduced in this commit to dynamically fetch the tun IP address and exlucde it from the pool of available IPs. Change-Id: I8e91f7280d60490c858a769dd578c1c8e54e9243
2017-10-16tun: Convert tun_ipv6_linklocal_get to be more genericPau Espin Pedrol3-15/+67
Add support for IPv4 and IPv6 global IPs. Also return the prefix length of the IP address by using a in46_prefix. Change-Id: I277af191dc611b6bbcb83479f4ae338083740322
2017-10-16lib/in46a: Introduce in46a_netmasklen APIPau Espin Pedrol4-0/+120
Change-Id: I06e3e038afd8f7afaec2a3fa67b1616500c8db80
2017-10-16lib/ippool: Fix listsize calculated 1 elem too smallPau Espin Pedrol3-16/+21
Take the chance this commit is changing test output to also remove use of IPPOOL_NOGATEWAY which is going to be removed soon, and instead test IPPOOL_NOBROADCAST. Change-Id: I95c24bc690490155bec9e3933d678e4668d7745f
2017-10-15Merge "sgsnemu: Use getprotobynumber() in print_ipprot()"Harald Welte1-9/+5
2017-10-15Merge "sgsnemu: Remove dead code: encaps_printf()"Harald Welte1-13/+0
2017-10-15Merge "sgsnemu: Mark local functions 'static'"Harald Welte1-23/+23
2017-10-15Merge "sgsnemu: Make use of "dependon" feature in gengetopt"Harald Welte2-8/+57
2017-10-14sgsnemu: Use getprotobynumber() in print_ipprot()Harald Welte1-9/+5
There's no point in sgsnemu doing a poor mans reimplementation of what the C library provides already by means of getprotobynumber() Change-Id: I8cdc460e4fa5d86d80addf6e5f341d2d80093a35
2017-10-14sgsnemu: Remove dead code: encaps_printf()Harald Welte1-13/+0
This function is never used/called, remove it. Change-Id: I37a447e4d5387e3fc5f4433ab20ceba7c446684b
2017-10-14sgsnemu: Mark local functions 'static'Harald Welte1-23/+23
We don't need to export those to the global name space as they're not called from code in other files. Change-Id: I454249335ba46abdb3afbc669c4a06a06f39ae72
2017-10-14sgsnemu: Print warnings on broken IPv6 configuration (acept_ra)Harald Welte1-0/+57
When sgsnemu is used for an IPv6 pdp context, we rely on the router discovery procedure and SLAAC to set the correct IPv6 address/prefix on the tun device. This requires the system to be configure to accept router-advertisements on the tun device. Let's print a warning if accept_ra for the specific tun device is set to a wrong value. We're leaving it up to the user to either set a system-wide /proc/sys/net/ipv6/conf/default/accept_ra or to configure this in an ip-up script used together with sgsnemu. Change-Id: I563092ca35bc74f035a5023e11256779aac46e11