diff options
author | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2014-10-28 09:15:10 +0000 |
---|---|---|
committer | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2014-10-28 09:15:10 +0000 |
commit | f01f587e5bb2eeb5c9e2cdd920f43053330a95cb (patch) | |
tree | 9052043b2597907d68165ac489339b9779d96248 /sys | |
parent | b0a33e4d1b17ee4827d00ca0af8292123fae34e2 (diff) |
Initialize the lists of the hash tables and the virtual pipex
sesssion for multicast in proper way.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/pipex.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/net/pipex.c b/sys/net/pipex.c index cf8ef5ec3c0..db4cc1c0132 100644 --- a/sys/net/pipex.c +++ b/sys/net/pipex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pipex.c,v 1.59 2014/10/28 09:10:21 yasuoka Exp $ */ +/* $OpenBSD: pipex.c,v 1.60 2014/10/28 09:15:09 yasuoka Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -129,7 +129,8 @@ int pipex_debug = 0; /* systcl net.inet.ip.pipex_debug */ void pipex_init(void) { - extern int max_keylen; /* for radix.c */ + int i; + extern int max_keylen; /* for radix.c */ if (pipex_softintr != NULL) return; @@ -144,8 +145,10 @@ pipex_init(void) if (sizeof(struct sockaddr_in) > max_keylen) max_keylen = sizeof(struct sockaddr_in); - memset(pipex_id_hashtable, 0, sizeof(pipex_id_hashtable)); - memset(pipex_peer_addr_hashtable, 0, sizeof(pipex_peer_addr_hashtable)); + for (i = 0; i < nitems(pipex_id_hashtable); i++) + LIST_INIT(&pipex_id_hashtable[i]); + for (i = 0; i < nitems(pipex_peer_addr_hashtable); i++) + LIST_INIT(&pipex_peer_addr_hashtable[i]); /* queue and softintr init */ IFQ_SET_MAXLEN(&pipexinq, IFQ_MAXLEN); IFQ_SET_MAXLEN(&pipexoutq, IFQ_MAXLEN); @@ -178,7 +181,7 @@ pipex_iface_init(struct pipex_iface_context *pipex_iface, struct ifnet *ifp) splx(s); /* virtual pipex_session entry for multicast */ - session = pool_get(&pipex_session_pool, PR_WAITOK); + session = pool_get(&pipex_session_pool, PR_WAITOK | PR_ZERO); session->is_multicast = 1; session->pipex_iface = pipex_iface; pipex_iface->multicast_session = session; |