Lines Matching refs:res

127 	restrict_u *	res,  in dump_restrict()  argument
135 inet_ntop(AF_INET6, &res->u.v6.addr, as, sizeof as); in dump_restrict()
136 inet_ntop(AF_INET6, &res->u.v6.mask, ms, sizeof ms); in dump_restrict()
138 struct in_addr sia = { htonl(res->u.v4.addr) }; in dump_restrict()
139 struct in_addr sim = { htonl(res->u.v4.mask) }; in dump_restrict()
145 res, as, ms, res->count, res->rflags, res->mflags, in dump_restrict()
146 res->ippeerlimit, res->expire, res->link); in dump_restrict()
157 restrict_u * res; in dump_restricts() local
162 for (res = &restrict_def4; res != NULL; res = next) { in dump_restricts()
163 dump_restrict(res, 0); in dump_restricts()
164 next = res->link; in dump_restricts()
168 for (res = &restrict_def6; res != NULL; res = next) { in dump_restricts()
169 dump_restrict(res, 1); in dump_restricts()
170 next = res->link; in dump_restricts()
175 for (res = restrictlist4; res != NULL; res = next) { in dump_restricts()
176 dump_restrict(res, 0); in dump_restricts()
177 next = res->link; in dump_restricts()
182 for (res = restrictlist6; res != NULL; res = next) { in dump_restricts()
183 dump_restrict(res, 1); in dump_restricts()
184 next = res->link; in dump_restricts()
240 restrict_u * res; in alloc_res4() local
243 UNLINK_HEAD_SLIST(res, resfree4, link); in alloc_res4()
244 if (res != NULL) in alloc_res4()
245 return res; in alloc_res4()
249 res = (void *)((char *)rl + (count - 1) * cb); in alloc_res4()
251 LINK_SLIST(resfree4, res, link); in alloc_res4()
252 res = (void *)((char *)res - cb); in alloc_res4()
254 INSIST(rl == res); in alloc_res4()
256 return res; in alloc_res4()
266 restrict_u * res; in alloc_res6() local
269 UNLINK_HEAD_SLIST(res, resfree6, link); in alloc_res6()
270 if (res != NULL) in alloc_res6()
271 return res; in alloc_res6()
275 res = (void *)((char *)rl + (count - 1) * cb); in alloc_res6()
277 LINK_SLIST(resfree6, res, link); in alloc_res6()
278 res = (void *)((char *)res - cb); in alloc_res6()
280 INSIST(rl == res); in alloc_res6()
282 return res; in alloc_res6()
288 restrict_u * res, in free_res() argument
296 if (RES_LIMITED & res->rflags) in free_res()
303 UNLINK_SLIST(unlinked, *plisthead, res, link, restrict_u); in free_res()
304 INSIST(unlinked == res); in free_res()
307 zero_mem(res, V6_SIZEOF_RESTRICT_U); in free_res()
310 zero_mem(res, V4_SIZEOF_RESTRICT_U); in free_res()
313 LINK_SLIST(*plisthead, res, link); in free_res()
342 restrict_u * res; in match_restrict4_addr() local
345 for (res = restrictlist4; res != NULL; res = next) { in match_restrict4_addr()
346 struct in_addr sia = { htonl(res->u.v4.addr) }; in match_restrict4_addr()
348 next = res->link; in match_restrict4_addr()
351 if ( res->expire in match_restrict4_addr()
352 && res->expire <= current_time) in match_restrict4_addr()
353 free_res(res, v6); /* zeroes the contents */ in match_restrict4_addr()
354 if ( res->u.v4.addr == (addr & res->u.v4.mask) in match_restrict4_addr()
355 && ( !(RESM_NTPONLY & res->mflags) in match_restrict4_addr()
357 DPRINTF(2, ("MATCH: ippeerlimit %d\n", res->ippeerlimit)); in match_restrict4_addr()
360 DPRINTF(2, ("doesn't match: ippeerlimit %d\n", res->ippeerlimit)); in match_restrict4_addr()
362 return res; in match_restrict4_addr()
373 restrict_u * res; in match_restrict6_addr() local
377 for (res = restrictlist6; res != NULL; res = next) { in match_restrict6_addr()
378 next = res->link; in match_restrict6_addr()
379 INSIST(next != res); in match_restrict6_addr()
380 if (res->expire && in match_restrict6_addr()
381 res->expire <= current_time) in match_restrict6_addr()
382 free_res(res, v6); in match_restrict6_addr()
383 MASK_IPV6_ADDR(&masked, addr, &res->u.v6.mask); in match_restrict6_addr()
384 if (ADDR6_EQ(&masked, &res->u.v6.addr) in match_restrict6_addr()
385 && (!(RESM_NTPONLY & res->mflags) in match_restrict6_addr()
389 return res; in match_restrict6_addr()
408 restrict_u *res; in match_restrict_entry() local
420 for (res = rlist; res != NULL; res = res->link) in match_restrict_entry()
421 if (res->mflags == pmatch->mflags && in match_restrict_entry()
422 !memcmp(&res->u, &pmatch->u, cb)) in match_restrict_entry()
424 return res; in match_restrict_entry()
611 restrict_u * res; in hack_restrict() local
632 res = NULL; in hack_restrict()
663 res = match_restrict_entry(&match, v6); in hack_restrict()
672 if (NULL == res) { in hack_restrict()
674 res = alloc_res6(); in hack_restrict()
675 memcpy(res, &match, in hack_restrict()
679 res = alloc_res4(); in hack_restrict()
680 memcpy(res, &match, in hack_restrict()
685 *plisthead, res, in hack_restrict()
687 ? res_sorts_before6(res, L_S_S_CUR()) in hack_restrict()
688 : res_sorts_before4(res, L_S_S_CUR()), in hack_restrict()
695 && !(RES_LIMITED & res->rflags)) in hack_restrict()
697 res->rflags |= rflags; in hack_restrict()
700 res->ippeerlimit = match.ippeerlimit; in hack_restrict()
709 if (res != NULL) { in hack_restrict()
710 if ( (RES_LIMITED & res->rflags) in hack_restrict()
713 res->rflags &= ~rflags; in hack_restrict()
724 if (res != NULL in hack_restrict()
726 || !(RESM_INTERFACE & res->mflags)) in hack_restrict()
727 && res != &restrict_def4 in hack_restrict()
728 && res != &restrict_def6) in hack_restrict()
729 free_res(res, v6); in hack_restrict()
752 restrict_u * res; in restrict_source() local
779 res = match_restrict4_addr(SRCADR(addr), SRCPORT(addr)); in restrict_source()
780 INSIST(res != NULL); in restrict_source()
781 found_specific = (SRCADR(&onesmask) == res->u.v4.mask); in restrict_source()
783 res = match_restrict6_addr(&SOCK_ADDR6(addr), in restrict_source()
785 INSIST(res != NULL); in restrict_source()
786 found_specific = ADDR6_EQ(&res->u.v6.mask, in restrict_source()
789 if (!expire && found_specific && res->expire) { in restrict_source()
791 free_res(res, IS_IPV6(addr)); in restrict_source()