Commit Graph

15124 Commits

Author SHA1 Message Date
Tobias Brunner a35ee9f402 Revert "configure: Cache result of pthread_condattr_setclock() check"
This reverts commit 8d79bfa831 as it does
not provide any advantage over setting ac_cv_func_pthread_condattr_setclock=no.

References #1502.
2016-06-17 15:04:17 +02:00
Tobias Brunner 8d79bfa831 configure: Cache result of pthread_condattr_setclock() check
Even if not using caching when running the configure script (-C) this
allows pre-defining the result by setting the environment variable
ss_cv_func_pthread_condattr_setclock_monotonic=yes|no|unknown
before/while running the script.

As the check requires running a test program this might be helpful
when cross-compiling to disable using monotonic time if
pthread_condattr_setclock() is defined but not actually usable with
CLOCK_MONOTONIC.

References #1502.
2016-06-17 11:36:48 +02:00
Tobias Brunner e827e78483 configure: Fix typo in pthread_condattr_setclock() check 2016-06-17 11:36:46 +02:00
Tobias Brunner 9e01d7ca32 quick-mode: Fix reporting lifebytes if lifetime is configured 2016-06-17 11:34:26 +02:00
Tobias Brunner 5947d48fb9 load-tester: Fix load-tester on platforms where plain `char` is signed
fgetc() returns an int and EOF is usually -1 so when this gets casted to
a char the result depends on whether `char` means `signed char` or
`unsigned char` (the C standard does not specify it).  If it is unsigned
then its value is 0xff so the comparison with EOF will fail as that is an
implicit signed int.
2016-06-17 10:22:25 +02:00
Tobias Brunner 67b9e151fa testing: Fix firewall rule on alice in tnc/tnccs-20-pdp-pt-tls scenario 2016-06-17 10:22:03 +02:00
Tobias Brunner 1e71eb848a Merge branch 'testing-jessie'
Updates the default Debian image used for the test environment from wheezy
to jessie.  Also adds a script that allows chrooting to an image (base,
root or one of the guests).  In pretty much all test scenarios
expect-connection is used to make test runs more reliable.

Fixes #1382.
2016-06-16 16:28:51 +02:00
Tobias Brunner 1f98c38283 testing: Build hostapd from sources
There is a bug (fix at [1]) in hostapd 2.1-2.3 that let it crash when used
with the wired driver.  The package in jessie (and sid) is affected, so we
build it from sources (same, older, version as wpa_supplicant).

[1] http://w1.fi/cgit/hostap/commit/?id=e9b783d58c23a7bb50b2f25bce7157f1f3
2016-06-16 14:36:15 +02:00
Tobias Brunner 63d9370249 testing: Update download URL for wpa_supplicant 2016-06-16 14:36:15 +02:00
Tobias Brunner 63acd803f0 testing: Wait for packets to be processed by tcpdump
Sometimes tcpdump fails to process all packets during the short running
time of a scenario:

0 packets captured
18 packets received by filter
0 packets dropped by kernel

So 18 packets were captured by libpcap but tcpdump did not yet process
and print them.

This tries to use --immediate-mode if supported by tcpdump (the one
currently in jessie or wheezy does not, but the one in jessie-backports
does), which disables the buffering in libpcap.

However, even with immediate mode there are cases where it takes a while
longer for all packets to get processed.  And without it we also need a
workaround (even though the version in wheezy actually works fine).
That's why there now is a loop checking for differences in captured vs.
received packets.  There are actually cases where these numbers are not
equal but we still captured all packets we're interested in, so we abort
after 1s of retrying.  But sometimes it could still happen that packets
we expected got lost somewhere ("packets dropped by kernel" is not
always 0 either).
2016-06-16 14:36:15 +02:00
Tobias Brunner eb25b1a73d testing: Fix expect-connection for tkm tests
We don't use swanctl there but there is no load statement either.
2016-06-16 14:35:26 +02:00
Tobias Brunner aacf84d837 testing: Add expect-connection calls for all tests and hosts
There are some exceptions (e.g. those that use auto=start or p2pnat).
2016-06-16 14:35:18 +02:00
Tobias Brunner 8f56bbc82b testing: Update test scenarios for Debian jessie
The main difference is that ping now reports icmp_seq instead of
icmp_req, so we match for icmp_.eq, which works with both releases.

tcpdump now also reports port 4500 as ipsec-nat-t.
2016-06-16 14:04:11 +02:00
Tobias Brunner 575a469b95 libimcv: Add Debian 8.5 to database 2016-06-16 14:03:49 +02:00
Tobias Brunner b71104a3df testing: Fix posttest.dat for ikev2/rw-dnssec scenario 2016-06-16 14:01:47 +02:00
Tobias Brunner 71424a2f85 testing: Make sure tcpdump is actually terminated before analyzing/collecting logs 2016-06-16 14:01:47 +02:00
Tobias Brunner 654343d942 testing: Correctly dis-/enable services with systemd 2016-06-16 14:01:47 +02:00
Tobias Brunner f565f954a7 testing: Install packages like the FIPS-enabled OpenSSL from a custom apt repo 2016-06-16 14:01:47 +02:00
Tobias Brunner 257e5db0d0 testing: Update base image to Debian jessie
Several packages got renamed/updated, libgcrypt was apparently installed
by default previously.

Since most libraries changed we have to completely rebuild all the tools
installed in the root image.  We currently don't provide a clean target in
the recipes, and even if we did we'd have to track which base image we
last built for.  It's easier to just use a different build directory for
each base image, at the cost of some additional disk space (if not manually
cleaned).  However, that's also the case when updating kernel or
software versions.
2016-06-15 17:58:24 +02:00
Tobias Brunner 0889628957 testing: Update 4.x kernel configs to be compatible with Debian 8/systemd 2016-06-15 16:24:44 +02:00
Tobias Brunner 5c71cbfa94 testing: Add root to fstab
This seems to be required for systemd to remount it.
2016-06-15 16:24:44 +02:00
Tobias Brunner 1c616eccae testing: Update Apache config for newer Debian releases
It is still compatible with the current release as the config in
sites-available will be ignored, while conf-enabled does not exist and
is not included in the main config.
2016-06-15 16:24:44 +02:00
Tobias Brunner 2b0a6811ab testing: Explicitly enable RC4 in SSH server config
Newer OpenSSH versions disable this by default because it's unsafe.
Since this is not relevant for our use case we enable it due to its
speed.
2016-06-15 16:24:44 +02:00
Tobias Brunner 6466546f81 testing: Add script to chroot into an image
If changes are made to the base or root image the images depending on
these have to be rebuilt.
2016-06-15 16:24:43 +02:00
Tobias Brunner cac9051eed testing: Add a patch to tnc-fhh that avoids building the tncsim package
This sub-package does not build on Debian jessie.
2016-06-15 16:24:43 +02:00
Tobias Brunner c857621e70 testing: Don't attempt to stop services when building base image
Unlike `apt-get install` in a chroot debootstrap does not seem to start
the services but stopping them might cause problems if they were running
outside the chroot.
2016-06-15 16:24:43 +02:00
Tobias Brunner e0c59faa68 leak-detective: Make sure to actually call malloc() from calloc() hook
Newer versions of GCC are too "smart" and replace a call to malloc(X)
followed by a call to memset(0,X) with a call co calloc(), which obviously
results in an infinite loop when it does that in our own calloc()
implementation.  Using `volatile` for the variable storing the total size
prevents the optimization and we actually call malloc().
2016-06-15 16:21:47 +02:00
Tobias Brunner 8f1806605d leak-detective: Whitelist __fprintf_chk as seen on newer systems 2016-06-15 11:21:39 +02:00
Martin Willi 518a5b2ece configure: Check for and explicitly link against -latomic
Some C libraries, such as uClibc, require an explicit link for some atomic
functions. Check for any libatomic, and explcily link it.
2016-06-14 14:27:20 +02:00
Tobias Brunner 796c36ade1 testing: Fix scenarios that check /etc/resolv.conf 2016-06-13 16:18:38 +02:00
Tobias Brunner 6294f28bd3 android: Catch exception if numbers are too large for Integer 2016-06-13 16:12:17 +02:00
Tobias Brunner a046f929ce android: Use non-aliased cipher identifiers
Some of these are also understood by BoringSSL.

Fixes #1510.
2016-06-13 10:38:20 +02:00
Tobias Brunner 9827380e6f android: Update Gradle plugin 2016-06-13 10:19:13 +02:00
Tobias Brunner 25b69260fe android: Fix signature of get_nexthop() 2016-06-13 10:18:45 +02:00
Tobias Brunner b1f7d10800 resolve: Add refcounting for installed DNS servers
This fixes DNS server installation if make-before-break reauthentication
is used as there the new SA and DNS server is installed before it then
is removed again when the old IKE_SA is torn down.
2016-06-10 18:40:01 +02:00
Tobias Brunner f1064ca59a resolve: Use process abstraction when calling resolvconf
This allows us to capture output written to stderr/stdout.
2016-06-10 18:39:53 +02:00
Tobias Brunner f4a20b74fd resolve: Make sure to clean up if calling resolvconf failed
If running resolvconf fails handle() fails release() is not called, which
might leave an interface file on the system (or depending on which script
called by resolvconf actually failed even the installed DNS server).
2016-06-10 18:39:21 +02:00
Tobias Brunner 96b1fab53c Merge branch 'interface-for-routes'
Changes how the interface for routes installed with policies is
determined.  In most cases we now use the interface over which we reach the
other peer, not the interface on which the local address (or the source IP) is
installed.  However, that might be the same interface depending on the
configuration (i.e. in practice there will often not be a change).

Routes are not installed anymore for drop policies and for policies with
protocol/port selectors.

Fixes #809, #824, #1347.
2016-06-10 18:15:42 +02:00
Tobias Brunner b52e540f43 kernel-pfroute: Return interface to reach destination from get_nexthop() 2016-06-10 17:52:26 +02:00
Tobias Brunner b98afc0a37 kernel-pfkey: Install routes with OUT policies 2016-06-10 15:25:46 +02:00
Tobias Brunner aea3c1052e kernel-netlink: Install routes with OUT policies
This is the direction we actually need routes in and makes the code
easier to read.
2016-06-10 15:25:09 +02:00
Tobias Brunner 85fed13c18 kernel-pfkey: Don't install routes for drop policies and if protocol/ports are in the selector 2016-06-10 15:25:05 +02:00
Tobias Brunner e7369a9dc5 kernel-netlink: Don't install routes for drop policies and if protocol/ports are in the selector
We don't need them for drop policies and they might even mess with other
routes we install.  Routes for policies with protocol/ports in the
selector will always be too broad and might conflict with other routes
we install.
2016-06-10 14:01:36 +02:00
Tobias Brunner 50798628c5 kernel-pfkey: Also use interface returned by get_nexthop() for IPsec policies
An exception is if the local address is virtual, in which case we want
the route to be via TUN device.
2016-06-10 13:57:27 +02:00
Tobias Brunner d1f8628420 kernel-netlink: Also use interface returned by get_nexthop() for IPsec policies 2016-06-10 13:57:27 +02:00
Tobias Brunner c158331bfc kernel-pfkey: Use interface to next hop for shunt policies 2016-06-10 13:57:27 +02:00
Tobias Brunner 4ba5ea407b kernel-netlink: Use interface to next hop for shunt policies
Using the source address to determine the interface is not correct for
net-to-net shunts between two interfaces on which the host has IP addresses
for each subnet.
2016-06-10 13:57:27 +02:00
Tobias Brunner 66e9165bc6 kernel-netlink: Return outbound interface in get_nexthop() 2016-06-10 13:54:18 +02:00
Tobias Brunner 99a57aa5ee kernel-net: Let get_nexthop() return an optional interface name
The returned name should be the interface over which the destination
address/net is reachable.
2016-06-10 13:54:18 +02:00
Tobias Brunner 436f64d5bc kernel-interface: Always set `vip` if get_address_by_ts() returns successfully 2016-06-10 13:52:30 +02:00