324 |
|
|
325 |
|
aclass = map_to_conf(conf); |
326 |
|
aclass->active = 1; |
327 |
< |
ConFreq(aclass) = DEFAULT_CONNECTFREQUENCY; |
328 |
< |
PingFreq(aclass) = DEFAULT_PINGFREQUENCY; |
329 |
< |
MaxTotal(aclass) = MAXIMUM_LINKS_DEFAULT; |
330 |
< |
MaxSendq(aclass) = DEFAULT_SENDQ; |
327 |
> |
aclass->con_freq = DEFAULT_CONNECTFREQUENCY; |
328 |
> |
aclass->ping_freq = DEFAULT_PINGFREQUENCY; |
329 |
> |
aclass->max_total = MAXIMUM_LINKS_DEFAULT; |
330 |
> |
aclass->max_sendq = DEFAULT_SENDQ; |
331 |
|
|
332 |
|
break; |
333 |
|
|
701 |
|
classitem = map_to_conf(conf); |
702 |
|
sendto_one(source_p, form_str(RPL_STATSYLINE), |
703 |
|
me.name, source_p->name, 'Y', |
704 |
< |
conf->name, PingFreq(classitem), |
705 |
< |
ConFreq(classitem), |
706 |
< |
MaxTotal(classitem), MaxSendq(classitem), |
707 |
< |
CurrUserCount(classitem), |
704 |
> |
conf->name, classitem->ping_freq, |
705 |
> |
classitem->con_freq, |
706 |
> |
classitem->max_total, classitem->max_sendq, |
707 |
> |
classitem->curr_user_count, |
708 |
|
classitem->active ? "active" : "disabled"); |
709 |
|
} |
710 |
|
break; |
1014 |
|
* setting a_limit_reached if any limit is reached. |
1015 |
|
* - Dianora |
1016 |
|
*/ |
1017 |
< |
if (MaxTotal(aclass) != 0 && CurrUserCount(aclass) >= MaxTotal(aclass)) |
1017 |
> |
if (aclass->max_total != 0 && aclass->curr_user_count >= aclass->max_total) |
1018 |
|
a_limit_reached = 1; |
1019 |
< |
else if (MaxPerIp(aclass) != 0 && ip_found->count > MaxPerIp(aclass)) |
1019 |
> |
else if (aclass->max_perip != 0 && ip_found->count > aclass->max_perip) |
1020 |
|
a_limit_reached = 1; |
1021 |
< |
else if (MaxLocal(aclass) != 0 && local >= MaxLocal(aclass)) |
1021 |
> |
else if (aclass->max_local != 0 && local >= aclass->max_local) |
1022 |
|
a_limit_reached = 1; |
1023 |
< |
else if (MaxGlobal(aclass) != 0 && global >= MaxGlobal(aclass)) |
1023 |
> |
else if (aclass->max_global != 0 && global >= aclass->max_global) |
1024 |
|
a_limit_reached = 1; |
1025 |
< |
else if (MaxIdent(aclass) != 0 && ident >= MaxIdent(aclass) && |
1025 |
> |
else if (aclass->max_ident != 0 && ident >= aclass->max_ident && |
1026 |
|
client_p->username[0] != '~') |
1027 |
|
a_limit_reached = 1; |
1028 |
|
|
1305 |
|
|
1306 |
|
assert(aconf->clients > 0); |
1307 |
|
|
1308 |
< |
if ((aclass_conf = ClassPtr(aconf)) != NULL) |
1308 |
> |
if ((aclass_conf = aconf->class_ptr) != NULL) |
1309 |
|
{ |
1310 |
|
aclass = map_to_conf(aclass_conf); |
1311 |
|
|
1371 |
|
&client_p->localClient->ip, aclass)) |
1372 |
|
return TOO_MANY; /* Already at maximum allowed */ |
1373 |
|
|
1374 |
< |
CurrUserCount(aclass)++; |
1374 |
> |
aclass->curr_user_count++; |
1375 |
|
aconf->clients++; |
1376 |
|
} |
1377 |
|
else if (conf->type == HUB_TYPE || conf->type == LEAF_TYPE) |
1467 |
|
{ |
1468 |
|
struct ClassItem *aclass = map_to_conf(aconf->class_ptr); |
1469 |
|
|
1470 |
< |
if (aconf->clients >= MaxTotal(aclass)) |
1470 |
> |
if (aconf->clients >= aclass->max_total) |
1471 |
|
continue; |
1472 |
|
} |
1473 |
|
|
2724 |
|
if (aconf->class_ptr != NULL) |
2725 |
|
{ |
2726 |
|
aclass = (struct ClassItem *)map_to_conf(aconf->class_ptr); |
2727 |
< |
*pingwarn = PingWarning(aclass); |
2728 |
< |
return PingFreq(aclass); |
2727 |
> |
*pingwarn = aclass->ping_warning; |
2728 |
> |
return aclass->ping_freq; |
2729 |
|
} |
2730 |
|
} |
2731 |
|
|
2829 |
|
{ |
2830 |
|
struct ClassItem *aclass = map_to_conf(ptr->data); |
2831 |
|
|
2832 |
< |
if (!aclass->active && !CurrUserCount(aclass)) |
2832 |
> |
if (!aclass->active && !aclass->curr_user_count) |
2833 |
|
{ |
2834 |
|
destroy_cidr_class(aclass); |
2835 |
|
delete_conf_item(ptr->data); |
2853 |
|
aclass = map_to_conf(class_default); |
2854 |
|
aclass->active = 1; |
2855 |
|
DupString(class_default->name, "default"); |
2856 |
< |
ConFreq(aclass) = DEFAULT_CONNECTFREQUENCY; |
2857 |
< |
PingFreq(aclass) = DEFAULT_PINGFREQUENCY; |
2858 |
< |
MaxTotal(aclass) = MAXIMUM_LINKS_DEFAULT; |
2859 |
< |
MaxSendq(aclass) = DEFAULT_SENDQ; |
2856 |
> |
aclass->con_freq = DEFAULT_CONNECTFREQUENCY; |
2857 |
> |
aclass->ping_freq = DEFAULT_PINGFREQUENCY; |
2858 |
> |
aclass->max_total = MAXIMUM_LINKS_DEFAULT; |
2859 |
> |
aclass->max_sendq = DEFAULT_SENDQ; |
2860 |
|
|
2861 |
|
client_check_cb = register_callback("check_client", check_client); |
2862 |
|
} |
2889 |
|
if ((class_conf = aconf->class_ptr) == NULL) |
2890 |
|
continue; |
2891 |
|
aclass = (struct ClassItem *)map_to_conf(class_conf); |
2892 |
< |
sendq = MaxSendq(aclass); |
2892 |
> |
sendq = aclass->max_sendq; |
2893 |
|
return sendq; |
2894 |
|
} |
2895 |
|
} |
3568 |
|
dlink_node *ptr = NULL; |
3569 |
|
struct CidrItem *cidr; |
3570 |
|
|
3571 |
< |
if (NumberPerCidr(aclass) <= 0) |
3571 |
> |
if (aclass->number_per_cidr <= 0) |
3572 |
|
return 0; |
3573 |
|
|
3574 |
|
if (ip->ss.ss_family == AF_INET) |
3575 |
|
{ |
3576 |
< |
if (CidrBitlenIPV4(aclass) <= 0) |
3576 |
> |
if (aclass->cidr_bitlen_ipv4 <= 0) |
3577 |
|
return 0; |
3578 |
|
|
3579 |
|
DLINK_FOREACH(ptr, aclass->list_ipv4.head) |
3580 |
|
{ |
3581 |
|
cidr = ptr->data; |
3582 |
< |
if (match_ipv4(ip, &cidr->mask, CidrBitlenIPV4(aclass))) |
3582 |
> |
if (match_ipv4(ip, &cidr->mask, aclass->cidr_bitlen_ipv4)) |
3583 |
|
{ |
3584 |
< |
if (!over_rule && (cidr->number_on_this_cidr >= NumberPerCidr(aclass))) |
3584 |
> |
if (!over_rule && (cidr->number_on_this_cidr >= aclass->number_per_cidr)) |
3585 |
|
return -1; |
3586 |
|
cidr->number_on_this_cidr++; |
3587 |
|
return 0; |
3590 |
|
cidr = MyMalloc(sizeof(struct CidrItem)); |
3591 |
|
cidr->number_on_this_cidr = 1; |
3592 |
|
cidr->mask = *ip; |
3593 |
< |
mask_addr(&cidr->mask, CidrBitlenIPV4(aclass)); |
3593 |
> |
mask_addr(&cidr->mask, aclass->cidr_bitlen_ipv4); |
3594 |
|
dlinkAdd(cidr, &cidr->node, &aclass->list_ipv4); |
3595 |
|
} |
3596 |
|
#ifdef IPV6 |
3597 |
< |
else if (CidrBitlenIPV6(aclass) > 0) |
3597 |
> |
else if (aclass->cidr_bitlen_ipv6 > 0) |
3598 |
|
{ |
3599 |
|
DLINK_FOREACH(ptr, aclass->list_ipv6.head) |
3600 |
|
{ |
3601 |
|
cidr = ptr->data; |
3602 |
< |
if (match_ipv6(ip, &cidr->mask, CidrBitlenIPV6(aclass))) |
3602 |
> |
if (match_ipv6(ip, &cidr->mask, aclass->cidr_bitlen_ipv6)) |
3603 |
|
{ |
3604 |
< |
if (!over_rule && (cidr->number_on_this_cidr >= NumberPerCidr(aclass))) |
3604 |
> |
if (!over_rule && (cidr->number_on_this_cidr >= aclass->number_per_cidr)) |
3605 |
|
return -1; |
3606 |
|
cidr->number_on_this_cidr++; |
3607 |
|
return 0; |
3610 |
|
cidr = MyMalloc(sizeof(struct CidrItem)); |
3611 |
|
cidr->number_on_this_cidr = 1; |
3612 |
|
cidr->mask = *ip; |
3613 |
< |
mask_addr(&cidr->mask, CidrBitlenIPV6(aclass)); |
3613 |
> |
mask_addr(&cidr->mask, aclass->cidr_bitlen_ipv6); |
3614 |
|
dlinkAdd(cidr, &cidr->node, &aclass->list_ipv6); |
3615 |
|
} |
3616 |
|
#endif |
3632 |
|
dlink_node *next_ptr = NULL; |
3633 |
|
struct CidrItem *cidr; |
3634 |
|
|
3635 |
< |
if (NumberPerCidr(aclass) == 0) |
3635 |
> |
if (aclass->number_per_cidr == 0) |
3636 |
|
return; |
3637 |
|
|
3638 |
|
if (ip->ss.ss_family == AF_INET) |
3639 |
|
{ |
3640 |
< |
if (CidrBitlenIPV4(aclass) <= 0) |
3640 |
> |
if (aclass->cidr_bitlen_ipv4 <= 0) |
3641 |
|
return; |
3642 |
|
|
3643 |
|
DLINK_FOREACH_SAFE(ptr, next_ptr, aclass->list_ipv4.head) |
3644 |
|
{ |
3645 |
|
cidr = ptr->data; |
3646 |
< |
if (match_ipv4(ip, &cidr->mask, CidrBitlenIPV4(aclass))) |
3646 |
> |
if (match_ipv4(ip, &cidr->mask, aclass->cidr_bitlen_ipv4)) |
3647 |
|
{ |
3648 |
|
cidr->number_on_this_cidr--; |
3649 |
|
if (cidr->number_on_this_cidr == 0) |
3656 |
|
} |
3657 |
|
} |
3658 |
|
#ifdef IPV6 |
3659 |
< |
else if (CidrBitlenIPV6(aclass) > 0) |
3659 |
> |
else if (aclass->cidr_bitlen_ipv6 > 0) |
3660 |
|
{ |
3661 |
|
DLINK_FOREACH_SAFE(ptr, next_ptr, aclass->list_ipv6.head) |
3662 |
|
{ |
3663 |
|
cidr = ptr->data; |
3664 |
< |
if (match_ipv6(ip, &cidr->mask, CidrBitlenIPV6(aclass))) |
3664 |
> |
if (match_ipv6(ip, &cidr->mask, aclass->cidr_bitlen_ipv6)) |
3665 |
|
{ |
3666 |
|
cidr->number_on_this_cidr--; |
3667 |
|
if (cidr->number_on_this_cidr == 0) |
3724 |
|
{ |
3725 |
|
struct ClassItem *old_class = map_to_conf(conf); |
3726 |
|
|
3727 |
< |
if (NumberPerCidr(old_class) > 0 && NumberPerCidr(new_class) > 0) |
3727 |
> |
if (old_class->number_per_cidr > 0 && new_class->number_per_cidr > 0) |
3728 |
|
{ |
3729 |
< |
if (CidrBitlenIPV4(old_class) > 0 && CidrBitlenIPV4(new_class) > 0) |
3729 |
> |
if (old_class->cidr_bitlen_ipv4 > 0 && new_class->cidr_bitlen_ipv4 > 0) |
3730 |
|
rebuild_cidr_list(AF_INET, conf, new_class, |
3731 |
|
&old_class->list_ipv4, &new_class->list_ipv4, |
3732 |
< |
CidrBitlenIPV4(old_class) != CidrBitlenIPV4(new_class)); |
3732 |
> |
old_class->cidr_bitlen_ipv4 != new_class->cidr_bitlen_ipv4); |
3733 |
|
|
3734 |
|
#ifdef IPV6 |
3735 |
< |
if (CidrBitlenIPV6(old_class) > 0 && CidrBitlenIPV6(new_class) > 0) |
3735 |
> |
if (old_class->cidr_bitlen_ipv6 > 0 && new_class->cidr_bitlen_ipv6 > 0) |
3736 |
|
rebuild_cidr_list(AF_INET6, conf, new_class, |
3737 |
|
&old_class->list_ipv6, &new_class->list_ipv6, |
3738 |
< |
CidrBitlenIPV6(old_class) != CidrBitlenIPV6(new_class)); |
3738 |
> |
old_class->cidr_bitlen_ipv6 != new_class->cidr_bitlen_ipv6); |
3739 |
|
#endif |
3740 |
|
} |
3741 |
|
|