PCAP_ACTIVATE(3PCAP)
π NAME π
pcap_activate β activate a capture handle, bestie π
π¦ SYNOPSIS π¦
#include <pcap/pcap.h>
int pcap_activate(pcap_t *p);
β¨ DESCRIPTION β¨
So, pcap_activate() is the moment of truth, okay? You call it to activate a packet capture handle so it can actually start looking at packets on the network π, and every single option you already set on that handle is in effect when it does. It's giving "we're live, babes" energy, fr fr.
π RETURN VALUE π
Here's the vibe check on what you get back, no cap:
0β success, zero warnings, absolutely ate β¨- non-zero positive value β success, but with warnings (she did it but she's side-eyeing you π«€)
- negative value β error, it's not happening π
And a non-zero return value tells you which warning or error condition went down.
β οΈ The possible warning values β οΈ
PCAP_WARNING_PROMISC_NOTSUPβ you asked for promiscuous mode but the capture source literally does not support promiscuous mode. Not supported, periodt.PCAP_WARNING_TSTAMP_TYPE_NOTSUPβ the time stamp type you specified in an earlierpcap_set_tstamp_type(3PCAP)call isn't supported by the capture source (and the time stamp type just stays as the default, no drama)PCAP_WARNINGβ some other warning condition happened; you can callpcap_geterr(3PCAP)orpcap_perror(3PCAP)withpas an argument to fetch or display a message describing what the warning condition is π
π The possible error values π
PCAP_ERROR_ACTIVATEDβ the handle has already been activated. Bestie. She's already awake.PCAP_ERROR_NO_SUCH_DEVICEβ the capture source you specified when the handle was created doesn't exist π«PCAP_ERROR_PERM_DENIEDβ the process doesn't have permission to open the capture source π«PCAP_ERROR_PROMISC_PERM_DENIEDβ the process does have permission to open the capture source, but does not have permission to put it into promiscuous mode πPCAP_ERROR_RFMON_NOTSUPβ monitor mode was specified but the capture source doesn't support monitor modePCAP_ERROR_IFACE_NOT_UPβ the capture source device is not up π΄PCAP_ERROR_CAPTURE_NOTSUPβ packet capture is not supported on the capture sourcePCAP_ERRORβ some other error occurred;pcap_geterr()orpcap_perror()may be called withpas an argument to fetch or display a message describing the error
If PCAP_WARNING_PROMISC_NOTSUP, PCAP_ERROR_NO_SUCH_DEVICE, PCAP_ERROR_PERM_DENIED, or PCAP_ERROR_CAPTURE_NOTSUP is returned, you can call pcap_geterr() or pcap_perror() with p as an argument to fetch or display a message giving additional details about the problem π¬ β and those deets might be genuinely useful for debugging the problem if it's unexpected. iykyk.
Heads up bestie: additional warning and error codes may be added in the future π. So a program should check for positive, negative, and zero return codes, and treat all positive return codes as warnings and all negative return codes as errors. Also, pcap_statustostr(3PCAP) can be called with a warning or error code as an argument to fetch a message describing that warning or error code. π§
Also also: ifpcap_activate()fails, thepcap_t *is not closed and freed π± β you gotta close it yourself usingpcap_close(3PCAP). Don't leave her hanging, okay?
π SEE ALSO π
pcap(3PCAP)
And that's the whole page, angel π This lil 3PCAP moment landed on 3 June 2024, and it lives under the name PCAP_ACTIVATE(3PCAP). Go forth and activate responsibly π«Άβ¨
π¦ 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
- arch rolling: libpcap 1.11.0-1 Β· BSD-3-Clause
- 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 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 on : a language model's rewrite of the original, under its terms