Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Goulet
Tor
Commits
27df23ab
Commit
27df23ab
authored
Sep 01, 2016
by
cypherpunks
Committed by
David Goulet
Feb 03, 2017
Browse files
Use the standard OpenBSD preprocessor definition
parent
0f79fb51
Changes
12
Hide whitespace changes
Inline
Side-by-side
changes/bug20980
0 → 100644
View file @
27df23ab
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.
configure.ac
View file @
27df23ab
...
...
@@ -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
...
...
src/common/backtrace.c
View file @
27df23ab
...
...
@@ -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
...
...
src/common/torgzip.c
View file @
27df23ab
...
...
@@ -206,7 +206,7 @@ tor_gzip_compress(char **out, size_t *out_len,
}
done:
*
out_len
=
stream
->
total_out
;
#ifdef
OPEN
BSD
#if
def
ined(Open
BSD
)
/* "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
...
...
src/common/util.c
View file @
27df23ab
...
...
@@ -79,7 +79,7 @@
#include
<malloc/malloc.h>
#endif
#ifdef HAVE_MALLOC_H
#if !defined(O
PEN
BSD) && !defined(__FreeBSD__)
#if !defined(O
pen
BSD) && !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. */
...
...
src/ext/csiphash.c
View file @
27df23ab
...
...
@@ -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)
...
...
src/ext/trunnel/trunnel.c
View file @
27df23ab
...
...
@@ -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>
...
...
src/or/config.c
View file @
27df23ab
...
...
@@ -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."
);
...
...
src/or/connection_edge.c
View file @
27df23ab
...
...
@@ -1959,7 +1959,7 @@ get_pf_socket(void)
if
(
pf_socket
>=
0
)
return
pf_socket
;
#ifdef
OPEN
BSD
#if
def
ined(Open
BSD
)
/* only works on OpenBSD */
pf
=
tor_open_cloexec
(
"/dev/pf"
,
O_RDONLY
,
0
);
#else
...
...
src/or/directory.c
View file @
27df23ab
...
...
@@ -39,7 +39,7 @@
#include
"shared_random.h"
#if defined(EXPORTMALLINFO) && defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
#if
n
def
OPEN
BSD
#if
!
def
ined(Open
BSD
)
#include
<malloc.h>
#endif
#endif
...
...
src/test/test-memwipe.c
View file @
27df23ab
...
...
@@ -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"
;
...
...
src/test/test_options.c
View file @
27df23ab
...
...
@@ -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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment