diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-03-16 07:50:45 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-03-16 07:50:45 +0000 |
commit | 87cce1817d03daca8c31be82d781ec47a4560087 (patch) | |
tree | 06cb3e407ea32dcc385cbe4fb77e251e34bc1e68 /streaming/rrdpush.c | |
parent | Releasing debian version 1.12.2-2. (diff) | |
download | netdata-87cce1817d03daca8c31be82d781ec47a4560087.tar.xz netdata-87cce1817d03daca8c31be82d781ec47a4560087.zip |
Merging upstream version 1.13.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'streaming/rrdpush.c')
-rw-r--r-- | streaming/rrdpush.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/streaming/rrdpush.c b/streaming/rrdpush.c index d1626db7..b98d0b3d 100644 --- a/streaming/rrdpush.c +++ b/streaming/rrdpush.c @@ -868,8 +868,12 @@ static int rrdpush_receive(int fd tags = appconfig_set_default(&stream_config, machine_guid, "host tags", (tags)?tags:""); if(tags && !*tags) tags = NULL; - if(!strcmp(machine_guid, "localhost")) - host = localhost; + if (strcmp(machine_guid, localhost->machine_guid) == 0) { + log_stream_connection(client_ip, client_port, key, machine_guid, hostname, "DENIED - ATTEMPT TO RECEIVE METRICS FROM MACHINE_GUID IDENTICAL TO MASTER"); + error("STREAM %s [receive from %s:%s]: denied to receive metrics, machine GUID [%s] is my own. Did you copy the master/proxy machine guid to a slave?", hostname, client_ip, client_port, machine_guid); + close(fd); + return 1; + } else host = rrdhost_find_or_create( hostname @@ -1050,24 +1054,24 @@ static void rrdpush_receiver_thread_cleanup(void *ptr) { static void *rrdpush_receiver_thread(void *ptr) { netdata_thread_cleanup_push(rrdpush_receiver_thread_cleanup, ptr); - struct rrdpush_thread *rpt = (struct rrdpush_thread *)ptr; - info("STREAM %s [%s]:%s: receive thread created (task id %d)", rpt->hostname, rpt->client_ip, rpt->client_port, gettid()); - - rrdpush_receive( - rpt->fd - , rpt->key - , rpt->hostname - , rpt->registry_hostname - , rpt->machine_guid - , rpt->os - , rpt->timezone - , rpt->tags - , rpt->program_name - , rpt->program_version - , rpt->update_every - , rpt->client_ip - , rpt->client_port - ); + struct rrdpush_thread *rpt = (struct rrdpush_thread *)ptr; + info("STREAM %s [%s]:%s: receive thread created (task id %d)", rpt->hostname, rpt->client_ip, rpt->client_port, gettid()); + + rrdpush_receive( + rpt->fd + , rpt->key + , rpt->hostname + , rpt->registry_hostname + , rpt->machine_guid + , rpt->os + , rpt->timezone + , rpt->tags + , rpt->program_name + , rpt->program_version + , rpt->update_every + , rpt->client_ip + , rpt->client_port + ); netdata_thread_cleanup_pop(1); return NULL; |