Skip to content

Commit 53ba917

Browse files
authored
Merge pull request syslog-ng#4544 from alexb271/proxied-socket
Add common proxy solution for all the supported transport methods that works transparently in the network() and the syslog() sources
2 parents d63b9fc + 4ba6ca2 commit 53ba917

26 files changed

+887
-487
lines changed

lib/logproto/CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ set(LOGPROTO_HEADERS
1111
logproto/logproto-server.h
1212
logproto/logproto-text-client.h
1313
logproto/logproto-text-server.h
14-
logproto/logproto-proxied-text-server.h
1514
PARENT_SCOPE)
1615

1716
set(LOGPROTO_SOURCES
@@ -26,7 +25,6 @@ set(LOGPROTO_SOURCES
2625
logproto/logproto-server.c
2726
logproto/logproto-text-client.c
2827
logproto/logproto-text-server.c
29-
logproto/logproto-proxied-text-server.c
3028
PARENT_SCOPE)
3129

3230
add_test_subdirectory(tests)

lib/logproto/Makefile.am

-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ logprotoinclude_HEADERS = \
1111
lib/logproto/logproto-framed-server.h \
1212
lib/logproto/logproto-text-client.h \
1313
lib/logproto/logproto-text-server.h \
14-
lib/logproto/logproto-proxied-text-server.h \
1514
lib/logproto/logproto-multiline-server.h \
1615
lib/logproto/logproto-record-server.h \
1716
lib/logproto/logproto-builtins.h \
@@ -26,7 +25,6 @@ logproto_sources = \
2625
lib/logproto/logproto-framed-server.c \
2726
lib/logproto/logproto-text-client.c \
2827
lib/logproto/logproto-text-server.c \
29-
lib/logproto/logproto-proxied-text-server.c \
3028
lib/logproto/logproto-multiline-server.c \
3129
lib/logproto/logproto-record-server.c \
3230
lib/logproto/logproto-builtins.c

lib/logproto/logproto-builtins.c

-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "logproto-dgram-server.h"
2525
#include "logproto-text-client.h"
2626
#include "logproto-text-server.h"
27-
#include "logproto-proxied-text-server.h"
2827
#include "logproto-framed-client.h"
2928
#include "logproto-framed-server.h"
3029
#include "plugin.h"
@@ -38,8 +37,6 @@ DEFINE_LOG_PROTO_SERVER(log_proto_dgram);
3837
DEFINE_LOG_PROTO_CLIENT(log_proto_text);
3938
DEFINE_LOG_PROTO_SERVER(log_proto_text);
4039
DEFINE_LOG_PROTO_SERVER(log_proto_text_with_nuls);
41-
DEFINE_LOG_PROTO_SERVER(log_proto_proxied_text);
42-
DEFINE_LOG_PROTO_SERVER(log_proto_proxied_text_tls_passthrough, .use_multitransport = TRUE);
4340
DEFINE_LOG_PROTO_CLIENT(log_proto_framed);
4441
DEFINE_LOG_PROTO_SERVER(log_proto_framed);
4542

@@ -51,8 +48,6 @@ static Plugin framed_server_plugins[] =
5148
LOG_PROTO_CLIENT_PLUGIN(log_proto_text, "text"),
5249
LOG_PROTO_SERVER_PLUGIN(log_proto_text, "text"),
5350
LOG_PROTO_SERVER_PLUGIN(log_proto_text_with_nuls, "text-with-nuls"),
54-
LOG_PROTO_SERVER_PLUGIN(log_proto_proxied_text, "proxied-tcp"),
55-
LOG_PROTO_SERVER_PLUGIN(log_proto_proxied_text_tls_passthrough, "proxied-tls-passthrough"),
5651
LOG_PROTO_CLIENT_PLUGIN(log_proto_framed, "framed"),
5752
LOG_PROTO_SERVER_PLUGIN(log_proto_framed, "framed"),
5853
};

lib/logproto/tests/CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ set(TEST_LOGPROTO_SOURCES
66
test-dgram-server.c
77
test-framed-server.c
88
test-indented-multiline-server.c
9-
test-regexp-multiline-server.c
10-
test-proxy-proto.c)
9+
test-regexp-multiline-server.c)
1110

1211
add_unit_test(LIBTEST CRITERION
1312
TARGET test_logproto

lib/logproto/tests/Makefile.am

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ lib_logproto_tests_test_logproto_SOURCES = \
1818
lib/logproto/tests/test-dgram-server.c \
1919
lib/logproto/tests/test-framed-server.c \
2020
lib/logproto/tests/test-indented-multiline-server.c \
21-
lib/logproto/tests/test-regexp-multiline-server.c \
22-
lib/logproto/tests/test-proxy-proto.c
21+
lib/logproto/tests/test-regexp-multiline-server.c
2322

2423
lib_logproto_tests_test_findeom_CFLAGS = \
2524
$(TEST_CFLAGS) \

lib/logproto/tests/test-proxy-proto.c

-268
This file was deleted.

lib/transport/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ set(TRANSPORT_HEADERS
55
transport/transport-file.h
66
transport/transport-pipe.h
77
transport/transport-socket.h
8+
transport/transport-socket-proxy.h
9+
transport/transport-socket-proxy-private.h
810
transport/transport-udp-socket.h
911
transport/transport-factory-id.h
1012
transport/transport-factory.h
@@ -23,6 +25,7 @@ set(TRANSPORT_SOURCES
2325
transport/transport-file.c
2426
transport/transport-pipe.c
2527
transport/transport-socket.c
28+
transport/transport-socket-proxy.c
2629
transport/transport-udp-socket.c
2730
transport/transport-tls.c
2831
transport/transport-factory-id.c

lib/transport/Makefile.am

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ transportinclude_HEADERS = \
99
lib/transport/transport-file.h \
1010
lib/transport/transport-pipe.h \
1111
lib/transport/transport-socket.h \
12+
lib/transport/transport-socket-proxy.h \
13+
lib/transport/transport-socket-proxy-private.h \
1214
lib/transport/transport-udp-socket.h \
1315
lib/transport/transport-factory-id.h \
1416
lib/transport/transport-factory.h \
@@ -26,6 +28,7 @@ transport_sources = \
2628
lib/transport/transport-file.c \
2729
lib/transport/transport-pipe.c \
2830
lib/transport/transport-socket.c \
31+
lib/transport/transport-socket-proxy.c \
2932
lib/transport/transport-udp-socket.c \
3033
lib/transport/transport-factory-id.c \
3134
lib/transport/transport-factory-registry.c \

lib/transport/multitransport.c

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ _do_transport_switch(MultiTransport *self, LogTransport *new_transport, const Tr
3636
{
3737
self->super.fd = log_transport_release_fd(self->active_transport);
3838
self->super.cond = new_transport->cond;
39+
/* At this point the proxy of the active transport must be released, and would be nice to handle the ownership passing here, but
40+
* - the proxy is not in the LogTransport, it is socket only now, and
41+
* - multitransport is a generic class, can handle none LogTransportSocket based transports
42+
*/
3943
log_transport_free(self->active_transport);
4044
self->active_transport = new_transport;
4145
self->active_transport_factory = new_transport_factory;

lib/transport/tests/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ add_unit_test(CRITERION TARGET test_transport_factory_id)
33
add_unit_test(CRITERION TARGET test_transport_factory)
44
add_unit_test(CRITERION TARGET test_transport_factory_registry)
55
add_unit_test(CRITERION TARGET test_multitransport)
6+
add_unit_test(CRITERION TARGET test_transport_socket_proxy)

0 commit comments

Comments
 (0)