From 390c257b07b939ac3905f9b7d2a693b3a178b74c Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Thu, 3 Aug 2006 22:40:26 +0000 Subject: 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 --- usr.sbin/bgpd/kroute.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'usr.sbin') 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 @@ -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); -- cgit v1.2.3