Skip to content

fix: properly parse ip addr show output for network interfaces#27

Merged
kennethdsheridan merged 1 commit intomainfrom
fix/network-interface-parsing
Jan 27, 2026
Merged

fix: properly parse ip addr show output for network interfaces#27
kennethdsheridan merged 1 commit intomainfrom
fix/network-interface-parsing

Conversation

@kennethdsheridan
Copy link
Contributor

Summary

Fix the network interface parser that was returning placeholder data (eth0 with 192.168.1.100) instead of actual interface information.

Problem

The parse_ip_output() function in src/domain/parsers/network.rs was a stub implementation that always returned the same dummy data regardless of the actual ip addr show output. This prevented proper detection of:

  • Real interface names
  • Actual IP addresses
  • Tailscale VPN interfaces
  • MAC addresses

Solution

Properly parse the ip addr show output:

  • Parse interface names from X: ifname: lines
  • Extract MAC addresses from link/ether lines
  • Handle Tailscale tunnel interfaces with link/none
  • Parse IPv4 addresses from inet lines
  • Classify interface types (tailscale, wireless, bridge, ethernet)

Testing

  • cargo check passes
  • This enables proper Tailscale IP detection for NetBox network_access_ip field

Related

  • Needed by metal-agent for proper network interface reporting
  • Enables netbox-ingestify to populate network_access_ip custom field

The previous implementation was a stub that always returned eth0 with
placeholder IP 192.168.1.100. This fix properly parses:
- Interface names from 'X: ifname:' lines
- MAC addresses from 'link/ether' lines
- Handles Tailscale tunnel interfaces with 'link/none'
- IPv4 addresses from 'inet' lines
- Correctly classifies interface types (tailscale, wireless, bridge, etc)

This enables proper detection of Tailscale VPN interfaces for NetBox
network_access_ip field population.
@semanticdiff-com
Copy link

semanticdiff-com bot commented Jan 27, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  src/domain/parsers/network.rs  18% smaller

@kennethdsheridan kennethdsheridan merged commit b57bb91 into main Jan 27, 2026
1 check 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