PCAP_SETFILTER(3PCAP)
💅 PCAP_SETFILTER 💅
okay so bestie, welcome to the PCAP_SETFILTER era — this one’s from the 3PCAP manual, and we’re about to set a filter together 💖
🌸 NAME 🌸
pcap_setfilter — set the filter. that’s it, that’s the whole name, and she ate ✨
✨ SYNOPSIS ✨
#include <pcap/pcap.h>
int pcap_setfilter(pcap_t *p, struct bpf_program *fp);
💖 DESCRIPTION 💖
so pcap_setfilter() is literally how you specify a filter program. fp is a pointer to a bpf_program struct — usually the result of a call to pcap_compile(3PCAP) 🎀
like, that’s the whole vibe: filter program goes in, and you’re specifying it. no cap.
🔥 RETURN VALUE 🔥
pcap_setfilter() returns 0 on success. if you call it on a capture handle that has been created but not activated, it returns PCAP_ERROR_NOT_ACTIVATED — yes, that’s a whole mood ðŸ˜. on other errors, it returns PCAP_ERROR.
if PCAP_ERROR is returned, you can call pcap_geterr(3PCAP) or pcap_perror(3PCAP) with p as an argument to fetch or display the error text. very helpful, very iconic 💜
🫶 SEE ALSO 🫶
pcap(3PCAP)
and that’s the whole page, bestie 💖 from the 3PCAP manual, dated 5 March 2022 — slay, periodt 💅✨
📦 where this page comes from
- alpine 3.22: libpcap-doc 1.10.7-r0 · BSD-3-Clause
- alpine 3.23: libpcap-doc 1.10.7-r0 · BSD-3-Clause
- alpine 3.24: libpcap-doc 1.10.7-r0 · BSD-3-Clause
- centos-stream 10: libpcap-devel 14:1.10.4-8.el10 · ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- debian bookworm: libpcap0.8-dev 1.10.3-1
- debian trixie: libpcap0.8-dev 1.10.5-2
- fedora 43: libpcap-devel 14:1.10.5-3.fc43 · ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 43: libpcap-devel 14:1.10.5-3.fc43 · ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 43: libpcap-devel 14:1.10.7-1.fc43 · ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 43: libpcap-devel 14:1.10.7-1.fc43 · ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 44: libpcap-devel 14:1.10.6-2.fc44 · ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 44: libpcap-devel 14:1.10.6-2.fc44 · ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 44: libpcap-devel 14:1.10.7-1.fc44 · ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 44: libpcap-devel 14:1.10.7-1.fc44 · ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- nixos 26.05: libpcap 1.10.7
- opensuse-leap 16.0: libpcap-devel 1.10.5-160000.5.1 · BSD-3-Clause
- opensuse-leap 16.0: libpcap-devel 1.10.5-160000.5.1 · BSD-3-Clause
- opensuse-leap 16.0: libpcap-devel 1.10.5-160000.5.1 · BSD-3-Clause
- opensuse-leap 16.0: libpcap-devel 1.10.5-160000.5.1 · BSD-3-Clause
- ubuntu noble: libpcap0.8-dev 1.10.4-4.1ubuntu3
- ubuntu noble: libpcap0.8-dev 1.10.4-4.1ubuntu3.1
- ubuntu questing: libpcap0.8-dev 1.10.5-2ubuntu2
- ubuntu resolute: libpcap0.8-dev 1.10.6-1ubuntu1 · BSD-3-clause-var3
- ubuntu resolute: libpcap0.8-dev 1.10.6-1ubuntu1.1 · BSD-3-clause-var3
- ubuntu stonking: libpcap0.8-dev 1.10.7-1ubuntu1 · BSD-3-clause-var3
- Copyright (c) 1994, 1996, 1997 The Regents of the University of California. All rights reserved
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms