debug version
[svn/Prometheus-QoS/.git] / parsehosts.c
index 1e0c65ceceaf5a6517f94074367b88d1e93d6b36..8c9eca159c6d1b3304f8e45342c1c04d2eeaced9 100644 (file)
@@ -11,7 +11,9 @@ extern struct IP *ips, *ip, *sharedip, *networks;
 extern struct Group *groups, *group;\r
 extern struct Keyword *keyword, *defaultkeyword, *keywords;\r
 extern struct Macro *macro, *macros;\r
+extern struct Textfile *previous_classmap, *textline;\r
 extern int class_count;\r
+extern int mix_new_hosts;\r
 extern int ip_count;\r
 extern int found_lmsid;\r
 extern int free_min;\r
@@ -25,27 +27,30 @@ void update_network(char *look_for, struct IP* ip);
 void TheIP(char *ipaddr, int is_network)\r
 {\r
  create(ip,IP);\r
- ip->name        = "";\r
- ip->addr        = ipaddr;\r
- ip->sharing     = NULL;\r
- ip->prio        = highest_priority+1;\r
- ip->lmsid       = -1;\r
- ip->fixedprio   = \\r
- ip->mark        = \\r
- ip->min         = \\r
- ip->max         = \\r
- ip->desired     = \\r
- ip->credit      = \\r
- ip->upload      = \\r
- ip->proxy       = \\r
- ip->direct      = \\r
- ip->traffic     = \\r
- ip->pktsup      = \\r
- ip->pps_limit   = \\r
- ip->pktsdown    = 0;\r
- ip->keyword     = keywords;\r
- ip->v6          = (strchr(ip->addr,':')!=NULL);\r
- ip->mask        = ((ip->v6)?64:32);\r
+ ip->name         = "";\r
+ ip->addr         = ipaddr;\r
+ ip->sharing      = NULL;\r
+ ip->prio         = highest_priority+1;\r
+ ip->lmsid        = -1;\r
+ ip->fixedprio    = \\r
+ ip->aggregated   = \\r
+ ip->mark         = \\r
+ ip->min          = \\r
+ ip->max          = \\r
+ ip->desired      = \\r
+ ip->credit       = \\r
+ ip->upload       = \\r
+ ip->proxy        = \\r
+ ip->direct       = \\r
+ ip->traffic      = \\r
+ ip->traffic_down = \\r
+ ip->traffic_up   = \\r
+ ip->pktsup       = \\r
+ ip->pps_limit    = \\r
+ ip->pktsdown     = 0;\r
+ ip->keyword      = keywords;\r
+ ip->v6           = (strchr(ip->addr,':')!=NULL);\r
+ ip->mask         = ((ip->v6)?64:32);\r
  if(is_network)\r
  {\r
   push(ip, networks);\r
@@ -339,7 +344,23 @@ void parse_hosts(char *hosts)
       }\r
      }\r
 \r
-     ip->mark = FIRSTIPCLASS+1+class_count++;     \r
+     if(mix_new_hosts)\r
+      for_each(textline, previous_classmap)\r
+      {\r
+       ptr = strchr(textline->str, ' ');\r
+       if(ptr)\r
+       {\r
+        if(!strncmp(ip->addr, textline->str, ptr-textline->str))\r
+        {\r
+         ip->mark = atoi(ptr+1);\r
+         printf("Match class: %s %d\n", ip->addr, ip->mark);\r
+        }\r
+       }      \r
+      }\r
+     \r
+     if(!mix_new_hosts || !ip->mark)\r
+      ip->mark = FIRSTIPCLASS+1+class_count++;\r
+          \r
      update_network(ip->addr, ip);\r
 \r
      if_exists(group,groups,(group->min == ip->min)) \r
This page took 0.095137 seconds and 4 git commands to generate.