summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2006-08-03 22:40:26 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2006-08-03 22:40:26 +0000
commit390c257b07b939ac3905f9b7d2a693b3a178b74c (patch)
tree95e088a690c1f9f9a10d1686101a3273f909357b /usr.sbin
parentf96d8014ccc4a3cd90cc0a1c553a25e140275060 (diff)
On startup in fetchtable() clean the routing table of all PROTO1 routes.
These may be leftovers from a crash or so and result in an strange behaving bgpd parent process additionally it causes huge CPU loads because of a linear list walk done on every insert. Code stolen from ospfd which does the same thing since a long time ago. This is a temporary fix until we have real routing priorities and all this PROTO1 flagging can be removed. PROTO1 is not exclusive to bgpd but for correct operation we currently need to enforce it. OK because it is only temporary henning@ Found and fix tested by Sylwester S. Biernacki
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/kroute.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c
index b7b45d2ac69..e751b9784bf 100644
--- a/usr.sbin/bgpd/kroute.c
+++ b/usr.sbin/bgpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.146 2006/04/12 14:23:46 henning Exp $ */
+/* $OpenBSD: kroute.c,v 1.147 2006/08/03 22:40:25 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -2018,10 +2018,19 @@ fetchtable(void)
break;
}
- if (sa->sa_family == AF_INET)
- kroute_insert(kr);
- else if (sa->sa_family == AF_INET6)
- kroute6_insert(kr6);
+ if (sa->sa_family == AF_INET) {
+ if (rtm->rtm_flags & RTF_PROTO1) {
+ send_rtmsg(kr_state.fd, RTM_DELETE, &kr->r);
+ free(kr);
+ } else
+ kroute_insert(kr);
+ } else if (sa->sa_family == AF_INET6) {
+ if (rtm->rtm_flags & RTF_PROTO1) {
+ send_rt6msg(kr_state.fd, RTM_DELETE, &kr6->r);
+ free(kr6);
+ } else
+ kroute6_insert(kr6);
+ }
}
free(buf);