# possibly be unused though)
OPTIONS_CFLAGS += $(foreach opt,$(use_opts),$(if $($(opt)),-D$(opt),))
-ifneq ($(USE_LINUX_SPLICE),)
-OPTIONS_CFLAGS += -DCONFIG_HAP_LINUX_SPLICE
-endif
-
-ifneq ($(USE_TPROXY),)
-OPTIONS_CFLAGS += -DTPROXY
-endif
-
-ifneq ($(USE_LINUX_TPROXY),)
-OPTIONS_CFLAGS += -DCONFIG_HAP_LINUX_TPROXY
-endif
-
ifneq ($(USE_LIBCRYPT),)
-OPTIONS_CFLAGS += -DCONFIG_HAP_CRYPT
OPTIONS_LDFLAGS += -lcrypt
endif
-ifneq ($(USE_CRYPT_H),)
-OPTIONS_CFLAGS += -DNEED_CRYPT_H
-endif
-
ifneq ($(USE_SLZ),)
# Use SLZ_INC and SLZ_LIB to force path to zlib.h and libz.{a,so} if needed.
SLZ_INC =
endif
ifneq ($(USE_POLL),)
-OPTIONS_CFLAGS += -DENABLE_POLL
OPTIONS_OBJS += src/ev_poll.o
endif
ifneq ($(USE_EPOLL),)
-OPTIONS_CFLAGS += -DENABLE_EPOLL
OPTIONS_OBJS += src/ev_epoll.o
endif
ifneq ($(USE_KQUEUE),)
-OPTIONS_CFLAGS += -DENABLE_KQUEUE
OPTIONS_OBJS += src/ev_kqueue.o
endif
ifneq ($(USE_EVPORTS),)
-OPTIONS_CFLAGS += -DENABLE_EVPORTS
OPTIONS_OBJS += src/ev_evports.o
endif
ifneq ($(USE_VSYSCALL),)
OPTIONS_OBJS += src/i386-linux-vsys.o
-OPTIONS_CFLAGS += -DCONFIG_HAP_LINUX_VSYSCALL
endif
ifneq ($(ASSUME_SPLICE_WORKS),)
OPTIONS_CFLAGS += -DASSUME_SPLICE_WORKS
endif
-ifneq ($(USE_NETFILTER),)
-OPTIONS_CFLAGS += -DNETFILTER
-endif
-
ifneq ($(USE_REGPARM),)
OPTIONS_CFLAGS += -DCONFIG_REGPARM=3
endif
endif
ifneq ($(USE_NS),)
-OPTIONS_CFLAGS += -DCONFIG_HAP_NS
OPTIONS_OBJS += src/namespace.o
endif
#endif
#if defined(USE_MY_ACCEPT4) || (!defined(SYS_ACCEPT4) && !defined(__NR_accept4))
-#if defined(CONFIG_HAP_LINUX_VSYSCALL) && defined(__linux__) && defined(__i386__)
+#if defined(USE_LINUX_VSYSCALL) && defined(__linux__) && defined(__i386__)
/* The syscall is redefined somewhere else */
extern int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags);
#elif ACCEPT4_USE_SOCKETCALL
/* On Linux 2.4 and above, MSG_TRUNC can be used on TCP sockets to drop any
* pending data. Let's rely on NETFILTER to detect if this is supported.
*/
-#ifdef NETFILTER
+#ifdef USE_NETFILTER
#define MSG_TRUNC_CLEARS_INPUT
#endif
#define TIMER_INVALID ((timer_t)(unsigned long)(0xfffffffful))
#endif
-#if defined(TPROXY) && defined(NETFILTER)
+#if defined(USE_TPROXY) && defined(USE_NETFILTER)
#include <linux/types.h>
#include <linux/netfilter_ipv6.h>
#include <linux/netfilter_ipv4.h>
#endif
/* On Linux, IP_TRANSPARENT and/or IP_FREEBIND generally require a kernel patch */
-#if defined(CONFIG_HAP_LINUX_TPROXY)
+#if defined(USE_LINUX_TPROXY)
#if !defined(IP_FREEBIND)
#define IP_FREEBIND 15
#endif /* !IP_FREEBIND */
#if !defined(IPV6_TRANSPARENT)
#define IPV6_TRANSPARENT 75
#endif /* !IPV6_TRANSPARENT */
-#endif /* CONFIG_HAP_LINUX_TPROXY */
+#endif /* USE_LINUX_TPROXY */
#if defined(IP_FREEBIND) \
|| defined(IP_BINDANY) \
/* We'll try to enable SO_REUSEPORT on Linux 2.4 and 2.6 if not defined.
* There are two families of values depending on the architecture. Those
* are at least valid on Linux 2.4 and 2.6, reason why we'll rely on the
- * NETFILTER define.
+ * USE_NETFILTER define.
*/
-#if !defined(SO_REUSEPORT) && defined(NETFILTER)
+#if !defined(SO_REUSEPORT) && defined(USE_NETFILTER)
#if (SO_REUSEADDR == 2)
#define SO_REUSEPORT 15
#elif (SO_REUSEADDR == 0x0004)
#ifndef _COMMON_EPOLL_H
#define _COMMON_EPOLL_H
-#if defined (__linux__) && defined(ENABLE_EPOLL)
+#if defined (__linux__) && defined(USE_EPOLL)
#ifndef USE_MY_EPOLL
#include <sys/epoll.h>
} data;
};
-#if defined(CONFIG_HAP_LINUX_VSYSCALL) && defined(__linux__) && defined(__i386__)
+#if defined(USE_LINUX_VSYSCALL) && defined(__linux__) && defined(__i386__)
/* Those are our self-defined functions */
extern int epoll_create(int size);
extern int epoll_ctl(int epfd, int op, int fd, struct epoll_event * event);
#endif /* USE_MY_EPOLL */
-#endif /* __linux__ && ENABLE_EPOLL */
+#endif /* __linux__ && USE_EPOLL */
#endif /* _COMMON_EPOLL_H */
#include <stdlib.h>
#include <ebistree.h>
-#ifdef CONFIG_HAP_NS
+#ifdef USE_NS
struct netns_entry
{
return socket(domain, type, protocol);
}
-#endif /* CONFIG_HAP_NS */
+#endif /* USE_NS */
#endif /* _NAMESPACE_H */
#ifndef _COMMON_SPLICE_H
#define _COMMON_SPLICE_H
-#if defined (__linux__) && defined(CONFIG_HAP_LINUX_SPLICE)
+#if defined (__linux__) && defined(USE_LINUX_SPLICE)
#include <errno.h>
#include <unistd.h>
#if defined(USE_MY_SPLICE)
-#if defined(CONFIG_HAP_LINUX_VSYSCALL) && defined(__linux__) && defined(__i386__)
+#if defined(USE_LINUX_VSYSCALL) && defined(__linux__) && defined(__i386__)
/* The syscall is redefined somewhere else */
extern int splice(int fdin, loff_t *off_in, int fdout, loff_t *off_out, size_t len, unsigned long flags);
#else
#endif /* USE_MY_SPLICE */
-#endif /* __linux__ && CONFIG_HAP_LINUX_SPLICE */
+#endif /* __linux__ && USE_LINUX_SPLICE */
#endif /* _COMMON_SPLICE_H */
*
*/
-#ifdef CONFIG_HAP_CRYPT
+#ifdef USE_LIBCRYPT
/* This is to have crypt() defined on Linux */
#define _GNU_SOURCE
-#ifdef NEED_CRYPT_H
+#ifdef USE_CRYPT_H
/* some platforms such as Solaris need this */
#include <crypt.h>
#endif
-#endif /* CONFIG_HAP_CRYPT */
+#endif /* USE_LIBCRYPT */
#include <stdio.h>
#include <stdlib.h>
struct userlist *userlist = NULL; /* list of all existing userlists */
-#ifdef CONFIG_HAP_CRYPT
+#ifdef USE_LIBCRYPT
#ifdef HA_HAVE_CRYPT_R
/* context for crypt_r() */
static THREAD_LOCAL struct crypt_data crypt_data = { .initialized = 0 };
#endif
if (!(u->flags & AU_O_INSECURE)) {
-#ifdef CONFIG_HAP_CRYPT
+#ifdef USE_LIBCRYPT
#ifdef HA_HAVE_CRYPT_R
ep = crypt_r(pass, u->pass, &crypt_data);
#else
goto out;
}
}
-#ifdef TPROXY
+#ifdef USE_TPROXY
else if (!strcmp(args[0], "transparent")) {
/* enable transparent proxy connections */
curproxy->options |= PR_O_TRANSP;
*
*/
-#ifdef CONFIG_HAP_CRYPT
+#ifdef USE_LIBCRYPT
/* This is to have crypt() defined on Linux */
#define _GNU_SOURCE
-#ifdef NEED_CRYPT_H
+#ifdef USE_CRYPT_H
/* some platforms such as Solaris need this */
#include <crypt.h>
#endif
-#endif /* CONFIG_HAP_CRYPT */
+#endif /* USE_LIBCRYPT */
#include <stdio.h>
#include <stdlib.h>
int
cfg_parse_netns(const char *file, int linenum, char **args, int kwm)
{
-#ifdef CONFIG_HAP_NS
+#ifdef USE_NS
const char *err;
const char *item = args[0];
while (*args[cur_arg]) {
if (!strcmp(args[cur_arg], "password")) {
-#ifdef CONFIG_HAP_CRYPT
+#ifdef USE_LIBCRYPT
if (!crypt("", args[cur_arg + 1])) {
ha_alert("parsing [%s:%d]: the encrypted password used for user '%s' is not supported by crypt(3).\n",
file, linenum, newuser->user);
memcpy(&tmpfd[i % MAX_SEND_FD], &l->fd, sizeof(l->fd));
if (!l->netns)
tmpbuf[curoff++] = 0;
-#ifdef CONFIG_HAP_NS
+#ifdef USE_NS
else {
char *name = l->netns->node.key;
unsigned char len = l->netns->name_len;
goto bad_header;
break;
}
-#ifdef CONFIG_HAP_NS
+#ifdef USE_NS
case PP2_TYPE_NETNS: {
const struct netns_entry *ns;
ns = netns_store_lookup((char*)tlv_packet->value, tlv_len);
}
#endif
-#ifdef CONFIG_HAP_NS
+#ifdef USE_NS
if (remote && (remote->proxy_netns)) {
if ((buf_len - ret) < sizeof(struct tlv))
return 0;
#include <sys/types.h>
#include <sys/resource.h>
-#if defined(ENABLE_POLL)
+#if defined(USE_POLL)
#include <poll.h>
#include <errno.h>
#endif
closefrom(start);
}
-#elif defined(ENABLE_POLL)
+#elif defined(USE_POLL)
/* This is a portable implementation of closefrom(). It closes all open file
* descriptors starting at <start> and above. It relies on the fact that poll()
* will return POLLNVAL for each invalid (hence close) file descriptor passed
}
}
-#else // defined(ENABLE_POLL)
+#else // defined(USE_POLL)
/* This is a portable implementation of closefrom(). It closes all open file
* descriptors starting at <start> and above. This is a naive version for use
while (start < nbfds)
close(start++);
}
-#endif // defined(ENABLE_POLL)
+#endif // defined(USE_POLL)
/* disable the specified poller */
void disable_poller(const char *poller_name)
" -N sets the default, per-proxy maximum # of connections (%d)\n"
" -L set local peer name (default to hostname)\n"
" -p writes pids of all children to this file\n"
-#if defined(ENABLE_EPOLL)
+#if defined(USE_EPOLL)
" -de disables epoll() usage even when available\n"
#endif
-#if defined(ENABLE_KQUEUE)
+#if defined(USE_KQUEUE)
" -dk disables kqueue() usage even when available\n"
#endif
-#if defined(ENABLE_EVPORTS)
+#if defined(USE_EVPORTS)
" -dv disables event ports usage even when available\n"
#endif
-#if defined(ENABLE_POLL)
+#if defined(USE_POLL)
" -dp disables poll() usage even when available\n"
#endif
-#if defined(CONFIG_HAP_LINUX_SPLICE)
+#if defined(USE_LINUX_SPLICE)
" -dS disables splice usage (broken on old kernels)\n"
#endif
#if defined(USE_GETADDRINFO)
vars_init(&global.vars, SCOPE_PROC);
global.tune.options |= GTUNE_USE_SELECT; /* select() is always available */
-#if defined(ENABLE_POLL)
+#if defined(USE_POLL)
global.tune.options |= GTUNE_USE_POLL;
#endif
-#if defined(ENABLE_EPOLL)
+#if defined(USE_EPOLL)
global.tune.options |= GTUNE_USE_EPOLL;
#endif
-#if defined(ENABLE_KQUEUE)
+#if defined(USE_KQUEUE)
global.tune.options |= GTUNE_USE_KQUEUE;
#endif
-#if defined(ENABLE_EVPORTS)
+#if defined(USE_EVPORTS)
global.tune.options |= GTUNE_USE_EVPORTS;
#endif
-#if defined(CONFIG_HAP_LINUX_SPLICE)
+#if defined(USE_LINUX_SPLICE)
global.tune.options |= GTUNE_USE_SPLICE;
#endif
#if defined(USE_GETADDRINFO)
display_build_opts();
exit(0);
}
-#if defined(ENABLE_EPOLL)
+#if defined(USE_EPOLL)
else if (*flag == 'd' && flag[1] == 'e')
global.tune.options &= ~GTUNE_USE_EPOLL;
#endif
-#if defined(ENABLE_POLL)
+#if defined(USE_POLL)
else if (*flag == 'd' && flag[1] == 'p')
global.tune.options &= ~GTUNE_USE_POLL;
#endif
-#if defined(ENABLE_KQUEUE)
+#if defined(USE_KQUEUE)
else if (*flag == 'd' && flag[1] == 'k')
global.tune.options &= ~GTUNE_USE_KQUEUE;
#endif
-#if defined(ENABLE_EVPORTS)
+#if defined(USE_EVPORTS)
else if (*flag == 'd' && flag[1] == 'v')
global.tune.options &= ~GTUNE_USE_EVPORTS;
#endif
-#if defined(CONFIG_HAP_LINUX_SPLICE)
+#if defined(USE_LINUX_SPLICE)
else if (*flag == 'd' && flag[1] == 'S')
global.tune.options &= ~GTUNE_USE_SPLICE;
#endif
#endif
}
-#ifdef CONFIG_HAP_NS
+#ifdef USE_NS
err_code |= netns_init();
if (err_code & (ERR_ABORT|ERR_FATAL)) {
ha_alert("Failed to initialize namespace support.\n");
return total;
}
-#if defined(CONFIG_HAP_LINUX_SPLICE)
+#if defined(USE_LINUX_SPLICE)
/* Send and get, using splicing */
static int h1_rcv_pipe(struct conn_stream *cs, struct pipe *pipe, unsigned int count)
{
.used_streams = h1_used_streams,
.rcv_buf = h1_rcv_buf,
.snd_buf = h1_snd_buf,
-#if defined(CONFIG_HAP_LINUX_SPLICE)
+#if defined(USE_LINUX_SPLICE)
.rcv_pipe = h1_rcv_pipe,
.snd_pipe = h1_snd_pipe,
#endif
return (cs->conn->xprt->unsubscribe(cs->conn, cs->conn->xprt_ctx, event_type, param));
}
-#if defined(CONFIG_HAP_LINUX_SPLICE)
+#if defined(USE_LINUX_SPLICE)
/* Send and get, using splicing */
static int mux_pt_rcv_pipe(struct conn_stream *cs, struct pipe *pipe, unsigned int count)
{
.snd_buf = mux_pt_snd_buf,
.subscribe = mux_pt_subscribe,
.unsubscribe = mux_pt_unsubscribe,
-#if defined(CONFIG_HAP_LINUX_SPLICE)
+#if defined(USE_LINUX_SPLICE)
.rcv_pipe = mux_pt_rcv_pipe,
.snd_pipe = mux_pt_snd_pipe,
#endif
{
const struct netns_entry *ns = NULL;
-#ifdef CONFIG_HAP_NS
+#ifdef USE_NS
if (objt_server(conn->target)) {
if (__objt_server(conn->target)->flags & SRV_F_USE_NS_FROM_PP)
ns = conn->proxy_netns;
if (ret < 0)
return ret;
-#if defined(TPROXY) && defined(SO_ORIGINAL_DST)
+#if defined(USE_TPROXY) && defined(SO_ORIGINAL_DST)
/* For TPROXY and Netfilter's NAT, we can retrieve the original
* IPv4 address before DNAT/REDIRECT. We must not do that with
* other families because v6-mapped IPv4 addresses are still
(xfer_sock->options & LI_MANDATORY_FLAGS)) {
if ((xfer_sock->namespace == NULL &&
l->netns == NULL)
-#ifdef CONFIG_HAP_NS
+#ifdef USE_NS
|| (xfer_sock->namespace != NULL &&
l->netns != NULL &&
!strcmp(xfer_sock->namespace,
}
#endif
-#ifdef CONFIG_HAP_NS
+#ifdef USE_NS
/* parse the "namespace" bind keyword */
static int bind_parse_namespace(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err)
{
{ "v4v6", bind_parse_v4v6, 0 }, /* force socket to bind to IPv4+IPv6 */
{ "v6only", bind_parse_v6only, 0 }, /* force socket to bind to IPv6 only */
#endif
-#ifdef CONFIG_HAP_NS
+#ifdef USE_NS
{ "namespace", bind_parse_namespace, 1 },
#endif
/* the versions with the NULL parse function*/
{ "nolinger", PR_O_TCP_NOLING, PR_CAP_FE | PR_CAP_BE, 0, 0 },
{ "persist", PR_O_PERSIST, PR_CAP_BE, 0, 0 },
{ "srvtcpka", PR_O_TCP_SRV_KA, PR_CAP_BE, 0, 0 },
-#ifdef TPROXY
+#ifdef USE_TPROXY
{ "transparent", PR_O_TRANSP, PR_CAP_BE, 0, 0 },
#else
{ "transparent", 0, 0, 0, 0 },
/* proxy->options2 */
const struct cfg_opt cfg_opts2[] =
{
-#ifdef CONFIG_HAP_LINUX_SPLICE
+#ifdef USE_LINUX_SPLICE
{ "splice-request", PR_O2_SPLIC_REQ, PR_CAP_FE|PR_CAP_BE, 0, 0 },
{ "splice-response", PR_O2_SPLIC_RTR, PR_CAP_FE|PR_CAP_BE, 0, 0 },
{ "splice-auto", PR_O2_SPLIC_AUT, PR_CAP_FE|PR_CAP_BE, 0, 0 },
#include <types/global.h>
-#if defined(CONFIG_HAP_LINUX_SPLICE)
+#if defined(USE_LINUX_SPLICE)
#include <common/splice.h>
/* A pipe contains 16 segments max, and it's common to see segments of 1448 bytes
return done;
}
-#endif /* CONFIG_HAP_LINUX_SPLICE */
+#endif /* USE_LINUX_SPLICE */
/* Receive up to <count> bytes from connection <conn>'s socket and store them
.rcv_buf = raw_sock_to_buf,
.subscribe = raw_sock_subscribe,
.unsubscribe = raw_sock_unsubscribe,
-#if defined(CONFIG_HAP_LINUX_SPLICE)
+#if defined(USE_LINUX_SPLICE)
.rcv_pipe = raw_sock_to_pipe,
.snd_pipe = raw_sock_from_pipe,
#endif
static int srv_parse_namespace(char **args, int *cur_arg,
struct proxy *curproxy, struct server *newsrv, char **err)
{
-#ifdef CONFIG_HAP_NS
+#ifdef USE_NS
char *arg;
arg = args[*cur_arg + 1];