Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux platform functions to get network interfaces #1811

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

luis4a0
Copy link
Contributor

@luis4a0 luis4a0 commented Oct 23, 2020

This PR adds the functions needed in Linux to get information about network interfaces present in the system. This will be needed to implement bridging in some backends.
Namely, this add the functions platform::get_network_interfaces_info() to get information about all the interfaces on the system.
This code works confined, which complicates the detection of some interfaces.

@codecov
Copy link

codecov bot commented Oct 23, 2020

Codecov Report

Merging #1811 (4061178) into master (363ba26) will increase coverage by 0.20%.
The diff coverage is 97.43%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1811      +/-   ##
==========================================
+ Coverage   78.48%   78.69%   +0.20%     
==========================================
  Files         234      234              
  Lines        8776     8853      +77     
==========================================
+ Hits         6888     6967      +79     
+ Misses       1888     1886       -2     
Impacted Files Coverage Δ
src/platform/platform_linux.cpp 89.13% <97.43%> (+13.72%) ⬆️
include/multipass/logging/level.h 94.73% <0.00%> (+10.52%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 363ba26...4061178. Read the comment docs.

@ricab
Copy link
Collaborator

ricab commented Oct 27, 2020

Hey @luis4a0, I think you brought one commit too many: the first one, titled "Add platform-dependent network info interface".

I thought this would be stacked on the bridging branch. This would replace the throwing platform_linux implementation and would be rebased on top of public/control. It doesn't achieve much without that anyway, right?

To test bridging with vbox on Linux, one would checkout the private/control branch and merge with this one locally. Does that make sense?

@luis4a0
Copy link
Contributor Author

luis4a0 commented Oct 27, 2020

Right, stacking on top of the control-... branch makes sense, and more knowing that GH will move the base once it gets merged. I'll do that.

@luis4a0 luis4a0 changed the base branch from master to control-network-interfaces-no-driver-specific-matching October 28, 2020 18:15
@ricab
Copy link
Collaborator

ricab commented Oct 28, 2020

I see you stacked this and dropped the repeated commit, great!

@luis4a0
Copy link
Contributor Author

luis4a0 commented Oct 28, 2020

Yes, this should work now.

@luis4a0 luis4a0 force-pushed the control-network-interfaces-no-driver-specific-matching branch from 6ab0a27 to 2579004 Compare October 29, 2020 17:59
@luis4a0 luis4a0 force-pushed the control-network-interfaces-no-driver-specific-matching branch 4 times, most recently from 7627b35 to fceacc1 Compare November 9, 2020 16:47
@luis4a0 luis4a0 force-pushed the control-network-interfaces-no-driver-specific-matching branch from fceacc1 to 1293126 Compare November 9, 2020 17:12
@luis4a0 luis4a0 force-pushed the control-network-interfaces-no-driver-specific-matching branch from fb7e6e6 to 7b1c2db Compare November 30, 2020 15:40
@bors bors bot closed this Nov 30, 2020
@bors bors bot deleted the branch main November 30, 2020 19:09
@ricab ricab reopened this Nov 30, 2020
@ricab ricab changed the base branch from control-network-interfaces-no-driver-specific-matching to master November 30, 2020 19:18
@luis4a0 luis4a0 force-pushed the bridging-linux branch 4 times, most recently from 05f6082 to a9da725 Compare December 3, 2020 15:01
@luis4a0 luis4a0 marked this pull request as ready for review December 3, 2020 17:53
ricab and others added 14 commits January 12, 2021 11:36
The test is incomplete, since we still have to mock the filesystem to
mimic reading from /sys.
To test virtual interfaces, the filesystem had to be mocked in order to
create a structure similar to /sys. For physical interfaces, only the
output of the `ip` command had to be simulated.
Move free functions to unnamed namespace. Add comments about
confinement.

These things were pointed out during the review of the PR.
- Made output strings look like the other platforms output;
- simplified function interfaces;
- add some logging.
It was read each time a physical interface was queried.
@ricab
Copy link
Collaborator

ricab commented Jan 12, 2021

Hey @luis4a0, I am revisiting this for the LXD implementation 🙂

The first commit in this branch appears bogus – description doesn't seem to match the diff, which is later reverted. I have a rebase on master that drops that commit. If you agree, I can push?

@luis4a0
Copy link
Contributor Author

luis4a0 commented Jan 12, 2021

Go ahead!

Base automatically changed from master to main March 3, 2021 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants