diff options
author | 1999-03-05 00:58:29 +0000 | |
---|---|---|
committer | 1999-03-05 00:58:29 +0000 | |
commit | 52178db38bd16712e3a97d1ef6a0eff461ff7242 (patch) | |
tree | ca5039b4534374880fceaa9f890bff74af29eb6c | |
parent | note com/lpt chipset used (diff) | |
download | wireguard-openbsd-52178db38bd16712e3a97d1ef6a0eff461ff7242.tar.xz wireguard-openbsd-52178db38bd16712e3a97d1ef6a0eff461ff7242.zip |
update allocation statistics
-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; |