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

Function bpfd_free

freebsd/net/bpf.c:2624–2663  ·  view source on GitHub ↗

* Free buffers currently in use by a descriptor. * Called on close. */

Source from the content-addressed store, hash-verified

2622 * Called on close.
2623 */
2624static void
2625bpfd_free(epoch_context_t ctx)
2626{
2627 struct bpf_d *d;
2628 struct bpf_program_buffer *p;
2629
2630 /*
2631 * We don't need to lock out interrupts since this descriptor has
2632 * been detached from its interface and it yet hasn't been marked
2633 * free.
2634 */
2635 d = __containerof(ctx, struct bpf_d, epoch_ctx);
2636 bpf_free(d);
2637 if (d->bd_rfilter != NULL) {
2638 p = __containerof((void *)d->bd_rfilter,
2639 struct bpf_program_buffer, buffer);
2640#ifdef BPF_JITTER
2641 p->func = d->bd_bfilter;
2642#endif
2643 bpf_program_buffer_free(&p->epoch_ctx);
2644 }
2645 if (d->bd_wfilter != NULL) {
2646 p = __containerof((void *)d->bd_wfilter,
2647 struct bpf_program_buffer, buffer);
2648#ifdef BPF_JITTER
2649 p->func = NULL;
2650#endif
2651 bpf_program_buffer_free(&p->epoch_ctx);
2652 }
2653
2654 mtx_destroy(&d->bd_lock);
2655 counter_u64_free(d->bd_rcount);
2656 counter_u64_free(d->bd_dcount);
2657 counter_u64_free(d->bd_fcount);
2658 counter_u64_free(d->bd_wcount);
2659 counter_u64_free(d->bd_wfcount);
2660 counter_u64_free(d->bd_wdcount);
2661 counter_u64_free(d->bd_zcopy);
2662 free(d, M_BPF);
2663}
2664
2665/*
2666 * Attach an interface to bpf. dlt is the link layer type; hdrlen is the

Callers

nothing calls this directly

Calls 4

bpf_freeFunction · 0.85
bpf_program_buffer_freeFunction · 0.85
counter_u64_freeFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected