I missed handling RTM_CHANGES with my changes.

BTW I just finished testing what wasn't working right with my ospfd
setup before and now everything is working properly. Yipee!

dmo

Index: rtsock.c
===================================================================
RCS file: /cvs/src/sys/net/rtsock.c,v
retrieving revision 1.95
diff -u -p rtsock.c
--- rtsock.c    3 Nov 2009 10:59:04 -0000       1.95
+++ rtsock.c    13 Dec 2009 05:01:25 -0000
@@ -490,17 +490,17 @@ route_output(struct mbuf *m, ...)
                 */
                if (rn_mpath_capable(rnh)) {
                        /* first find correct priority bucket */
-                       rn = rn_mpath_prio(rn, prio);
+                       rn = rn_mpath_prio_lookup(rn, prio);
                        rt = (struct rtentry *)rn;
-                       if (prio != RTP_ANY &&
-                           (rt->rt_priority & RTP_MASK) != prio) {
+                       if (!rn || (prio != RTP_ANY &&
+                           (rt->rt_priority & RTP_MASK) != prio)) {
                                error = ESRCH;
                                rt->rt_refcnt++;
                                goto flush;
                        }

                        /* if multipath routes */
-                       if (rn_mpath_next(rn, 0)) {
+                       if (rn_mpath_next(rn, 2)) {
                                if (gate)
                                        rt = rt_mpath_matchgate(rt, gate, prio);
                                else if (rtm->rtm_type != RTM_GET)
@@ -639,6 +639,19 @@ report:
                                    ifa->ifa_refcnt++;
                                    rt->rt_ifp = ifp;
                                }
+                       }
+
+                       /* new gateway, possible link state change  */
+                       if ((LINK_STATE_IS_UP(ifa->ifa_ifp->if_link_state) ||
+                               ifa->ifa_ifp->if_link_state ==
LINK_STATE_UNKNOWN) &&
+                               ifa->ifa_ifp->if_flags & IFF_UP) {
+                                       rt->rt_flags |= RTF_UP;
+                                       rt->rt_priority &= RTP_MASK;
+                       }
+                       else {
+                               rt->rt_flags &= ~RTF_UP;
+                               rtm->rtm_flags &= RTF_UP;
+                               rt->rt_priority |= RTP_DOWN;
                        }

                        /* XXX Hack to allow some flags to be toggled */

Reply via email to