
sclark at netwolves
Jan 19, 2010, 9:45 AM
Post #2 of 2
(455 views)
Permalink
|
On 01/19/2010 09:47 AM, Steve Clark wrote: > Hi, > > I am trying to generate an arbitrary graph for a specific unit - but rrd is not saving data by its > ip but by its mac address and I see no way to enter the mac address in the arbitrary graph screen. > > Also why does rrd save data for some units by ip and others by mac address? > > Thanks, > Steve > > I am running ntop 3.3.10 on FreeBSD 6.3. Current svn co as of this morning has the same code though. Looking into a work around - I.E. being able to enter the mac address in place of the IP I find several things that seem unusual: INET6 is defined in global-defines.h based on it not being the gnuc compiler - whats with that? #ifndef __GNUC__ #define INET6 #endif /* __GNUC__ */ in util.c - I though IP 6 addresses were only hexadecimal - why a-z A-Z stuff for validation and not a-f A-F also you don't get these as valid unless INET6 is defined ? int ipSanityCheck(char* string, char* parm, int nonFatal) { int i, j; static char ipChar[256]; // Common: // Numbers 0 - 9 // . // // INET6 // Upper and lower case letters: A - Z and a - z // : if(string == NULL) { traceEvent(CONST_TRACE_WARNING, "Invalid (empty) path specified for option %s", parm); if(nonFatal == 1) return(-1); return(-1); /* LDE */ } /* one time load of table */ if(ipChar['0'] != 1) { memset(&ipChar, 0, sizeof(ipChar)); for(i='0'; i<='9'; i++) ipChar[i]=1; ipChar['.']=1; #ifdef INET6 for(i='A'; i<='Z'; i++) ipChar[i]=1; for(i='a'; i<='z'; i++) ipChar[i]=1; ipChar[':']=1; #endif } ... In rrdPlugin.c if(rrdIP[0] == '\0') { /* Interface level */ safe_snprintf(__FILE__, __LINE__, rrdKey, sizeof(rrdKey), "interfaces/%s/", rrdInterface); } else { /* Security check... it's an ip - 0..9 a..f . and : ONLY */ if(ipSanityCheck(rrdIP, "arbitrary rrd request", 1) != 0) { traceEvent(CONST_TRACE_ERROR, "SECURITY: Invalid arbitrary rrd request(ip)... ignored (sanitized: %s)", rrdIP); return; } len=strlen(rrdIP); for(i=0; i<len; i++) if(rrdIP[i] == '.' || rrdIP[i] == ':') rrdIP[i] = CONST_PATH_SEP; ^^^^^^^^^^ >>>> adding the above would allow entering ipv6 : separated ips or mac addresses <<<<<< safe_snprintf(__FILE__, __LINE__, rrdKey, sizeof(rrdKey), "interfaces/%s/hosts/%s/", rrdInterface, rrdIP); } -- Stephen Clark NetWolves Sr. Software Engineer III Phone: 813-579-3200 Fax: 813-882-0209 Email: steve.clark [at] netwolves www.netwolves.com
|