diff options
-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"); |