/[svn]/ircd-hybrid/trunk/src/conf_class.c
ViewVC logotype

Diff of /ircd-hybrid/trunk/src/conf_class.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1646 by michael, Wed Nov 7 21:02:43 2012 UTC revision 1647 by michael, Fri Nov 9 20:11:58 2012 UTC
# Line 350  remove_from_cidr_check(struct irc_ssaddr Line 350  remove_from_cidr_check(struct irc_ssaddr
350  #endif  #endif
351  }  }
352    
353  static void  void
354  rebuild_cidr_list(int aftype, struct ClassItem *oldcl, struct ClassItem *newcl,  rebuild_cidr_list(struct ClassItem *class)
                   dlink_list *old_list, dlink_list *new_list, int changed)  
355  {  {
356    dlink_node *ptr;    dlink_node *ptr;
   struct Client *client_p;  
   struct MaskItem *conf;  
357    
358    if (!changed)    destroy_cidr_class(class);
   {  
     *new_list = *old_list;  
     old_list->head = old_list->tail = NULL;  
     old_list->length = 0;  
     return;  
   }  
359    
360    DLINK_FOREACH(ptr, local_client_list.head)    DLINK_FOREACH(ptr, local_client_list.head)
361    {    {
362      client_p = ptr->data;      struct Client *client_p = ptr->data;
363      if (client_p->localClient->aftype != aftype)      struct MaskItem *conf = client_p->localClient->confs.tail->data;
       continue;  
     if (dlink_list_length(&client_p->localClient->confs) == 0)  
       continue;  
364    
365      conf = client_p->localClient->confs.tail->data;      if (conf && (conf->type == CONF_CLIENT))
366      if (conf->type == CONF_CLIENT)        if (conf->class == class)
367        if (conf->class == oldcl)          cidr_limit_reached(1, &client_p->localClient->ip, class);
         cidr_limit_reached(1, &client_p->localClient->ip, newcl);  
368    }    }
369  }  }
370    
371  /*  /*
  * rebuild_cidr_class  
  *  
  * inputs       - pointer to old conf  
  *              - pointer to new_class  
  * output       - none  
  * side effects - rebuilds the class link list of cidr blocks  
  */  
 void  
 rebuild_cidr_class(struct ClassItem *old_class, struct ClassItem *new_class)  
 {  
   if (old_class->number_per_cidr > 0 && new_class->number_per_cidr > 0)  
   {  
     if (old_class->cidr_bitlen_ipv4 > 0 && new_class->cidr_bitlen_ipv4 > 0)  
       rebuild_cidr_list(AF_INET, old_class, new_class,  
                         &old_class->list_ipv4, &new_class->list_ipv4,  
                         old_class->cidr_bitlen_ipv4 != new_class->cidr_bitlen_ipv4);  
   
 #ifdef IPV6  
     if (old_class->cidr_bitlen_ipv6 > 0 && new_class->cidr_bitlen_ipv6 > 0)  
       rebuild_cidr_list(AF_INET6, old_class, new_class,  
                         &old_class->list_ipv6, &new_class->list_ipv6,  
                         old_class->cidr_bitlen_ipv6 != new_class->cidr_bitlen_ipv6);  
 #endif  
   }  
   
   destroy_cidr_class(old_class);  
 }  
   
 /*  
372   * destroy_cidr_list   * destroy_cidr_list
373   *   *
374   * inputs       - pointer to class dlink list of cidr blocks   * inputs       - pointer to class dlink list of cidr blocks

Legend:
Removed from v.1646  
changed lines
  Added in v.1647

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28