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

Function key_newacq

freebsd/netipsec/key.c:6764–6791  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6762}
6763
6764static uint32_t
6765key_newacq(const struct secasindex *saidx, int *perror)
6766{
6767 struct secacq *acq;
6768 uint32_t seq;
6769
6770 acq = malloc(sizeof(*acq), M_IPSEC_SAQ, M_NOWAIT | M_ZERO);
6771 if (acq == NULL) {
6772 ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__));
6773 *perror = ENOBUFS;
6774 return (0);
6775 }
6776
6777 /* copy secindex */
6778 bcopy(saidx, &acq->saidx, sizeof(acq->saidx));
6779 acq->created = time_second;
6780 acq->count = 0;
6781
6782 /* add to acqtree */
6783 ACQ_LOCK();
6784 seq = acq->seq = (V_acq_seq == ~0 ? 1 : ++V_acq_seq);
6785 LIST_INSERT_HEAD(&V_acqtree, acq, chain);
6786 LIST_INSERT_HEAD(ACQADDRHASH_HASH(saidx), acq, addrhash);
6787 LIST_INSERT_HEAD(ACQSEQHASH_HASH(seq), acq, seqhash);
6788 ACQ_UNLOCK();
6789 *perror = 0;
6790 return (seq);
6791}
6792
6793static uint32_t
6794key_getacq(const struct secasindex *saidx, int *perror)

Callers 1

key_getacqFunction · 0.85

Calls 1

mallocFunction · 0.85

Tested by

no test coverage detected