Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Allow changing route flags. Should fix PR/40455



details:   https://anonhg.NetBSD.org/src/rev/e7c6c99af44b
branches:  trunk
changeset: 761881:e7c6c99af44b
user:      kefren <kefren%NetBSD.org@localhost>
date:      Thu Feb 10 07:42:18 2011 +0000

description:
Allow changing route flags. Should fix PR/40455
OK'ed: dyoung@

diffstat:

 sys/net/rtsock.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r 84d53719fce0 -r e7c6c99af44b sys/net/rtsock.c
--- a/sys/net/rtsock.c  Thu Feb 10 07:18:29 2011 +0000
+++ b/sys/net/rtsock.c  Thu Feb 10 07:42:18 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock.c,v 1.133 2011/02/01 01:39:20 matt Exp $        */
+/*     $NetBSD: rtsock.c,v 1.134 2011/02/10 07:42:18 kefren Exp $      */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.133 2011/02/01 01:39:20 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.134 2011/02/10 07:42:18 kefren Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -139,6 +139,8 @@
        .ri_maxqlen = IFQ_MAXLEN,
 };
 
+#define        PRESERVED_RTF   (RTF_UP | RTF_GATEWAY | RTF_HOST | RTF_DONE | RTF_MASK)
+
 static void COMPATNAME(route_init)(void);
 static int COMPATNAME(route_output)(struct mbuf *, ...);
 static int COMPATNAME(route_usrreq)(struct socket *,
@@ -473,6 +475,9 @@
                        if (ifp && rt->rt_ifp != ifp)
                                rt->rt_ifp = ifp;
                        rt_setmetrics(rtm->rtm_inits, rtm, rt);
+                       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*/



Home | Main Index | Thread Index | Old Index