OpenVPN
packet_id.c
Go to the documentation of this file.
1/*
2 * OpenVPN -- An application to securely tunnel IP networks
3 * over a single TCP/UDP port, with support for SSL/TLS-based
4 * session authentication and key exchange,
5 * packet encryption, packet authentication, and
6 * packet compression.
7 *
8 * Copyright (C) 2002-2025 OpenVPN Inc <sales@openvpn.net>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, see <https://www.gnu.org/licenses/>.
21 */
22
23/*
24 * These routines are designed to catch replay attacks,
25 * where a man-in-the-middle captures packets and then
26 * attempts to replay them back later.
27 *
28 * We use the "sliding-window" algorithm, similar
29 * to IPSec.
30 */
31
32#ifdef HAVE_CONFIG_H
33#include "config.h"
34#endif
35
36#include "syshead.h"
37
38#include <stddef.h>
39
40#include "packet_id.h"
41#include "misc.h"
42#include "integer.h"
43
44#include "memdbg.h"
45
46/* #define PID_SIMULATE_BACKTRACK */
47
48/*
49 * Special time_t value that indicates that
50 * sequence number has expired.
51 */
52#define SEQ_UNSEEN ((time_t)0)
53#define SEQ_EXPIRED ((time_t)1)
54
55#ifdef ENABLE_DEBUG
56static void packet_id_debug_print(int msglevel, const struct packet_id_rec *p,
57 const struct packet_id_net *pin, const char *message,
59
60#endif /* ENABLE_DEBUG */
61
62static inline void
63packet_id_debug(int msglevel, const struct packet_id_rec *p, const struct packet_id_net *pin,
64 const char *message, uint64_t value)
65{
66#ifdef ENABLE_DEBUG
67 if (unlikely(check_debug_level(msglevel)))
68 {
69 packet_id_debug_print(msglevel, p, pin, message, value);
70 }
71#endif
72}
73
74static void
75packet_id_init_recv(struct packet_id_rec *rec, int seq_backtrack, int time_backtrack,
76 const char *name, int unit)
77{
78 rec->name = name;
79 rec->unit = unit;
80 if (seq_backtrack)
81 {
82 ASSERT(MIN_SEQ_BACKTRACK <= seq_backtrack && seq_backtrack <= MAX_SEQ_BACKTRACK);
83 ASSERT(MIN_TIME_BACKTRACK <= time_backtrack && time_backtrack <= MAX_TIME_BACKTRACK);
84 CIRC_LIST_ALLOC(rec->seq_list, struct seq_list, seq_backtrack);
85 rec->seq_backtrack = seq_backtrack;
86 rec->time_backtrack = time_backtrack;
87 }
88 rec->initialized = true;
89}
90void
91packet_id_init(struct packet_id *p, int seq_backtrack, int time_backtrack, const char *name,
92 int unit)
93{
94 dmsg(D_PID_DEBUG, "PID packet_id_init seq_backtrack=%d time_backtrack=%d", seq_backtrack,
95 time_backtrack);
96
97 ASSERT(p);
98 CLEAR(*p);
99
100 packet_id_init_recv(&p->rec, seq_backtrack, time_backtrack, name, unit);
101}
102
103void
105{
106 ASSERT(src);
107 ASSERT(dest);
108 /* clear free any old data in rec list */
109 free(dest->seq_list);
110 CLEAR(*dest);
111
112 /* Copy data to dest */
113 *dest = *src;
114
115 /* Reinitalise the source */
116 CLEAR(*src);
117 packet_id_init_recv(src, dest->seq_backtrack, dest->time_backtrack, dest->name, dest->unit);
118}
119
120void
122{
123 if (p)
124 {
125 dmsg(D_PID_DEBUG, "PID packet_id_free");
126 free(p->rec.seq_list);
127 CLEAR(*p);
128 }
129}
130
131void
132packet_id_add(struct packet_id_rec *p, const struct packet_id_net *pin)
133{
134 const time_t local_now = now;
135 if (p->seq_list)
136 {
137 int64_t diff;
138
139 /*
140 * If time value increases, start a new sequence list of number
141 * sequence for the new time point.
142 */
143 if (!CIRC_LIST_SIZE(p->seq_list) || pin->time > p->time
144 || (pin->id >= p->seq_backtrack && pin->id - p->seq_backtrack > p->id))
145 {
146 p->time = pin->time;
147 p->id = 0;
148 if (pin->id > p->seq_backtrack)
149 {
150 p->id = pin->id - p->seq_backtrack;
151 }
153 }
154
155 while (p->id < pin->id
156#ifdef PID_SIMULATE_BACKTRACK
157 || (get_random() % 64) < 31
158#endif
159 )
160 {
162 ++p->id;
163 }
164
165 diff = p->id - pin->id;
166 if (diff < CIRC_LIST_SIZE(p->seq_list) && local_now > SEQ_EXPIRED)
167 {
168 CIRC_LIST_ITEM(p->seq_list, diff) = local_now;
169 }
170 }
171 else
172 {
173 p->time = pin->time;
174 p->id = pin->id;
175 }
176}
177
178/*
179 * Expire sequence numbers which can no longer
180 * be accepted because they would violate
181 * time_backtrack.
182 */
183void
185{
186 const time_t local_now = now;
187 if (p->time_backtrack)
188 {
189 bool expire = false;
190 for (int i = 0; i < CIRC_LIST_SIZE(p->seq_list); ++i)
191 {
192 const time_t t = CIRC_LIST_ITEM(p->seq_list, i);
193 if (t == SEQ_EXPIRED)
194 {
195 break;
196 }
197 if (!expire && t && t + p->time_backtrack < local_now)
198 {
199 expire = true;
200 }
201 if (expire)
202 {
204 }
205 }
206 }
207 p->last_reap = local_now;
208}
209
210/*
211 * Return true if packet id is ok, or false if
212 * it is a replay.
213 */
214bool
215packet_id_test(struct packet_id_rec *p, const struct packet_id_net *pin)
216{
217 uint64_t diff;
218
219 packet_id_debug(D_PID_DEBUG, p, pin, "PID_TEST", 0);
220
222
223 if (!pin->id)
224 {
225 return false;
226 }
227
228 if (p->seq_backtrack)
229 {
230 /*
231 * In backtrack mode, we allow packet reordering subject
232 * to the seq_backtrack and time_backtrack constraints.
233 *
234 * This mode is used with UDP.
235 */
236 if (pin->time == p->time)
237 {
238 /* is packet-id greater than any one we've seen yet? */
239 if (pin->id > p->id)
240 {
241 return true;
242 }
243
244 /* check packet-id sliding window for original/replay status */
245 diff = p->id - pin->id;
246
247 /* keep track of maximum backtrack seen for debugging purposes */
248 if (diff > p->max_backtrack_stat)
249 {
250 p->max_backtrack_stat = diff;
251 packet_id_debug(D_PID_DEBUG_LOW, p, pin, "PID_ERR replay-window backtrack occurred",
253 }
254
255 if (diff >= (packet_id_type)CIRC_LIST_SIZE(p->seq_list))
256 {
257 packet_id_debug(D_PID_DEBUG_LOW, p, pin, "PID_ERR large diff", diff);
258 return false;
259 }
260
261 {
262 const time_t v = CIRC_LIST_ITEM(p->seq_list, diff);
263 if (v == 0)
264 {
265 return true;
266 }
267 else
268 {
269 /* raised from D_PID_DEBUG_LOW to reduce verbosity */
270 packet_id_debug(D_PID_DEBUG_MEDIUM, p, pin, "PID_ERR replay", diff);
271 return false;
272 }
273 }
274 }
275 else if (pin->time < p->time) /* if time goes back, reject */
276 {
277 packet_id_debug(D_PID_DEBUG_LOW, p, pin, "PID_ERR time backtrack", 0);
278 return false;
279 }
280 else /* time moved forward */
281 {
282 return true;
283 }
284 }
285 else
286 {
287 /*
288 * In non-backtrack mode, all sequence number series must
289 * begin at some number n > 0 and must increment linearly without gaps.
290 *
291 * This mode is used with TCP.
292 */
293 if (pin->time == p->time)
294 {
295 return !p->id || pin->id == p->id + 1;
296 }
297 else if (pin->time < p->time) /* if time goes back, reject */
298 {
299 return false;
300 }
301 else /* time moved forward */
302 {
303 return pin->id == 1;
304 }
305 }
306}
307
308/*
309 * Read/write a packet ID to/from the buffer. Short form is sequence number
310 * only. Long form is sequence number and timestamp.
311 */
312
313bool
314packet_id_read(struct packet_id_net *pin, struct buffer *buf, bool long_form)
315{
316 packet_id_type net_id;
317 net_time_t net_time;
318
319 pin->id = 0;
320 pin->time = 0;
321
322 if (!buf_read(buf, &net_id, sizeof(net_id)))
323 {
324 return false;
325 }
326 pin->id = ntohpid(net_id);
327 if (long_form)
328 {
329 if (!buf_read(buf, &net_time, sizeof(net_time)))
330 {
331 return false;
332 }
333 pin->time = ntohtime(net_time);
334 }
335 return true;
336}
337
338static bool
339packet_id_send_update(struct packet_id_send *p, bool long_form)
340{
341 if (!p->time)
342 {
343 p->time = now;
344 }
345 if (p->id == PACKET_ID_MAX)
346 {
347 /* Packet ID only allowed to roll over if using long form and time has
348 * moved forward since last roll over.
349 */
350 if (!long_form || now <= p->time)
351 {
352 return false;
353 }
354 p->time = now;
355 p->id = 0;
356 }
357 p->id++;
358 return true;
359}
360
361static bool
363{
364 if (!p->time)
365 {
366 p->time = now;
367 }
368 if (p->id == PACKET_ID_EPOCH_MAX)
369 {
370 return false;
371 }
372 p->id++;
373 return true;
374}
375
376bool
377packet_id_write(struct packet_id_send *p, struct buffer *buf, bool long_form, bool prepend)
378{
379 if (!packet_id_send_update(p, long_form))
380 {
381 return false;
382 }
383
384 const packet_id_type net_id = htonpid(p->id);
385 const net_time_t net_time = htontime(p->time);
386 if (prepend)
387 {
388 if (long_form)
389 {
390 if (!buf_write_prepend(buf, &net_time, sizeof(net_time)))
391 {
392 return false;
393 }
394 }
395 if (!buf_write_prepend(buf, &net_id, sizeof(net_id)))
396 {
397 return false;
398 }
399 }
400 else
401 {
402 if (!buf_write(buf, &net_id, sizeof(net_id)))
403 {
404 return false;
405 }
406 if (long_form)
407 {
408 if (!buf_write(buf, &net_time, sizeof(net_time)))
409 {
410 return false;
411 }
412 }
413 }
414 return true;
415}
416
417const char *
418packet_id_net_print(const struct packet_id_net *pin, bool print_timestamp, struct gc_arena *gc)
419{
420 struct buffer out = alloc_buf_gc(256, gc);
421
423 if (print_timestamp && pin->time)
424 {
425 buf_printf(&out, " / time = (" packet_id_format ") %s", (packet_id_print_type)pin->time,
426 time_string(pin->time, 0, false, gc));
427 }
428
429 buf_printf(&out, " ]");
430 return BSTR(&out);
431}
432
433/* initialize the packet_id_persist structure in a disabled state */
434void
436{
437 p->filename = NULL;
438 p->fd = -1;
439 p->time = p->time_last_written = 0;
440 p->id = p->id_last_written = 0;
441}
442
443/* close the file descriptor if it is open, and switch to disabled state */
444void
446{
448 {
449 if (close(p->fd))
450 {
451 msg(D_PID_PERSIST | M_ERRNO, "Close error on --replay-persist file %s", p->filename);
452 }
454 }
455}
456
457/* load persisted rec packet_id (time and id) only once from file, and set state to enabled */
458void
459packet_id_persist_load(struct packet_id_persist *p, const char *filename)
460{
461 struct gc_arena gc = gc_new();
463 {
464 /* open packet-id persist file for both read and write */
465 p->fd = platform_open(filename, O_CREAT | O_RDWR | O_BINARY, S_IRUSR | S_IWUSR);
466 if (p->fd == -1)
467 {
468 msg(D_PID_PERSIST | M_ERRNO, "Cannot open --replay-persist file %s for read/write",
469 filename);
470 }
471 else
472 {
473 struct packet_id_persist_file_image image;
474 ssize_t n;
475
476#if defined(HAVE_FLOCK) && defined(LOCK_EX) && defined(LOCK_NB)
477 if (flock(p->fd, LOCK_EX | LOCK_NB))
478 {
479 msg(M_ERR, "Cannot obtain exclusive lock on --replay-persist file %s", filename);
480 }
481#endif
482
483 p->filename = filename;
484 n = read(p->fd, &image, sizeof(image));
485 if (n == sizeof(image))
486 {
487 p->time = p->time_last_written = image.time;
488 p->id = p->id_last_written = image.id;
489 dmsg(D_PID_PERSIST_DEBUG, "PID Persist Read from %s: %s", p->filename,
491 }
492 else if (n == -1)
493 {
494 msg(D_PID_PERSIST | M_ERRNO, "Read error on --replay-persist file %s", p->filename);
495 }
496 }
497 }
498 gc_free(&gc);
499}
500
501/* save persisted rec packet_id (time and id) to file (only if enabled state) */
502void
504{
506 && (p->time != p->time_last_written || p->id != p->id_last_written))
507 {
508 struct packet_id_persist_file_image image;
509 ssize_t n;
510 off_t seek_ret;
511 struct gc_arena gc = gc_new();
512
513 image.time = p->time;
514 image.id = p->id;
515 seek_ret = lseek(p->fd, (off_t)0, SEEK_SET);
516 if (seek_ret == (off_t)0)
517 {
518 n = write(p->fd, &image, sizeof(image));
519 if (n == sizeof(image))
520 {
521 p->time_last_written = p->time;
522 p->id_last_written = p->id;
523 dmsg(D_PID_PERSIST_DEBUG, "PID Persist Write to %s: %s", p->filename,
525 }
526 else
527 {
528 msg(D_PID_PERSIST | M_ERRNO, "Cannot write to --replay-persist file %s",
529 p->filename);
530 }
531 }
532 else
533 {
534 msg(D_PID_PERSIST | M_ERRNO, "Cannot seek to beginning of --replay-persist file %s",
535 p->filename);
536 }
537 gc_free(&gc);
538 }
539}
540
541/* transfer packet_id_persist -> packet_id */
542void
544{
545 if (p && pid && packet_id_persist_enabled(p) && p->time)
546 {
547 pid->rec.time = p->time;
548 pid->rec.id = p->id;
549 }
550}
551
552const char *
554{
555 struct buffer out = alloc_buf_gc(256, gc);
556
557 buf_printf(&out, "[");
558
560 {
562 if (p->time)
563 {
564 buf_printf(&out, " / time = (" packet_id_format ") %s", (packet_id_print_type)p->time,
565 time_string(p->time, 0, false, gc));
566 }
567 }
568
569 buf_printf(&out, " ]");
570 return (char *)out.data;
571}
572
573#ifdef ENABLE_DEBUG
574
575static void
576packet_id_debug_print(int msglevel, const struct packet_id_rec *p, const struct packet_id_net *pin,
577 const char *message, packet_id_print_type value)
578{
579 struct gc_arena gc = gc_new();
580 struct buffer out = alloc_buf_gc(256, &gc);
581 struct timeval tv;
582 const time_t prev_now = now;
583 const struct seq_list *sl = p->seq_list;
584 int i;
585
586 CLEAR(tv);
587 gettimeofday(&tv, NULL);
588
589 buf_printf(&out, "%s [" packet_id_format "]", message, value);
590 buf_printf(&out, " [%s-%d] [", p->name, p->unit);
591 for (i = 0; sl != NULL && i < sl->x_size; ++i)
592 {
593 char c;
594 time_t v;
595 int diff;
596
597 v = CIRC_LIST_ITEM(sl, i);
598 if (v == SEQ_UNSEEN)
599 {
600 c = '_';
601 }
602 else if (v == SEQ_EXPIRED)
603 {
604 c = 'E';
605 }
606 else
607 {
608 diff = (int)(prev_now - v);
609 if (diff < 0)
610 {
611 c = 'N';
612 }
613 else if (diff < 10)
614 {
615 c = (char)('0' + diff);
616 }
617 else
618 {
619 c = '>';
620 }
621 }
622 buf_printf(&out, "%c", c);
623 }
624 buf_printf(&out, "] %" PRIi64 ":" packet_id_format, (int64_t)p->time, p->id);
625 if (pin)
626 {
627 buf_printf(&out, " %" PRIi64 ":" packet_id_format, (int64_t)pin->time, pin->id);
628 }
629
630 buf_printf(&out, " t=%" PRIi64 "[%d]", (int64_t)prev_now, (int)(prev_now - tv.tv_sec));
631
632 buf_printf(&out, " r=[%d,%" PRIu64 ",%d,%" PRIu64 ",%d]", (int)(p->last_reap - tv.tv_sec),
634 if (sl != NULL)
635 {
636 buf_printf(&out, " sl=[%d,%d,%d,%d]", sl->x_head, sl->x_size, sl->x_cap, sl->x_sizeof);
637 }
638
639
640 msg(msglevel, "%s", BSTR(&out));
641 gc_free(&gc);
642}
643
644#endif /* ifdef ENABLE_DEBUG */
645
646uint16_t
648{
649 uint64_t packet_id;
650
651
652 if (!buf_read(buf, &packet_id, sizeof(packet_id)))
653 {
654 return 0;
655 }
656
657 uint64_t id = ntohll(packet_id);
658 /* top most 16 bits */
659 uint16_t epoch = id >> 48;
660
661 pin->id = id & PACKET_ID_MASK;
662 return epoch;
663}
664
665bool
666packet_id_write_epoch(struct packet_id_send *p, uint16_t epoch, struct buffer *buf)
667{
669 {
670 return false;
671 }
672
673 /* Highest 16 bits of packet id is the epoch.
674 *
675 * The lower 48 bits are the per-epoch packet id counter. */
676 uint64_t net_id = ((uint64_t)epoch) << 48 | p->id;
677
678 /* convert to network order. This ensures that the highest bytes
679 * also become the first ones on the wire*/
680 net_id = htonll(net_id);
681
682 return buf_write(buf, &net_id, sizeof(net_id));
683}
bool buf_printf(struct buffer *buf, const char *format,...)
Definition buffer.c:241
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
Definition buffer.c:89
#define BSTR(buf)
Definition buffer.h:128
static bool buf_write_prepend(struct buffer *dest, const void *src, int size)
Definition buffer.h:672
static bool buf_read(struct buffer *src, void *dest, int size)
Definition buffer.h:762
static bool buf_write(struct buffer *dest, const void *src, size_t size)
Definition buffer.h:660
static void gc_free(struct gc_arena *a)
Definition buffer.h:1015
static struct gc_arena gc_new(void)
Definition buffer.h:1007
#define CIRC_LIST_ALLOC(dest, list_type, size)
Definition circ_list.h:61
#define CIRC_LIST_PUSH(obj, item)
Definition circ_list.h:40
#define CIRC_LIST_ITEM(obj, index)
Definition circ_list.h:53
#define CIRC_LIST_RESET(obj)
Definition circ_list.h:55
#define CIRC_LIST_SIZE(obj)
Definition circ_list.h:47
long int get_random(void)
Definition crypto.c:1716
#define D_PID_DEBUG_LOW
Definition errlevel.h:105
#define D_PID_DEBUG_MEDIUM
Definition errlevel.h:106
#define D_PID_DEBUG
Definition errlevel.h:148
#define D_PID_PERSIST_DEBUG
Definition errlevel.h:169
#define D_PID_PERSIST
Definition errlevel.h:67
#define ntohll(x)
Definition integer.h:36
#define htonll(x)
Definition integer.h:29
@ write
@ read
#define CLEAR(x)
Definition basic.h:32
static bool check_debug_level(unsigned int level)
Definition error.h:257
#define dmsg(flags,...)
Definition error.h:170
#define M_ERR
Definition error.h:104
#define msg(flags,...)
Definition error.h:150
#define ASSERT(x)
Definition error.h:217
#define M_ERRNO
Definition error.h:93
const char * time_string(time_t t, long usec, bool show_usec, struct gc_arena *gc)
Definition otime.c:104
time_t now
Definition otime.c:33
static void packet_id_debug(int msglevel, const struct packet_id_rec *p, const struct packet_id_net *pin, const char *message, uint64_t value)
Definition packet_id.c:63
static void packet_id_init_recv(struct packet_id_rec *rec, int seq_backtrack, int time_backtrack, const char *name, int unit)
Definition packet_id.c:75
void packet_id_persist_save(struct packet_id_persist *p)
Definition packet_id.c:503
const char * packet_id_persist_print(const struct packet_id_persist *p, struct gc_arena *gc)
Definition packet_id.c:553
void packet_id_persist_load_obj(const struct packet_id_persist *p, struct packet_id *pid)
Definition packet_id.c:543
uint16_t packet_id_read_epoch(struct packet_id_net *pin, struct buffer *buf)
Reads the packet ID containing both the epoch and the per-epoch counter from the buf.
Definition packet_id.c:647
void packet_id_init(struct packet_id *p, int seq_backtrack, int time_backtrack, const char *name, int unit)
Definition packet_id.c:91
#define SEQ_UNSEEN
Definition packet_id.c:52
void packet_id_persist_close(struct packet_id_persist *p)
Definition packet_id.c:445
bool packet_id_write_epoch(struct packet_id_send *p, uint16_t epoch, struct buffer *buf)
Writes the packet ID containing both the epoch and the packet id to the buffer specified by buf.
Definition packet_id.c:666
void packet_id_free(struct packet_id *p)
Definition packet_id.c:121
static bool packet_id_send_update_epoch(struct packet_id_send *p)
Definition packet_id.c:362
bool packet_id_test(struct packet_id_rec *p, const struct packet_id_net *pin)
Definition packet_id.c:215
bool packet_id_read(struct packet_id_net *pin, struct buffer *buf, bool long_form)
Definition packet_id.c:314
static bool packet_id_send_update(struct packet_id_send *p, bool long_form)
Definition packet_id.c:339
void packet_id_move_recv(struct packet_id_rec *dest, struct packet_id_rec *src)
Move the packet id recv structure from src to dest.
Definition packet_id.c:104
void packet_id_reap(struct packet_id_rec *p)
Definition packet_id.c:184
const char * packet_id_net_print(const struct packet_id_net *pin, bool print_timestamp, struct gc_arena *gc)
Definition packet_id.c:418
void packet_id_add(struct packet_id_rec *p, const struct packet_id_net *pin)
Definition packet_id.c:132
#define SEQ_EXPIRED
Definition packet_id.c:53
void packet_id_persist_load(struct packet_id_persist *p, const char *filename)
Definition packet_id.c:459
void packet_id_persist_init(struct packet_id_persist *p)
Definition packet_id.c:435
bool packet_id_write(struct packet_id_send *p, struct buffer *buf, bool long_form, bool prepend)
Write a packet ID to buf, and update the packet ID state.
Definition packet_id.c:377
#define packet_id_format
Definition packet_id.h:76
#define htonpid(x)
Definition packet_id.h:61
static bool packet_id_persist_enabled(const struct packet_id_persist *p)
Definition packet_id.h:278
uint64_t packet_id_print_type
Definition packet_id.h:77
#define MAX_SEQ_BACKTRACK
Definition packet_id.h:85
uint32_t net_time_t
Definition packet_id.h:51
uint32_t packet_id_type
Definition packet_id.h:45
#define PACKET_ID_MAX
Definition packet_id.h:46
#define ntohtime(x)
Definition packet_id.h:70
#define MIN_SEQ_BACKTRACK
Definition packet_id.h:84
#define MAX_TIME_BACKTRACK
Definition packet_id.h:94
#define ntohpid(x)
Definition packet_id.h:64
#define MIN_TIME_BACKTRACK
Definition packet_id.h:93
#define htontime(x)
Definition packet_id.h:67
#define PACKET_ID_EPOCH_MAX
Definition packet_id.h:47
#define PACKET_ID_MASK
Mask of the bits that contain the 48-bit of the per-epoch packet counter in the packet id.
Definition packet_id.h:50
int platform_open(const char *path, int flags, int mode)
Definition platform.c:517
Wrapper structure for dynamically allocated memory.
Definition buffer.h:60
uint8_t * data
Pointer to the allocated memory.
Definition buffer.h:67
int len
Length in bytes of the actual content within the allocated memory.
Definition buffer.h:65
Garbage collection arena used to keep track of dynamically allocated memory.
Definition buffer.h:116
Data structure for describing the packet id that is received/send to the network.
Definition packet_id.h:191
uint64_t id
Definition packet_id.h:194
const char * filename
Definition packet_id.h:133
packet_id_type id_last_written
Definition packet_id.h:138
packet_id_type id
Definition packet_id.h:136
time_t time_last_written
Definition packet_id.h:137
uint64_t max_backtrack_stat
Definition packet_id.h:120
uint64_t seq_backtrack
Definition packet_id.h:118
const char * name
Definition packet_id.h:123
uint64_t id
Definition packet_id.h:117
time_t last_reap
Definition packet_id.h:115
struct seq_list * seq_list
Definition packet_id.h:122
uint64_t id
Definition packet_id.h:153
struct packet_id_rec rec
Definition packet_id.h:201
#define O_BINARY
Definition syshead.h:420
#define unlikely(x)
Definition syshead.h:35
struct gc_arena gc
Definition test_ssl.c:154