summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/rde_decide.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2004-01-13 13:45:51 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2004-01-13 13:45:51 +0000
commit881b3b8bcfb0f8f0dfae84c16000b4266963a1a0 (patch)
tree26b7cdd3a950617a7baed9e20c4f4555d8f0509d /usr.sbin/bgpd/rde_decide.c
parent26cec58ff5c7c4ee8a5ba13f3e18da741e3d3e7d (diff)
Implement a max-prefix and a announce none | self | all neighbor statement.
The first limits the number of sent prefixes per peer the latter controls which prefix we do annouce to the neighbor. Another looks good from henning@
Diffstat (limited to 'usr.sbin/bgpd/rde_decide.c')
-rw-r--r--usr.sbin/bgpd/rde_decide.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/rde_decide.c b/usr.sbin/bgpd/rde_decide.c
index 35f20e972e0..78ae3e0c515 100644
--- a/usr.sbin/bgpd/rde_decide.c
+++ b/usr.sbin/bgpd/rde_decide.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_decide.c,v 1.18 2004/01/13 13:18:03 claudio Exp $ */
+/* $OpenBSD: rde_decide.c,v 1.19 2004/01/13 13:45:50 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -428,6 +428,22 @@ up_generate_updates(struct rde_peer *peer,
/* Do not send routes back to sender */
return;
+ /* announce type handling */
+ switch (peer->conf.announce_type) {
+ case ANNOUNCE_NONE:
+ return;
+ case ANNOUNCE_ALL:
+ break;
+ case ANNOUNCE_SELF:
+ /*
+ * pass only prefix that have a aspath count
+ * of zero this is equal to the ^$ regex.
+ */
+ if (old->aspath->flags.aspath->hdr.as_cnt != 0)
+ return;
+ break;
+ }
+
/* withdraw prefix */
p = calloc(1, sizeof(struct update_prefix));
if (p == NULL)
@@ -442,6 +458,22 @@ up_generate_updates(struct rde_peer *peer,
/* Do not send routes back to sender */
return;
+ /* announce type handling */
+ switch (peer->conf.announce_type) {
+ case ANNOUNCE_NONE:
+ return;
+ case ANNOUNCE_ALL:
+ break;
+ case ANNOUNCE_SELF:
+ /*
+ * pass only prefix that have a aspath count
+ * of zero this is equal to the ^$ regex.
+ */
+ if (new->aspath->flags.aspath->hdr.as_cnt != 0)
+ return;
+ break;
+ }
+
/* generate update */
p = calloc(1, sizeof(struct update_prefix));
if (p == NULL)