PCAP_SET_PROMISC(3PCAP)

✨ NAME ✨

pcap_set_promisc β€” bestie, this is the one that decides whether promiscuous mode gets turned on for a capture handle that hasn't been activated yet πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <pcap/pcap.h>

int pcap_set_promisc(pcap_t *p, int promisc);

🌸 DESCRIPTION 🌸

okay so here's the tea: pcap_set_promisc() sets whether promiscuous mode should be turned on for a capture handle at the moment that handle gets activated. It's literally you saying "hey, when you wake up, do this."

And the logic is so simple it's giving main character energy:

  • if promisc is non-zero, promiscuous mode will be set πŸ”₯
  • otherwise (promisc is zero), it will not be set πŸ™ˆ

that's it. that's the whole vibe check. no cap.


πŸ’– RETURN VALUE πŸ’–

pcap_set_promisc() returns 0 on success ✨

but if you call it on a capture handle that has already been activated, it returns PCAP_ERROR_ACTIVATED instead 😭 like bestie, the window has closed, you're too late, it's already activated, we don't do that here.

lowkey important: this is a set-before-activate situation only. once it's activated, that's periodt. πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

  • pcap(3PCAP)
  • pcap_create(3PCAP)
  • pcap_activate(3PCAP)

and that's the whole page, babe 🫢 this came to you from the PCAP_SET_PROMISC(3PCAP) manual, dated 3 January 2014 β€” yes she's an icon, yes she's been serving since 2014, and honestly? she ate. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from