Skip to content

Commit

Permalink
SONiC handle collector settings being removed under our feet
Browse files Browse the repository at this point in the history
  • Loading branch information
sflow committed Jun 12, 2020
1 parent 301413d commit 880c2c2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Linux/mod_sonic.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ extern "C" {
#define HSP_SONIC_FIELD_SFLOW_AGENT "agent_id"
#define HSP_SONIC_FIELD_COLLECTOR_IP "collector_ip"
#define HSP_SONIC_FIELD_COLLECTOR_PORT "collector_port"
#define HSP_SONIC_FIELD_COLLECTOR_VRF "collector_vrf" // not defined yet, so name may change
#define HSP_SONIC_FIELD_COLLECTOR_VRF "collector_vrf"

#define HSP_SONIC_DEFAULT_POLLING_INTERVAL 20
#define HSP_SONIC_MIN_POLLING_INTERVAL 5
Expand Down Expand Up @@ -976,6 +976,17 @@ extern "C" {
if(reply->type == REDIS_REPLY_ARRAY
&& reply->elements > 0
&& ISEVEN(reply->elements)) {
// reset fields that might have been deleted under our feet
coll->port = SFL_DEFAULT_COLLECTOR_PORT;
if(coll->ipStr) {
my_free(coll->ipStr);
coll->ipStr = NULL;
}
if(coll->deviceName) {
my_free(coll->deviceName);
coll->deviceName = NULL;
}
// now see what we got
for(int ii = 0; ii < reply->elements; ii += 2) {
redisReply *f_name = reply->element[ii];
redisReply *f_val = reply->element[ii + 1];
Expand Down

0 comments on commit 880c2c2

Please sign in to comment.