diff -u tinystats/tinydns.sh.sample tinystats_crm/tinydns.sh.sample --- tinystats/tinydns.sh.sample 2005-07-08 08:01:13.000000000 +0200 +++ tinystats_crm/tinydns.sh.sample 2005-08-16 14:22:38.000000000 +0200 @@ -27,7 +27,7 @@ [ -f `dirname $0`/tinydns.conf ] && . `dirname $0`/tinydns.conf -[ ! -f ${RRDDB} ] && /usr/local/bin/rrdtool create ${RRDDB} --start N \ +[ ! -f ${RRDDB} ] && $RRDTOOL create ${RRDDB} --start N \ DS:A:DERIVE:600:0:U DS:NS:DERIVE:600:0:U \ DS:CNAME:DERIVE:600:0:U DS:SOA:DERIVE:600:0:U \ DS:PTR:DERIVE:600:0:U DS:HINFO:DERIVE:600:0:U \ Only in tinystats_crm/: tinystats diff -u tinystats/tinystats.c tinystats_crm/tinystats.c --- tinystats/tinystats.c 2005-07-01 15:02:42.000000000 +0200 +++ tinystats_crm/tinystats.c 2005-08-16 15:50:26.000000000 +0200 @@ -114,8 +114,9 @@ { char buff[BUF_SIZE]; char buff_pretty[BUF_SIZE]; - char ip[16]; - char line[BUF_SIZE]; + char ip[33]; + char lineB[BUF_SIZE]; + char *line; int lpos = 0; int i, n, j; char res[5]; @@ -124,21 +125,33 @@ long port; long id; - bzero (line, sizeof line); - + bzero (lineB, sizeof lineB); while ((n = read (0, buff, sizeof (buff))) > 0) { for (i = 0; i < n && buff[i]; i++) { if (buff[i] != '\n') - line[lpos++] = buff[i]; + lineB[lpos++] = buff[i]; else { + line = lineB; + lineB[lpos] = 0; if (human && lpos > START_LEN) { - for (j = 0; j < 4; j++) { - bzero (res, sizeof res); - memcpy (res, line+j*2, 2); - oct[j] = strtol (res, NULL, 16); - } - snprintf (ip, 16, "%d.%d.%d.%d", + if (strstr(line, "00000000000000000000ffff") != NULL) { + line += 24; + lpos -= 24; + + for (j = 0; j < 4; j++) { + bzero (res, sizeof res); + memcpy (res, line+j*2, 2); + oct[j] = strtol (res, NULL, 16); + } + snprintf (ip, 16, "%d.%d.%d.%d", (int) oct[0], (int) oct[1], (int) oct[2], (int) oct[3]); + } + else { + memcpy(ip, line, 32); + ip[32] = 0; + line += 24; + lpos -= 24; + } bzero (res, sizeof res); memcpy (res, line+9, 4); @@ -151,7 +164,7 @@ bzero (res, sizeof res); memcpy (res, line+21, 4); - snprintf (buff_pretty, BUF_SIZE, "%-15s %05d [%05d] %c %-4s", + snprintf (buff_pretty, BUF_SIZE, "%-32s %05d [%05d] %c %-4s", ip, (int) port, (int) id, line[19], get_rr (res)); write (1, buff_pretty, strlen (buff_pretty)); write (1, line+25, lpos-25);