Skip to content

⭐️ os network interfaces#5390

Merged
tas50 merged 7 commits intomainfrom
afiune/network/interfaces
Apr 3, 2025
Merged

⭐️ os network interfaces#5390
tas50 merged 7 commits intomainfrom
afiune/network/interfaces

Conversation

@afiune
Copy link
Copy Markdown
Contributor

@afiune afiune commented Mar 28, 2025

This change introduces a new resource to the os provider called network, this
resource today gathers all the network interfaces from the system and additional
information about the interface like ip addresses (v4 and v6), subnet, gateway, the
status and flags of the interface, as well as the MAC address.

Data Collection Methods

The new networki package has an entry point function called Interfaces() that
returns the list of interfaces in the system. The way this function work is by detecting
the operating system we are connected to, and based of that information, it runs multiple
detector functions to collect as much information from different sources:

detectors := []func() ([]Interface, error){
	...
}

In the future, we can add more of these to enhance the data we collect.

Testing

Ran tests agains all three operating systems we need to support.

macOS 🍎

Screenshot 2025-03-28 at 1 50 36 PM

Windows 🪟

Screenshot 2025-04-01 at 3 54 59 PM

Linux 🐧

amazonlinux

Screenshot 2025-04-01 at 4 11 07 PM

Debian

Screenshot 2025-04-01 at 4 11 48 PM

@afiune afiune changed the title ⭐️ os network interfaces resource ⭐️ os network interfaces Mar 28, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 28, 2025

Test Results

3 692 tests  +32   3 688 ✅ +32   1m 50s ⏱️ -38s
  398 suites + 1       4 💤 ± 0 
   30 files   ± 0       0 ❌ ± 0 

Results for commit 27a4041. ± Comparison against base commit 635ad20.

♻️ This comment has been updated with latest results.

@afiune afiune force-pushed the afiune/network/interfaces branch from 99efa02 to 449bc1f Compare March 28, 2025 20:54
@github-actions

This comment has been minimized.

@afiune afiune force-pushed the afiune/network/interfaces branch 2 times, most recently from 1272f00 to 1a77fab Compare April 1, 2025 22:51
@afiune afiune marked this pull request as ready for review April 1, 2025 22:52
@afiune afiune force-pushed the afiune/network/interfaces branch 2 times, most recently from 231eb2e to 2f03115 Compare April 2, 2025 00:56
Signed-off-by: Salim Afiune Maya <afiune@mondoo.com>
@afiune afiune force-pushed the afiune/network/interfaces branch from 2f03115 to 6566b40 Compare April 2, 2025 01:21
@atomic111
Copy link
Copy Markdown
Member

@afiune thank you

afiune added 2 commits April 1, 2025 23:13
Signed-off-by: Salim Afiune Maya <afiune@mondoo.com>
Signed-off-by: Salim Afiune Maya <afiune@mondoo.com>
@afiune afiune force-pushed the afiune/network/interfaces branch from 7924011 to 1a2db60 Compare April 2, 2025 07:13
Signed-off-by: Salim Afiune Maya <afiune@mondoo.com>
Comment thread providers/os/id/networki/linux_n.go Outdated
matches[1],
parseInt(matches[2]),
)
// if ip.Broadcast != matches[3] {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will delete. 💯

Comment thread providers/os/id/networki/windows_n.go Outdated
Comment thread providers/os/id/networki/linux_n.go
afiune added 2 commits April 2, 2025 13:44
Signed-off-by: Salim Afiune Maya <afiune@mondoo.com>
Signed-off-by: Salim Afiune Maya <afiune@mondoo.com>
@afiune afiune requested a review from jaym April 2, 2025 20:45
Signed-off-by: Salim Afiune Maya <afiune@mondoo.com>
@afiune afiune force-pushed the afiune/network/interfaces branch from a1ca787 to 27a4041 Compare April 2, 2025 20:59
@tas50 tas50 merged commit ceb4281 into main Apr 3, 2025
17 checks passed
@tas50 tas50 deleted the afiune/network/interfaces branch April 3, 2025 14:24
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants