summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bgpd/parse.y')
-rw-r--r--usr.sbin/bgpd/parse.y62
1 files changed, 61 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index 8e3ef2cf638..8e13288efcb 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.151 2005/03/13 15:27:30 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.152 2005/03/14 17:32:04 claudio Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -1134,18 +1134,78 @@ filter_set_opt : LOCALPREF number {
$$->type = ACTION_SET_LOCALPREF;
$$->action.metric = $2;
}
+ | LOCALPREF '+' number {
+ if ($3 > INT_MAX) {
+ yyerror("metric to small: max %u", INT_MAX);
+ YYERROR;
+ }
+ if (($$ = calloc(1, sizeof(struct filter_set))) == NULL)
+ fatal(NULL);
+ $$->type = ACTION_SET_RELATIVE_LOCALPREF;
+ $$->action.relative = $3;
+ }
+ | LOCALPREF '-' number {
+ if ($3 > INT_MAX) {
+ yyerror("metric to small: min -%u", INT_MAX);
+ YYERROR;
+ }
+ if (($$ = calloc(1, sizeof(struct filter_set))) == NULL)
+ fatal(NULL);
+ $$->type = ACTION_SET_RELATIVE_LOCALPREF;
+ $$->action.relative = -$3;
+ }
| MED number {
if (($$ = calloc(1, sizeof(struct filter_set))) == NULL)
fatal(NULL);
$$->type = ACTION_SET_MED;
$$->action.metric = $2;
}
+ | MED '+' number {
+ if ($3 > INT_MAX) {
+ yyerror("metric to small: max %u", INT_MAX);
+ YYERROR;
+ }
+ if (($$ = calloc(1, sizeof(struct filter_set))) == NULL)
+ fatal(NULL);
+ $$->type = ACTION_SET_RELATIVE_MED;
+ $$->action.metric = $3;
+ }
+ | MED '-' number {
+ if ($3 > INT_MAX) {
+ yyerror("metric to small: min -%u", INT_MAX);
+ YYERROR;
+ }
+ if (($$ = calloc(1, sizeof(struct filter_set))) == NULL)
+ fatal(NULL);
+ $$->type = ACTION_SET_RELATIVE_MED;
+ $$->action.relative = -$3;
+ }
| METRIC number { /* alias for MED */
if (($$ = calloc(1, sizeof(struct filter_set))) == NULL)
fatal(NULL);
$$->type = ACTION_SET_MED;
$$->action.metric = $2;
}
+ | METRIC '+' number {
+ if ($3 > INT_MAX) {
+ yyerror("metric to small: max %u", INT_MAX);
+ YYERROR;
+ }
+ if (($$ = calloc(1, sizeof(struct filter_set))) == NULL)
+ fatal(NULL);
+ $$->type = ACTION_SET_RELATIVE_MED;
+ $$->action.metric = $3;
+ }
+ | METRIC '-' number {
+ if ($3 > INT_MAX) {
+ yyerror("metric to small: min -%u", INT_MAX);
+ YYERROR;
+ }
+ if (($$ = calloc(1, sizeof(struct filter_set))) == NULL)
+ fatal(NULL);
+ $$->type = ACTION_SET_RELATIVE_MED;
+ $$->action.relative = -$3;
+ }
| NEXTHOP address {
if (($$ = calloc(1, sizeof(struct filter_set))) == NULL)
fatal(NULL);