From c67e6710eb38ebb77a256288967df990c06400d1 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Mon, 4 Nov 2024 14:54:06 +0100 Subject: [PATCH] remove adsbexchange hardcoding to send uuid, use beast_reduce_plus_out with uuid in net-connector or use beast_reduce_plus_out with --uuid-file --- README.md | 10 +++++++++- help.h | 2 +- net_io.c | 13 ++++--------- readsb.c | 1 - track.c | 4 ++++ 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index e6fc8468..2da38275 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,14 @@ Selectively forwards beast messages if the received data hasn't been forwarded i Data not related to the physical aircraft state are only forwarded every 500 ms (4 * `--net-beast-reduce-interval`).The messages of this output are normal beast messages and compatible with every program able to receive beast messages. +This is used by some aggregators to aggregate ADS-B data, an example net connector would be: +``` +--net-connector=feed.airplanes.live,30004,beast_reduce_plus_out,uuid=0033062d-e17e-4389-91a9-79ebb967fb4c +``` +The uuid is optional, if none is given, the uuid from --uuid-file is used, if that isn't present no uuid is sent. +The beast_reduce_out net-connector will never send an uuid. +The aggregator enables --net-receiver-id and --net-ingest on their readsb server, it's made to work with beast_reduce_plus_out. + ### Debian package - Build package with no additional receiver library dependencies: `dpkg-buildpackage -b`. @@ -121,9 +129,9 @@ For that purpose it's used in conjunction with tar1090 with some extra options t Websites using this software: - https://adsb.lol/ -- https://globe.adsbexchange.com/ - https://globe.airplanes.live/ - https://globe.adsb.fi/ +- https://globe.adsbexchange.com/ Projects that use or have used data generated by this software: diff --git a/help.h b/help.h index 517968f2..c4e8a33d 100644 --- a/help.h +++ b/help.h @@ -46,7 +46,7 @@ static struct argp_option optionsViewadsb[] = { {"quiet", OptQuiet, 0, 0, "Disable output (default)", 1}, {"debug", OptDebug, "", 0, "Debug mode (verbose), n: network, P: CPR, S: speed check", 1}, {0,0,0,0, "Network options:", 2}, - {"net-connector", OptNetConnector, "", 0, "Establish connection, can be specified multiple times (viewadsb default: --net-connector 127.0.0.1,30005,beast_in viewadsb first usage overrides default, second usage adds another input/output) Protocols: beast_out, beast_in, raw_out, raw_in, sbs_in, sbs_in_jaero, sbs_out, sbs_out_jaero, vrs_out, json_out, gpsd_in, uat_in, uat_replay_out, planefinder_in, asterix_in, asterix_out (one failover ip/address,port can be specified: primary-address,primary-port,protocol,failover-address,failover-port) (any position in the comma separated list can also be either silent_fail or uuid=)", 2}, + {"net-connector", OptNetConnector, "", 0, "Establish connection, can be specified multiple times (viewadsb default: --net-connector 127.0.0.1,30005,beast_in viewadsb first usage overrides default, second usage adds another input/output) Protocols: beast_out, beast_reduce_out, beast_reduce_plus_out, beast_in, raw_out, raw_in, sbs_in, sbs_in_jaero, sbs_out, sbs_out_jaero, vrs_out, json_out, gpsd_in, uat_in, uat_replay_out, planefinder_in, asterix_in, asterix_out (one failover ip/address,port can be specified: primary-address,primary-port,protocol,failover-address,failover-port) (any position in the comma separated list can also be either silent_fail or uuid=)", 2}, {0,0,0,0, "Help options:", 100}, { 0 } }; diff --git a/net_io.c b/net_io.c index acfb5a27..098c5c82 100644 --- a/net_io.c +++ b/net_io.c @@ -371,23 +371,19 @@ static struct client *createSocketClient(struct net_service *service, int fd) { static int sendUUID(struct client *c, int64_t now) { struct net_connector *con = c->con; - // sending UUID if hostname matches adsbexchange or for beast_reduce_plus output + // sending UUID for beast_reduce_plus output char uuid[150]; uuid[0] = '\0'; if ((c->sendq && c->sendq_len + 256 < c->sendq_max) && con - && (con->enable_uuid_ping || (strstr(con->address, "feed") && strstr(con->address, ".adsbexchange.com")) || Modes.debug_ping || Modes.debug_send_uuid)) { + && (con->enable_uuid_ping || Modes.debug_ping || Modes.debug_send_uuid)) { int res = -1; if (con->uuid) { strncpy(uuid, con->uuid, 135); res = strlen(uuid); - } else { + } else if (Modes.uuidFile) { int fd = open(Modes.uuidFile, O_RDONLY); - // try legacy / adsbexchange image path as hardcoded fallback - if (fd == -1) { - fd = open("/boot/adsbx-uuid", O_RDONLY); - } if (fd != -1) { res = read(fd, uuid, 128); close(fd); @@ -408,9 +404,8 @@ static int sendUUID(struct client *c, int64_t now) { strncpy(c->sendq + c->sendq_len, uuid, res); c->sendq_len += 36; } else { + fprintf(stderr, "ERROR: Not a valid UUID: '%s' (to generate a valid uuid use this command: cat /proc/sys/kernel/random/uuid)\n", uuid); uuid[0] = '\0'; - fprintf(stderr, "ERROR: Not a valid UUID: %s\n", Modes.uuidFile); - fprintf(stderr, "Use this command to fix: sudo uuidgen > %s\n", Modes.uuidFile); } // enable ping stuff diff --git a/readsb.c b/readsb.c index 6cbfbb5a..46e63a7b 100644 --- a/readsb.c +++ b/readsb.c @@ -157,7 +157,6 @@ static void configSetDefaults(void) { Modes.net_output_flush_interval_beast_reduce = -1; // default to net_output_flush_interval after config parse if not configured Modes.netReceiverId = 0; Modes.netIngest = 0; - Modes.uuidFile = strdup("/usr/local/share/adsbexchange/adsbx-uuid"); Modes.json_trace_interval = 20 * 1000; Modes.state_write_interval = 1 * HOURS; Modes.heatmap_current_interval = -15; diff --git a/track.c b/track.c index 7f82b36d..8962c6c5 100644 --- a/track.c +++ b/track.c @@ -2620,6 +2620,10 @@ struct aircraft *trackUpdateFromMessage(struct modesMessage *mm) { } } + if (0 && a->addr == Modes.cpr_focus && mm->cpr_valid) { + displayModesMessage(mm); + } + if (cpr_new) { a->last_cpr_type = mm->cpr_type; }