Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: exclude devices that don't support ARP #13

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

weskoerber
Copy link
Owner

@weskoerber weskoerber commented Sep 12, 2024

Closes #9 closes #12

TODOs:

@weskoerber weskoerber marked this pull request as draft September 12, 2024 06:00
@weskoerber
Copy link
Owner Author

Windows has IfType in the IP_ADAPTER_ADDRESSES_LH structure; one of these values might indicate a layer 3+ device

The full IfType specification can be found in ipifcons.h (permalink).

The IfType value of my Tailscale device on my Windows 11 machine reports a value of 53:

#define IF_TYPE_PROP_VIRTUAL            53  // Proprietary virtual/internal

@weskoerber
Copy link
Owner Author

weskoerber commented Sep 14, 2024

It seems that we'll have to get the ARP table and iterate each entry in the table, comparing it against the interface. Rough steps to make this work:

  • GetAdaptersAddresses to get a list of adapters
  • GetIpNetTable to get the ARP table
    • Iterate each row in table
    • If dwPhysAddrLen field in the table entry is 0, it means the interface identified by dwIndex is not attached to a physical address; filter it out

In one (confusing) sentence: Filter addresses returned from GetAdaptersAddresses having IfIndex that matches dwIndex in table returned from GetIpNetTable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant