Commit cbbff9bb authored by Bernd Zeimetz's avatar Bernd Zeimetz

New upstream version 3.4

parent 6b23f226
......@@ -22,39 +22,63 @@ script:
- |
if [ $TRAVIS_OS_NAME = osx ]; then
brew update > /dev/null
brew install lz4 openssl
brew install lz4 openssl oniguruma pcre pcre2
else
sudo apt-get install libonig-dev libpcre3-dev
fi
# workaround git not retaining mtimes and bison/flex not being uptodate
- touch conffile.yy.c conffile.tab.c conffile.tab.h
- touch configure.ac Makefile.am aclocal.m4 configure Makefile.in config.h.in
- |
if [[ ${CC} == coverity ]] ; then
[[ -n ${COVERITY_SCAN_TOKEN} ]] || exit 0; # don't fail on this for PRs
# ensure we end up with an existing compiler
export CC=gcc
./configure || { cat config.log ; exit 1 ; }
curl -s 'https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh' | bash
else
v() { echo "$@"; "$@"; }
# everything disabled, this MUST work
./configure --without-gzip --without-lz4 --without-ssl \
echo "==> base test, all disabled"
v ./configure --without-gzip --without-lz4 --without-ssl \
--without-oniguruma --without-pcre2 --without-pcre \
|| { cat config.log ; exit 1 ; }
make CFLAGS="-O3 -Wall -Werror -Wshadow -pipe" clean check || exit 1
v make CFLAGS="-O3 -Wall -Werror -Wshadow -pipe" clean check || exit 1
# compile some enabled/disabled variants compile only
if ./configure --with-gzip --without-lz4 --without-ssl ; then
make CFLAGS="-O3 -Wall -Werror -Wshadow -pipe" clean relay || exit 1
echo "==> gzip enabled"
if v ./configure --with-gzip --without-lz4 --without-ssl ; then
v make CFLAGS="-O3 -Wall -Werror -Wshadow -pipe" clean relay || exit 1
fi
echo "==> lz4 enabled"
if v ./configure --without-gzip --with-lz4 --without-ssl ; then
v make CFLAGS="-O3 -Wall -Werror -Wshadow -pipe" clean relay || exit 1
fi
if ./configure --without-gzip --with-lz4 --without-ssl ; then
make CFLAGS="-O3 -Wall -Werror -Wshadow -pipe" clean relay || exit 1
echo "==> gzip,lz4 enabled"
if v ./configure --with-gzip --with-lz4 --without-ssl ; then
v make CFLAGS="-O3 -Wall -Werror -Wshadow -pipe" clean relay || exit 1
fi
if ./configure --with-gzip --with-lz4 --without-ssl ; then
make CFLAGS="-O3 -Wall -Werror -Wshadow -pipe" clean relay || exit 1
echo "==> gzip,lz4,ssl enabled"
if v ./configure --with-gzip --with-lz4 --with-ssl ; then
v make CFLAGS="-O3 -Wall -Werror -Wshadow -pipe" clean relay || exit 1
fi
if ./configure --with-gzip --with-lz4 --with-ssl ; then
make CFLAGS="-O3 -Wall -Werror -Wshadow -pipe" clean relay || exit 1
# test the regex implementations
echo "==> oniguruma enabled"
v ./configure --with-oniguruma --without-pcre2 --without-pcre || exit
v make CFLAGS="-O3 -Wall -Werror -Wshadow -pipe" clean check || exit 1
if [ $TRAVIS_OS_NAME = osx ] ; then
echo "==> pcre2 enabled"
v ./configure --without-oniguruma --with-pcre2 --without-pcre || exit
v make CFLAGS="-O3 -Wall -Werror -Wshadow -pipe" clean check || exit 1
fi
echo "==> pcre enabled"
v ./configure --without-oniguruma --without-pcre2 --with-pcre || exit
v make CFLAGS="-O3 -Wall -Werror -Wshadow -pipe" clean check || exit 1
# final test with everything enabled that is detected
./configure || { cat config.log ; exit 1 ; }
make CFLAGS="-O3 -Wall -Werror -Wshadow -pipe" clean check || exit 1
echo "==> everything default"
v ./configure || { cat config.log ; exit 1 ; }
v make CFLAGS="-O3 -Wall -Werror -Wshadow -pipe" clean check || exit 1
fi
exit 0 # all is good here
env:
global:
......
# 3.3 (unreleased master branch)
# 3.5 (unreleased master branch)
# 3.4 (18-10-2018)
### New Features
* **router** `syslog` message type to emit syslog packets was added.
[Pull Request #329](https://github.com/grobian/carbon-c-relay/pull/329)
* **server** will now set the SNI hostname before connecting over TLS.
* **relay** a new flag `-E` was added to disable disconnecting idle
clients.
[Bug #330](https://github.com/grobian/carbon-c-relay/issues/330)
* **relay** support for snappy compression was added.
* **relay** SSL support can now be used next to compression
[Bug #323](https://github.com/grobian/carbon-c-relay/issues/323)
* **relay** add option to set CA certs using `-C`, in addition
certificate verification failures are now treated as fatal
[Bug #314](https://github.com/grobian/carbon-c-relay/issues/314)
### Bugfixes
* [Issue #327](https://github.com/grobian/carbon-c-relay/issues/327)
gzip compression leaking half closed sockets
* [Issue #341](https://github.com/grobian/carbon-c-relay/issues/341)
after SIGHUP with changed config relay no longer accepts connections
* passing a directory as config file silently succeeds with empty config
as result
# 3.3 (23-03-2018)
### New Features
* **dispatcher** tags support was added, it is only activated when the
`;` character is *not* in the list of allowed characters (`-c` flag).
Note that by default this character is not allowed, hence tags support
enabled.
[Issue #311](https://github.com/grobian/carbon-c-relay/issues/311)
* **dispatcher** support for oniguruma, pcre2 and pcre regex libraries
was added. These libraries perform all better than the libc
implementation, bringing down cpu time of the relay considerably.
### Bugfixes
* Fix conffile.tab.h dependency for parallel make.
# 3.2 (21-10-2017)
......
# Copyright 2013-2017 Fabian Groffen
# Copyright 2013-2018 Fabian Groffen
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
......@@ -27,6 +27,8 @@ conffile.tab.c conffile.tab.h: conffile.y
conffile.yy.c: conffile.l conffile.tab.h
flex -o $@ $<
router.c: conffile.tab.h
man:
sed -e '/travis-ci.org\/grobian\/carbon-c-relay.svg/d' carbon-c-relay.md | \
ronn \
......@@ -37,7 +39,8 @@ man:
bin_PROGRAMS = relay
relay_LINK = $(CCLD) $(AM_LDFLAGS) $(LDFLAGS) -o $@
relay_LDADD = $(LIBGZIP) $(LIBLZ4) $(LIBSSL)
relay_LDADD = $(LIBGZIP) $(LIBLZ4) $(LIBSNAPPY) $(LIBSSL) \
$(LIBONIGURUMA) $(LIBPCRE2) $(LIBPCRE)
relay_SOURCES = \
relay.c \
md5.c \
......@@ -79,6 +82,7 @@ EXTRA_DIST = \
README.md \
conffile.tab.c conffile.tab.h conffile.y \
conffile.yy.c conffile.l \
posixregex.h \
$(NULL)
CRTESTS = \
......@@ -105,6 +109,7 @@ CRTESTS = \
issue288 \
issue293 \
issue310 \
server-type \
$(NULL)
test: check
......
......@@ -14,7 +14,7 @@
@SET_MAKE@
# Copyright 2013-2017 Fabian Groffen
# Copyright 2013-2018 Fabian Groffen
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
......@@ -126,6 +126,8 @@ am_relay_OBJECTS = relay.$(OBJEXT) md5.$(OBJEXT) \
relay_OBJECTS = $(am_relay_OBJECTS)
am__DEPENDENCIES_1 =
relay_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
......@@ -264,7 +266,11 @@ LDFLAGS = @LDFLAGS@
LIBGZIP = @LIBGZIP@
LIBLZ4 = @LIBLZ4@
LIBOBJS = @LIBOBJS@
LIBONIGURUMA = @LIBONIGURUMA@
LIBPCRE = @LIBPCRE@
LIBPCRE2 = @LIBPCRE2@
LIBS = @LIBS@
LIBSNAPPY = @LIBSNAPPY@
LIBSSL = @LIBSSL@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
......@@ -328,7 +334,9 @@ AUTOMAKE_OPTIONS = foreign
GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always 2>/dev/null || date +%F)
GVCFLAGS = -DGIT_VERSION=\"$(GIT_VERSION)\"
relay_LINK = $(CCLD) $(AM_LDFLAGS) $(LDFLAGS) -o $@
relay_LDADD = $(LIBGZIP) $(LIBLZ4) $(LIBSSL)
relay_LDADD = $(LIBGZIP) $(LIBLZ4) $(LIBSNAPPY) $(LIBSSL) \
$(LIBONIGURUMA) $(LIBPCRE2) $(LIBPCRE)
relay_SOURCES = \
relay.c \
md5.c \
......@@ -371,6 +379,7 @@ EXTRA_DIST = \
README.md \
conffile.tab.c conffile.tab.h conffile.y \
conffile.yy.c conffile.l \
posixregex.h \
$(NULL)
CRTESTS = \
......@@ -397,6 +406,7 @@ CRTESTS = \
issue288 \
issue293 \
issue310 \
server-type \
$(NULL)
all: config.h
......@@ -942,6 +952,8 @@ conffile.tab.c conffile.tab.h: conffile.y
conffile.yy.c: conffile.l conffile.tab.h
flex -o $@ $<
router.c: conffile.tab.h
man:
sed -e '/travis-ci.org\/grobian\/carbon-c-relay.svg/d' carbon-c-relay.md | \
ronn \
......
/*
* Copyright 2013-2017 Fabian Groffen
* Copyright 2013-2018 Fabian Groffen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -21,7 +21,6 @@
#include <string.h>
#include <time.h>
#include <math.h>
#include <regex.h>
#include <pthread.h>
#include <errno.h>
#include <assert.h>
......@@ -32,6 +31,7 @@
#include "router.h"
#include "fnv1a.h"
#include "aggregator.h"
#include "posixregex.h"
static pthread_t aggregatorid;
static size_t prevreceived = 0;
......
/*
* Copyright 2013-2017 Fabian Groffen
* Copyright 2013-2018 Fabian Groffen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -18,10 +18,10 @@
#ifndef AGGREGATOR_H
#define AGGREGATOR_H 1
#include <regex.h>
#include <pthread.h>
#include "server.h"
#include "posixregex.h"
#define AGGR_HT_POW_SIZE 12 /* 4096: too big? issue #60 */
typedef struct _aggregator {
......
/*
* Copyright 2013-2017 Fabian Groffen
* Copyright 2013-2018 Fabian Groffen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2013-2017 Fabian Groffen
* Copyright 2013-2018 Fabian Groffen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "CARBON\-C\-RELAY" "1" "October 2017" "Graphite" "Graphite data collection and visualisation"
.TH "CARBON\-C\-RELAY" "1" "September 2018" "Graphite" "Graphite data collection and visualisation"
.
.SH "NAME"
\fBcarbon\-c\-relay\fR \- graphite relay, aggregator and rewriter
......@@ -28,7 +28,7 @@ trailing/leading dot elimination
whitespace normalisation (this mostly affects output of the relay to other targets: metric, value and timestamp will be separated by a single space only, ever)
.
.IP "\(bu" 4
irregular char replacement with underscores (_), currently irregular is defined as not being in \fB[0\-9a\-zA\-Z\-_:#]\fR, but can be overridden on the command line\.
irregular char replacement with underscores (_), currently irregular is defined as not being in \fB[0\-9a\-zA\-Z\-_:#]\fR, but can be overridden on the command line\. Note that tags (when present and allowed) are not processed this way\.
.
.IP "" 0
.
......@@ -96,6 +96,10 @@ Sets the socket send/receive buffer sizes in bytes, for both TCP and UDP scenari
Specifies the IO timeout in milliseconds used for server connections\. The default is \fI600\fR milliseconds, but may need increasing when WAN links are used for target servers\. A relatively low value for connection timeout allows the relay to quickly establish a server is unreachable, and as such failover strategies to kick in before the queue runs high\.
.
.TP
\fB\-E\fR
Disable disconnecting idle incoming connections\. By default the relay disconnects idle client connections after 10 minutes\. It does this to prevent resources clogging up when a faulty or malicious client keeps on opening connections without closing them\. It typically prevents running out of file descriptors\. For some scenarios, however, it is not desirable for idle connections to be disconnected, hence passing this flag will disable this behaviour\.
.
.TP
\fB\-c\fR \fIchars\fR
Defines the characters that are next to \fB[A\-Za\-z0\-9]\fR allowed in metrics to \fIchars\fR\. Any character not in this list, is replaced by the relay with \fB_\fR (underscore)\. The default list of allowed characters is \fI\-_:#\fR\.
.
......@@ -123,7 +127,7 @@ cluster <name>
<carbon_ch | fnv1a_ch | jump_fnv1a_ch> [replication <count>] >
<host[:port][=instance] [proto <udp | tcp>]
[type linemode]
[transport <gzip | lz4 | ssl>]> \.\.\.
[transport <gzip | lz4 | snappy> [ssl]]> \.\.\.
;
cluster <name>
......@@ -167,7 +171,7 @@ statistics
;
listen
type linemode [transport <gzip | lz4 | ssl <pemcert>>]
type linemode [transport <gzip | lz4> [ssl <pemcert>]]
<<interface[:port] | port> proto <udp | tcp>> \.\.\.
</ptah/to/file proto unix> \.\.\.
;
......
......@@ -36,6 +36,8 @@ rule sees the metric:
- irregular char replacement with underscores (\_), currently
irregular is defined as not being in `[0-9a-zA-Z-_:#]`, but can be
overridden on the command line.
Note that tags (when present and allowed) are not processed this
way.
## OPTIONS
......@@ -154,6 +156,15 @@ These options control the behaviour of **carbon-c-relay**.
unreachable, and as such failover strategies to kick in before the
queue runs high.
* `-E`:
Disable disconnecting idle incoming connections. By default the
relay disconnects idle client connections after 10 minutes. It does
this to prevent resources clogging up when a faulty or malicious
client keeps on opening connections without closing them. It
typically prevents running out of file descriptors. For some
scenarios, however, it is not desirable for idle connections to be
disconnected, hence passing this flag will disable this behaviour.
* `-c` *chars*:
Defines the characters that are next to `[A-Za-z0-9]` allowed in
metrics to *chars*. Any character not in this list, is replaced by
......@@ -188,7 +199,7 @@ cluster <name>
<carbon_ch | fnv1a_ch | jump_fnv1a_ch> [replication <count>] >
<host[:port][=instance] [proto <udp | tcp>]
[type linemode]
[transport <gzip | lz4 | ssl>]> ...
[transport <gzip | lz4 | snappy> [ssl]]> ...
;
cluster <name>
......@@ -232,7 +243,7 @@ statistics
;
listen
type linemode [transport <gzip | lz4 | ssl <pemcert>>]
type linemode [transport <gzip | lz4> [ssl <pemcert>]]
<<interface[:port] | port> proto <udp | tcp>> ...
</ptah/to/file proto unix> ...
;
......
" Vim syntax file
" Language: carbon-c-relay config
" Maintainer: Fabian Groffen
" Latest Revision: 23 October 2017
if exists("b:current_syntax")
finish
endif
syn match comment "#.*$"
syn region string start='"' end='"'
syn match int '\<\d\+\>' contained
syn match star '\<\*\>' contained
" Keywords
syn keyword startKeywords cluster match rewrite aggregate statistics listen include contained
syn keyword clusterKeywords forward any_of failover carbon_ch fnv1a_ch jump_fnv1a_ch file ip replication proto useall udp tcp type linemode transport gzip lz4 ssl contained
syn keyword matchKeywords validate else log drop route using send to blackhole stop contained
syn keyword rewriteKeywords into contained
syn keyword aggregateKeywords every seconds expire after timestamp at start middle end of bucket compute sum count cnt maximum max minimum min average avg median variance stddev percentile write to send stop contained
syn match percentile '\<percentile\d+\>' contained
syn keyword statisticsKeywords submit every seconds reset counters after interval prefix with send to stop contained
syn keyword listenKeywords type linemode transport gzip lz4 ssl proto udp tcp unix contained
"syn keyword includeKeywords contained
" Regions
syn region cluster start="cluster" end=";" fold transparent contains=startKeywords,clusterKeywords,string,int,comment
syn region match start="match" end=";" fold transparent contains=startKeywords,matchKeywords,star,string,comment
syn region rewrite start="rewrite" end=";" fold transparent contains=startKeywords,rewriteKeywords,string,comment
syn region match start="aggregate" end=";" fold transparent contains=startKeywords,aggregateKeywords,percentile,string,int,comment
syn region match start="statistics" end=";" fold transparent contains=startKeywords,statisticsKeywords,string,int,comment
syn region match start="listen" end=";" fold transparent contains=startKeywords,listenKeywords,string,int,comment
syn region match start="include" end=";" fold transparent contains=startKeywords,string,comment
" Colouring
hi def link comment Comment
hi def link string Constant
hi def link int Constant
hi def link star Constant
hi def link startKeywords Statement
hi def link clusterKeywords PreProc
hi def link matchKeywords PreProc
hi def link rewriteKeywords PreProc
hi def link aggregateKeywords PreProc
hi def link statisticsKeywords PreProc
hi def link listenKeywords PreProc
"hi def link includeKeywords PreProc
hi def link clName Identifier
let b:current_syntax = "carbon-c-relay"
/*
* Copyright 2013-2017 Fabian Groffen
* Copyright 2013-2018 Fabian Groffen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -83,8 +83,15 @@ collector_runner(void *s)
#define send(metric) \
if (debug & 1) \
logout("%s", metric); \
else \
server_send(submission, strdup(metric), 1);
else { \
size_t len = strlen(metric); \
char *mtrc = malloc(sizeof(char) * len + sizeof(len)); \
if (mtrc != NULL) { \
*((size_t *)mtrc) = len; \
memcpy(mtrc + sizeof(len), metric, len); \
server_send(submission, mtrc, 1); \
} \
}
nextcycle = time(NULL) + collector_interval;
while (__sync_bool_compare_and_swap(&keep_running, 1, 1)) {
......
/*
* Copyright 2013-2017 Fabian Groffen
* Copyright 2013-2018 Fabian Groffen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2013-2017 Fabian Groffen
* Copyright 2013-2018 Fabian Groffen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
......@@ -81,9 +81,11 @@ cluster {
<idcl>tcp return crTCP;
<idcl>type return crTYPE;
<idcl>linemode return crLINEMODE;
<idcl>syslog return crSYSLOGMODE;
<idcl>transport return crTRANSPORT;
<idcl>gzip return crGZIP;
<idcl>lz4 return crLZ4;
<idcl>snappy return crSNAPPY;
<idcl>ssl return crSSL;
<idcl>= return '=';
......@@ -237,6 +239,11 @@ listen {
BEGIN(idli);
return crLZ4;
}
<idli>snappy {
identstate = li;
BEGIN(idli);
return crSNAPPY;
}
<idli>ssl {
identstate = idli;
BEGIN(idli);
......
This diff is collapsed.
/* A Bison parser, made by GNU Bison 3.0.4. */
/* A Bison parser, made by GNU Bison 3.1. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -48,7 +48,7 @@
extern int router_yydebug;
#endif
/* "%code requires" blocks. */
#line 11 "conffile.y" /* yacc.c:1909 */
#line 11 "conffile.y" /* yacc.c:1913 */
struct _clust {
enum clusttype t;
......@@ -59,6 +59,7 @@ struct _clhost {
int port;
char *inst;
int proto;
con_type type;
con_trnsp trnsp;
void *saddr;
void *hint;
......@@ -92,7 +93,7 @@ struct _rcptr_trsp {
char *pemcert;
};
#line 96 "conffile.tab.h" /* yacc.c:1909 */
#line 97 "conffile.tab.h" /* yacc.c:1913 */
/* Token type. */
#ifndef ROUTER_YYTOKENTYPE
......@@ -159,16 +160,18 @@ struct _rcptr_trsp {
crLISTEN = 315,
crTYPE = 316,
crLINEMODE = 317,
crTRANSPORT = 318,
crGZIP = 319,
crLZ4 = 320,
crSSL = 321,
crUNIX = 322,
crINCLUDE = 323,
crCOMMENT = 324,
crSTRING = 325,
crUNEXPECTED = 326,
crINTVAL = 327
crSYSLOGMODE = 318,
crTRANSPORT = 319,
crGZIP = 320,
crLZ4 = 321,
crSNAPPY = 322,
crSSL = 323,
crUNIX = 324,
crINCLUDE = 325,
crCOMMENT = 326,
crSTRING = 327,
crUNEXPECTED = 328,
crINTVAL = 329
};
#endif
......@@ -200,6 +203,12 @@ union ROUTER_YYSTYPE
con_proto rcptr_proto;
/* cluster_opt_transport */
con_trnsp cluster_opt_transport;
/* cluster_transport_zip */
con_trnsp cluster_transport_zip;
/* cluster_transport_ssl */
con_trnsp cluster_transport_ssl;
/* cluster_opt_type */
con_type cluster_opt_type;
/* match_opt_send_to */
destinations * match_opt_send_to;
/* match_send_to */
......@@ -280,7 +289,7 @@ union ROUTER_YYSTYPE
struct _rcptr * receptor;
/* transport_mode */
struct _rcptr_trsp * transport_mode;
#line 284 "conffile.tab.h" /* yacc.c:1909 */
#line 293 "conffile.tab.h" /* yacc.c:1913 */
};
typedef union ROUTER_YYSTYPE ROUTER_YYSTYPE;
......
......@@ -18,6 +18,7 @@ struct _clhost {
int port;
char *inst;
int proto;
con_type type;
con_trnsp trnsp;
void *saddr;
void *hint;
......@@ -66,11 +67,13 @@ struct _rcptr_trsp {
%type <struct _clust> cluster_type cluster_file
%type <int> cluster_opt_repl cluster_opt_useall
%type <con_proto> cluster_opt_proto
%type <con_type> cluster_opt_type
%type <char *> cluster_opt_instance
%type <cluster *> cluster
%type <struct _clhost *> cluster_host cluster_hosts cluster_opt_host
cluster_path cluster_paths cluster_opt_path
%type <con_trnsp> cluster_opt_transport
%type <con_trnsp> cluster_opt_transport cluster_transport_zip
cluster_transport_ssl
%token crMATCH
%token crVALIDATE crELSE crLOG crDROP crROUTE crUSING
......@@ -104,7 +107,8 @@ struct _rcptr_trsp {
%type <char *> statistics_opt_prefix
%token crLISTEN
%token crTYPE crLINEMODE crTRANSPORT crGZIP crLZ4 crSSL crUNIX
%token crTYPE crLINEMODE crSYSLOGMODE crTRANSPORT
%token crGZIP crLZ4 crSNAPPY crSSL crUNIX
%type <con_proto> rcptr_proto
%type <struct _rcptr *> receptor opt_receptor receptors
%type <struct _rcptr_trsp *> transport_mode
......@@ -191,7 +195,7 @@ cluster: crCLUSTER crSTRING[name] cluster_type[type] cluster_hosts[servers]
for (w = $servers; w != NULL; w = w->next) {
err = router_add_server(rtr, w->ip, w->port, w->inst,
T_LINEMODE, w->trnsp, w->proto,
w->type, w->trnsp, w->proto,
w->saddr, w->hint, $type.ival, $$);
if (err != NULL) {
router_yyerror(&yylloc, yyscanner, rtr, ralloc, palloc, err);
......@@ -320,6 +324,7 @@ cluster_host: crSTRING[ip] cluster_opt_instance[inst]
}
ret->inst = $inst;
ret->proto = $prot;
ret->type = $type;
ret->trnsp = $trnsp;
ret->next = NULL;
$$ = ret;
......@@ -342,12 +347,26 @@ cluster_opt_proto: { $$ = CON_TCP; }
| crPROTO crTCP { $$ = CON_TCP; }
;
cluster_opt_type:
| crTYPE crLINEMODE
cluster_opt_type: { $$ = T_LINEMODE; }
| crTYPE crLINEMODE { $$ = T_LINEMODE; }
| crTYPE crSYSLOGMODE { $$ = T_SYSLOGMODE; }
;
cluster_opt_transport: { $$ = W_PLAIN; }
| crTRANSPORT crGZIP {
cluster_opt_transport: { $$ = W_PLAIN; }
| cluster_transport_zip
{
$$ = $1;
}
| cluster_transport_ssl
{
$$ = $1;
}
| cluster_transport_zip cluster_transport_ssl
{
$$ = $1 | $2;
}
;
cluster_transport_zip: crTRANSPORT crGZIP {
#ifdef HAVE_GZIP
$$ = W_GZIP;
#else
......@@ -367,7 +386,18 @@ cluster_opt_transport: { $$ = W_PLAIN; }
YYERROR;
#endif
}
| crTRANSPORT crSSL {
| crTRANSPORT crSNAPPY {
#ifdef HAVE_SNAPPY
$$ = W_SNAPPY;
#else
router_yyerror(&yylloc, yyscanner, rtr,
ralloc, palloc,
"feature snappy not compiled in");
YYERROR;
#endif
}
;
cluster_transport_ssl: crTRANSPORT crSSL {
#ifdef HAVE_SSL
$$ = W_SSL;
#else
......@@ -377,7 +407,7 @@ cluster_opt_transport: { $$ = W_PLAIN; }
YYERROR;
#endif
}
;
;
/*** }}} END cluster ***/
/*** {{{ BEGIN match ***/
......@@ -890,6 +920,22 @@ transport_mode: {
ralloc, palloc,
"feature lz4 not compiled in");
YYERROR;
#endif
}
| crTRANSPORT crSNAPPY {
#ifdef HAVE_SNAPPY
if (($$ = ra_malloc(palloc,
sizeof(struct _rcptr_trsp))) == NULL)
{
logerr("malloc failed\n");
YYABORT;
}
$$->mode = W_SNAPPY;
#else
router_yyerror(&yylloc, yyscanner, rtr,
ralloc, palloc,
"feature snappy not compiled in");
YYERROR;
#endif
}
| crTRANSPORT crSSL crSTRING[pemcert] {
......
This diff is collapsed.
......@@ -64,12 +64,30 @@
/* Define to 1 if you have the <netinet/tcp.h> header file. */
#undef HAVE_NETINET_TCP_H
/* Define to 1 if you have the <onigposix.h> header file. */
#undef HAVE_ONIGPOSIX_H
/* Define if you have oniguruma */
#undef HAVE_ONIGURAMA
/* Define to 1 if you have the <openssl/err.h> header file. */
#undef HAVE_OPENSSL_ERR_H
/* Define to 1 if you have the <openssl/ssl.h> header file. */
#undef HAVE_OPENSSL_SSL_H
/* Define if you have pcre */
#undef HAVE_PCRE
/* Define if you have pcre2 */
#undef HAVE_PCRE2
/* Define to 1 if you have the <pcre2posix.h> header file. */
#undef HAVE_PCRE2POSIX_H
/* Define to 1 if you have the <pcreposix.h> header file. */
#undef HAVE_PCREPOSIX_H
/* Define to 1 if you have the <poll.h> header file. */
#undef HAVE_POLL_H
......@@ -92,6 +110,12 @@
/* Define to 1 if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H
/* Define if you have snappy */
#undef HAVE_SNAPPY
/* Define to 1 if you have the <snappy-c.h> header file. */
#undef HAVE_SNAPPY_C_H
/* Define to 1 if you have the `socket' function. */
#undef HAVE_SOCKET
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([carbon-c-relay], [3.2], [])
AC_INIT([carbon-c-relay], [3.4], [])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE
......@@ -112,6 +112,23 @@ AS_IF([test "x$with_lz4" != xno],
]
)])
AC_ARG_WITH([snappy], [support snappy compression for sending/receiving],
[], [with_snappy=check])
LIBSNAPPY=
AS_IF([test "x$with_snappy" != xno],
[AC_CHECK_HEADERS([snappy-c.h], [], [LIBSNAPPY=_missing_header])
AC_CHECK_LIB([snappy${LIBSNAPPY}], [snappy_compress],
[AC_SUBST([LIBSNAPPY], [-lsnappy])
AC_DEFINE([HAVE_SNAPPY], [1], [Define if you have snappy])
],
[if test "x$with_snappy" != xcheck; then
AC_MSG_FAILURE(
[--with-snappy was given, but test for snappy failed])
fi
LIBSNAPPY=
]
)])
AC_ARG_WITH([ssl], [support ssl encryption for sending/receiving],
[], [with_ssl=check])