636 |
struct AddressRec * |
struct AddressRec * |
637 |
add_conf_by_address(const unsigned int type, struct MaskItem *conf) |
add_conf_by_address(const unsigned int type, struct MaskItem *conf) |
638 |
{ |
{ |
639 |
const char *address; |
const char *hostname = conf->host; |
640 |
const char *username; |
const char *username = conf->user; |
641 |
static unsigned int prec_value = 0xFFFFFFFF; |
static unsigned int prec_value = 0xFFFFFFFF; |
642 |
int bits = 0; |
int bits = 0; |
643 |
struct AddressRec *arec; |
struct AddressRec *arec = NULL; |
644 |
|
|
645 |
address = conf->host; |
assert(type && hostname); |
|
username = conf->user; |
|
|
|
|
|
assert(type); |
|
|
|
|
|
if (EmptyString(address)) |
|
|
address = "/NOMATCH!/"; |
|
646 |
|
|
647 |
arec = MyMalloc(sizeof(struct AddressRec)); |
arec = MyMalloc(sizeof(struct AddressRec)); |
648 |
arec->masktype = parse_netmask(address, &arec->Mask.ipa.addr, &bits); |
arec->masktype = parse_netmask(hostname, &arec->Mask.ipa.addr, &bits); |
649 |
arec->Mask.ipa.bits = bits; |
arec->Mask.ipa.bits = bits; |
650 |
arec->username = username; |
arec->username = username; |
651 |
arec->conf = conf; |
arec->conf = conf; |
667 |
break; |
break; |
668 |
#endif |
#endif |
669 |
default: /* HM_HOST */ |
default: /* HM_HOST */ |
670 |
arec->Mask.hostname = address; |
arec->Mask.hostname = hostname; |
671 |
dlinkAdd(arec, &arec->node, &atable[get_mask_hash(address)]); |
dlinkAdd(arec, &arec->node, &atable[get_mask_hash(hostname)]); |
672 |
break; |
break; |
673 |
} |
} |
674 |
|
|