summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/rde_decide.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2004-01-17 19:35:37 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2004-01-17 19:35:37 +0000
commit0eb529cc1daeabd034c9b73afe31ea23ca92c3b5 (patch)
tree11adc3b098f54f3a8f6e276057376871e3e6e23d /usr.sbin/bgpd/rde_decide.c
parent4178e1c718887b538c0ca3a76328d50a17abfaea (diff)
Make it possible to announce own networks. In the RDE these prefixes are
attached to a pseudo peer and inserted like all other prefixes into the RIB. OK henning@
Diffstat (limited to 'usr.sbin/bgpd/rde_decide.c')
-rw-r--r--usr.sbin/bgpd/rde_decide.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/usr.sbin/bgpd/rde_decide.c b/usr.sbin/bgpd/rde_decide.c
index 1ca553fca50..d5ddf19e674 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.21 2004/01/13 17:11:29 henning Exp $ */
+/* $OpenBSD: rde_decide.c,v 1.22 2004/01/17 19:35:36 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -537,12 +537,10 @@ up_generate_attr(struct rde_peer *peer, struct update_attr *upa,
if (peer->conf.ebgp == 0) {
/*
* if directly connected use peer->local_addr
- * This is only the case for announcements, which we
- * currenlty don't handle. It is currently unclear how
- * to recognize those routes. The connected flag is not
- * enough.
*/
- if (a->nexthop == peer->remote_addr.v4.s_addr)
+ if (nh->flags & NEXTHOP_ANNOUNCE)
+ nexthop = peer->local_addr.v4.s_addr;
+ else if (a->nexthop == peer->remote_addr.v4.s_addr)
/*
* per rfc: if remote peer address is equal to
* the nexthop set the nexthop to our local address.
@@ -553,7 +551,7 @@ up_generate_attr(struct rde_peer *peer, struct update_attr *upa,
nexthop = nh->exit_nexthop.v4.s_addr;
} else if (peer->conf.distance == 1) {
/* ebgp directly connected */
- if (nh->connected) {
+ if (nh->flags & NEXTHOP_CONNECTED) {
mask = 0xffffffff << (32 - nh->nexthop_netlen);
mask = htonl(mask);
if ((peer->remote_addr.v4.s_addr & mask) ==
@@ -567,8 +565,9 @@ up_generate_attr(struct rde_peer *peer, struct update_attr *upa,
} else
/* ebgp multihop */
/*
- * XXX for ebgp multihop nh->connected should always be false
- * so it should be possible to unify the two ebgp cases.
+ * XXX for ebgp multihop nh->flags should never have
+ * NEXTHOP_CONNECTED set so it should be possible to unify the
+ * two ebgp cases.
*/
nexthop = peer->local_addr.v4.s_addr;