remove all entries in rt timer queue on ip_mtudisc change, instead of

destroying the queue.
This commit is contained in:
itojun 2002-11-12 02:10:13 +00:00
parent 6a151fcce1
commit 50a545a34b
3 changed files with 21 additions and 15 deletions

View File

@ -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 @@ rt_timer_queue_change(rtq, timeout)
}
void
rt_timer_queue_destroy(rtq, destroy)
rt_timer_queue_remove_all(rtq, destroy)
struct rttimer_queue *rtq;
int destroy;
{
@ -933,8 +933,18 @@ rt_timer_queue_destroy(rtq, destroy)
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);

View File

@ -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 @@ void rt_timer_init __P((void));
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 *));

View File

@ -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 @@ ip_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
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_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
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);