Skip to content

Build with -Wextra and modernise the capture device setup - #39

Merged
git-hulk merged 1 commit into
masterfrom
fix-warnings-and-device-setup
Sep 2, 2026
Merged

Build with -Wextra and modernise the capture device setup#39
git-hulk merged 1 commit into
masterfrom
fix-warnings-and-device-setup

Conversation

@git-hulk

@git-hulk git-hulk commented Sep 2, 2026

Copy link
Copy Markdown
Owner
  • hashtable compared strlen's size_t against an int in three places,
    which is what -Wextra was reporting, and read a uint32_t straight
    out of the key with a cast. That load is undefined for an unaligned
    key and faults outright on a strict-alignment target; memcpy says
    the same thing and compiles to the same instruction.

    • sniffer_online called pcap_lookupnet purely to bail out when it
      failed: neither the network nor the mask it returns is ever used.
      That made a capture on an interface with no IPv4 address fail for no
      reason. Dropped.

    • Replace pcap_lookupdev, which is deprecated and hands back a shared
      buffer, with pcap_findalldevs. The fallback now also skips loopback
      unless it is the only device there is. Reaching this path needs
      root, since the uid check runs first, so it is covered by inspection
      and by exercising pcap_findalldevs directly rather than by a test.

    • Turn on -Wextra now that the tree is clean under it.

🤖 Generated with Claude Code

@git-hulk
git-hulk force-pushed the design-established-connections branch from 6112af8 to 2f40818 Compare September 2, 2026 11:45
@git-hulk
git-hulk force-pushed the fix-warnings-and-device-setup branch from 95f3105 to 858298e Compare September 2, 2026 11:45
@git-hulk
git-hulk force-pushed the design-established-connections branch from 2f40818 to b2ab59e Compare September 2, 2026 11:46
@git-hulk
git-hulk force-pushed the fix-warnings-and-device-setup branch from 858298e to 6890e0f Compare September 2, 2026 11:46
@git-hulk
git-hulk force-pushed the design-established-connections branch from b2ab59e to 86e90ef Compare September 2, 2026 11:47
@git-hulk
git-hulk force-pushed the fix-warnings-and-device-setup branch 2 times, most recently from f60b078 to 74b1b83 Compare September 2, 2026 11:58
@git-hulk
git-hulk force-pushed the design-established-connections branch from 429a565 to 72fa0d8 Compare September 2, 2026 12:15
@git-hulk
git-hulk force-pushed the fix-warnings-and-device-setup branch from 74b1b83 to aaaff4c Compare September 2, 2026 12:15
@git-hulk
git-hulk force-pushed the design-established-connections branch from 72fa0d8 to 21a0828 Compare September 2, 2026 12:24
@git-hulk
git-hulk force-pushed the fix-warnings-and-device-setup branch from aaaff4c to b11586e Compare September 2, 2026 12:24
@git-hulk
git-hulk force-pushed the design-established-connections branch from 21a0828 to da92808 Compare September 2, 2026 12:26
@git-hulk
git-hulk force-pushed the fix-warnings-and-device-setup branch from b11586e to b45045a Compare September 2, 2026 12:26
@git-hulk
git-hulk force-pushed the design-established-connections branch from da92808 to 1c27aee Compare September 2, 2026 12:27
@git-hulk
git-hulk force-pushed the fix-warnings-and-device-setup branch from b45045a to ae8a007 Compare September 2, 2026 12:27
@git-hulk
git-hulk force-pushed the design-established-connections branch from 1c27aee to b3b0c72 Compare September 2, 2026 12:28
@git-hulk
git-hulk force-pushed the fix-warnings-and-device-setup branch from ae8a007 to 43c709f Compare September 2, 2026 12:28
@git-hulk
git-hulk force-pushed the design-established-connections branch from b3b0c72 to 8584a14 Compare September 2, 2026 12:31
@git-hulk
git-hulk force-pushed the fix-warnings-and-device-setup branch from 43c709f to 2adb55c Compare September 2, 2026 12:31
@git-hulk
git-hulk force-pushed the design-established-connections branch from 8584a14 to 9406c9a Compare September 2, 2026 12:34
@git-hulk
git-hulk force-pushed the fix-warnings-and-device-setup branch from 2adb55c to b8d5274 Compare September 2, 2026 12:34
  - hashtable compared strlen's size_t against an int in three places,
    which is what -Wextra was reporting, and read a uint32_t straight
    out of the key with a cast. That load is undefined for an unaligned
    key and faults outright on a strict-alignment target; memcpy says
    the same thing and compiles to the same instruction.

  - sniffer_online called pcap_lookupnet purely to bail out when it
    failed: neither the network nor the mask it returns is ever used.
    That made a capture on an interface with no IPv4 address fail for no
    reason. Dropped.

  - Replace pcap_lookupdev, which is deprecated and hands back a shared
    buffer, with pcap_findalldevs. The fallback now also skips loopback
    unless it is the only device there is. Reaching this path needs
    root, since the uid check runs first, so it is covered by inspection
    and by exercising pcap_findalldevs directly rather than by a test.

  - Turn on -Wextra now that the tree is clean under it.

Assistant By Opus 5

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@git-hulk
git-hulk force-pushed the fix-warnings-and-device-setup branch from b8d5274 to d21e0ab Compare September 2, 2026 12:38
@git-hulk
git-hulk changed the base branch from design-established-connections to master September 2, 2026 12:38
@git-hulk
git-hulk merged commit 74eb372 into master Sep 2, 2026
6 checks passed
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.

1 participant