* SUCH DAMAGE.
*/
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__NetBSD__)
-#include "opt_inet.h"
-#ifdef __NetBSD__
-#include "opt_ipsec.h"
-#endif
-#endif
-
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/param.h>
#include <net/net_osdep.h>
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
MALLOC_DEFINE(M_SECA, "key mgmt", "security associations, key management");
-#endif
-static void keydb_delsecasvar __P((struct secasvar *));
+static void keydb_delsecasvar(struct secasvar *);
/*
* secpolicy management
{
struct secpolicy *p;
- p = (struct secpolicy *)_MALLOC(sizeof(*p), M_SECA, M_NOWAIT);
+ p = (struct secpolicy *)_MALLOC(sizeof(*p), M_SECA, M_WAITOK);
if (!p)
return p;
bzero(p, sizeof(*p));
struct secashead *p;
int i;
- p = (struct secashead *)_MALLOC(sizeof(*p), M_SECA, M_NOWAIT);
+ p = (struct secashead *)_MALLOC(sizeof(*p), M_SECA, M_WAITOK);
if (!p)
return p;
bzero(p, sizeof(*p));
{
struct secasvar *p;
- p = (struct secasvar *)_MALLOC(sizeof(*p), M_SECA, M_NOWAIT);
+ p = (struct secasvar *)_MALLOC(sizeof(*p), M_SECA, M_WAITOK);
if (!p)
return p;
bzero(p, sizeof(*p));
{
int s;
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
p->refcnt++;
splx(s);
}
{
int s;
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
p->refcnt--;
- if (p->refcnt == 0)
+ /* negative refcnt will cause panic intentionally */
+ if (p->refcnt <= 0)
keydb_delsecasvar(p);
splx(s);
}
{
struct secreplay *p;
- p = (struct secreplay *)_MALLOC(sizeof(*p), M_SECA, M_NOWAIT);
+ p = (struct secreplay *)_MALLOC(sizeof(*p), M_SECA, M_WAITOK);
if (!p)
return p;
bzero(p, sizeof(*p));
if (wsize != 0) {
- p->bitmap = (caddr_t)_MALLOC(wsize, M_SECA, M_NOWAIT);
+ p->bitmap = (caddr_t)_MALLOC(wsize, M_SECA, M_WAITOK);
if (!p->bitmap) {
_FREE(p, M_SECA);
return NULL;
{
struct secreg *p;
- p = (struct secreg *)_MALLOC(sizeof(*p), M_SECA, M_NOWAIT);
+ p = (struct secreg *)_MALLOC(sizeof(*p), M_SECA, M_WAITOK);
if (p)
bzero(p, sizeof(*p));
return p;