MCPcopy Create free account
hub / github.com/F-Stack/f-stack / key_getacq

Function key_getacq

freebsd/netipsec/key.c:6793–6830  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6791}
6792
6793static uint32_t
6794key_getacq(const struct secasindex *saidx, int *perror)
6795{
6796 struct secacq *acq;
6797 uint32_t seq;
6798
6799 ACQ_LOCK();
6800 LIST_FOREACH(acq, ACQADDRHASH_HASH(saidx), addrhash) {
6801 if (key_cmpsaidx(&acq->saidx, saidx, CMP_EXACTLY)) {
6802 if (acq->count > V_key_blockacq_count) {
6803 /*
6804 * Reset counter and send message.
6805 * Also reset created time to keep ACQ for
6806 * this saidx.
6807 */
6808 acq->created = time_second;
6809 acq->count = 0;
6810 seq = acq->seq;
6811 } else {
6812 /*
6813 * Increment counter and do nothing.
6814 * We send SADB_ACQUIRE message only
6815 * for each V_key_blockacq_count packet.
6816 */
6817 acq->count++;
6818 seq = 0;
6819 }
6820 break;
6821 }
6822 }
6823 ACQ_UNLOCK();
6824 if (acq != NULL) {
6825 *perror = 0;
6826 return (seq);
6827 }
6828 /* allocate new entry */
6829 return (key_newacq(saidx, perror));
6830}
6831
6832static int
6833key_acqreset(uint32_t seq)

Callers 1

key_acquireFunction · 0.85

Calls 2

key_cmpsaidxFunction · 0.85
key_newacqFunction · 0.85

Tested by

no test coverage detected