| 6791 | } |
| 6792 | |
| 6793 | static uint32_t |
| 6794 | key_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 | |
| 6832 | static int |
| 6833 | key_acqreset(uint32_t seq) |
no test coverage detected