summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/bgpd/bgpd.h3
-rw-r--r--usr.sbin/bgpd/parse.y34
-rw-r--r--usr.sbin/bgpd/rde.c5
3 files changed, 21 insertions, 21 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index 9a43575cc1c..801c649948b 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.98 2004/02/24 15:43:03 claudio Exp $ */
+/* $OpenBSD: bgpd.h,v 1.99 2004/02/26 09:53:58 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -157,6 +157,7 @@ struct peer_config {
struct network_config {
struct bgpd_addr prefix;
u_int8_t prefixlen;
+ struct filter_set attrset;
};
TAILQ_HEAD(network_head, network);
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index 75b42ad9c5a..ccd3386b085 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.60 2004/02/25 19:48:18 claudio Exp $ */
+/* $OpenBSD: parse.y,v 1.61 2004/02/26 09:53:58 claudio Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -213,7 +213,7 @@ conf_main : AS number {
else
YYERROR;
}
- | NETWORK address '/' number {
+ | NETWORK address '/' number filter_set {
struct network *n;
if ((n = calloc(1, sizeof(struct network))) == NULL)
@@ -224,6 +224,9 @@ conf_main : AS number {
YYERROR;
}
n->net.prefixlen = $4;
+ memcpy(&n->net.attrset, &$5,
+ sizeof(n->net.attrset));
+
TAILQ_INSERT_TAIL(netconf, n, network_l);
}
| DUMP TABLE STRING optnumber {
@@ -429,8 +432,12 @@ peeropts : REMOTEAS number {
strtoul(s, NULL, 16);
}
}
- | filter_set {
- memcpy(&curpeer->conf.attrset, &$1,
+ | SET filter_set_opt {
+ memcpy(&curpeer->conf.attrset, &$2,
+ sizeof(curpeer->conf.attrset));
+ }
+ | SET optnl "{" optnl filter_set_l optnl "}" {
+ memcpy(&curpeer->conf.attrset, &$5,
sizeof(curpeer->conf.attrset));
}
| mrtdump
@@ -448,20 +455,6 @@ filterrule : action quick direction filter_peer filter_match filter_set
if (expand_rule(&r, &$4, &$5, &$6) == -1)
YYERROR;
}
- | action quick direction filter_peer filter_match
- {
- struct filter_rule r;
- struct filter_set set;
-
- bzero(&r, sizeof(r));
- bzero(&set, sizeof(set));
- r.action = $1;
- r.quick = $2;
- r.dir = $3;
-
- if (expand_rule(&r, &$4, &$5, &set) == -1)
- YYERROR;
- }
;
action : ALLOW { $$ = ACTION_ALLOW; }
@@ -581,7 +574,10 @@ filter_as : AS { $$ = AS_ALL; }
| TRANSITAS { $$ = AS_TRANSIT; }
;
-filter_set : SET filter_set_opt { $$ = $2; }
+filter_set : /* empty */ {
+ bzero(&$$, sizeof($$));
+ }
+ | SET filter_set_opt { $$ = $2; }
| SET optnl "{" optnl filter_set_l optnl "}" { $$ = $5; }
;
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index 29bd7828fa4..83b93321053 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.86 2004/02/25 19:48:18 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.87 2004/02/26 09:53:58 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -894,6 +894,9 @@ network_add(struct network_config *nc)
attrs.origin = ORIGIN_IGP;
TAILQ_INIT(&attrs.others);
+ /* apply default overrides */
+ rde_apply_set(&attrs, &nc->attrset);
+
path_update(&peerself, &attrs, &nc->prefix, nc->prefixlen);
}