Coverage Report

Created: 2025-11-09 06:11

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/frr/lib/stream.h
Line
Count
Source
1
// SPDX-License-Identifier: GPL-2.0-or-later
2
/*
3
 * Packet interface
4
 * Copyright (C) 1999 Kunihiro Ishiguro
5
 */
6
7
#ifndef _ZEBRA_STREAM_H
8
#define _ZEBRA_STREAM_H
9
10
#include <pthread.h>
11
12
#include "frratomic.h"
13
#include "mpls.h"
14
#include "prefix.h"
15
16
#ifdef __cplusplus
17
extern "C" {
18
#endif
19
20
/*
21
 * A stream is an arbitrary buffer, whose contents generally are assumed to
22
 * be in network order.
23
 *
24
 * A stream has the following attributes associated with it:
25
 *
26
 * - size: the allocated, invariant size of the buffer.
27
 *
28
 * - getp: the get position marker, denoting the offset in the stream where
29
 *         the next read (or 'get') will be from. This getp marker is
30
 *         automatically adjusted when data is read from the stream, the
31
 *         user may also manipulate this offset as they wish, within limits
32
 *         (see below)
33
 *
34
 * - endp: the end position marker, denoting the offset in the stream where
35
 *         valid data ends, and if the user attempted to write (or
36
 *         'put') data where that data would be written (or 'put') to.
37
 *
38
 * These attributes are all size_t values.
39
 *
40
 * Constraints:
41
 *
42
 * 1. getp can never exceed endp
43
 *
44
 * - hence if getp is equal to endp, there is no more valid data that can be
45
 *   gotten from the stream (though, the user may reposition getp to earlier in
46
 *   the stream, if they wish).
47
 *
48
 * 2. endp can never exceed size
49
 *
50
 * - hence, if endp is equal to size, then the stream is full, and no more
51
 *   data can be written to the stream.
52
 *
53
 * In other words the following must always be true, and the stream
54
 * abstraction is allowed internally to assert that the following property
55
 * holds true for a stream, as and when it wishes:
56
 *
57
 *        getp <= endp <= size
58
 *
59
 * It is the users responsibility to ensure this property is never violated.
60
 *
61
 * A stream therefore can be thought of like this:
62
 *
63
 *  ---------------------------------------------------
64
 *  |XXXXXXXXXXXXXXXXXXXXXXXX                         |
65
 *  ---------------------------------------------------
66
 *               ^               ^                        ^
67
 *               getp            endp                     size
68
 *
69
 * This shows a stream containing data (shown as 'X') up to the endp offset.
70
 * The stream is empty from endp to size. Without adjusting getp, there are
71
 * still endp-getp bytes of valid data to be read from the stream.
72
 *
73
 * Methods are provided to get and put to/from the stream, as well as
74
 * retrieve the values of the 3 markers and manipulate the getp marker.
75
 *
76
 * Note:
77
 * At the moment, newly allocated streams are zero filled. Hence, one can
78
 * use stream_forward_endp() to effectively create arbitrary zero-fill
79
 * padding. However, note that stream_reset() does *not* zero-out the
80
 * stream. This property should **not** be relied upon.
81
 *
82
 * Best practice is to use stream_put (<stream *>, NULL, <size>) to zero out
83
 * any part of a stream which isn't otherwise written to.
84
 */
85
86
/* Stream buffer. */
87
struct stream {
88
  struct stream *next;
89
90
  /*
91
   * Remainder is ***private*** to stream
92
   * direct access is frowned upon!
93
   * Use the appropriate functions/macros
94
   */
95
  size_t getp;         /* next get position */
96
  size_t endp;         /* last valid data position */
97
  size_t size;         /* size of data segment */
98
  unsigned char data[];  /* data pointer */
99
};
100
101
/* First in first out queue structure. */
102
struct stream_fifo {
103
  /* lock for mt-safe operations */
104
  pthread_mutex_t mtx;
105
106
  /* number of streams in this fifo */
107
  atomic_size_t count;
108
#if defined DEV_BUILD
109
  atomic_size_t max_count;
110
#endif
111
112
  struct stream *head;
113
  struct stream *tail;
114
};
115
116
/* Utility macros. */
117
255
#define STREAM_SIZE(S)  ((S)->size)
118
/* number of bytes which can still be written */
119
566k
#define STREAM_WRITEABLE(S) ((S)->size - (S)->endp)
120
/* number of bytes still to be read */
121
228k
#define STREAM_READABLE(S) ((S)->endp - (S)->getp)
122
123
0
#define STREAM_CONCAT_REMAIN(S1, S2, size) ((size) - (S1)->endp - (S2)->endp)
124
125
/* this macro is deprecated, but not slated for removal anytime soon */
126
6.64k
#define STREAM_DATA(S)  ((S)->data)
127
128
/* Stream prototypes.
129
 * For stream_{put,get}S, the S suffix mean:
130
 *
131
 * c: character (unsigned byte)
132
 * w: word (two bytes)
133
 * l: long (two words)
134
 * q: quad (four words)
135
 */
136
extern struct stream *stream_new(size_t);
137
extern void stream_free(struct stream *);
138
/* Copy 'src' into 'dest', returns 'dest' */
139
extern struct stream *stream_copy(struct stream *dest,
140
          const struct stream *src);
141
extern struct stream *stream_dup(const struct stream *s);
142
143
extern size_t stream_resize_inplace(struct stream **sptr, size_t newsize);
144
145
extern size_t stream_get_getp(const struct stream *s);
146
extern size_t stream_get_endp(const struct stream *s);
147
extern size_t stream_get_size(const struct stream *s);
148
149
/**
150
 * Create a new stream structure; copy offset bytes from s1 to the new
151
 * stream; copy s2 data to the new stream; copy rest of s1 data to the
152
 * new stream.
153
 */
154
extern struct stream *stream_dupcat(const struct stream *s1,
155
            const struct stream *s2, size_t offset);
156
157
extern void stream_set_getp(struct stream *, size_t);
158
extern void stream_set_endp(struct stream *, size_t);
159
extern void stream_forward_getp(struct stream *, size_t);
160
extern bool stream_forward_getp2(struct stream *, size_t);
161
extern void stream_rewind_getp(struct stream *s, size_t size);
162
extern bool stream_rewind_getp2(struct stream *s, size_t size);
163
extern void stream_forward_endp(struct stream *, size_t);
164
extern bool stream_forward_endp2(struct stream *, size_t);
165
166
/* steam_put: NULL source zeroes out size_t bytes of stream */
167
extern void stream_put(struct stream *, const void *, size_t);
168
extern int stream_putc(struct stream *, uint8_t);
169
extern int stream_putc_at(struct stream *, size_t, uint8_t);
170
extern int stream_putw(struct stream *, uint16_t);
171
extern int stream_putw_at(struct stream *, size_t, uint16_t);
172
extern int stream_put3(struct stream *, uint32_t);
173
extern int stream_put3_at(struct stream *, size_t, uint32_t);
174
extern int stream_putl(struct stream *, uint32_t);
175
extern int stream_putl_at(struct stream *, size_t, uint32_t);
176
extern int stream_putq(struct stream *, uint64_t);
177
extern int stream_putq_at(struct stream *, size_t, uint64_t);
178
extern int stream_put_ipv4(struct stream *, uint32_t);
179
extern int stream_put_in_addr(struct stream *s, const struct in_addr *addr);
180
extern bool stream_put_ipaddr(struct stream *s, struct ipaddr *ip);
181
extern int stream_put_in_addr_at(struct stream *s, size_t putp,
182
         const struct in_addr *addr);
183
extern int stream_put_in6_addr_at(struct stream *s, size_t putp,
184
          const struct in6_addr *addr);
185
extern int stream_put_prefix_addpath(struct stream *s, const struct prefix *p,
186
             bool addpath_capable,
187
             uint32_t addpath_tx_id);
188
extern int stream_put_prefix(struct stream *s, const struct prefix *p);
189
extern int stream_put_labeled_prefix(struct stream *, const struct prefix *,
190
             mpls_label_t *, bool addpath_capable,
191
             uint32_t addpath_tx_id);
192
extern void stream_get(void *, struct stream *, size_t);
193
extern bool stream_get2(void *data, struct stream *s, size_t size);
194
extern void stream_get_from(void *, struct stream *, size_t, size_t);
195
extern uint8_t stream_getc(struct stream *);
196
extern bool stream_getc2(struct stream *s, uint8_t *byte);
197
extern uint8_t stream_getc_from(struct stream *, size_t);
198
extern uint16_t stream_getw(struct stream *);
199
extern bool stream_getw2(struct stream *s, uint16_t *word);
200
extern uint16_t stream_getw_from(struct stream *, size_t);
201
extern uint32_t stream_get3(struct stream *);
202
extern uint32_t stream_get3_from(struct stream *, size_t);
203
extern uint32_t stream_getl(struct stream *);
204
extern bool stream_getl2(struct stream *s, uint32_t *l);
205
extern uint32_t stream_getl_from(struct stream *, size_t);
206
extern uint64_t stream_getq(struct stream *);
207
extern uint64_t stream_getq_from(struct stream *, size_t);
208
bool stream_getq2(struct stream *s, uint64_t *q);
209
extern uint32_t stream_get_ipv4(struct stream *);
210
extern bool stream_get_ipaddr(struct stream *s, struct ipaddr *ip);
211
212
/* IEEE-754 floats */
213
extern float stream_getf(struct stream *);
214
extern double stream_getd(struct stream *);
215
extern int stream_putf(struct stream *, float);
216
extern int stream_putd(struct stream *, double);
217
218
#undef stream_read
219
#undef stream_write
220
221
/* Deprecated: assumes blocking I/O.  Will be removed.
222
   Use stream_read_try instead.  */
223
extern int stream_read(struct stream *, int, size_t);
224
225
/* Read up to size bytes into the stream.
226
   Return code:
227
     >0: number of bytes read
228
     0: end-of-file
229
     -1: fatal error
230
     -2: transient error, should retry later (i.e. EAGAIN or EINTR)
231
   This is suitable for use with non-blocking file descriptors.
232
 */
233
extern ssize_t stream_read_try(struct stream *s, int fd, size_t size);
234
235
extern ssize_t stream_recvmsg(struct stream *s, int fd, struct msghdr *,
236
            int flags, size_t size);
237
extern ssize_t stream_recvfrom(struct stream *s, int fd, size_t len, int flags,
238
             struct sockaddr *from, socklen_t *fromlen);
239
extern size_t stream_write(struct stream *, const void *, size_t);
240
241
/* reset the stream. See Note above */
242
extern void stream_reset(struct stream *);
243
extern int stream_flush(struct stream *, int);
244
extern int stream_empty(struct stream *); /* is the stream empty? */
245
246
/* debugging */
247
extern void stream_hexdump(const struct stream *s);
248
249
/**
250
 * Reorganize the buffer data so it can fit more. This function is normally
251
 * called right after stream data is consumed so we can read more data
252
 * (the functions that consume data start with `stream_get*()` and macros
253
 * `STREAM_GET*()`).
254
 *
255
 * \param s stream pointer.
256
 */
257
extern void stream_pulldown(struct stream *s);
258
259
/* deprecated */
260
extern uint8_t *stream_pnt(struct stream *);
261
262
/*
263
 * Operations on struct stream_fifo.
264
 *
265
 * Each function has a safe variant, which ensures that the operation performed
266
 * is atomic with respect to the operations performed by all other safe
267
 * variants. In other words, the safe variants lock the stream_fifo's mutex
268
 * before performing their action. These are provided for convenience when
269
 * using stream_fifo in a multithreaded context, to alleviate the need for the
270
 * caller to implement their own synchronization around the stream_fifo.
271
 *
272
 * The following functions do not have safe variants. The caller must ensure
273
 * that these operations are performed safely in a multithreaded context:
274
 * - stream_fifo_new
275
 * - stream_fifo_free
276
 */
277
278
/*
279
 * Create a new stream_fifo.
280
 *
281
 * Returns:
282
 *    newly created stream_fifo
283
 */
284
extern struct stream_fifo *stream_fifo_new(void);
285
286
/*
287
 * Init or re-init an on-stack fifo. This allows use of a fifo struct without
288
 * requiring a malloc/free cycle.
289
 * Note well that the fifo must be de-inited with the 'fifo_deinit' api.
290
 */
291
void stream_fifo_init(struct stream_fifo *fifo);
292
293
/*
294
 * Deinit an on-stack fifo.
295
 */
296
void stream_fifo_deinit(struct stream_fifo *fifo);
297
298
/*
299
 * Push a stream onto a stream_fifo.
300
 *
301
 * fifo
302
 *    the stream_fifo to push onto
303
 *
304
 * s
305
 *    the stream to push onto the stream_fifo
306
 */
307
extern void stream_fifo_push(struct stream_fifo *fifo, struct stream *s);
308
extern void stream_fifo_push_safe(struct stream_fifo *fifo, struct stream *s);
309
310
/*
311
 * Pop a stream off a stream_fifo.
312
 *
313
 * fifo
314
 *    the stream_fifo to pop from
315
 *
316
 * Returns:
317
 *    the next stream in the stream_fifo
318
 */
319
extern struct stream *stream_fifo_pop(struct stream_fifo *fifo);
320
extern struct stream *stream_fifo_pop_safe(struct stream_fifo *fifo);
321
322
/*
323
 * Retrieve the next stream from a stream_fifo without popping it.
324
 *
325
 * fifo
326
 *    the stream_fifo to operate on
327
 *
328
 * Returns:
329
 *    the next stream that would be returned from stream_fifo_pop
330
 */
331
extern struct stream *stream_fifo_head(struct stream_fifo *fifo);
332
extern struct stream *stream_fifo_head_safe(struct stream_fifo *fifo);
333
334
/*
335
 * Remove all streams from a stream_fifo.
336
 *
337
 * fifo
338
 *    the stream_fifo to clean
339
 */
340
extern void stream_fifo_clean(struct stream_fifo *fifo);
341
extern void stream_fifo_clean_safe(struct stream_fifo *fifo);
342
343
/*
344
 * Retrieve number of streams on a stream_fifo.
345
 *
346
 * fifo
347
 *    the stream_fifo to retrieve the count for
348
 *
349
 * Returns:
350
 *    the number of streams on the stream_fifo
351
 */
352
extern size_t stream_fifo_count_safe(struct stream_fifo *fifo);
353
354
/*
355
 * Free a stream_fifo.
356
 *
357
 * Calls stream_fifo_clean, then deinitializes the stream_fifo and frees it.
358
 *
359
 * fifo
360
 *    the stream_fifo to free
361
 */
362
extern void stream_fifo_free(struct stream_fifo *fifo);
363
364
/* This is here because "<< 24" is particularly problematic in C.
365
 * This is because the left operand of << is integer-promoted, which means
366
 * an uint8_t gets converted into a *signed* int.  Shifting into the sign
367
 * bit of a signed int is theoretically undefined behaviour, so - the left
368
 * operand needs to be cast to unsigned.
369
 *
370
 * This is not a problem for 16- or 8-bit values (they don't reach the sign
371
 * bit), for 64-bit values (you need to cast them anyway), and neither for
372
 * encoding (because it's downcasted.)
373
 */
374
static inline const uint8_t *ptr_get_be64(const uint8_t *ptr, uint64_t *out)
375
0
{
376
0
  uint32_t tmp1, tmp2;
377
378
0
  memcpy(&tmp1, ptr, sizeof(tmp1));
379
0
  memcpy(&tmp2, ptr + sizeof(tmp1), sizeof(tmp1));
380
381
0
  *out = (((uint64_t)ntohl(tmp1)) << 32) | ntohl(tmp2);
382
383
0
  return ptr + 8;
384
0
}
Unexecuted instantiation: ospf_main.c:ptr_get_be64
Unexecuted instantiation: ospf_bfd.c:ptr_get_be64
Unexecuted instantiation: ospf_dump.c:ptr_get_be64
Unexecuted instantiation: ospf_dump_api.c:ptr_get_be64
Unexecuted instantiation: ospf_interface.c:ptr_get_be64
Unexecuted instantiation: ospf_lsa.c:ptr_get_be64
Unexecuted instantiation: ospf_lsdb.c:ptr_get_be64
Unexecuted instantiation: ospf_neighbor.c:ptr_get_be64
Unexecuted instantiation: ospf_network.c:ptr_get_be64
Unexecuted instantiation: ospf_nsm.c:ptr_get_be64
Unexecuted instantiation: ospf_opaque.c:ptr_get_be64
Unexecuted instantiation: ospf_packet.c:ptr_get_be64
Unexecuted instantiation: ospf_ri.c:ptr_get_be64
Unexecuted instantiation: ospf_routemap.c:ptr_get_be64
Unexecuted instantiation: ospf_routemap_nb.c:ptr_get_be64
Unexecuted instantiation: ospf_routemap_nb_config.c:ptr_get_be64
Unexecuted instantiation: ospf_spf.c:ptr_get_be64
Unexecuted instantiation: ospf_ti_lfa.c:ptr_get_be64
Unexecuted instantiation: ospf_sr.c:ptr_get_be64
Unexecuted instantiation: ospf_te.c:ptr_get_be64
Unexecuted instantiation: ospf_vty.c:ptr_get_be64
Unexecuted instantiation: ospf_zebra.c:ptr_get_be64
Unexecuted instantiation: ospfd.c:ptr_get_be64
Unexecuted instantiation: ospf_gr_helper.c:ptr_get_be64
Unexecuted instantiation: ospf_abr.c:ptr_get_be64
Unexecuted instantiation: ospf_apiserver.c:ptr_get_be64
Unexecuted instantiation: ospf_asbr.c:ptr_get_be64
Unexecuted instantiation: ospf_ase.c:ptr_get_be64
Unexecuted instantiation: ospf_ext.c:ptr_get_be64
Unexecuted instantiation: ospf_flood.c:ptr_get_be64
Unexecuted instantiation: ospf_gr.c:ptr_get_be64
Unexecuted instantiation: ospf_ia.c:ptr_get_be64
Unexecuted instantiation: ospf_ism.c:ptr_get_be64
Unexecuted instantiation: ospf_ldp_sync.c:ptr_get_be64
Unexecuted instantiation: ospf_route.c:ptr_get_be64
Unexecuted instantiation: ospf_api.c:ptr_get_be64
Unexecuted instantiation: affinitymap.c:ptr_get_be64
Unexecuted instantiation: affinitymap_cli.c:ptr_get_be64
Unexecuted instantiation: affinitymap_northbound.c:ptr_get_be64
Unexecuted instantiation: bfd.c:ptr_get_be64
Unexecuted instantiation: command.c:ptr_get_be64
Unexecuted instantiation: cspf.c:ptr_get_be64
Unexecuted instantiation: filter.c:ptr_get_be64
Unexecuted instantiation: filter_cli.c:ptr_get_be64
Unexecuted instantiation: filter_nb.c:ptr_get_be64
Unexecuted instantiation: ldp_sync.c:ptr_get_be64
Unexecuted instantiation: libfrr.c:ptr_get_be64
Unexecuted instantiation: link_state.c:ptr_get_be64
Unexecuted instantiation: log.c:ptr_get_be64
Unexecuted instantiation: mgmt_be_client.c:ptr_get_be64
Unexecuted instantiation: mgmt_fe_client.c:ptr_get_be64
Unexecuted instantiation: mgmt_msg.c:ptr_get_be64
Unexecuted instantiation: mlag.c:ptr_get_be64
Unexecuted instantiation: plist.c:ptr_get_be64
Unexecuted instantiation: pullwr.c:ptr_get_be64
Unexecuted instantiation: routemap.c:ptr_get_be64
Unexecuted instantiation: routemap_cli.c:ptr_get_be64
Unexecuted instantiation: routemap_northbound.c:ptr_get_be64
Unexecuted instantiation: stream.c:ptr_get_be64
Unexecuted instantiation: zclient.c:ptr_get_be64
Unexecuted instantiation: tc.c:ptr_get_be64
Unexecuted instantiation: connected.c:ptr_get_be64
Unexecuted instantiation: if_netlink.c:ptr_get_be64
Unexecuted instantiation: interface.c:ptr_get_be64
Unexecuted instantiation: ioctl.c:ptr_get_be64
Unexecuted instantiation: kernel_netlink.c:ptr_get_be64
Unexecuted instantiation: label_manager.c:ptr_get_be64
Unexecuted instantiation: main.c:ptr_get_be64
Unexecuted instantiation: netconf_netlink.c:ptr_get_be64
Unexecuted instantiation: redistribute.c:ptr_get_be64
Unexecuted instantiation: router-id.c:ptr_get_be64
Unexecuted instantiation: rt_netlink.c:ptr_get_be64
Unexecuted instantiation: rtadv.c:ptr_get_be64
Unexecuted instantiation: rtread_netlink.c:ptr_get_be64
Unexecuted instantiation: rule_netlink.c:ptr_get_be64
Unexecuted instantiation: table_manager.c:ptr_get_be64
Unexecuted instantiation: tc_netlink.c:ptr_get_be64
Unexecuted instantiation: zapi_msg.c:ptr_get_be64
Unexecuted instantiation: zebra_affinitymap.c:ptr_get_be64
Unexecuted instantiation: zebra_dplane.c:ptr_get_be64
Unexecuted instantiation: zebra_gr.c:ptr_get_be64
Unexecuted instantiation: zebra_l2.c:ptr_get_be64
Unexecuted instantiation: zebra_l2_bridge_if.c:ptr_get_be64
Unexecuted instantiation: zebra_evpn.c:ptr_get_be64
Unexecuted instantiation: zebra_evpn_mac.c:ptr_get_be64
Unexecuted instantiation: zebra_evpn_neigh.c:ptr_get_be64
Unexecuted instantiation: zebra_mlag.c:ptr_get_be64
Unexecuted instantiation: zebra_mlag_vty.c:ptr_get_be64
Unexecuted instantiation: zebra_mpls.c:ptr_get_be64
Unexecuted instantiation: zebra_mpls_netlink.c:ptr_get_be64
Unexecuted instantiation: zebra_mpls_null.c:ptr_get_be64
Unexecuted instantiation: zebra_mpls_vty.c:ptr_get_be64
Unexecuted instantiation: zebra_srv6.c:ptr_get_be64
Unexecuted instantiation: zebra_srv6_vty.c:ptr_get_be64
Unexecuted instantiation: zebra_mroute.c:ptr_get_be64
Unexecuted instantiation: zebra_nb.c:ptr_get_be64
Unexecuted instantiation: zebra_nb_config.c:ptr_get_be64
Unexecuted instantiation: zebra_nb_rpcs.c:ptr_get_be64
Unexecuted instantiation: zebra_nb_state.c:ptr_get_be64
Unexecuted instantiation: zebra_netns_id.c:ptr_get_be64
Unexecuted instantiation: zebra_netns_notify.c:ptr_get_be64
Unexecuted instantiation: zebra_nhg.c:ptr_get_be64
Unexecuted instantiation: zebra_ns.c:ptr_get_be64
Unexecuted instantiation: zebra_opaque.c:ptr_get_be64
Unexecuted instantiation: zebra_pbr.c:ptr_get_be64
Unexecuted instantiation: zebra_ptm.c:ptr_get_be64
Unexecuted instantiation: zebra_ptm_redistribute.c:ptr_get_be64
Unexecuted instantiation: zebra_pw.c:ptr_get_be64
Unexecuted instantiation: zebra_rib.c:ptr_get_be64
Unexecuted instantiation: zebra_router.c:ptr_get_be64
Unexecuted instantiation: zebra_rnh.c:ptr_get_be64
Unexecuted instantiation: zebra_routemap.c:ptr_get_be64
Unexecuted instantiation: zebra_routemap_nb_config.c:ptr_get_be64
Unexecuted instantiation: zebra_script.c:ptr_get_be64
Unexecuted instantiation: zebra_srte.c:ptr_get_be64
Unexecuted instantiation: zebra_tc.c:ptr_get_be64
Unexecuted instantiation: zebra_vrf.c:ptr_get_be64
Unexecuted instantiation: zebra_vty.c:ptr_get_be64
Unexecuted instantiation: zebra_vxlan.c:ptr_get_be64
Unexecuted instantiation: zebra_vxlan_if.c:ptr_get_be64
Unexecuted instantiation: zebra_evpn_mh.c:ptr_get_be64
Unexecuted instantiation: zebra_neigh.c:ptr_get_be64
Unexecuted instantiation: zserv.c:ptr_get_be64
Unexecuted instantiation: debug_nl.c:ptr_get_be64
Unexecuted instantiation: bgp_main.c:ptr_get_be64
Unexecuted instantiation: bgp_attr.c:ptr_get_be64
Unexecuted instantiation: bgp_attr_evpn.c:ptr_get_be64
Unexecuted instantiation: bgp_clist.c:ptr_get_be64
Unexecuted instantiation: bgp_community.c:ptr_get_be64
Unexecuted instantiation: bgp_community_alias.c:ptr_get_be64
Unexecuted instantiation: bgp_debug.c:ptr_get_be64
Unexecuted instantiation: bgp_dump.c:ptr_get_be64
Unexecuted instantiation: bgp_ecommunity.c:ptr_get_be64
Unexecuted instantiation: bgp_evpn.c:ptr_get_be64
Unexecuted instantiation: bgp_evpn_mh.c:ptr_get_be64
Unexecuted instantiation: bgp_evpn_vty.c:ptr_get_be64
Unexecuted instantiation: bgp_filter.c:ptr_get_be64
Unexecuted instantiation: bgp_flowspec_vty.c:ptr_get_be64
Unexecuted instantiation: bgp_fsm.c:ptr_get_be64
Unexecuted instantiation: bgp_io.c:ptr_get_be64
Unexecuted instantiation: bgp_keepalives.c:ptr_get_be64
Unexecuted instantiation: bgp_labelpool.c:ptr_get_be64
Unexecuted instantiation: bgp_lcommunity.c:ptr_get_be64
Unexecuted instantiation: bgp_mac.c:ptr_get_be64
Unexecuted instantiation: bgp_mpath.c:ptr_get_be64
Unexecuted instantiation: bgp_mplsvpn.c:ptr_get_be64
Unexecuted instantiation: bgp_network.c:ptr_get_be64
Unexecuted instantiation: bgp_nexthop.c:ptr_get_be64
Unexecuted instantiation: bgp_nht.c:ptr_get_be64
Unexecuted instantiation: bgp_packet.c:ptr_get_be64
Unexecuted instantiation: bgp_pbr.c:ptr_get_be64
Unexecuted instantiation: bgp_rd.c:ptr_get_be64
Unexecuted instantiation: bgp_regex.c:ptr_get_be64
Unexecuted instantiation: bgp_route.c:ptr_get_be64
Unexecuted instantiation: bgp_routemap.c:ptr_get_be64
Unexecuted instantiation: bgp_routemap_nb.c:ptr_get_be64
Unexecuted instantiation: bgp_routemap_nb_config.c:ptr_get_be64
Unexecuted instantiation: bgp_table.c:ptr_get_be64
Unexecuted instantiation: bgp_updgrp.c:ptr_get_be64
Unexecuted instantiation: bgp_updgrp_adv.c:ptr_get_be64
Unexecuted instantiation: bgp_updgrp_packet.c:ptr_get_be64
Unexecuted instantiation: bgp_vpn.c:ptr_get_be64
Unexecuted instantiation: bgp_vty.c:ptr_get_be64
Unexecuted instantiation: bgp_zebra.c:ptr_get_be64
Unexecuted instantiation: bgpd.c:ptr_get_be64
Unexecuted instantiation: bgp_rfapi_cfg.c:ptr_get_be64
Unexecuted instantiation: rfapi_import.c:ptr_get_be64
Unexecuted instantiation: rfapi.c:ptr_get_be64
Unexecuted instantiation: rfapi_ap.c:ptr_get_be64
Unexecuted instantiation: rfapi_encap_tlv.c:ptr_get_be64
Unexecuted instantiation: rfapi_nve_addr.c:ptr_get_be64
Unexecuted instantiation: rfapi_monitor.c:ptr_get_be64
Unexecuted instantiation: rfapi_rib.c:ptr_get_be64
Unexecuted instantiation: rfapi_vty.c:ptr_get_be64
Unexecuted instantiation: vnc_debug.c:ptr_get_be64
Unexecuted instantiation: vnc_export_bgp.c:ptr_get_be64
Unexecuted instantiation: vnc_export_table.c:ptr_get_be64
Unexecuted instantiation: vnc_import_bgp.c:ptr_get_be64
Unexecuted instantiation: vnc_zebra.c:ptr_get_be64
Unexecuted instantiation: bgp_addpath.c:ptr_get_be64
Unexecuted instantiation: bgp_advertise.c:ptr_get_be64
Unexecuted instantiation: bgp_aspath.c:ptr_get_be64
Unexecuted instantiation: bgp_bfd.c:ptr_get_be64
Unexecuted instantiation: bgp_conditional_adv.c:ptr_get_be64
Unexecuted instantiation: bgp_damp.c:ptr_get_be64
Unexecuted instantiation: bgp_encap_tlv.c:ptr_get_be64
Unexecuted instantiation: bgp_flowspec.c:ptr_get_be64
Unexecuted instantiation: bgp_flowspec_util.c:ptr_get_be64
Unexecuted instantiation: bgp_label.c:ptr_get_be64
Unexecuted instantiation: bgp_open.c:ptr_get_be64
Unexecuted instantiation: rfp_example.c:ptr_get_be64
Unexecuted instantiation: pim_assert.c:ptr_get_be64
Unexecuted instantiation: pim_bfd.c:ptr_get_be64
Unexecuted instantiation: pim_bsm.c:ptr_get_be64
Unexecuted instantiation: pim_cmd_common.c:ptr_get_be64
Unexecuted instantiation: pim_hello.c:ptr_get_be64
Unexecuted instantiation: pim_iface.c:ptr_get_be64
Unexecuted instantiation: pim_ifchannel.c:ptr_get_be64
Unexecuted instantiation: pim_instance.c:ptr_get_be64
Unexecuted instantiation: pim_join.c:ptr_get_be64
Unexecuted instantiation: pim_jp_agg.c:ptr_get_be64
Unexecuted instantiation: pim_macro.c:ptr_get_be64
Unexecuted instantiation: pim_mroute.c:ptr_get_be64
Unexecuted instantiation: pim_msg.c:ptr_get_be64
Unexecuted instantiation: pim_nb_config.c:ptr_get_be64
Unexecuted instantiation: pim_neighbor.c:ptr_get_be64
Unexecuted instantiation: pim_nht.c:ptr_get_be64
Unexecuted instantiation: pim_oil.c:ptr_get_be64
Unexecuted instantiation: pim_pim.c:ptr_get_be64
Unexecuted instantiation: pim_routemap.c:ptr_get_be64
Unexecuted instantiation: pim_rp.c:ptr_get_be64
Unexecuted instantiation: pim_rpf.c:ptr_get_be64
Unexecuted instantiation: pim_sock.c:ptr_get_be64
Unexecuted instantiation: pim_ssm.c:ptr_get_be64
Unexecuted instantiation: pim_ssmpingd.c:ptr_get_be64
Unexecuted instantiation: pim_static.c:ptr_get_be64
Unexecuted instantiation: pim_tib.c:ptr_get_be64
Unexecuted instantiation: pim_tlv.c:ptr_get_be64
Unexecuted instantiation: pim_upstream.c:ptr_get_be64
Unexecuted instantiation: pim_util.c:ptr_get_be64
Unexecuted instantiation: pim_vty.c:ptr_get_be64
Unexecuted instantiation: pim_zebra.c:ptr_get_be64
Unexecuted instantiation: pim_zlookup.c:ptr_get_be64
Unexecuted instantiation: pim_vxlan.c:ptr_get_be64
Unexecuted instantiation: pim_register.c:ptr_get_be64
Unexecuted instantiation: pimd.c:ptr_get_be64
Unexecuted instantiation: pim_cmd.c:ptr_get_be64
Unexecuted instantiation: pim_igmp.c:ptr_get_be64
Unexecuted instantiation: pim_igmp_mtrace.c:ptr_get_be64
Unexecuted instantiation: pim_igmpv2.c:ptr_get_be64
Unexecuted instantiation: pim_igmpv3.c:ptr_get_be64
Unexecuted instantiation: pim_main.c:ptr_get_be64
Unexecuted instantiation: pim_mlag.c:ptr_get_be64
Unexecuted instantiation: pim_msdp.c:ptr_get_be64
Unexecuted instantiation: pim_msdp_packet.c:ptr_get_be64
Unexecuted instantiation: pim_msdp_socket.c:ptr_get_be64
Unexecuted instantiation: pim_signals.c:ptr_get_be64
Unexecuted instantiation: pim_zpthread.c:ptr_get_be64
385
386
static inline const uint8_t *ptr_get_be32(const uint8_t *ptr, uint32_t *out)
387
731
{
388
731
  uint32_t tmp;
389
390
731
  memcpy(&tmp, ptr, sizeof(tmp));
391
731
  *out = ntohl(tmp);
392
731
  return ptr + 4;
393
731
}
Unexecuted instantiation: ospf_main.c:ptr_get_be32
Unexecuted instantiation: ospf_bfd.c:ptr_get_be32
Unexecuted instantiation: ospf_dump.c:ptr_get_be32
Unexecuted instantiation: ospf_dump_api.c:ptr_get_be32
Unexecuted instantiation: ospf_interface.c:ptr_get_be32
Unexecuted instantiation: ospf_lsa.c:ptr_get_be32
Unexecuted instantiation: ospf_lsdb.c:ptr_get_be32
Unexecuted instantiation: ospf_neighbor.c:ptr_get_be32
Unexecuted instantiation: ospf_network.c:ptr_get_be32
Unexecuted instantiation: ospf_nsm.c:ptr_get_be32
Unexecuted instantiation: ospf_opaque.c:ptr_get_be32
Unexecuted instantiation: ospf_packet.c:ptr_get_be32
Unexecuted instantiation: ospf_ri.c:ptr_get_be32
Unexecuted instantiation: ospf_routemap.c:ptr_get_be32
Unexecuted instantiation: ospf_routemap_nb.c:ptr_get_be32
Unexecuted instantiation: ospf_routemap_nb_config.c:ptr_get_be32
Unexecuted instantiation: ospf_spf.c:ptr_get_be32
Unexecuted instantiation: ospf_ti_lfa.c:ptr_get_be32
Unexecuted instantiation: ospf_sr.c:ptr_get_be32
Unexecuted instantiation: ospf_te.c:ptr_get_be32
Unexecuted instantiation: ospf_vty.c:ptr_get_be32
Unexecuted instantiation: ospf_zebra.c:ptr_get_be32
Unexecuted instantiation: ospfd.c:ptr_get_be32
Unexecuted instantiation: ospf_gr_helper.c:ptr_get_be32
Unexecuted instantiation: ospf_abr.c:ptr_get_be32
Unexecuted instantiation: ospf_apiserver.c:ptr_get_be32
Unexecuted instantiation: ospf_asbr.c:ptr_get_be32
Unexecuted instantiation: ospf_ase.c:ptr_get_be32
Unexecuted instantiation: ospf_ext.c:ptr_get_be32
Unexecuted instantiation: ospf_flood.c:ptr_get_be32
Unexecuted instantiation: ospf_gr.c:ptr_get_be32
Unexecuted instantiation: ospf_ia.c:ptr_get_be32
Unexecuted instantiation: ospf_ism.c:ptr_get_be32
Unexecuted instantiation: ospf_ldp_sync.c:ptr_get_be32
Unexecuted instantiation: ospf_route.c:ptr_get_be32
Unexecuted instantiation: ospf_api.c:ptr_get_be32
Unexecuted instantiation: affinitymap.c:ptr_get_be32
Unexecuted instantiation: affinitymap_cli.c:ptr_get_be32
Unexecuted instantiation: affinitymap_northbound.c:ptr_get_be32
Unexecuted instantiation: bfd.c:ptr_get_be32
Unexecuted instantiation: command.c:ptr_get_be32
Unexecuted instantiation: cspf.c:ptr_get_be32
Unexecuted instantiation: filter.c:ptr_get_be32
Unexecuted instantiation: filter_cli.c:ptr_get_be32
Unexecuted instantiation: filter_nb.c:ptr_get_be32
Unexecuted instantiation: ldp_sync.c:ptr_get_be32
Unexecuted instantiation: libfrr.c:ptr_get_be32
Unexecuted instantiation: link_state.c:ptr_get_be32
Unexecuted instantiation: log.c:ptr_get_be32
Unexecuted instantiation: mgmt_be_client.c:ptr_get_be32
Unexecuted instantiation: mgmt_fe_client.c:ptr_get_be32
Unexecuted instantiation: mgmt_msg.c:ptr_get_be32
Unexecuted instantiation: mlag.c:ptr_get_be32
Unexecuted instantiation: plist.c:ptr_get_be32
Unexecuted instantiation: pullwr.c:ptr_get_be32
Unexecuted instantiation: routemap.c:ptr_get_be32
Unexecuted instantiation: routemap_cli.c:ptr_get_be32
Unexecuted instantiation: routemap_northbound.c:ptr_get_be32
Unexecuted instantiation: stream.c:ptr_get_be32
Unexecuted instantiation: zclient.c:ptr_get_be32
Unexecuted instantiation: tc.c:ptr_get_be32
Unexecuted instantiation: connected.c:ptr_get_be32
Unexecuted instantiation: if_netlink.c:ptr_get_be32
Unexecuted instantiation: interface.c:ptr_get_be32
Unexecuted instantiation: ioctl.c:ptr_get_be32
Unexecuted instantiation: kernel_netlink.c:ptr_get_be32
Unexecuted instantiation: label_manager.c:ptr_get_be32
Unexecuted instantiation: main.c:ptr_get_be32
Unexecuted instantiation: netconf_netlink.c:ptr_get_be32
Unexecuted instantiation: redistribute.c:ptr_get_be32
Unexecuted instantiation: router-id.c:ptr_get_be32
Unexecuted instantiation: rt_netlink.c:ptr_get_be32
Unexecuted instantiation: rtadv.c:ptr_get_be32
Unexecuted instantiation: rtread_netlink.c:ptr_get_be32
Unexecuted instantiation: rule_netlink.c:ptr_get_be32
Unexecuted instantiation: table_manager.c:ptr_get_be32
Unexecuted instantiation: tc_netlink.c:ptr_get_be32
Unexecuted instantiation: zapi_msg.c:ptr_get_be32
Unexecuted instantiation: zebra_affinitymap.c:ptr_get_be32
Unexecuted instantiation: zebra_dplane.c:ptr_get_be32
Unexecuted instantiation: zebra_gr.c:ptr_get_be32
Unexecuted instantiation: zebra_l2.c:ptr_get_be32
Unexecuted instantiation: zebra_l2_bridge_if.c:ptr_get_be32
Unexecuted instantiation: zebra_evpn.c:ptr_get_be32
Unexecuted instantiation: zebra_evpn_mac.c:ptr_get_be32
Unexecuted instantiation: zebra_evpn_neigh.c:ptr_get_be32
Unexecuted instantiation: zebra_mlag.c:ptr_get_be32
Unexecuted instantiation: zebra_mlag_vty.c:ptr_get_be32
Unexecuted instantiation: zebra_mpls.c:ptr_get_be32
Unexecuted instantiation: zebra_mpls_netlink.c:ptr_get_be32
Unexecuted instantiation: zebra_mpls_null.c:ptr_get_be32
Unexecuted instantiation: zebra_mpls_vty.c:ptr_get_be32
Unexecuted instantiation: zebra_srv6.c:ptr_get_be32
Unexecuted instantiation: zebra_srv6_vty.c:ptr_get_be32
Unexecuted instantiation: zebra_mroute.c:ptr_get_be32
Unexecuted instantiation: zebra_nb.c:ptr_get_be32
Unexecuted instantiation: zebra_nb_config.c:ptr_get_be32
Unexecuted instantiation: zebra_nb_rpcs.c:ptr_get_be32
Unexecuted instantiation: zebra_nb_state.c:ptr_get_be32
Unexecuted instantiation: zebra_netns_id.c:ptr_get_be32
Unexecuted instantiation: zebra_netns_notify.c:ptr_get_be32
Unexecuted instantiation: zebra_nhg.c:ptr_get_be32
Unexecuted instantiation: zebra_ns.c:ptr_get_be32
Unexecuted instantiation: zebra_opaque.c:ptr_get_be32
Unexecuted instantiation: zebra_pbr.c:ptr_get_be32
Unexecuted instantiation: zebra_ptm.c:ptr_get_be32
Unexecuted instantiation: zebra_ptm_redistribute.c:ptr_get_be32
Unexecuted instantiation: zebra_pw.c:ptr_get_be32
Unexecuted instantiation: zebra_rib.c:ptr_get_be32
Unexecuted instantiation: zebra_router.c:ptr_get_be32
Unexecuted instantiation: zebra_rnh.c:ptr_get_be32
Unexecuted instantiation: zebra_routemap.c:ptr_get_be32
Unexecuted instantiation: zebra_routemap_nb_config.c:ptr_get_be32
Unexecuted instantiation: zebra_script.c:ptr_get_be32
Unexecuted instantiation: zebra_srte.c:ptr_get_be32
Unexecuted instantiation: zebra_tc.c:ptr_get_be32
Unexecuted instantiation: zebra_vrf.c:ptr_get_be32
Unexecuted instantiation: zebra_vty.c:ptr_get_be32
Unexecuted instantiation: zebra_vxlan.c:ptr_get_be32
Unexecuted instantiation: zebra_vxlan_if.c:ptr_get_be32
Unexecuted instantiation: zebra_evpn_mh.c:ptr_get_be32
Unexecuted instantiation: zebra_neigh.c:ptr_get_be32
Unexecuted instantiation: zserv.c:ptr_get_be32
Unexecuted instantiation: debug_nl.c:ptr_get_be32
Unexecuted instantiation: bgp_main.c:ptr_get_be32
Unexecuted instantiation: bgp_attr.c:ptr_get_be32
bgp_attr_evpn.c:ptr_get_be32
Line
Count
Source
387
19
{
388
19
  uint32_t tmp;
389
390
19
  memcpy(&tmp, ptr, sizeof(tmp));
391
  *out = ntohl(tmp);
392
19
  return ptr + 4;
393
19
}
Unexecuted instantiation: bgp_clist.c:ptr_get_be32
Unexecuted instantiation: bgp_community.c:ptr_get_be32
Unexecuted instantiation: bgp_community_alias.c:ptr_get_be32
Unexecuted instantiation: bgp_debug.c:ptr_get_be32
Unexecuted instantiation: bgp_dump.c:ptr_get_be32
bgp_ecommunity.c:ptr_get_be32
Line
Count
Source
387
384
{
388
384
  uint32_t tmp;
389
390
384
  memcpy(&tmp, ptr, sizeof(tmp));
391
  *out = ntohl(tmp);
392
384
  return ptr + 4;
393
384
}
Unexecuted instantiation: bgp_evpn.c:ptr_get_be32
Unexecuted instantiation: bgp_evpn_mh.c:ptr_get_be32
Unexecuted instantiation: bgp_evpn_vty.c:ptr_get_be32
Unexecuted instantiation: bgp_filter.c:ptr_get_be32
Unexecuted instantiation: bgp_flowspec_vty.c:ptr_get_be32
Unexecuted instantiation: bgp_fsm.c:ptr_get_be32
Unexecuted instantiation: bgp_io.c:ptr_get_be32
Unexecuted instantiation: bgp_keepalives.c:ptr_get_be32
Unexecuted instantiation: bgp_labelpool.c:ptr_get_be32
bgp_lcommunity.c:ptr_get_be32
Line
Count
Source
387
270
{
388
270
  uint32_t tmp;
389
390
270
  memcpy(&tmp, ptr, sizeof(tmp));
391
  *out = ntohl(tmp);
392
270
  return ptr + 4;
393
270
}
Unexecuted instantiation: bgp_mac.c:ptr_get_be32
Unexecuted instantiation: bgp_mpath.c:ptr_get_be32
Unexecuted instantiation: bgp_mplsvpn.c:ptr_get_be32
Unexecuted instantiation: bgp_network.c:ptr_get_be32
Unexecuted instantiation: bgp_nexthop.c:ptr_get_be32
Unexecuted instantiation: bgp_nht.c:ptr_get_be32
Unexecuted instantiation: bgp_packet.c:ptr_get_be32
Unexecuted instantiation: bgp_pbr.c:ptr_get_be32
bgp_rd.c:ptr_get_be32
Line
Count
Source
387
58
{
388
58
  uint32_t tmp;
389
390
58
  memcpy(&tmp, ptr, sizeof(tmp));
391
  *out = ntohl(tmp);
392
58
  return ptr + 4;
393
58
}
Unexecuted instantiation: bgp_regex.c:ptr_get_be32
Unexecuted instantiation: bgp_route.c:ptr_get_be32
Unexecuted instantiation: bgp_routemap.c:ptr_get_be32
Unexecuted instantiation: bgp_routemap_nb.c:ptr_get_be32
Unexecuted instantiation: bgp_routemap_nb_config.c:ptr_get_be32
Unexecuted instantiation: bgp_table.c:ptr_get_be32
Unexecuted instantiation: bgp_updgrp.c:ptr_get_be32
Unexecuted instantiation: bgp_updgrp_adv.c:ptr_get_be32
Unexecuted instantiation: bgp_updgrp_packet.c:ptr_get_be32
Unexecuted instantiation: bgp_vpn.c:ptr_get_be32
Unexecuted instantiation: bgp_vty.c:ptr_get_be32
Unexecuted instantiation: bgp_zebra.c:ptr_get_be32
Unexecuted instantiation: bgpd.c:ptr_get_be32
Unexecuted instantiation: bgp_rfapi_cfg.c:ptr_get_be32
Unexecuted instantiation: rfapi_import.c:ptr_get_be32
Unexecuted instantiation: rfapi.c:ptr_get_be32
Unexecuted instantiation: rfapi_ap.c:ptr_get_be32
Unexecuted instantiation: rfapi_encap_tlv.c:ptr_get_be32
Unexecuted instantiation: rfapi_nve_addr.c:ptr_get_be32
Unexecuted instantiation: rfapi_monitor.c:ptr_get_be32
Unexecuted instantiation: rfapi_rib.c:ptr_get_be32
Unexecuted instantiation: rfapi_vty.c:ptr_get_be32
Unexecuted instantiation: vnc_debug.c:ptr_get_be32
Unexecuted instantiation: vnc_export_bgp.c:ptr_get_be32
Unexecuted instantiation: vnc_export_table.c:ptr_get_be32
Unexecuted instantiation: vnc_import_bgp.c:ptr_get_be32
Unexecuted instantiation: vnc_zebra.c:ptr_get_be32
Unexecuted instantiation: bgp_addpath.c:ptr_get_be32
Unexecuted instantiation: bgp_advertise.c:ptr_get_be32
Unexecuted instantiation: bgp_aspath.c:ptr_get_be32
Unexecuted instantiation: bgp_bfd.c:ptr_get_be32
Unexecuted instantiation: bgp_conditional_adv.c:ptr_get_be32
Unexecuted instantiation: bgp_damp.c:ptr_get_be32
Unexecuted instantiation: bgp_encap_tlv.c:ptr_get_be32
Unexecuted instantiation: bgp_flowspec.c:ptr_get_be32
Unexecuted instantiation: bgp_flowspec_util.c:ptr_get_be32
Unexecuted instantiation: bgp_label.c:ptr_get_be32
Unexecuted instantiation: bgp_open.c:ptr_get_be32
Unexecuted instantiation: rfp_example.c:ptr_get_be32
Unexecuted instantiation: pim_assert.c:ptr_get_be32
Unexecuted instantiation: pim_bfd.c:ptr_get_be32
Unexecuted instantiation: pim_bsm.c:ptr_get_be32
Unexecuted instantiation: pim_cmd_common.c:ptr_get_be32
Unexecuted instantiation: pim_hello.c:ptr_get_be32
Unexecuted instantiation: pim_iface.c:ptr_get_be32
Unexecuted instantiation: pim_ifchannel.c:ptr_get_be32
Unexecuted instantiation: pim_instance.c:ptr_get_be32
Unexecuted instantiation: pim_join.c:ptr_get_be32
Unexecuted instantiation: pim_jp_agg.c:ptr_get_be32
Unexecuted instantiation: pim_macro.c:ptr_get_be32
Unexecuted instantiation: pim_mroute.c:ptr_get_be32
Unexecuted instantiation: pim_msg.c:ptr_get_be32
Unexecuted instantiation: pim_nb_config.c:ptr_get_be32
Unexecuted instantiation: pim_neighbor.c:ptr_get_be32
Unexecuted instantiation: pim_nht.c:ptr_get_be32
Unexecuted instantiation: pim_oil.c:ptr_get_be32
Unexecuted instantiation: pim_pim.c:ptr_get_be32
Unexecuted instantiation: pim_routemap.c:ptr_get_be32
Unexecuted instantiation: pim_rp.c:ptr_get_be32
Unexecuted instantiation: pim_rpf.c:ptr_get_be32
Unexecuted instantiation: pim_sock.c:ptr_get_be32
Unexecuted instantiation: pim_ssm.c:ptr_get_be32
Unexecuted instantiation: pim_ssmpingd.c:ptr_get_be32
Unexecuted instantiation: pim_static.c:ptr_get_be32
Unexecuted instantiation: pim_tib.c:ptr_get_be32
Unexecuted instantiation: pim_tlv.c:ptr_get_be32
Unexecuted instantiation: pim_upstream.c:ptr_get_be32
Unexecuted instantiation: pim_util.c:ptr_get_be32
Unexecuted instantiation: pim_vty.c:ptr_get_be32
Unexecuted instantiation: pim_zebra.c:ptr_get_be32
Unexecuted instantiation: pim_zlookup.c:ptr_get_be32
Unexecuted instantiation: pim_vxlan.c:ptr_get_be32
Unexecuted instantiation: pim_register.c:ptr_get_be32
Unexecuted instantiation: pimd.c:ptr_get_be32
Unexecuted instantiation: pim_cmd.c:ptr_get_be32
Unexecuted instantiation: pim_igmp.c:ptr_get_be32
Unexecuted instantiation: pim_igmp_mtrace.c:ptr_get_be32
Unexecuted instantiation: pim_igmpv2.c:ptr_get_be32
Unexecuted instantiation: pim_igmpv3.c:ptr_get_be32
Unexecuted instantiation: pim_main.c:ptr_get_be32
Unexecuted instantiation: pim_mlag.c:ptr_get_be32
Unexecuted instantiation: pim_msdp.c:ptr_get_be32
Unexecuted instantiation: pim_msdp_packet.c:ptr_get_be32
Unexecuted instantiation: pim_msdp_socket.c:ptr_get_be32
Unexecuted instantiation: pim_signals.c:ptr_get_be32
Unexecuted instantiation: pim_zpthread.c:ptr_get_be32
394
395
static inline uint8_t *ptr_get_be16(uint8_t *ptr, uint16_t *out)
396
29
{
397
29
  uint16_t tmp;
398
399
29
  memcpy(&tmp, ptr, sizeof(tmp));
400
29
  *out = ntohs(tmp);
401
402
29
  return ptr + 2;
403
29
}
Unexecuted instantiation: ospf_main.c:ptr_get_be16
Unexecuted instantiation: ospf_bfd.c:ptr_get_be16
Unexecuted instantiation: ospf_dump.c:ptr_get_be16
Unexecuted instantiation: ospf_dump_api.c:ptr_get_be16
Unexecuted instantiation: ospf_interface.c:ptr_get_be16
Unexecuted instantiation: ospf_lsa.c:ptr_get_be16
Unexecuted instantiation: ospf_lsdb.c:ptr_get_be16
Unexecuted instantiation: ospf_neighbor.c:ptr_get_be16
Unexecuted instantiation: ospf_network.c:ptr_get_be16
Unexecuted instantiation: ospf_nsm.c:ptr_get_be16
Unexecuted instantiation: ospf_opaque.c:ptr_get_be16
Unexecuted instantiation: ospf_packet.c:ptr_get_be16
Unexecuted instantiation: ospf_ri.c:ptr_get_be16
Unexecuted instantiation: ospf_routemap.c:ptr_get_be16
Unexecuted instantiation: ospf_routemap_nb.c:ptr_get_be16
Unexecuted instantiation: ospf_routemap_nb_config.c:ptr_get_be16
Unexecuted instantiation: ospf_spf.c:ptr_get_be16
Unexecuted instantiation: ospf_ti_lfa.c:ptr_get_be16
Unexecuted instantiation: ospf_sr.c:ptr_get_be16
Unexecuted instantiation: ospf_te.c:ptr_get_be16
Unexecuted instantiation: ospf_vty.c:ptr_get_be16
Unexecuted instantiation: ospf_zebra.c:ptr_get_be16
Unexecuted instantiation: ospfd.c:ptr_get_be16
Unexecuted instantiation: ospf_gr_helper.c:ptr_get_be16
Unexecuted instantiation: ospf_abr.c:ptr_get_be16
Unexecuted instantiation: ospf_apiserver.c:ptr_get_be16
Unexecuted instantiation: ospf_asbr.c:ptr_get_be16
Unexecuted instantiation: ospf_ase.c:ptr_get_be16
Unexecuted instantiation: ospf_ext.c:ptr_get_be16
Unexecuted instantiation: ospf_flood.c:ptr_get_be16
Unexecuted instantiation: ospf_gr.c:ptr_get_be16
Unexecuted instantiation: ospf_ia.c:ptr_get_be16
Unexecuted instantiation: ospf_ism.c:ptr_get_be16
Unexecuted instantiation: ospf_ldp_sync.c:ptr_get_be16
Unexecuted instantiation: ospf_route.c:ptr_get_be16
Unexecuted instantiation: ospf_api.c:ptr_get_be16
Unexecuted instantiation: affinitymap.c:ptr_get_be16
Unexecuted instantiation: affinitymap_cli.c:ptr_get_be16
Unexecuted instantiation: affinitymap_northbound.c:ptr_get_be16
Unexecuted instantiation: bfd.c:ptr_get_be16
Unexecuted instantiation: command.c:ptr_get_be16
Unexecuted instantiation: cspf.c:ptr_get_be16
Unexecuted instantiation: filter.c:ptr_get_be16
Unexecuted instantiation: filter_cli.c:ptr_get_be16
Unexecuted instantiation: filter_nb.c:ptr_get_be16
Unexecuted instantiation: ldp_sync.c:ptr_get_be16
Unexecuted instantiation: libfrr.c:ptr_get_be16
Unexecuted instantiation: link_state.c:ptr_get_be16
Unexecuted instantiation: log.c:ptr_get_be16
Unexecuted instantiation: mgmt_be_client.c:ptr_get_be16
Unexecuted instantiation: mgmt_fe_client.c:ptr_get_be16
Unexecuted instantiation: mgmt_msg.c:ptr_get_be16
Unexecuted instantiation: mlag.c:ptr_get_be16
Unexecuted instantiation: plist.c:ptr_get_be16
Unexecuted instantiation: pullwr.c:ptr_get_be16
Unexecuted instantiation: routemap.c:ptr_get_be16
Unexecuted instantiation: routemap_cli.c:ptr_get_be16
Unexecuted instantiation: routemap_northbound.c:ptr_get_be16
Unexecuted instantiation: stream.c:ptr_get_be16
Unexecuted instantiation: zclient.c:ptr_get_be16
Unexecuted instantiation: tc.c:ptr_get_be16
Unexecuted instantiation: connected.c:ptr_get_be16
Unexecuted instantiation: if_netlink.c:ptr_get_be16
Unexecuted instantiation: interface.c:ptr_get_be16
Unexecuted instantiation: ioctl.c:ptr_get_be16
Unexecuted instantiation: kernel_netlink.c:ptr_get_be16
Unexecuted instantiation: label_manager.c:ptr_get_be16
Unexecuted instantiation: main.c:ptr_get_be16
Unexecuted instantiation: netconf_netlink.c:ptr_get_be16
Unexecuted instantiation: redistribute.c:ptr_get_be16
Unexecuted instantiation: router-id.c:ptr_get_be16
Unexecuted instantiation: rt_netlink.c:ptr_get_be16
Unexecuted instantiation: rtadv.c:ptr_get_be16
Unexecuted instantiation: rtread_netlink.c:ptr_get_be16
Unexecuted instantiation: rule_netlink.c:ptr_get_be16
Unexecuted instantiation: table_manager.c:ptr_get_be16
Unexecuted instantiation: tc_netlink.c:ptr_get_be16
Unexecuted instantiation: zapi_msg.c:ptr_get_be16
Unexecuted instantiation: zebra_affinitymap.c:ptr_get_be16
Unexecuted instantiation: zebra_dplane.c:ptr_get_be16
Unexecuted instantiation: zebra_gr.c:ptr_get_be16
Unexecuted instantiation: zebra_l2.c:ptr_get_be16
Unexecuted instantiation: zebra_l2_bridge_if.c:ptr_get_be16
Unexecuted instantiation: zebra_evpn.c:ptr_get_be16
Unexecuted instantiation: zebra_evpn_mac.c:ptr_get_be16
Unexecuted instantiation: zebra_evpn_neigh.c:ptr_get_be16
Unexecuted instantiation: zebra_mlag.c:ptr_get_be16
Unexecuted instantiation: zebra_mlag_vty.c:ptr_get_be16
Unexecuted instantiation: zebra_mpls.c:ptr_get_be16
Unexecuted instantiation: zebra_mpls_netlink.c:ptr_get_be16
Unexecuted instantiation: zebra_mpls_null.c:ptr_get_be16
Unexecuted instantiation: zebra_mpls_vty.c:ptr_get_be16
Unexecuted instantiation: zebra_srv6.c:ptr_get_be16
Unexecuted instantiation: zebra_srv6_vty.c:ptr_get_be16
Unexecuted instantiation: zebra_mroute.c:ptr_get_be16
Unexecuted instantiation: zebra_nb.c:ptr_get_be16
Unexecuted instantiation: zebra_nb_config.c:ptr_get_be16
Unexecuted instantiation: zebra_nb_rpcs.c:ptr_get_be16
Unexecuted instantiation: zebra_nb_state.c:ptr_get_be16
Unexecuted instantiation: zebra_netns_id.c:ptr_get_be16
Unexecuted instantiation: zebra_netns_notify.c:ptr_get_be16
Unexecuted instantiation: zebra_nhg.c:ptr_get_be16
Unexecuted instantiation: zebra_ns.c:ptr_get_be16
Unexecuted instantiation: zebra_opaque.c:ptr_get_be16
Unexecuted instantiation: zebra_pbr.c:ptr_get_be16
Unexecuted instantiation: zebra_ptm.c:ptr_get_be16
Unexecuted instantiation: zebra_ptm_redistribute.c:ptr_get_be16
Unexecuted instantiation: zebra_pw.c:ptr_get_be16
Unexecuted instantiation: zebra_rib.c:ptr_get_be16
Unexecuted instantiation: zebra_router.c:ptr_get_be16
Unexecuted instantiation: zebra_rnh.c:ptr_get_be16
Unexecuted instantiation: zebra_routemap.c:ptr_get_be16
Unexecuted instantiation: zebra_routemap_nb_config.c:ptr_get_be16
Unexecuted instantiation: zebra_script.c:ptr_get_be16
Unexecuted instantiation: zebra_srte.c:ptr_get_be16
Unexecuted instantiation: zebra_tc.c:ptr_get_be16
Unexecuted instantiation: zebra_vrf.c:ptr_get_be16
Unexecuted instantiation: zebra_vty.c:ptr_get_be16
Unexecuted instantiation: zebra_vxlan.c:ptr_get_be16
Unexecuted instantiation: zebra_vxlan_if.c:ptr_get_be16
Unexecuted instantiation: zebra_evpn_mh.c:ptr_get_be16
Unexecuted instantiation: zebra_neigh.c:ptr_get_be16
Unexecuted instantiation: zserv.c:ptr_get_be16
Unexecuted instantiation: debug_nl.c:ptr_get_be16
Unexecuted instantiation: bgp_main.c:ptr_get_be16
Unexecuted instantiation: bgp_attr.c:ptr_get_be16
bgp_attr_evpn.c:ptr_get_be16
Line
Count
Source
396
29
{
397
29
  uint16_t tmp;
398
399
29
  memcpy(&tmp, ptr, sizeof(tmp));
400
29
  *out = ntohs(tmp);
401
402
29
  return ptr + 2;
403
29
}
Unexecuted instantiation: bgp_clist.c:ptr_get_be16
Unexecuted instantiation: bgp_community.c:ptr_get_be16
Unexecuted instantiation: bgp_community_alias.c:ptr_get_be16
Unexecuted instantiation: bgp_debug.c:ptr_get_be16
Unexecuted instantiation: bgp_dump.c:ptr_get_be16
Unexecuted instantiation: bgp_ecommunity.c:ptr_get_be16
Unexecuted instantiation: bgp_evpn.c:ptr_get_be16
Unexecuted instantiation: bgp_evpn_mh.c:ptr_get_be16
Unexecuted instantiation: bgp_evpn_vty.c:ptr_get_be16
Unexecuted instantiation: bgp_filter.c:ptr_get_be16
Unexecuted instantiation: bgp_flowspec_vty.c:ptr_get_be16
Unexecuted instantiation: bgp_fsm.c:ptr_get_be16
Unexecuted instantiation: bgp_io.c:ptr_get_be16
Unexecuted instantiation: bgp_keepalives.c:ptr_get_be16
Unexecuted instantiation: bgp_labelpool.c:ptr_get_be16
Unexecuted instantiation: bgp_lcommunity.c:ptr_get_be16
Unexecuted instantiation: bgp_mac.c:ptr_get_be16
Unexecuted instantiation: bgp_mpath.c:ptr_get_be16
Unexecuted instantiation: bgp_mplsvpn.c:ptr_get_be16
Unexecuted instantiation: bgp_network.c:ptr_get_be16
Unexecuted instantiation: bgp_nexthop.c:ptr_get_be16
Unexecuted instantiation: bgp_nht.c:ptr_get_be16
Unexecuted instantiation: bgp_packet.c:ptr_get_be16
Unexecuted instantiation: bgp_pbr.c:ptr_get_be16
Unexecuted instantiation: bgp_rd.c:ptr_get_be16
Unexecuted instantiation: bgp_regex.c:ptr_get_be16
Unexecuted instantiation: bgp_route.c:ptr_get_be16
Unexecuted instantiation: bgp_routemap.c:ptr_get_be16
Unexecuted instantiation: bgp_routemap_nb.c:ptr_get_be16
Unexecuted instantiation: bgp_routemap_nb_config.c:ptr_get_be16
Unexecuted instantiation: bgp_table.c:ptr_get_be16
Unexecuted instantiation: bgp_updgrp.c:ptr_get_be16
Unexecuted instantiation: bgp_updgrp_adv.c:ptr_get_be16
Unexecuted instantiation: bgp_updgrp_packet.c:ptr_get_be16
Unexecuted instantiation: bgp_vpn.c:ptr_get_be16
Unexecuted instantiation: bgp_vty.c:ptr_get_be16
Unexecuted instantiation: bgp_zebra.c:ptr_get_be16
Unexecuted instantiation: bgpd.c:ptr_get_be16
Unexecuted instantiation: bgp_rfapi_cfg.c:ptr_get_be16
Unexecuted instantiation: rfapi_import.c:ptr_get_be16
Unexecuted instantiation: rfapi.c:ptr_get_be16
Unexecuted instantiation: rfapi_ap.c:ptr_get_be16
Unexecuted instantiation: rfapi_encap_tlv.c:ptr_get_be16
Unexecuted instantiation: rfapi_nve_addr.c:ptr_get_be16
Unexecuted instantiation: rfapi_monitor.c:ptr_get_be16
Unexecuted instantiation: rfapi_rib.c:ptr_get_be16
Unexecuted instantiation: rfapi_vty.c:ptr_get_be16
Unexecuted instantiation: vnc_debug.c:ptr_get_be16
Unexecuted instantiation: vnc_export_bgp.c:ptr_get_be16
Unexecuted instantiation: vnc_export_table.c:ptr_get_be16
Unexecuted instantiation: vnc_import_bgp.c:ptr_get_be16
Unexecuted instantiation: vnc_zebra.c:ptr_get_be16
Unexecuted instantiation: bgp_addpath.c:ptr_get_be16
Unexecuted instantiation: bgp_advertise.c:ptr_get_be16
Unexecuted instantiation: bgp_aspath.c:ptr_get_be16
Unexecuted instantiation: bgp_bfd.c:ptr_get_be16
Unexecuted instantiation: bgp_conditional_adv.c:ptr_get_be16
Unexecuted instantiation: bgp_damp.c:ptr_get_be16
Unexecuted instantiation: bgp_encap_tlv.c:ptr_get_be16
Unexecuted instantiation: bgp_flowspec.c:ptr_get_be16
Unexecuted instantiation: bgp_flowspec_util.c:ptr_get_be16
Unexecuted instantiation: bgp_label.c:ptr_get_be16
Unexecuted instantiation: bgp_open.c:ptr_get_be16
Unexecuted instantiation: rfp_example.c:ptr_get_be16
Unexecuted instantiation: pim_assert.c:ptr_get_be16
Unexecuted instantiation: pim_bfd.c:ptr_get_be16
Unexecuted instantiation: pim_bsm.c:ptr_get_be16
Unexecuted instantiation: pim_cmd_common.c:ptr_get_be16
Unexecuted instantiation: pim_hello.c:ptr_get_be16
Unexecuted instantiation: pim_iface.c:ptr_get_be16
Unexecuted instantiation: pim_ifchannel.c:ptr_get_be16
Unexecuted instantiation: pim_instance.c:ptr_get_be16
Unexecuted instantiation: pim_join.c:ptr_get_be16
Unexecuted instantiation: pim_jp_agg.c:ptr_get_be16
Unexecuted instantiation: pim_macro.c:ptr_get_be16
Unexecuted instantiation: pim_mroute.c:ptr_get_be16
Unexecuted instantiation: pim_msg.c:ptr_get_be16
Unexecuted instantiation: pim_nb_config.c:ptr_get_be16
Unexecuted instantiation: pim_neighbor.c:ptr_get_be16
Unexecuted instantiation: pim_nht.c:ptr_get_be16
Unexecuted instantiation: pim_oil.c:ptr_get_be16
Unexecuted instantiation: pim_pim.c:ptr_get_be16
Unexecuted instantiation: pim_routemap.c:ptr_get_be16
Unexecuted instantiation: pim_rp.c:ptr_get_be16
Unexecuted instantiation: pim_rpf.c:ptr_get_be16
Unexecuted instantiation: pim_sock.c:ptr_get_be16
Unexecuted instantiation: pim_ssm.c:ptr_get_be16
Unexecuted instantiation: pim_ssmpingd.c:ptr_get_be16
Unexecuted instantiation: pim_static.c:ptr_get_be16
Unexecuted instantiation: pim_tib.c:ptr_get_be16
Unexecuted instantiation: pim_tlv.c:ptr_get_be16
Unexecuted instantiation: pim_upstream.c:ptr_get_be16
Unexecuted instantiation: pim_util.c:ptr_get_be16
Unexecuted instantiation: pim_vty.c:ptr_get_be16
Unexecuted instantiation: pim_zebra.c:ptr_get_be16
Unexecuted instantiation: pim_zlookup.c:ptr_get_be16
Unexecuted instantiation: pim_vxlan.c:ptr_get_be16
Unexecuted instantiation: pim_register.c:ptr_get_be16
Unexecuted instantiation: pimd.c:ptr_get_be16
Unexecuted instantiation: pim_cmd.c:ptr_get_be16
Unexecuted instantiation: pim_igmp.c:ptr_get_be16
Unexecuted instantiation: pim_igmp_mtrace.c:ptr_get_be16
Unexecuted instantiation: pim_igmpv2.c:ptr_get_be16
Unexecuted instantiation: pim_igmpv3.c:ptr_get_be16
Unexecuted instantiation: pim_main.c:ptr_get_be16
Unexecuted instantiation: pim_mlag.c:ptr_get_be16
Unexecuted instantiation: pim_msdp.c:ptr_get_be16
Unexecuted instantiation: pim_msdp_packet.c:ptr_get_be16
Unexecuted instantiation: pim_msdp_socket.c:ptr_get_be16
Unexecuted instantiation: pim_signals.c:ptr_get_be16
Unexecuted instantiation: pim_zpthread.c:ptr_get_be16
404
405
/*
406
 * so Normal stream_getX functions assert.  Which is anathema
407
 * to keeping a daemon up and running when something goes south
408
 * Provide a stream_getX2 functions that do not assert.
409
 * In addition provide these macro's that upon failure
410
 * goto stream_failure.  This is modeled upon some NL_XX
411
 * macros in the linux kernel.
412
 *
413
 * This change allows for proper memory freeing
414
 * after we've detected an error.
415
 *
416
 * In the future we will be removing the assert in
417
 * the stream functions but we need a transition
418
 * plan.
419
 */
420
#define STREAM_GETC(S, P)                                                      \
421
22.8k
  do {                                                                   \
422
22.8k
    uint8_t _pval;                                                 \
423
22.8k
    if (!stream_getc2((S), &_pval))                                \
424
22.8k
      goto stream_failure;                                   \
425
22.8k
    (P) = _pval;                                                   \
426
22.8k
  } while (0)
427
428
#define STREAM_GETW(S, P)                                                      \
429
19.0k
  do {                                                                   \
430
19.0k
    uint16_t _pval;                                                \
431
19.0k
    if (!stream_getw2((S), &_pval))                                \
432
19.0k
      goto stream_failure;                                   \
433
19.0k
    (P) = _pval;                                                   \
434
19.0k
  } while (0)
435
436
#define STREAM_GETL(S, P)                                                      \
437
74.2k
  do {                                                                   \
438
74.2k
    uint32_t _pval;                                                \
439
74.2k
    if (!stream_getl2((S), &_pval))                                \
440
74.2k
      goto stream_failure;                                   \
441
74.2k
    (P) = _pval;                                                   \
442
74.1k
  } while (0)
443
444
#define STREAM_GETF(S, P)                                                      \
445
0
  do {                                                                   \
446
0
    union {                                                        \
447
0
      float r;                                               \
448
0
      uint32_t d;                                            \
449
0
    } _pval;                                                       \
450
0
    if (!stream_getl2((S), &_pval.d))                              \
451
0
      goto stream_failure;                                   \
452
0
    (P) = _pval.r;                                                 \
453
0
  } while (0)
454
455
#define STREAM_GETQ(S, P)                                                      \
456
8.58k
  do {                                                                   \
457
8.58k
    uint64_t _pval;                                                \
458
8.58k
    if (!stream_getq2((S), &_pval))                                \
459
8.58k
      goto stream_failure;                                   \
460
8.58k
    (P) = _pval;                                                   \
461
8.57k
  } while (0)
462
463
#define STREAM_GET_IPADDR(S, P)                                                \
464
10
  do {                                                                   \
465
10
    if (!stream_get_ipaddr((S), (P)))                              \
466
10
      goto stream_failure;                                   \
467
10
  } while (0)
468
469
#define STREAM_GET(P, STR, SIZE)                                               \
470
14.1k
  do {                                                                   \
471
14.1k
    if (!stream_get2((P), (STR), (SIZE)))                          \
472
14.1k
      goto stream_failure;                                   \
473
14.1k
  } while (0)
474
475
#define STREAM_FORWARD_GETP(STR, SIZE)                                         \
476
3
  do {                                                                   \
477
3
    if (!stream_forward_getp2((STR), (SIZE)))                      \
478
3
      goto stream_failure;                                   \
479
3
  } while (0)
480
481
#define STREAM_REWIND_GETP(STR, SIZE)                                          \
482
  do {                                                                   \
483
    if (!stream_rewind_getp2((STR), (SIZE)))                       \
484
      goto stream_failure;                                   \
485
  } while (0)
486
487
#define STREAM_FORWARD_ENDP(STR, SIZE)                                         \
488
  do {                                                                   \
489
    if (!stream_forward_endp2((STR), (SIZE)))                      \
490
      goto stream_failure;                                   \
491
  } while (0)
492
493
#ifdef __cplusplus
494
}
495
#endif
496
497
#endif /* _ZEBRA_STREAM_H */