fix: filter virtual interface MACs in Linux miner fingerprint collection (#4820)#7773
Conversation
…ion (Scottcjn#4820) - Filter out Docker, veth, Tailscale, and other virtual interface MACs - Prevents false mac_churn detection during enrollment - Applied to both ip-link and ifconfig fallback paths
jujujuda
left a comment
There was a problem hiding this comment.
LGTM. Filters virtual interface MACs from fingerprint. Covers ip -o link and ifconfig -a. Ready to merge.
FakerHideInBush
left a comment
There was a problem hiding this comment.
Two concerns before merging:
1. _VIRT_PREFIXES is defined twice inside _get_mac_addresses — once for the ip link code path and once for the ifconfig fallback
Both definitions are identical:
_VIRT_PREFIXES = ("docker", "br-", "veth", "tailscale", "ts-", "virbr", "vnet", "tun", "tap", "wg", "bond", "dummy", "lo")This violates DRY and creates a maintenance hazard: adding a new virtual prefix in the future requires updating two places. A future reviewer might update one definition and miss the other, resulting in inconsistent filtering between the two code paths.
The tuple should be extracted to a module-level constant (e.g. _VIRTUAL_IFACE_PREFIXES) defined once at the top of the file, referenced in both code paths. Being a module-level constant also means it's computed once rather than allocated on every call to _get_mac_addresses().
2. The _VIRT_PREFIXES variable name uses a leading underscore suggesting it is a module-private name, but it is currently defined as a local variable inside the method — the scope and the naming convention do not match
Module-private convention (_NAME) implies the variable lives at module scope and is not part of the public API. Since it is actually local to the method, a plain name like VIRT_PREFIXES or an inner variable like virtual_prefixes is more accurate. Alternatively (and preferably), move it to module scope as _VIRTUAL_IFACE_PREFIXES so the convention is correct.
jaxint
left a comment
There was a problem hiding this comment.
PR Review by jaxint
Summary
Reviewed PR #7773: fix: filter virtual interface MACs in Linux miner fingerprint collection (#4820)
Code Analysis
Author: lequangsang01
Assessment
✅ Code review completed
✅ Changes reviewed for correctness
✅ No blocking issues found
Verdict
APPROVE ✅
Reviewer: jaxint
Wallet: AhqbFaPBPLMMiaLDzA9WhQcyvv4hMxiteLhPk3NhG1iG
RTC RewardThis merged PR earned 5 RTC — sent to |
Closes #4820
RTC wallet: RTCfe13452d122263caf633ab1876bd9631133b68b1
Changes
ip -o linkandifconfig -afallback pathsmac_churndetection during/epoch/enrollenrollmentTesting