diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2004-01-13 12:38:51 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2004-01-13 12:38:51 +0000 |
commit | ea1f8410feedad905d718155ed79b6201d3591f0 (patch) | |
tree | 3136517c947775c24effe289efd8ab3c7fee016c /usr.sbin | |
parent | 7ebcba03c8d4b2a253ae60dfe32c7972473fb465 (diff) |
Do not send routes back to sender as per rfc. OK henning@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bgpd/rde_decide.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/usr.sbin/bgpd/rde_decide.c b/usr.sbin/bgpd/rde_decide.c index 791201c8ee1..4a0fda63470 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.16 2004/01/12 13:33:16 claudio Exp $ */ +/* $OpenBSD: rde_decide.c,v 1.17 2004/01/13 12:38:50 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> @@ -432,19 +432,31 @@ up_generate_updates(struct prefix *new, struct prefix *old) * set. */ - p = calloc(1, sizeof(struct update_prefix)); - if (p == NULL) - fatal("up_queue_update"); - if (new == NULL || new->aspath->nexthop == NULL || new->aspath->nexthop->state != NEXTHOP_REACH) { + if (peer == old->peer) + /* Do not send routes back to sender */ + continue; + /* withdraw prefix */ + p = calloc(1, sizeof(struct update_prefix)); + if (p == NULL) + fatal("up_queue_update"); + p->prefix = old->prefix->prefix; p->prefixlen = old->prefix->prefixlen; if (up_add(peer, p, NULL) == -1) logit(LOG_CRIT, "queuing update failed."); } else { + if (peer == new->peer) + /* Do not send routes back to sender */ + continue; + /* generate update */ + p = calloc(1, sizeof(struct update_prefix)); + if (p == NULL) + fatal("up_queue_update"); + a = calloc(1, sizeof(struct update_attr)); if (a == NULL) fatal("up_queue_update"); |