summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/parse.y
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2005-06-29 09:43:27 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2005-06-29 09:43:27 +0000
commit594757d5f959a472146827a74c37df70dae806f1 (patch)
treeb9f724ee6b9b82a70fa8e500966f6bd069c79992 /usr.sbin/bgpd/parse.y
parent78885a9a4f071e782047df91843c9f08dfc7b24c (diff)
rtlabel support via filter sets. Just use "set rtlabel foobar" in filters
network and neighbor statements and the routes are labeled accordingly. While doing that fix some mem-leaks by introducing filterset_free() and remove the free on send option of send_filterset(). This took a bit longer because we need to carefully track the rtlabel id refcnts or bad things may happen on reloads. henning@ looks fine
Diffstat (limited to 'usr.sbin/bgpd/parse.y')
-rw-r--r--usr.sbin/bgpd/parse.y18
1 files changed, 16 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index b47d259100c..77feafffe5b 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.164 2005/06/09 15:32:03 claudio Exp $ */
+/* $OpenBSD: parse.y,v 1.165 2005/06/29 09:43:25 claudio Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -153,7 +153,7 @@ typedef struct {
%token CONNECTED STATIC
%token PREFIX PREFIXLEN SOURCEAS TRANSITAS COMMUNITY
%token SET LOCALPREF MED METRIC NEXTHOP REJECT BLACKHOLE NOMODIFY
-%token PREPEND_SELF PREPEND_PEER PFTABLE WEIGHT
+%token PREPEND_SELF PREPEND_PEER PFTABLE WEIGHT RTLABEL
%token ERROR
%token IPSEC ESP AH SPI IKE
%token <v.string> STRING
@@ -1357,6 +1357,19 @@ filter_set_opt : LOCALPREF number {
}
free($2);
}
+ | RTLABEL string {
+ if (($$ = calloc(1, sizeof(struct filter_set))) == NULL)
+ fatal(NULL);
+ $$->type = ACTION_RTLABEL;
+ if (strlcpy($$->action.rtlabel, $2,
+ sizeof($$->action.rtlabel)) >=
+ sizeof($$->action.rtlabel)) {
+ yyerror("rtlabel name too long");
+ free($2);
+ YYERROR;
+ }
+ free($2);
+ }
| COMMUNITY STRING {
if (($$ = calloc(1, sizeof(struct filter_set))) == NULL)
fatal(NULL);
@@ -1492,6 +1505,7 @@ lookup(char *s)
{ "route-collector", ROUTECOLL},
{ "route-reflector", REFLECTOR},
{ "router-id", ROUTERID},
+ { "rtlabel", RTLABEL},
{ "set", SET},
{ "source-as", SOURCEAS},
{ "spi", SPI},