Make sure icmp_redirect_timeout_q and ip_mtudisc_timeout_q are initialized on bootup

Fix PR kern/52029
This commit is contained in:
ozaki-r 2017-03-06 07:31:15 +00:00
parent b9b3014049
commit ab7c3877f1
2 changed files with 7 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_icmp.c,v 1.159 2017/02/17 04:32:10 ozaki-r Exp $ */
/* $NetBSD: ip_icmp.c,v 1.160 2017/03/06 07:31:15 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -94,7 +94,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.159 2017/02/17 04:32:10 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.160 2017/03/06 07:31:15 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_ipsec.h"
@ -195,10 +195,7 @@ icmp_init(void)
* something other than zero.
*/
mutex_enter(&icmp_mtx);
if (icmp_redirtimeout != 0) {
icmp_redirect_timeout_q =
rt_timer_queue_create(icmp_redirtimeout);
}
icmp_redirect_timeout_q = rt_timer_queue_create(icmp_redirtimeout);
mutex_exit(&icmp_mtx);
icmpstat_percpu = percpu_alloc(sizeof(uint64_t) * ICMP_NSTATS);
@ -1205,8 +1202,6 @@ icmp_mtudisc(struct icmp *icp, struct in_addr faddr)
}
mutex_enter(&icmp_mtx);
if (ip_mtudisc_timeout_q == NULL)
ip_mtudisc_timeout_q = rt_timer_queue_create(ip_mtudisc_timeout);
error = rt_timer_add(rt, icmp_mtudisc_timeout, ip_mtudisc_timeout_q);
mutex_exit(&icmp_mtx);
if (error) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_input.c,v 1.351 2017/02/17 18:09:25 ozaki-r Exp $ */
/* $NetBSD: ip_input.c,v 1.352 2017/03/06 07:31:15 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.351 2017/02/17 18:09:25 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.352 2017/03/06 07:31:15 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -353,6 +353,8 @@ ip_init(void)
ipforward_rt_percpu = percpu_alloc(sizeof(struct route));
if (ipforward_rt_percpu == NULL)
panic("failed to allocate ipforward_rt_percpu");
ip_mtudisc_timeout_q = rt_timer_queue_create(ip_mtudisc_timeout);
}
static struct in_ifaddr *