X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=htmlandlogs.c;h=c0d564894684a645e37372c6b44ab3c93e850797;hb=14e28c6f75dba715fac299d909fdad50bfcf192d;hp=73a3d0f3f682270e99c28213202c77bcfbfd2a2b;hpb=e48d46c959233c89ccd6ccd411b31704610abb71;p=svn%2FPrometheus-QoS%2F.git
diff --git a/htmlandlogs.c b/htmlandlogs.c
index 73a3d0f..c0d5648 100644
--- a/htmlandlogs.c
+++ b/htmlandlogs.c
@@ -30,14 +30,18 @@ void append_log(struct IP *self) /*using global variables*/
FILE *f;
date(d); /* this is typical cll1.h macro - prints current date */
- string(str,STRLEN);
- sprintf(str,"%s/%s.log", log_dir, self->name);
- f=fopen(str,"a");
+ string(str, STRLEN);
+ sprintf(str, "%s/%s.log", log_dir, self->name);
+
+ /*-----------------------------------------------------------------*/
+ printf("Writing traffic log %s ...\n", str);
+ /*-----------------------------------------------------------------*/
+ f = fopen(str, "a");
if(f > 0)
{
- fprintf(f,"%ld\t%s\t%Lu\t%Lu\t%Lu\t%Lu\t%d\t%d\t%d\t%d\t%s",
- time(NULL), self->name, self->traffic, self->direct, self->proxy,
- self->upload, self->min, self->max, self->desired, self->lmsid, d); /* d = date*/
+ fprintf(f, "%ld\t%s\t%Lu\t%Lu\t%Lu\t%Lu\t%d\t%d\t%d\t%d\t%s",
+ time(NULL), self->name, self->traffic, self->direct, self->proxy,
+ self->upload, self->min, self->max, self->desired, self->lmsid, d); /* d = date*/
fclose(f);
}
else
@@ -50,7 +54,7 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
{
int i;
char *str;
- FILE *f=fopen(html,"w");
+ FILE *f=fopen(html, "w");
string(str,STRLEN);
if(f > 0)
@@ -58,10 +62,6 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
int count=1;
i=0;
- /*-----------------------------------------------------------------*/
- printf("Writing statistics summary into HTML page %s ...\n", html);
- /*-----------------------------------------------------------------*/
-
if(use_jquery_popups)
{
fprintf(f,"\n", jquery_url);
@@ -195,11 +195,16 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
{
fprintf(f,"",i);
popup_button=0;
- for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing))
+ for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing) && !sharedip->v6) /* IPv4 only */
{
fprintf(f,"
%s\n", log_url, sharedip->name, sharedip->name);
popup_button++;
}
+ for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing) && sharedip->v6) /* IPv6 only */
+ {
+ fprintf(f,"
%s/64\n", log_url, sharedip->addr, sharedip->addr);
+ popup_button++;
+ }
fputs("\n",f);
if(popup_button)
{
@@ -233,7 +238,11 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
if(use_jquery_popups)
{
fprintf(f,"",i);
- for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing))
+ for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing) && !sharedip->v6) /* IPv4 only */
+ {
+ fprintf(f,"
%Lu", sharedip->direct);
+ }
+ for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing) && sharedip->v6) /* IPv6 only */
{
fprintf(f,"
%Lu", sharedip->direct);
}
@@ -251,7 +260,11 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
if(use_jquery_popups)
{
fprintf(f,"",i);
- for_each(sharedip,ips) if(eq(ip->name, sharedip->sharing))
+ for_each(sharedip,ips) if(eq(ip->name, sharedip->sharing) && !sharedip->v6) /* IPv4 only */
+ {
+ fprintf(f,"
%Lu", sharedip->upload);
+ }
+ for_each(sharedip,ips) if(eq(ip->name, sharedip->sharing) && sharedip->v6) /* IPv6 only */
{
fprintf(f,"
%Lu", sharedip->upload);
}