> This is not correct and expains why you had to change radix_mpath.c.
> If you change the rt_priority you must rebalance the dupedkey list so that
> the order remains correct. It is also only necessary when the ifp changes.
> So here is what I came up with that is totaly untested and maybe wrong as
> well.
>
> --
> :wq Claudio
>
> Index: route.c
> ===================================================================
> RCS file: /cvs/src/sys/net/route.c,v
> retrieving revision 1.114
> diff -u -p -r1.114 route.c
> --- route.c     3 Nov 2009 10:59:04 -0000       1.114
> +++ route.c     15 Dec 2009 14:48:36 -0000
> @@ -152,9 +152,6 @@ int okaytoclone(u_int, int);
>  int    rtflushclone1(struct radix_node *, void *);
>  void   rtflushclone(struct radix_node_head *, struct rtentry *);
>  int    rt_if_remove_rtdelete(struct radix_node *, void *);
> -#ifndef SMALL_KERNEL
> -int    rt_if_linkstate_change(struct radix_node *, void *);
> -#endif
>
>  #define        LABELID_MAX     50000
>
> Index: route.h
> ===================================================================
> RCS file: /cvs/src/sys/net/route.h,v
> retrieving revision 1.65
> diff -u -p -r1.65 route.h
> --- route.h     3 Nov 2009 10:59:04 -0000       1.65
> +++ route.h     15 Dec 2009 14:48:23 -0000
> @@ -394,6 +394,7 @@ int  rtrequest1(int, struct rt_addrinfo
>  void    rt_if_remove(struct ifnet *);
>  #ifndef SMALL_KERNEL
>  void    rt_if_track(struct ifnet *);
> +int     rt_if_linkstate_change(struct radix_node *, void *);
>  #endif
>  int     rtdeletemsg(struct rtentry *, u_int);
>
> Index: rtsock.c
> ===================================================================
> RCS file: /cvs/src/sys/net/rtsock.c,v
> retrieving revision 1.95
> diff -u -p -r1.95 rtsock.c
> --- rtsock.c    3 Nov 2009 10:59:04 -0000       1.95
> +++ rtsock.c    15 Dec 2009 14:49:53 -0000
> @@ -638,6 +638,11 @@ report:
>                                     rt->rt_ifa = ifa;
>                                     ifa->ifa_refcnt++;
>                                     rt->rt_ifp = ifp;
> +#ifndef SMALL_KERNEL
> +                                   /* recheck link state after ifp change */
> +                                   rt_if_linkstate_change(
> +                                       (struct radix_node *)rt, ifp);
> +#endif
>                                 }
>                         }
>
> @@ -651,6 +656,7 @@ report:
>                             &rt->rt_rmx);
>                         rtm->rtm_index = rt->rt_ifp->if_index;
>                         rtm->rtm_priority = rt->rt_priority & RTP_MASK;
> +                       rtm->rtm_flags = rt->rt_flags;
>                         if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest)
>                                 rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt, &info);
>                         if (genmask)
>

Thanks for looking into this.  I've tested your patch and it seems to
work and it is more correct than what I came up with (darn it).

So with that problem solved it some other ones apparent.  My
radix_multipath.c meddling had to do with priorities not being handled
correctly.

Here's how to reproduce some of the faulty behaviour:
#route add 1/8 192.168.2.2

netstat shows the route:
1/8                192.168.2.2        UGS        0        0     -     8 em0

#route add 1/8 192.168.2.3 -priority 32
#route add 1/8 192.168.2.4 -priority 32

netstat nows shows:
1/8                192.168.2.2        UGS        0        0     -     8 em2
1/8                192.168.2.3        UGSP       0        0     -    32 em2
1/8                192.168.2.4        UGS        0        0     -    32 em2

It shouldn't have allowed me to add that last route without the -mpath
flag and only one route has the MPATH flag.  Both will have the MPATH
flag if you use the -mpath flag to route.

#route delete 1/8 192.168.2.4

netstat shows:
1/8                192.168.2.2        UGS        0        0     -     8 em2
1/8                192.168.2.3        UGSP       0        0     -    32 em2

It should have removed the MPATH flag but I believe it removed it from
the route with priority equalling 8.  It does the same thing if both
routes had the MPATH flag too.

With my most current patch this all works properly.

It looks like the last road block in my router project is going to be
similar to Vladimir Kirillov's problem.  In my case I'm having a
downed link layer host route take precedence over an up ospf /32 route

Much thanks for the help so far.

dmo

Reply via email to