The following code in /etc/init.d/zebra from net-misc/quagga is slow when routing table is large (e.g. 200K entries): cleanup() { stale=`ip route | grep 'proto zebra' | awk '{ print $1 }'` if [ ! -z "$stale" ] ; then einfo "Cleaning up stale zebra routes..." fi for r in $stale; do ebegin "Removing stale route to $r..." ip route del $r; eend $? done } I propose replacing it by two 'ip -X route flush proto zebra' commands where X is 4 and 6 to handle both IPv4 and IPv6. It is probably important to check for IPv4/IPv6 protocol kernel support. Reproducible: Always Steps to Reproduce: 1.Run quagga with many entries in routing table 2.Make it crash (e.g. out of memory) 3.Start quagga again Actual Results: Slow cleanup (e.g. 100 deleted routes per second) Expected Results: Fast cleanup
Seems that "ip route flush proto zebra" is enough to cleanup the staled routes. Fixed in cvs without revision bump (not important enough to worth a new revision). Thanks!