[collectd] multicast ttl

e f ef_cd at apa.at
Mon Jan 30 12:17:54 CET 2006


i'm using collectd in an vlan environment and had some troubles get this 
right to work...
after some googling i found the right info:

Even more important for the multicast sender is to set the TTL to 
something greater
then 1 (which is the default).  TTL, or time to live, is a counter 
attached to every sent packet. 
The TTL value gets decremented at every router and when it reaches 0 is 
Thus multicast data will not get very far if the TTL value is 1.

so i have done the following changes to multicast.c
in function  "multicast_send (char *type, char *instance, char *value)"

#define MCAST_TTL 2

int ttl = MCAST_TTL;

if (setsockopt(sd,IPPROTO_IP,IP_MULTICAST_TTL,&ttl,sizeof(ttl)) < 0)
 syslog (LOG_WARNING, "multicast_ttl: set ip ttl");
 return (-1);

in future releases it would be great, if this could be done via a 
config-parameter ;)


diff multicast.c_new 

< #define MCAST_TTL 2
<       int ttl = MCAST_TTL;
<       if (setsockopt(sd,IPPROTO_IP,IP_MULTICAST_TTL,&ttl,sizeof(ttl)) < 0)
<       {
<               syslog (LOG_WARNING, "multicast_ttl: increase failure");
<               return (-1);
<       }

More information about the Collectd mailing list