summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-01-08 17:06:51 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-01-08 17:06:51 +0000
commita9346ae8bb642289baf72d9801fe0116e1482f40 (patch)
tree1db13f81d51cd976a8b89e2aedaa39f6a4003d08 /usr.sbin/bgpd
parent553a91a70d9aa25f02c8763c0a6fa09ab9d02d34 (diff)
in kroute_insert, use knexthop_validate instead of hand-baking a slightly
optimized version of it
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/kroute.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c
index 7976a1dbe52..f8707d2ce09 100644
--- a/usr.sbin/bgpd/kroute.c
+++ b/usr.sbin/bgpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.56 2004/01/08 16:55:25 henning Exp $ */
+/* $OpenBSD: kroute.c,v 1.57 2004/01/08 17:06:50 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -357,7 +357,6 @@ int
kroute_insert(struct kroute_node *kr)
{
struct knexthop_node *h;
- struct kroute_nexthop nh;
in_addr_t mask, ina;
if (RB_INSERT(kroute_tree, &krt, kr) != NULL) {
@@ -370,20 +369,10 @@ kroute_insert(struct kroute_node *kr)
if (kr->flags & F_KERNEL) {
mask = 0xffffffff << (32 - kr->r.prefixlen);
ina = ntohl(kr->r.prefix);
- RB_FOREACH(h, knexthop_tree, &knt) {
- if ((ntohl(h->nexthop) & mask) == ina) {
- if (h->kroute != NULL)
- continue; /* XXX */
- h->kroute = kr;
- kr->flags |= F_NEXTHOP;
- bzero(&nh, sizeof(nh));
- nh.nexthop = h->nexthop;
- nh.valid = 1;
- nh.connected = kr->flags & F_CONNECTED;
- nh.gateway = kr->r.nexthop;
- send_nexthop_update(&nh);
- }
- }
+ RB_FOREACH(h, knexthop_tree, &knt)
+ if ((ntohl(h->nexthop) & mask) == ina)
+ knexthop_validate(h);
+
if (kr->flags & F_CONNECTED)
if (kif_kr_insert(kr) == -1)
return (-1);