Skip to content

Conversation

barsnick
Copy link
Contributor

@barsnick barsnick commented Oct 8, 2025

Describe your changes

Some improvements to PacketSniffer logging and error handling.

Issue ticket number and link

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • I read the contribution documentation and made sure that my changes meet its requirements

In case init() ever gets called a second time (depends on framework).

Signed-off-by: Moritz Barsnick <[email protected]>
This aids in debugging and finding the PCAP trace file.

Signed-off-by: Moritz Barsnick <[email protected]>
Actually process the error buffer handed to pcap_open_live(). Initialize it
and evaluate the length.

This allows for useful log messages such as:
void module::PacketSniffer::init() :: Could not open device "enp0s3", sniffing disabled. Error: enp0s3: You don't have permission to capture on that device (socket: Operation not permitted)

Signed-off-by: Moritz Barsnick <[email protected]>
This does not provide Ethernet headers, but works just as well.

Signed-off-by: Moritz Barsnick <[email protected]>
Copy link
Member

@SebaLukas SebaLukas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except the question about "any" the PR looks good 👍

@SebaLukas SebaLukas added this pull request to the merge queue Oct 16, 2025
Merged via the queue into main with commit 1520c25 Oct 16, 2025
12 checks passed
@SebaLukas SebaLukas deleted the feature/packetsniffer-improvements branch October 16, 2025 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants