-/* $OpenBSD: pf_table.c,v 1.134 2020/07/28 16:47:41 yasuoka Exp $ */
+/* $OpenBSD: pf_table.c,v 1.135 2021/10/23 09:36:58 sashan Exp $ */
/*
* Copyright (c) 2002 Cedric Berger
copyout((from), (to), (size)) : \
(bcopy((from), (to), (size)), 0))
-#define YIELD(cnt, ok) \
- sched_pause(preempt)
+#define YIELD(ok) \
+ do { \
+ if (ok) \
+ sched_pause(preempt); \
+ } while (0)
#define FILLIN_SIN(sin, addr) \
do { \
return (ENOMEM);
SLIST_INIT(&workq);
for (i = 0; i < size; i++) {
- YIELD(i, flags & PFR_FLAG_USERIOCTL);
+ YIELD(flags & PFR_FLAG_USERIOCTL);
if (COPYIN(addr+i, &ad, sizeof(ad), flags))
senderr(EFAULT);
if (pfr_validate_addr(&ad))
} else {
/* iterate over addresses to delete */
for (i = 0; i < size; i++) {
- YIELD(i, flags & PFR_FLAG_USERIOCTL);
+ YIELD(flags & PFR_FLAG_USERIOCTL);
if (COPYIN(addr+i, &ad, sizeof(ad), flags))
return (EFAULT);
if (pfr_validate_addr(&ad))
}
SLIST_INIT(&workq);
for (i = 0; i < size; i++) {
- YIELD(i, flags & PFR_FLAG_USERIOCTL);
+ YIELD(flags & PFR_FLAG_USERIOCTL);
if (COPYIN(addr+i, &ad, sizeof(ad), flags))
senderr(EFAULT);
if (pfr_validate_addr(&ad))
SLIST_INIT(&delq);
SLIST_INIT(&changeq);
for (i = 0; i < size; i++) {
- YIELD(i, flags & PFR_FLAG_USERIOCTL);
+ YIELD(flags & PFR_FLAG_USERIOCTL);
if (COPYIN(addr+i, &ad, sizeof(ad), flags))
senderr(EFAULT);
if (pfr_validate_addr(&ad))
return (ESRCH);
for (i = 0; i < size; i++) {
- YIELD(i, flags & PFR_FLAG_USERIOCTL);
+ YIELD(flags & PFR_FLAG_USERIOCTL);
if (COPYIN(addr+i, &ad, sizeof(ad), flags))
return (EFAULT);
if (pfr_validate_addr(&ad))
return (ESRCH);
SLIST_INIT(&workq);
for (i = 0; i < size; i++) {
- YIELD(i, flags & PFR_FLAG_USERIOCTL);
+ YIELD(flags & PFR_FLAG_USERIOCTL);
if (COPYIN(addr+i, &ad, sizeof(ad), flags))
senderr(EFAULT);
if (pfr_validate_addr(&ad))
int i;
for (i = 0, p = SLIST_FIRST(workq); p != NULL; i++, p = q) {
- YIELD(i, 1);
+ YIELD(1);
q = SLIST_NEXT(p, pfrke_workq);
pfr_destroy_kentry(p);
}
if (p->pfrke_type == PFRKE_COST)
kt->pfrkt_refcntcost++;
pfr_ktable_winfo_update(kt, p);
- YIELD(n, 1);
+ YIELD(1);
}
kt->pfrkt_cnt += n;
}
SLIST_FOREACH(p, workq, pfrke_workq) {
pfr_unroute_kentry(kt, p);
++n;
- YIELD(n, 1);
+ YIELD(1);
if (p->pfrke_type == PFRKE_COST)
kt->pfrkt_refcntcost--;
}
int i;
for (i = 0; i < size; i++) {
- YIELD(i, flags & PFR_FLAG_USERIOCTL);
+ YIELD(flags & PFR_FLAG_USERIOCTL);
if (COPYIN(addr+i, &ad, sizeof(ad), flags))
break;
ad.pfra_fback = PFR_FB_NONE;
SLIST_INIT(&addq);
SLIST_INIT(&changeq);
for (i = 0; i < size; i++) {
- YIELD(i, flags & PFR_FLAG_USERIOCTL);
+ YIELD(flags & PFR_FLAG_USERIOCTL);
if (COPYIN(tbl+i, &key.pfrkt_t, sizeof(key.pfrkt_t), flags))
senderr(EFAULT);
if (pfr_validate_table(&key.pfrkt_t, PFR_TFLAG_USRMASK,
ACCEPT_FLAGS(flags, PFR_FLAG_DUMMY);
SLIST_INIT(&workq);
for (i = 0; i < size; i++) {
- YIELD(i, flags & PFR_FLAG_USERIOCTL);
+ YIELD(flags & PFR_FLAG_USERIOCTL);
if (COPYIN(tbl+i, &key.pfrkt_t, sizeof(key.pfrkt_t), flags))
return (EFAULT);
if (pfr_validate_table(&key.pfrkt_t, 0,
ACCEPT_FLAGS(flags, PFR_FLAG_DUMMY | PFR_FLAG_ADDRSTOO);
SLIST_INIT(&workq);
for (i = 0; i < size; i++) {
- YIELD(i, flags & PFR_FLAG_USERIOCTL);
+ YIELD(flags & PFR_FLAG_USERIOCTL);
if (COPYIN(tbl+i, &key.pfrkt_t, sizeof(key.pfrkt_t), flags))
return (EFAULT);
if (pfr_validate_table(&key.pfrkt_t, 0, 0))
return (EINVAL);
SLIST_INIT(&workq);
for (i = 0; i < size; i++) {
- YIELD(i, flags & PFR_FLAG_USERIOCTL);
+ YIELD(flags & PFR_FLAG_USERIOCTL);
if (COPYIN(tbl+i, &key.pfrkt_t, sizeof(key.pfrkt_t), flags))
return (EFAULT);
if (pfr_validate_table(&key.pfrkt_t, 0,
}
SLIST_INIT(&addrq);
for (i = 0; i < size; i++) {
- YIELD(i, flags & PFR_FLAG_USERIOCTL);
+ YIELD(flags & PFR_FLAG_USERIOCTL);
if (COPYIN(addr+i, &ad, sizeof(ad), flags))
senderr(EFAULT);
if (pfr_validate_addr(&ad))