diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2016-01-14 12:05:52 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2016-01-14 12:05:52 +0000 |
commit | 5c6973b1f4c5b2d493f64f66dcb6344d205f6ba4 (patch) | |
tree | 40a44de2221834400d1d442060003f8bb98c323f /sbin/pfctl | |
parent | 760ace11e6ffc4748736f080e7b7ac0065399b1a (diff) |
detect multiple root queues on a single interface and give a nice error
message - beats "pfctl: DIOCXCOMMIT: Invalid argument".
from Nathanael Rensen <nathanael at list.polymorpheus.com>, 10x!
ok sthen phessler, commit reminder mikeb
Diffstat (limited to 'sbin/pfctl')
-rw-r--r-- | sbin/pfctl/pfctl.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 7366dffdbaf..933ac31d94b 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl.c,v 1.333 2016/01/05 22:51:38 benno Exp $ */ +/* $OpenBSD: pfctl.c,v 1.334 2016/01/14 12:05:51 henning Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -1119,6 +1119,16 @@ pfctl_add_queue(struct pfctl *pf, struct pf_queuespec *q) return (1); } + if (q->parent[0] == '\0') { + TAILQ_FOREACH(qi, &rootqs, entries) { + if (strcmp(q->ifname, qi->qs.ifname)) + continue; + printf("A root queue is already defined on %s\n", + qi->qs.ifname); + return (1); + } + } + if ((qi = calloc(1, sizeof(*qi))) == NULL) err(1, "calloc"); bcopy(q, &qi->qs, sizeof(qi->qs)); |