From 9cf1af0a1869119e0d944fff72ccc8e8fe91ab24 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Tue, 26 Nov 2024 14:53:24 +0000 Subject: [PATCH] readProxy setting --- net_io.c | 2 +- readsb.c | 3 +++ readsb.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/net_io.c b/net_io.c index 098c5c82..c926df2b 100644 --- a/net_io.c +++ b/net_io.c @@ -5074,7 +5074,7 @@ static int processClient(struct client *c, int64_t now, struct messageBuffer *mb if (now - c->connectedSince < 5 * SECONDS) { // check for PROXY v1 header if connection is new / low bytes received - if (Modes.netIngest && c->som == c->buf) { + if ((Modes.netIngest || Modes.readProxy) && c->som == c->buf) { if (c->eod - c->som >= 6 && c->som[0] == 'P' && c->som[1] == 'R') { int res = readProxy(c); if (res != 0) { diff --git a/readsb.c b/readsb.c index 5e3b385a..46b39b98 100644 --- a/readsb.c +++ b/readsb.c @@ -2041,6 +2041,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { if (strcasecmp(token[0], "legacy_history") == 0) { Modes.legacy_history = 1; } + if (strcasecmp(token[0], "readProxy") == 0) { + Modes.readProxy = 1; + } if (strcasecmp(token[0], "beast_forward_noforward") == 0) { Modes.beast_forward_noforward = 1; } diff --git a/readsb.h b/readsb.h index b1e9557c..ad7d739c 100644 --- a/readsb.h +++ b/readsb.h @@ -709,6 +709,7 @@ struct _Modes int8_t netReceiverIdPrint; int8_t netReceiverIdJson; int8_t netIngest; + int8_t readProxy; int8_t enableClientsJson; int8_t forward_mlat; // forward beast mlat messages to beast output ports int8_t forward_mlat_sbs; // forward mlat messages to sbs output ports