-
Notifications
You must be signed in to change notification settings - Fork 57
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
Allow specifying mac on macvlan link creation #45
Allow specifying mac on macvlan link creation #45
Conversation
68062af
to
fe0667b
Compare
I still need to figure out how to add unit tests to this. |
Cargo.toml
Outdated
@@ -28,6 +28,7 @@ netlink-proto = { default-features = false, version = "0.11" } | |||
nix = { version = "0.26.1", default-features = false, features = ["fs", "mount", "sched", "signal"] } | |||
tokio = { version = "1.0.1", features = ["rt"], optional = true} | |||
async-global-executor = { version = "2.0.2", optional = true } | |||
macaddr = "1.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure we want to consume this dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be cautious on introducing new dependency.
But in our case, this is dependency for example and test code, please add this dependency to dev-dependencies
section of Cargo.toml
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
As a follow up I can try to port (new implementation) the required functions into the project, thus removing the need for the dependency.
b123048
to
7e0f0c5
Compare
Cargo.toml
Outdated
@@ -28,6 +28,7 @@ netlink-proto = { default-features = false, version = "0.11" } | |||
nix = { version = "0.26.1", default-features = false, features = ["fs", "mount", "sched", "signal"] } | |||
tokio = { version = "1.0.1", features = ["rt"], optional = true} | |||
async-global-executor = { version = "2.0.2", optional = true } | |||
macaddr = "1.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be cautious on introducing new dependency.
But in our case, this is dependency for example and test code, please add this dependency to dev-dependencies
section of Cargo.toml
.
790992b
to
3b78d76
Compare
Signed-off-by: Miguel Duarte Barroso <[email protected]>
Add unit test asserting a macvlan interface can be added / retrieved / deleted and the expected parameters are there. Some default settings are set by the kernel - i.e. Flags, BcQueueLen, BcQueueLenUsed, and MacAddrCount. Signed-off-by: Miguel Duarte Barroso <[email protected]>
3b78d76
to
ed35e89
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI failed.
I noticed we already have LinkSetRequest::address()
. Can we introduce LinkAddRequest::address()
to this PR. Otherwise this PR is purely for test and example code, does not make sense to have that PR title.
Signed-off-by: Miguel Duarte Barroso <[email protected]>
Signed-off-by: Miguel Duarte Barroso <[email protected]>
If we make the `name` method of `LinkAddRequest` public we provide a better developer experience to the user, as shown in the refactored test. FWIW, in the `LinkSetRequest` structs, the `name` and `address` methods are already public. We also refactor the `name` method to re-use the `append_nla` method. Signed-off-by: Miguel Duarte Barroso <[email protected]>
Hm, locally I was using stable rust, and the
Done. I've chosen to slightly refactor the I think this is ready for another review round @cathay4t . Thanks for the help / reviews. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
This probably should be added for other interface types, not only macvlan.
Welcome any feedback.
Fixes: #30