avoid silly static variables that even caused nesting issues, not to mention

reentrancy concerns.
This commit is contained in:
christos 2005-05-29 21:43:09 +00:00
parent ea2d4204b6
commit 6dbf0e5b0a
1 changed files with 14 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip6_mroute.c,v 1.63 2005/02/26 22:45:12 perry Exp $ */
/* $NetBSD: ip6_mroute.c,v 1.64 2005/05/29 21:43:09 christos Exp $ */
/* $KAME: ip6_mroute.c,v 1.49 2001/07/25 09:21:18 jinmei Exp $ */
/*
@ -117,7 +117,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.63 2005/02/26 22:45:12 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.64 2005/05/29 21:43:09 christos Exp $");
#include "opt_inet.h"
#include "opt_mrouting.h"
@ -628,7 +628,6 @@ ip6_mrouter_detach(ifp)
}
}
static struct sockaddr_in6 sin6 = { sizeof(sin6), AF_INET6 };
/*
* Add a mif to the mif table
@ -1048,6 +1047,7 @@ ip6_mforward(ip6, ifp, m)
struct mbuf *mm;
int s;
mifi_t mifi;
struct sockaddr_in6 sin6;
#ifdef MRT6DEBUG
if (mrt6debug & DEBUG_FORWARD)
@ -1188,6 +1188,9 @@ ip6_mforward(ip6, ifp, m)
/*
* Send message to routing daemon
*/
(void)memset(&sin6, 0, sizeof(sin6));
sin6.sin6_len = sizeof(sin6);
sin6.sin6_family = AF_INET6;
sin6.sin6_addr = ip6->ip6_src;
im = NULL;
@ -1408,8 +1411,7 @@ ip6_mdq(m, ifp, rt)
* unnecessary PIM assert.
* XXX: M_LOOP is an ad-hoc hack...
*/
static struct sockaddr_in6 sin6 =
{ sizeof(sin6), AF_INET6 };
struct sockaddr_in6 sin6;
struct mbuf *mm;
struct mrt6msg *im;
@ -1447,6 +1449,9 @@ ip6_mdq(m, ifp, rt)
mifp++, iif++)
;
(void)memset(&sin6, 0, sizeof(sin6));
sin6.sin6_len = sizeof(sin6);
sin6.sin6_family = AF_INET6;
switch (ip6_mrouter_ver) {
case MRT6_OINIT:
oim->im6_mif = iif;
@ -1638,7 +1643,7 @@ register_send(ip6, mif, m)
{
struct mbuf *mm;
int i, len = m->m_pkthdr.len;
static struct sockaddr_in6 sin6 = { sizeof(sin6), AF_INET6 };
struct sockaddr_in6 sin6;
struct mrt6msg *im6;
#ifdef MRT6DEBUG
@ -1671,6 +1676,9 @@ register_send(ip6, mif, m)
/*
* Send message to routing daemon
*/
(void)memset(&sin6, 0, sizeof(sin6));
sin6.sin6_len = sizeof(sin6);
sin6.sin6_family = AF_INET6;
sin6.sin6_addr = ip6->ip6_src;
im6 = mtod(mm, struct mrt6msg *);