| 1 |
|
/* |
| 2 |
< |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
| 2 |
> |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
| 3 |
|
* |
| 4 |
< |
* Copyright (C) 2002 by the past and present ircd coders, and others. |
| 4 |
> |
* Copyright (c) 1997-2014 ircd-hybrid development team |
| 5 |
|
* |
| 6 |
|
* This program is free software; you can redistribute it and/or modify |
| 7 |
|
* it under the terms of the GNU General Public License as published by |
| 19 |
|
* USA |
| 20 |
|
*/ |
| 21 |
|
|
| 22 |
< |
/*! \file |
| 22 |
> |
/*! \file conf_class.c |
| 23 |
|
* \brief Configuration managment for class{} blocks |
| 24 |
|
* \version $Id$ |
| 25 |
|
*/ |
| 35 |
|
|
| 36 |
|
struct ClassItem *class_default; |
| 37 |
|
|
| 38 |
< |
static dlink_list class_list = { NULL, NULL, 0 }; |
| 38 |
> |
static dlink_list class_list; |
| 39 |
|
|
| 40 |
|
|
| 41 |
|
const dlink_list * |
| 47 |
|
struct ClassItem * |
| 48 |
|
class_make(void) |
| 49 |
|
{ |
| 50 |
< |
struct ClassItem *class = MyMalloc(sizeof(*class)); |
| 50 |
> |
struct ClassItem *class = MyCalloc(sizeof(*class)); |
| 51 |
|
|
| 52 |
|
class->active = 1; |
| 53 |
|
class->con_freq = DEFAULT_CONNECTFREQUENCY; |
| 258 |
|
} |
| 259 |
|
} |
| 260 |
|
|
| 261 |
< |
cidr = MyMalloc(sizeof(struct CidrItem)); |
| 261 |
> |
cidr = MyCalloc(sizeof(struct CidrItem)); |
| 262 |
|
cidr->number_on_this_cidr = 1; |
| 263 |
|
cidr->mask = *ip; |
| 264 |
|
mask_addr(&cidr->mask, class->cidr_bitlen_ipv4); |
| 281 |
|
} |
| 282 |
|
} |
| 283 |
|
|
| 284 |
< |
cidr = MyMalloc(sizeof(struct CidrItem)); |
| 284 |
> |
cidr = MyCalloc(sizeof(struct CidrItem)); |
| 285 |
|
cidr->number_on_this_cidr = 1; |
| 286 |
|
cidr->mask = *ip; |
| 287 |
|
mask_addr(&cidr->mask, class->cidr_bitlen_ipv6); |
| 357 |
|
void |
| 358 |
|
rebuild_cidr_list(struct ClassItem *class) |
| 359 |
|
{ |
| 360 |
< |
dlink_node *ptr; |
| 360 |
> |
dlink_node *ptr = NULL; |
| 361 |
|
|
| 362 |
|
destroy_cidr_class(class); |
| 363 |
|
|
| 382 |
|
static void |
| 383 |
|
destroy_cidr_list(dlink_list *list) |
| 384 |
|
{ |
| 385 |
< |
dlink_node *ptr = NULL, *next_ptr = NULL; |
| 385 |
> |
dlink_node *ptr = NULL, *ptr_next = NULL; |
| 386 |
|
|
| 387 |
< |
DLINK_FOREACH_SAFE(ptr, next_ptr, list->head) |
| 387 |
> |
DLINK_FOREACH_SAFE(ptr, ptr_next, list->head) |
| 388 |
|
{ |
| 389 |
|
dlinkDelete(ptr, list); |
| 390 |
|
MyFree(ptr->data); |