To fix bad pointer dereference on start up when gif is used,
- Allow rn_init() to be called multiple times, but do nothing except the first call. - Include opt_inet.h so that #ifdef INET works. - Call rn_init() from encap_init() explicitly rather than depending on the order of initialization.
This commit is contained in:
parent
1cd0ad9aff
commit
f1b6d58e81
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: radix.c,v 1.26 2005/01/23 18:41:56 matt Exp $ */
|
||||
/* $NetBSD: radix.c,v 1.27 2005/01/24 04:46:49 enami Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1993
|
||||
@ -36,11 +36,13 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: radix.c,v 1.26 2005/01/23 18:41:56 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: radix.c,v 1.27 2005/01/24 04:46:49 enami Exp $");
|
||||
|
||||
#ifndef _NET_RADIX_H_
|
||||
#include <sys/param.h>
|
||||
#ifdef _KERNEL
|
||||
#include "opt_inet.h"
|
||||
|
||||
#include <sys/systm.h>
|
||||
#include <sys/malloc.h>
|
||||
#define M_DONTWAIT M_NOWAIT
|
||||
@ -943,11 +945,18 @@ rn_init()
|
||||
{
|
||||
char *cp, *cplim;
|
||||
#ifdef _KERNEL
|
||||
struct domain *dom;
|
||||
static int initialized;
|
||||
__link_set_decl(domains, struct domain);
|
||||
struct domain *const *dpp;
|
||||
|
||||
DOMAIN_FOREACH(dom)
|
||||
if (dom->dom_maxrtkey > max_keylen)
|
||||
max_keylen = dom->dom_maxrtkey;
|
||||
if (initialized)
|
||||
return;
|
||||
initialized = 1;
|
||||
|
||||
__link_set_foreach(dpp, domains) {
|
||||
if ((*dpp)->dom_maxrtkey > max_keylen)
|
||||
max_keylen = (*dpp)->dom_maxrtkey;
|
||||
}
|
||||
#ifdef INET
|
||||
encap_setkeylen();
|
||||
#endif
|
||||
|
@ -70,7 +70,7 @@
|
||||
#define USE_RADIX
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.20 2005/01/24 02:42:49 itojun Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.21 2005/01/24 04:46:49 enami Exp $");
|
||||
|
||||
#include "opt_mrouting.h"
|
||||
#include "opt_inet.h"
|
||||
@ -192,8 +192,9 @@ encap_init()
|
||||
#ifdef USE_RADIX
|
||||
/*
|
||||
* initialize radix lookup table.
|
||||
* max_keylen initialization should happen before the call to rn_init().
|
||||
* max_keylen initialization happen in the rn_init().
|
||||
*/
|
||||
rn_init();
|
||||
rn_inithead((void *)&encap_head[0], sizeof(struct sockaddr_pack) << 3);
|
||||
#ifdef INET6
|
||||
rn_inithead((void *)&encap_head[1], sizeof(struct sockaddr_pack) << 3);
|
||||
|
Loading…
Reference in New Issue
Block a user