X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fnetwork.c;h=5d485ba3a23894a844d771336313dc9f4b693015;hb=82e27678f8972d2625b466e7e7ba9daaa6395c98;hp=a2221e5b4661f8f5410cf2e701896ecbbd0b24a3;hpb=d1483d2e2a9116c233aeaceba99fa58a7e6bdc87;p=collectd.git diff --git a/src/network.c b/src/network.c index a2221e5b..5d485ba3 100644 --- a/src/network.c +++ b/src/network.c @@ -2977,6 +2977,10 @@ static int network_config_set_ttl (const oconfig_item_t *ci) /* {{{ */ tmp = (int) ci->values[0].value.number; if ((tmp > 0) && (tmp <= 255)) network_config_ttl = tmp; + else { + WARNING ("network plugin: The `TimeToLive' must be between 1 and 255."); + return (-1); + } return (0); } /* }}} int network_config_set_ttl */ @@ -3248,6 +3252,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; @@ -3256,8 +3268,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)