/* If no packets received for this length of time, set a backtrack floor * at highest received packet ID thus far.
*/ #define PKTID_RECV_EXPIRE (30 * HZ)
/* Packet-ID state for transmitter */ struct ovpn_pktid_xmit {
atomic_t seq_num;
};
/* Packet-ID state for receiver. * Other than lock member, can be zeroed to initialize.
*/ struct ovpn_pktid_recv { /* "sliding window" bitmask of recent packet IDs received */
u8 history[REPLAY_WINDOW_BYTES]; /* bit position of deque base in history */ unsignedint base; /* extent (in bits) of deque in history */ unsignedint extent; /* expiration of history in jiffies */ unsignedlong expire; /* highest sequence number received */
u32 id; /* highest time stamp received */
u32 time; /* we will only accept backtrack IDs > id_floor */
u32 id_floor; unsignedint max_backtrack; /* protects entire pktd ID state */
spinlock_t lock;
};
/* Get the next packet ID for xmit */ staticinlineint ovpn_pktid_xmit_next(struct ovpn_pktid_xmit *pid, u32 *pktid)
{ const u32 seq_num = atomic_fetch_add_unless(&pid->seq_num, 1, 0); /* when the 32bit space is over, we return an error because the packet * ID is used to create the cipher IV and we do not want to reuse the * same value more than once
*/ if (unlikely(!seq_num)) return -ERANGE;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.