On 12:55 Fri 20 Nov, Vladimir Kirillov wrote:
> The network seems to continue working through the second up default route:
>
> <skip>
> 
> but the acccess to network 172.30.1/24 still lies through routes which
> are down:
> (and not the working second default route)

I have my draft solution of the above problem, I force rtalloc1() to
skip down routes, drop them and pick the next available (see diff below)


Is the solution sane? Or, why not?

Index: route.c
===================================================================
RCS file: /cvs/src/sys/net/route.c,v
retrieving revision 1.114
diff -N -u -p route.c
--- route.c     3 Nov 2009 10:59:04 -0000       1.114
+++ route.c     25 Nov 2009 09:53:00 -0000
@@ -371,9 +371,19 @@ rtalloc1(struct sockaddr *dst, int report, u_int table
        info.rti_info[RTAX_DST] = dst;
 
        rnh = rt_gettable(dst->sa_family, tableid);
+again:
        if (rnh && (rn = rnh->rnh_matchaddr((caddr_t)dst, rnh)) &&
            ((rn->rn_flags & RNF_ROOT) == 0)) {
                newrt = rt = (struct rtentry *)rn;
+               if (!(rt->rt_flags & RTF_UP)) {
+                       /* 
+                        * The old route is down,  find a new one.
+                        */
+                       printf("route %p is down, retrying..\n", rt);
+                       rtdeletemsg(rt, tableid);
+
+                       goto again;
+               }
                if (report && (rt->rt_flags & RTF_CLONING)) {
                        err = rtrequest1(RTM_RESOLVE, &info, RTP_DEFAULT,
                            &newrt, tableid);

Reply via email to