From: Tim Laszlo Date: Fri, 20 Jun 2014 14:00:43 +0000 (-0500) Subject: network: set ttl before opening server sockets X-Git-Tag: collectd-5.5.0~244^2 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=8fe384e8d02d6cc1360113828f3ef3a34c24c3f8;hp=873ee04392be176051a22ad09ae1ae2fa224bfc7;p=collectd.git network: set ttl before opening server sockets If TimeToLive is defined in collectd.conf after Server options, the net_config_ttl value is updated after network_config_add_server and the desired ttl is not used. --- diff --git a/src/network.c b/src/network.c index 8cf17031..5769da79 100644 --- a/src/network.c +++ b/src/network.c @@ -3163,6 +3163,14 @@ static int network_config (oconfig_item_t *ci) /* {{{ */ { int i; + /* The options need to be applied first */ + for (i = 0; i < ci->children_num; i++) + { + oconfig_item_t *child = ci->children + i; + if (strcasecmp ("TimeToLive", child->key) == 0) + network_config_set_ttl (child); + } + for (i = 0; i < ci->children_num; i++) { oconfig_item_t *child = ci->children + i; @@ -3171,8 +3179,9 @@ static int network_config (oconfig_item_t *ci) /* {{{ */ network_config_add_listen (child); else if (strcasecmp ("Server", child->key) == 0) network_config_add_server (child); - else if (strcasecmp ("TimeToLive", child->key) == 0) - network_config_set_ttl (child); + else if (strcasecmp ("TimeToLive", child->key) == 0) { + /* Handled earlier */ + } else if (strcasecmp ("MaxPacketSize", child->key) == 0) network_config_set_buffer_size (child); else if (strcasecmp ("Forward", child->key) == 0)