X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fnetwork.c;h=b1919833034e2e01d534579788dfcb1f7b7916db;hp=1b6cf1ea9713e1add30e345f8f26b0ec0f486553;hb=103f05e098865196fc5f28df51e99b64fd6b5202;hpb=fd7673e5e9ad074624fc23cda5d2ec4549d43659 diff --git a/src/network.c b/src/network.c index 1b6cf1ea..b1919833 100644 --- a/src/network.c +++ b/src/network.c @@ -2904,6 +2904,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 */ @@ -3166,6 +3170,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; @@ -3174,8 +3186,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)