diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1999-03-05 00:58:30 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1999-03-05 00:58:30 +0000 |
commit | 80d1f8b4d584822423ed3ef572408d19547e8b89 (patch) | |
tree | e6ddb41ae494755df9bf4dc3a1fd52e1022348dd /sys/net/pfkeyv2.c | |
parent | 1afb91a47cd81424878862c7b8690f6aa62ae3ae (diff) |
update allocation statistics
Diffstat (limited to 'sys/net/pfkeyv2.c')
-rw-r--r-- | sys/net/pfkeyv2.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c index a7f51104e8b..53ee477b6a2 100644 --- a/sys/net/pfkeyv2.c +++ b/sys/net/pfkeyv2.c @@ -1214,6 +1214,7 @@ pfkeyv2_send(struct socket *socket, void *message, int len) } ipsec_in_use++; + sa2->tdb_cur_allocations++; } /* If this is a "local" packet flow */ @@ -1258,8 +1259,25 @@ pfkeyv2_send(struct socket *socket, void *message, int len) } ipsec_in_use++; + sa2->tdb_cur_allocations++; } } + + /* If we are adding flows, check for allocation expirations */ + if (!delflag) { + if ((sa2->tdb_flags & TDBF_ALLOCATIONS) && + (sa2->tdb_cur_allocations > sa2->tdb_exp_allocations)) { + /* XXX expiration notification */ + + tdb_delete(sa2, 0); + break; + } else + if ((sa2->tdb_flags & TDBF_SOFT_ALLOCATIONS) && + (sa2->tdb_cur_allocations > sa2->tdb_soft_allocations)) { + /* XXX expiration notification */ + sa2->tdb_flags &= ~TDBF_SOFT_ALLOCATIONS; + } + } } break; |