Create a "dummy" `struct sockaddr_dl` for devices.
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- c
- 領域
- networking
調査の方向性
Start by reading the pcap_findalldevs.3pcap documentation cited in the issue and inspect how Npcap currently populates each device's address list. Compare the Windows sockaddr_dl option with a Npcap-specific MAC address function and account for older Npcap versions. Done means choosing and implementing a documented way to expose device MAC addresses while preserving the stated compatibility expectations.
索引モデルが issue の本文から書いたものです。
説明
Inside a project so far, I've had to use GetAdaptersAddresses to retrieve PhysicalAddress and PhysicalAddressLength as a dirty workaround to retrieve the MAC address of each device. As WinPcap/Npcap does not fill out Data/Linklayer information.
However, like I suspected, it turns out the linked list between IP_ADAPTER_ADDRESSES and pcap_if are not always in the same order. Which means I'll either have to lazily loop over and match devices, or build something to make a lookup.
On the Linux end, I can simply go through the pcap_if_t's addresses linked list, checking if addr->sa_family matches the value of AF_PACKET, and if so, it should (probably) be the MAC address.
Despite Windows seemingly tries everything to avoid anything related to the datalink layer. WinSock2 (ws2def.h to be specific) does seem to include some barebone structure for it. The only caveat is that it's only available on Windows 7 and up (_WIN32_WINNT < 0x0601) inside the header, but that shouldn't really be an issue since Npcap is meant to run on that.
MS seems to be using AF_LINK and sockaddr_dl as their standard for datalink MAC addresses. I'm saying seem to because I was unable to find any official documentation about it from MS Learn.
sockaddr_dl seems to be the best match though, since the man pages for pcap_findalldevs.3pcap says:
Note that the addresses in the list of addresses might be IPv4 addresses, IPv6 addresses, or some other type of addresses, [...] Whether other addresses are returned, and what types they might have is platform-dependent. Namely, link-layer addresses, such as Ethernet MAC addresses, have the value
AF_PACKET(on Linux) orAF_LINK(on AIX, FreeBSD, Haiku, illumos, macOS, NetBSD, OpenBSD and QNX) or are not returned at all (on GNU/Hurd and Solaris).[...] For link-layer addresses, it can be interpreted as if it pointed to a
struct sockaddr_ll(forAF_PACKET, see packet(7)) or astruct sockaddr_dl(forAF_LINK).
And the fact that sockaddr_ll seems to be absent from WinSock2.
One big caveat is that, since this won't be available on older versions of Npcap, it means for backward compatibility I would have to keep a workaround, or warn that MAC addresses will be unavailable unless updated to a more recent version.
A more naive solution would be to make a Npcap exclusive function to return the MAC address (and length) of a device, or return a NULL pointer if no MAC address are available (I.E. loopback).
Also please let me know if I've missed anything from documentation about being able to retrieve MAC addresses via Npcap.
- 主要言語
- C
- スター
- 3.6k
- フォーク
- 601
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nmap/npcap のほかの issue
-
driverquery.exe copying to npcap install folder triggers Windows Defender Attack Surface Reductionオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
似ている issue
-
bug severity: medium
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
AlessandroSangiuliano/Uros#1014 ·
-
severity: low
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
luainkernel/lunatik#2727 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 6 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
bot-triaged module: cuda module: memory usage module: pybind module: tensor creation triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
pytorch/pytorch#206707 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信