diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-04-12 14:32:02 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-04-12 14:32:02 +0000 |
commit | cf15ea6afd9afb2f756e819126b4db8ed244adf9 (patch) | |
tree | 44a92901de0895b80ab82145c4c9cc1aca114a48 /usr.sbin/bgpd/parse.y | |
parent | 69eb085e352c4a2ce2742b3774e248665379d0ac (diff) |
Introduce a per prefix weight. The weight is used to tip prefixes with equal
long AS pathes in one or the other direction. It weights a prefix at a very
late stage in the decision process. This is a nice bgpd feature to traffic
engineer networks where most AS pathes are equally long.
OK henning@
Diffstat (limited to 'usr.sbin/bgpd/parse.y')
-rw-r--r-- | usr.sbin/bgpd/parse.y | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index 0eddbd03158..a2d47a30084 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.157 2005/04/12 14:26:58 claudio Exp $ */ +/* $OpenBSD: parse.y,v 1.158 2005/04/12 14:32:00 claudio Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -152,7 +152,7 @@ typedef struct { %token FROM TO ANY %token PREFIX PREFIXLEN SOURCEAS TRANSITAS COMMUNITY %token SET LOCALPREF MED METRIC NEXTHOP REJECT BLACKHOLE NOMODIFY -%token PREPEND_SELF PREPEND_PEER PFTABLE +%token PREPEND_SELF PREPEND_PEER PFTABLE WEIGHT %token ERROR %token IPSEC ESP AH SPI IKE %token <v.string> STRING @@ -1206,6 +1206,32 @@ filter_set_opt : LOCALPREF number { $$->type = ACTION_SET_RELATIVE_MED; $$->action.relative = -$3; } + | WEIGHT number { + if (($$ = calloc(1, sizeof(struct filter_set))) == NULL) + fatal(NULL); + $$->type = ACTION_SET_WEIGHT; + $$->action.metric = $2; + } + | WEIGHT '+' number { + if ($3 > INT_MAX) { + yyerror("weight to big: max %u", INT_MAX); + YYERROR; + } + if (($$ = calloc(1, sizeof(struct filter_set))) == NULL) + fatal(NULL); + $$->type = ACTION_SET_RELATIVE_WEIGHT; + $$->action.metric = $3; + } + | WEIGHT '-' number { + if ($3 > INT_MAX) { + yyerror("weight to small: min -%u", INT_MAX); + YYERROR; + } + if (($$ = calloc(1, sizeof(struct filter_set))) == NULL) + fatal(NULL); + $$->type = ACTION_SET_RELATIVE_WEIGHT; + $$->action.relative = -$3; + } | NEXTHOP address { if (($$ = calloc(1, sizeof(struct filter_set))) == NULL) fatal(NULL); @@ -1417,7 +1443,8 @@ lookup(char *s) { "tcp", TCP}, { "to", TO}, { "transit-as", TRANSITAS}, - { "transparent-as", TRANSPARENT} + { "transparent-as", TRANSPARENT}, + { "weight", WEIGHT} }; const struct keywords *p; |