summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-02-03 09:44:31 -0500
committerNick Mathewson <nickm@torproject.org>2017-02-03 09:44:31 -0500
commit1ec429d07deff782c4fd8ffb931942185f9e8f0f (patch)
tree4d1e6c66ed3843ecbcdbd4704c9ae4360d63d041
parentc103ce995b31ef094d884e5921d79c664e2bcdb5 (diff)
parent27df23abb675ffeb198bf0c1cc85c4baed77a988 (diff)
downloadtor-1ec429d07deff782c4fd8ffb931942185f9e8f0f.tar.gz
tor-1ec429d07deff782c4fd8ffb931942185f9e8f0f.zip
Merge remote-tracking branch 'dgoulet/bug20980_030_01'
-rw-r--r--changes/bug209804
-rw-r--r--configure.ac4
-rw-r--r--src/common/backtrace.c2
-rw-r--r--src/common/torgzip.c2
-rw-r--r--src/common/util.c2
-rw-r--r--src/ext/csiphash.c4
-rw-r--r--src/ext/trunnel/trunnel.c2
-rw-r--r--src/or/config.c2
-rw-r--r--src/or/connection_edge.c2
-rw-r--r--src/or/directory.c2
-rw-r--r--src/test/test-memwipe.c2
-rw-r--r--src/test/test_options.c4
12 files changed, 16 insertions, 16 deletions
diff --git a/changes/bug20980 b/changes/bug20980
new file mode 100644
index 0000000000..362a753090
--- /dev/null
+++ b/changes/bug20980
@@ -0,0 +1,4 @@
+ o Minor bugfix (OpenBSD):
+ - Use "OpenBSD" pre-defined compiler macro instead of "OPENBSD" or
+ "__OpenBSD__". It is supported by OpenBSD itself and also most OpenBSD
+ variants like Bitrig. Fixes bug 20980.
diff --git a/configure.ac b/configure.ac
index 669dc3742a..bad21e3684 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1150,10 +1150,6 @@ if test "x$linux_netfilter_ipv6_ip6_tables" = "x1"; then
fi
if test "x$transparent_ok" = "x1"; then
AC_DEFINE(USE_TRANSPARENT, 1, "Define to enable transparent proxy support")
- case "$host" in
- *-*-openbsd* | *-*-bitrig*)
- AC_DEFINE(OPENBSD, 1, "Define to handle pf on OpenBSD properly") ;;
- esac
else
AC_MSG_NOTICE([Transparent proxy support enabled, but missing headers.])
fi
diff --git a/src/common/backtrace.c b/src/common/backtrace.c
index 81e04e94eb..61096952d8 100644
--- a/src/common/backtrace.c
+++ b/src/common/backtrace.c
@@ -76,7 +76,7 @@ clean_backtrace(void **stack, size_t depth, const ucontext_t *ctx)
#ifdef PC_FROM_UCONTEXT
#if defined(__linux__)
const size_t n = 1;
-#elif defined(__darwin__) || defined(__APPLE__) || defined(__OpenBSD__) \
+#elif defined(__darwin__) || defined(__APPLE__) || defined(OpenBSD) \
|| defined(__FreeBSD__)
const size_t n = 2;
#else
diff --git a/src/common/torgzip.c b/src/common/torgzip.c
index 3353f0ef61..04ae353cf4 100644
--- a/src/common/torgzip.c
+++ b/src/common/torgzip.c
@@ -206,7 +206,7 @@ tor_gzip_compress(char **out, size_t *out_len,
}
done:
*out_len = stream->total_out;
-#ifdef OPENBSD
+#if defined(OpenBSD)
/* "Hey Rocky! Watch me change an unsigned field to a signed field in a
* third-party API!"
* "Oh, that trick will just make people do unsafe casts to the unsigned
diff --git a/src/common/util.c b/src/common/util.c
index 824b4fbc67..180712ad6d 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -79,7 +79,7 @@
#include <malloc/malloc.h>
#endif
#ifdef HAVE_MALLOC_H
-#if !defined(OPENBSD) && !defined(__FreeBSD__)
+#if !defined(OpenBSD) && !defined(__FreeBSD__)
/* OpenBSD has a malloc.h, but for our purposes, it only exists in order to
* scold us for being so stupid as to autodetect its presence. To be fair,
* they've done this since 1996, when autoconf was only 5 years old. */
diff --git a/src/ext/csiphash.c b/src/ext/csiphash.c
index b60f73a7ff..8348c66048 100644
--- a/src/ext/csiphash.c
+++ b/src/ext/csiphash.c
@@ -53,7 +53,7 @@
#else
/* See: http://sourceforge.net/p/predef/wiki/Endianness/ */
-# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(OpenBSD)
# include <sys/endian.h>
# else
# include <endian.h>
@@ -62,7 +62,7 @@
__BYTE_ORDER == __LITTLE_ENDIAN
# define _le64toh(x) ((uint64_t)(x))
# else
-# if defined(__OpenBSD__)
+# if defined(OpenBSD)
# define _le64toh(x) letoh64(x)
# else
# define _le64toh(x) le64toh(x)
diff --git a/src/ext/trunnel/trunnel.c b/src/ext/trunnel/trunnel.c
index a008fb9f31..8f72351277 100644
--- a/src/ext/trunnel/trunnel.c
+++ b/src/ext/trunnel/trunnel.c
@@ -31,7 +31,7 @@
# define IS_LITTLE_ENDIAN
# endif
#else
-# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(OpenBSD)
# include <sys/endian.h>
# else
# include <endian.h>
diff --git a/src/or/config.c b/src/or/config.c
index 8016282411..e979930b10 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -3086,7 +3086,7 @@ options_validate(or_options_t *old_options, or_options_t *options,
if (!strcasecmp(options->TransProxyType, "default")) {
options->TransProxyType_parsed = TPT_DEFAULT;
} else if (!strcasecmp(options->TransProxyType, "pf-divert")) {
-#if !defined(__OpenBSD__) && !defined( DARWIN )
+#if !defined(OpenBSD) && !defined( DARWIN )
/* Later versions of OS X have pf */
REJECT("pf-divert is a OpenBSD-specific "
"and OS X/Darwin-specific feature.");
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 82d5d3c5a2..ef551048b8 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -1959,7 +1959,7 @@ get_pf_socket(void)
if (pf_socket >= 0)
return pf_socket;
-#ifdef OPENBSD
+#if defined(OpenBSD)
/* only works on OpenBSD */
pf = tor_open_cloexec("/dev/pf", O_RDONLY, 0);
#else
diff --git a/src/or/directory.c b/src/or/directory.c
index 4c94fe4d19..93dc488d15 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -39,7 +39,7 @@
#include "shared_random.h"
#if defined(EXPORTMALLINFO) && defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
-#ifndef OPENBSD
+#if !defined(OpenBSD)
#include <malloc.h>
#endif
#endif
diff --git a/src/test/test-memwipe.c b/src/test/test-memwipe.c
index 21882448c3..d3f2dc0644 100644
--- a/src/test/test-memwipe.c
+++ b/src/test/test-memwipe.c
@@ -36,7 +36,7 @@ const char *s = NULL;
sum += (unsigned char)buf[i]; \
}
-#ifdef __OpenBSD__
+#ifdef OpenBSD
/* Disable some of OpenBSD's malloc protections for this test. This helps
* us do bad things, such as access freed buffers, without crashing. */
const char *malloc_options="sufjj";
diff --git a/src/test/test_options.c b/src/test/test_options.c
index e822404d18..d5782e9ec0 100644
--- a/src/test/test_options.c
+++ b/src/test/test_options.c
@@ -1022,7 +1022,7 @@ test_options_validate__transproxy(void *ignored)
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
-#if !defined(__OpenBSD__) && !defined( DARWIN )
+#if !defined(OpenBSD) && !defined( DARWIN )
tt_str_op(msg, OP_EQ,
"pf-divert is a OpenBSD-specific and OS X/Darwin-specific feature.");
#else
@@ -1091,7 +1091,7 @@ test_options_validate__transproxy(void *ignored)
if (msg) {
TT_DIE(("Expected NULL but got '%s'", msg));
}
-#elif defined(__OpenBSD__)
+#elif defined(OpenBSD)
tdata = get_options_test_data("TransProxyType pf-divert\n"
"TransPort 127.0.0.1:123\n");
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);