IPv6 iptables exceptions (for OSPF)
[svn/Prometheus-QoS/.git] / htmlandlogs.c
index f624a48442c56c3d508c1b01f149de98f8b9d061..c0d564894684a645e37372c6b44ab3c93e850797 100644 (file)
@@ -30,14 +30,18 @@ void append_log(struct IP *self) /*using global variables*/
  FILE *f; \r
 \r
  date(d); /* this is typical cll1.h macro - prints current date */ \r
- string(str,STRLEN); \r
- sprintf(str,"%s/%s.log", log_dir, self->name);\r
- f=fopen(str,"a");\r
+ string(str, STRLEN); \r
+ sprintf(str, "%s/%s.log", log_dir, self->name);\r
+\r
+ /*-----------------------------------------------------------------*/\r
+ printf("Writing traffic log %s ...\n", str);\r
+ /*-----------------------------------------------------------------*/\r
+ f = fopen(str, "a");\r
  if(f > 0)\r
  {\r
-  fprintf(f,"%ld\t%s\t%Lu\t%Lu\t%Lu\t%Lu\t%d\t%d\t%d\t%d\t%s",\r
-            time(NULL), self->name, self->traffic, self->direct, self->proxy,\r
-            self->upload, self->min, self->max, self->desired, self->lmsid, d); /* d = date*/\r
+  fprintf(f, "%ld\t%s\t%Lu\t%Lu\t%Lu\t%Lu\t%d\t%d\t%d\t%d\t%s",\r
+             time(NULL), self->name, self->traffic, self->direct, self->proxy,\r
+             self->upload, self->min, self->max, self->desired, self->lmsid, d); /* d = date*/\r
   fclose(f);\r
  }\r
  else\r
@@ -50,7 +54,7 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
 {\r
  int i;\r
  char *str;\r
- FILE *f=fopen(html,"w");\r
+ FILE *f=fopen(html, "w");\r
 \r
  string(str,STRLEN); \r
  if(f > 0)\r
@@ -58,10 +62,6 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
   int count=1;\r
   i=0;\r
 \r
-  /*-----------------------------------------------------------------*/\r
-  printf("Writing statistics summary into HTML page %s ...\n", html);\r
-  /*-----------------------------------------------------------------*/\r
-\r
   if(use_jquery_popups)\r
   {\r
    fprintf(f,"<script type=\"text/javascript\" src=\"%s\"></script>\n", jquery_url);\r
@@ -195,11 +195,16 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
    {\r
      fprintf(f,"<span id=\"sharing_%d\" style=\"display:none\">",i);\r
      popup_button=0;\r
-     for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing))\r
+     for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing) && !sharedip->v6) /* IPv4 only */\r
      {\r
       fprintf(f,"<br /><a class=\"blue\" target=\"_blank\" href=\"%s%s.log\">%s</a>\n", log_url, sharedip->name, sharedip->name);\r
       popup_button++;\r
      }\r
+     for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing) && sharedip->v6) /* IPv6 only */\r
+     {\r
+      fprintf(f,"<br /><a class=\"blue\" target=\"_blank\" href=\"%s%s.log\">%s/64</a>\n", log_url, sharedip->addr, sharedip->addr);\r
+      popup_button++;\r
+     }\r
      fputs("</span>\n",f);\r
      if(popup_button)\r
      {\r
@@ -225,8 +230,7 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
    }\r
    fprintf(f,"<td style=\"text-align: right\">%Lu</td>\n", ip->credit);\r
    fprintf(f,"<td style=\"text-align: right\"><span style=\"color:#%s\">%Lu</span></td>",\r
-             ip->keyword->html_color,\r
-             ip->credit+(ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20)));\r
+             ip->keyword->html_color, ip->realquota);\r
    fprintf(f,"<td style=\"text-align: right\">%s%Lu%s", f1, ip->traffic, f2);\r
 \r
    /* download --------------------------------------- */\r
@@ -234,7 +238,11 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
    if(use_jquery_popups)\r
    {\r
      fprintf(f,"<span id=\"download_%d\" style=\"display:none\">",i);\r
-     for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing))\r
+     for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing) && !sharedip->v6) /* IPv4 only */\r
+     {\r
+      fprintf(f,"<br />%Lu", sharedip->direct);\r
+     }\r
+     for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing) && sharedip->v6) /* IPv6 only */\r
      {\r
       fprintf(f,"<br />%Lu", sharedip->direct);\r
      }\r
@@ -252,7 +260,11 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
    if(use_jquery_popups)\r
    {\r
      fprintf(f,"<span id=\"upload_%d\" style=\"display:none\">",i);\r
-     for_each(sharedip,ips) if(eq(ip->name, sharedip->sharing))\r
+     for_each(sharedip,ips) if(eq(ip->name, sharedip->sharing) && !sharedip->v6) /* IPv4 only */\r
+     {\r
+      fprintf(f,"<br />%Lu", sharedip->upload);\r
+     }\r
+     for_each(sharedip,ips) if(eq(ip->name, sharedip->sharing) && sharedip->v6) /* IPv6 only */\r
      {\r
       fprintf(f,"<br />%Lu", sharedip->upload);\r
      }\r
This page took 0.13595 seconds and 4 git commands to generate.