Skip to content

Add exclude_prefixes parameter to get_macs/get_ips for virtual interface filtering - #1

Open
jshessen wants to merge 1 commit into
sunfounder:mainfrom
jshessen:fix/exclude-virtual-network-interfaces
Open

Add exclude_prefixes parameter to get_macs/get_ips for virtual interface filtering#1
jshessen wants to merge 1 commit into
sunfounder:mainfrom
jshessen:fix/exclude-virtual-network-interfaces

Conversation

@jshessen

@jshessen jshessen commented Mar 26, 2026

Copy link
Copy Markdown

Problem

Transient Docker and bridge interfaces create unstable interface names that pollute downstream persistent metrics.

Root Cause

get_macs() and get_ips() currently enumerate all kernel-visible interfaces with no caller-controlled filtering.

Change

  • Add optional exclude_prefixes to _get_ips()
  • Add optional exclude_prefixes to get_ips()
  • Add optional exclude_prefixes to get_macs()
  • Keep backwards compatibility when exclude_prefixes is None

Verification

  • python3 -m py_compile sf_rpi_status/status.py
  • Verified default call path behavior is unchanged
  • Verified filtered call path can exclude veth, br-, and docker prefixes

Dependency Status

Upstream Overlap Status

  • Related upstream branch: upstream/fix/filter-virtual-interfaces
  • This PR intentionally keeps filtering caller-configurable (exclude_prefixes) instead of hardcoding interface-name prefixes.
  • Proposed reconciliation path: keep this PR open and align by merging/rebasing with upstream as needed so downstream dependency PRs can continue using runtime-configurable filtering.

Impact

Enables downstream packages to prevent unbounded metric key growth caused by transient virtual interfaces.

@jshessen

jshessen commented Apr 2, 2026

Copy link
Copy Markdown
Author

@cavonlee @Lovmong any chance you could review these PRs?

@jshessen

Copy link
Copy Markdown
Author

Hi @cavonlee, quick alignment note so you can choose the preferred direction.

I compared this PR branch against upstream fix/filter-virtual-interfaces at code level in sf_rpi_status/status.py.

Current branch intent:

  • Adds configurable filtering via exclude_prefixes on get_ips and get_macs call paths
  • Keeps behavior caller-driven so downstream projects can choose prefix policy

Upstream fix/filter branch intent:

  • Applies hardcoded filtering in sf_rpi_status itself with fixed prefixes

So they overlap in area, but differ in control model:

  • Configurable downstream policy (this PR)
  • Hardcoded upstream policy (upstream fix/filter branch)

Downstream dependencies currently rely on configurable behavior:

Happy to take either path you prefer:

  1. Keep configurable API in sf_rpi_status and continue with this PR
  2. Rebase/rework this PR toward the upstream hardcoded approach and adapt downstream accordingly

If you pick one, I will update all linked PRs to match your preferred direction.

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