handle RTM_DESYNC. if the kernel says we're out of sync with the kernel
authordlg <dlg@openbsd.org>
Wed, 14 Jul 2010 01:00:32 +0000 (01:00 +0000)
committerdlg <dlg@openbsd.org>
Wed, 14 Jul 2010 01:00:32 +0000 (01:00 +0000)
routing table and interface list, do a reload of the kernel state.

ive been running this in production for 2 or 3 weeks.
tested by sthen@
ok sthen@ claudio@ deraadt@
code written by andrew sallaway at the univeristy of queensland.

usr.sbin/ospfd/kroute.c

index a799353..373c43f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: kroute.c,v 1.86 2010/07/12 14:35:13 bluhm Exp $ */
+/*     $OpenBSD: kroute.c,v 1.87 2010/07/14 01:00:32 dlg Exp $ */
 
 /*
  * Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -361,6 +361,8 @@ kr_fib_reload(void)
 {
        struct kroute_node      *krn, *kr, *kn;
 
+       log_info("reloading interface list and routing table");
+
        kr_state.fib_serial++;
 
        if (fetchifs(0) == -1 || fetchtable() == -1)
@@ -1525,6 +1527,13 @@ add:
                case RTM_IFANNOUNCE:
                        if_announce(next);
                        break;
+               case RTM_DESYNC:
+                       /*
+                        * We lost some routing packets. Force a reload of
+                        * the kernel route/interface information.
+                        */
+                       kr_fib_reload();
+                       break;
                default:
                        /* ignore for now */
                        break;