[email protected]
[Top] [All Lists]

Re: bin/40455 (route can't change reject to blackhole)

Subject: Re: bin/40455 route can't change reject to blackhole
From: Mihai Chelaru
Date: Sun, 2 May 2010 22:05:03 +0000 UTC
The following reply was made to PR bin/40455; it has been noted by GNATS.

From: Mihai Chelaru <[email protected]>
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: bin/40455 (route can't change reject to blackhole)
Date: Mon, 03 May 2010 01:02:48 +0300

 The problem is that rtsock is ignoring flags at RTM_CHANGE. Is this 
 patch resolving the issue ?
 
 
 Index: sys/net/rtsock.c
 ===================================================================
 RCS file: /cvsroot/src/sys/net/rtsock.c,v
 retrieving revision 1.128
 diff -u -p -r1.128 rtsock.c
 --- sys/net/rtsock.c   2 May 2010 19:17:56 -0000       1.128
 +++ sys/net/rtsock.c   2 May 2010 21:50:21 -0000
 @@ -95,6 +95,8 @@ __KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1
 
   DOMAIN_DEFINE(routedomain);  /* forward declare and add to link set */
 
 +#define PRESERVED_RTF (RTF_UP | RTF_GATEWAY | RTF_HOST | RTF_DONE | 
 RTF_MASK)
 +
   struct       sockaddr route_dst = { .sa_len = 2, .sa_family = PF_ROUTE, };
   struct       sockaddr route_src = { .sa_len = 2, .sa_family = PF_ROUTE, };
 
 @@ -437,6 +439,9 @@ route_output(struct mbuf *m, ...)
                        }
                        rt_setmetrics(rtm->rtm_inits, &rtm->rtm_rmx,
                            &rt->rt_rmx);
 +                      if (rt->rt_flags != info.rti_flags)
 +                              rt->rt_flags = (info.rti_flags & ~PRESERVED_RTF)
 +                                  | (rt->rt_flags & PRESERVED_RTF);
                        if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest)
                                rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt, &info);
                        /*FALLTHROUGH*/
 
 
 -- 
 Mihai
 

<Prev in Thread] Current Thread [Next in Thread>