Source-Changes-HG archive

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

[src/trunk]: src/sys remove all entries in rt timer queue on ip_mtudisc chang...



details:   https://anonhg.NetBSD.org/src/rev/070cf65733a2
branches:  trunk
changeset: 539255:070cf65733a2
user:      itojun <itojun%NetBSD.org@localhost>
date:      Tue Nov 12 02:10:13 2002 +0000

description:
remove all entries in rt timer queue on ip_mtudisc change, instead of
destroying the queue.

diffstat:

 sys/net/route.c        |  18 ++++++++++++++----
 sys/net/route.h        |   3 ++-
 sys/netinet/ip_input.c |  15 +++++----------
 3 files changed, 21 insertions(+), 15 deletions(-)

diffs (107 lines):

diff -r 47e340a0fbaf -r 070cf65733a2 sys/net/route.c
--- a/sys/net/route.c   Tue Nov 12 01:57:07 2002 +0000
+++ b/sys/net/route.c   Tue Nov 12 02:10:13 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.c,v 1.54 2002/11/12 01:37:30 itojun Exp $        */
+/*     $NetBSD: route.c,v 1.55 2002/11/12 02:10:13 itojun Exp $        */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -102,7 +102,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.54 2002/11/12 01:37:30 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.55 2002/11/12 02:10:13 itojun Exp $");
 
 #include "opt_ns.h"
 
@@ -918,7 +918,7 @@
 }
 
 void
-rt_timer_queue_destroy(rtq, destroy)
+rt_timer_queue_remove_all(rtq, destroy)
        struct rttimer_queue *rtq;
        int destroy;
 {
@@ -933,8 +933,18 @@
                if (rtq->rtq_count > 0)
                        rtq->rtq_count--;
                else
-                       printf("rt_timer_queue_destroy: rtq_count reached 0\n");
+                       printf("rt_timer_queue_remove_all: "
+                           "rtq_count reached 0\n");
        }
+}
+
+void
+rt_timer_queue_destroy(rtq, destroy)
+       struct rttimer_queue *rtq;
+       int destroy;
+{
+
+       rt_timer_queue_remove_all(rtq, destroy);
 
        LIST_REMOVE(rtq, rtq_link);
 
diff -r 47e340a0fbaf -r 070cf65733a2 sys/net/route.h
--- a/sys/net/route.h   Tue Nov 12 01:57:07 2002 +0000
+++ b/sys/net/route.h   Tue Nov 12 02:10:13 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.h,v 1.31 2002/11/12 01:37:30 itojun Exp $        */
+/*     $NetBSD: route.h,v 1.32 2002/11/12 02:10:13 itojun Exp $        */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -302,6 +302,7 @@
 struct rttimer_queue *
         rt_timer_queue_create __P((u_int));
 void    rt_timer_queue_change __P((struct rttimer_queue *, long));
+void    rt_timer_queue_remove_all __P((struct rttimer_queue *, int));
 void    rt_timer_queue_destroy __P((struct rttimer_queue *, int));
 void    rt_timer_remove_all __P((struct rtentry *, int));
 unsigned long  rt_timer_count __P((struct rttimer_queue *));
diff -r 47e340a0fbaf -r 070cf65733a2 sys/netinet/ip_input.c
--- a/sys/netinet/ip_input.c    Tue Nov 12 01:57:07 2002 +0000
+++ b/sys/netinet/ip_input.c    Tue Nov 12 02:10:13 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_input.c,v 1.162 2002/11/12 01:57:07 itojun Exp $    */
+/*     $NetBSD: ip_input.c,v 1.163 2002/11/12 02:10:13 itojun Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -102,7 +102,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.162 2002/11/12 01:57:07 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.163 2002/11/12 02:10:13 itojun Exp $");
 
 #include "opt_gateway.h"
 #include "opt_pfil_hooks.h"
@@ -1826,13 +1826,8 @@
        case IPCTL_MTUDISC:
                error = sysctl_int(oldp, oldlenp, newp, newlen,
                    &ip_mtudisc);
-               if (ip_mtudisc != 0 && ip_mtudisc_timeout_q == NULL) {
-                       ip_mtudisc_timeout_q =
-                           rt_timer_queue_create(ip_mtudisc_timeout);
-               } else if (ip_mtudisc == 0 && ip_mtudisc_timeout_q != NULL) {
-                       rt_timer_queue_destroy(ip_mtudisc_timeout_q, TRUE);
-                       ip_mtudisc_timeout_q = NULL;
-               }
+               if (error == 0 && ip_mtudisc == 0)
+                       rt_timer_queue_remove_all(ip_mtudisc_timeout_q, TRUE);
                return error;
        case IPCTL_ANONPORTMIN:
                old = anonportmin;
@@ -1868,7 +1863,7 @@
                        ip_mtudisc_timeout = old;
                        return (EINVAL);
                }
-               if (ip_mtudisc_timeout_q != NULL)
+               if (error == 0)
                        rt_timer_queue_change(ip_mtudisc_timeout_q,
                                              ip_mtudisc_timeout);
                return (error);



Home | Main Index | Thread Index | Old Index