summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2002-12-13 21:51:26 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2002-12-13 21:51:26 +0000
commit7b65947518598beacf61b63ae8b73b5c48d03be9 (patch)
treeefdf81daa744e119861129fa8a2bc39f78077644
parent74b65e1212e5b69c99fd0132a289ec8a4be28e01 (diff)
allow a second queue for higher priorized (currently: tos=lowdelay) packets
to be specified per rule queue (qname, priorized_qname) idea dhartmei ok dhartmei@ frantzen@ deraadt@
-rw-r--r--sbin/pfctl/parse.y48
-rw-r--r--sbin/pfctl/pfctl_parser.c8
2 files changed, 40 insertions, 16 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index 8ca1a18c3eb..7731b787a28 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.253 2002/12/13 20:02:40 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.254 2002/12/13 21:51:25 henning Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -177,6 +177,11 @@ struct node_queue_bw {
u_int16_t bw_percent;
};
+struct node_qassign {
+ char *qname;
+ char *pqname;
+};
+
struct filter_opts {
int marker;
#define FOM_FLAGS 0x01
@@ -200,7 +205,7 @@ struct filter_opts {
int fragment;
int allowopts;
char *label;
- char *qname;
+ struct node_qassign queues;
} filter_opts;
struct scrub_opts {
@@ -339,6 +344,7 @@ typedef struct {
struct node_queue *queue;
struct node_queue_opt queue_options;
struct node_queue_bw queue_bwspec;
+ struct node_qassign qassign;
struct filter_opts filter_opts;
struct queue_opts queue_opts;
struct scrub_opts scrub_opts;
@@ -401,7 +407,7 @@ typedef struct {
%type <v.state_opt> state_opt_spec state_opt_list state_opt_item
%type <v.logquick> logquick
%type <v.interface> antispoof_ifspc antispoof_iflst
-%type <v.string> qname
+%type <v.qassign> qname
%type <v.queue> qassign qassign_list qassign_item
%type <v.queue_options> scheduler
%type <v.number> cbqflags_list cbqflags_item
@@ -1049,14 +1055,23 @@ pfrule : action dir logquick interface route af proto fromto
free($9.label);
}
- if ($9.qname) {
- if (strlcpy(r.qname, $9.qname,
+ if ($9.queues.qname != NULL) {
+ if (strlcpy(r.qname, $9.queues.qname,
sizeof(r.qname)) >= PF_QNAME_SIZE) {
yyerror("rule qname too long (max "
"%d chars)", PF_QNAME_SIZE-1);
YYERROR;
}
- free($9.qname);
+ free($9.queues.qname);
+ }
+ if ($9.queues.pqname != NULL) {
+ if (strlcpy(r.pqname, $9.queues.pqname,
+ sizeof(r.pqname)) >= PF_QNAME_SIZE) {
+ yyerror("rule pqname too long (max "
+ "%d chars)", PF_QNAME_SIZE-1);
+ YYERROR;
+ }
+ free($9.queues.pqname);
}
expand_rule(&r, $4, $5.host, $7,
@@ -1138,11 +1153,11 @@ filter_opt : USER uids {
filter_opts.label = $1;
}
| qname {
- if (filter_opts.qname) {
+ if (filter_opts.queues.qname) {
yyerror("queue cannot be redefined");
YYERROR;
}
- filter_opts.qname = $1;
+ filter_opts.queues = $1;
}
;
@@ -1858,11 +1873,18 @@ label : LABEL STRING {
}
;
-qname : QUEUE STRING {
- if (($$ = strdup($2)) == NULL) {
- yyerror("qname strdup() failed");
- YYERROR;
- }
+qname : QUEUE STRING {
+ if (($$.qname = strdup($2)) == NULL)
+ err(1, "qname strdup() failed");
+ }
+ | QUEUE '(' STRING ')' {
+ if (($$.qname = strdup($3)) == NULL)
+ err(1, "qname strdup() failed");
+ }
+ | QUEUE '(' STRING comma STRING ')' {
+ if (($$.qname = strdup($3)) == NULL ||
+ ($$.pqname = strdup($5)) == NULL)
+ err(1, "qname strdup() failed");
}
;
diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c
index 08eeef41a96..ff3c364a167 100644
--- a/sbin/pfctl/pfctl_parser.c
+++ b/sbin/pfctl/pfctl_parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_parser.c,v 1.120 2002/12/07 23:15:53 dhartmei Exp $ */
+/* $OpenBSD: pfctl_parser.c,v 1.121 2002/12/13 21:51:25 henning Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -887,8 +887,10 @@ print_rule(struct pf_rule *r, int verbose)
}
if (r->label[0])
printf("label %s ", r->label);
- if (r->qname[0])
- printf("queue %s", r->qname);
+ if (r->qname[0] && r->pqname[0])
+ printf("queue(%s, %s) ", r->qname, r->pqname);
+ else if (r->qname[0])
+ printf("queue %s ", r->qname);
printf("\n");
}