ip protocol usage statistics and more
[svn/Prometheus-QoS/.git] / parsehosts.c
index 528f376ce38fa5333bb6305d3d15c5db47021451..92ee23ac12dd5442b8b83f8774d4cd9da72a901a 100644 (file)
@@ -39,11 +39,15 @@ void TheIP(char *ipaddr)
  ip->pktsup      = \\r
  ip->pktsdown    = 0;\r
  ip->keyword     = keywords;\r
+ ip->v6          = (strchr(ip->addr,':')!=NULL);\r
  push(ip,ips);\r
+ ip_count++;\r
 }\r
 \r
+struct IP *lastIP6;\r
+\r
 /* == This function strips extra characters after IPv4 address and stores it = */\r
-void parse_ip(char *str)\r
+parse_ip(char *str)\r
 {\r
  char *ptr, *ipaddr, *ip6range = NULL, *ipname = NULL, *lmsid = NULL;\r
 \r
@@ -53,7 +57,7 @@ void parse_ip(char *str)
   if(ptr && ptr-str > 4)\r
   {\r
    ptr -= 4;   \r
-   duplicate(ptr,ip6range);\r
+   duplicate(ptr, ip6range);\r
    ptr = strstr(ip6range, "::");\r
    if(ptr)\r
    {\r
@@ -96,18 +100,23 @@ void parse_ip(char *str)
  if(ip6range)\r
  {\r
   concatenate(ip6prefix,ip6range,ptr);\r
-  concatenate(ptr,"/64",ip6range);\r
+  ip6range=ptr;\r
   if_exists(ip, ips, eq(ip->addr,ip6range));\r
   else\r
   {\r
    TheIP(ip6range);\r
   }\r
-  ip->name = ptr;\r
-  ip->sharing = ipname;\r
+  ip->name = ip6range;\r
+  ip->keyword = defaultkeyword; /* settings for default keyword */\r
   if(lmsid)\r
   {\r
    ip->lmsid = atoi(lmsid);\r
   }\r
+  lastIP6 = ip;\r
+ }\r
+ else\r
+ {\r
+  lastIP6 = NULL;\r
  }\r
 \r
  if_exists(ip, ips, eq(ip->addr,ipaddr));\r
@@ -146,9 +155,12 @@ void parse_hosts(char *hosts)
   { \r
    substring += 8; /* "sharing-" */\r
    parse_ip(str);\r
-   ip_count++;\r
    ip->sharing = substring;\r
    ip->keyword = defaultkeyword; /* settings for default keyword */\r
+   if(lastIP6)\r
+   {\r
+    lastIP6->sharing = substring;\r
+   }\r
    while(*substring and *substring != '\n')\r
    {\r
     substring++;\r
@@ -162,7 +174,6 @@ void parse_hosts(char *hosts)
    if_exists(keyword,keywords,(substring=strstr(str,keyword->key)))\r
    {\r
     parse_ip(str);\r
-    ip_count++;\r
     ip->keyword = keyword;\r
     keyword->ip_count++;\r
     ip->prio = keyword->default_prio;\r
This page took 0.121925 seconds and 4 git commands to generate.