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

add rich representation for VLAN QOS mapping #33

Merged
merged 2 commits into from
Jul 10, 2023

Conversation

jreppnow
Copy link
Contributor

Hi!

Thanks for the cool crates. This PR adds a rich representation for VLAN QOS mappings.
This is mainly used to allow user space applications to use the SOL_PRIORITY flag to set VLAN priority for their sockets.

I used the implementation here as a reference: https://github.com/shemminger/iproute2/blob/main/ip/iplink_vlan.c

Notes:

  • I used the rich_nlas feature flag for this, but since it existed before, this might still be a breaking change for some users. Could alternatively introduce another feature flag specifically for this change.
  • Once this is accepted, I would also like to add corresponding functionality in the rtnetlink crate.

@jreppnow
Copy link
Contributor Author

The captured data in the test case is from:

sudo strace -s 1000 -f -e trace=network ip link add link enp5s0 name eth0.75 type vlan id 75 egress 3:4 ingress 0:1 1:2

I had to adjust the length field for IFLA_INFO_KIND and add the padding manually, as iproute2 does not use null-terminated strings (aka c strings) for this specific field.

@cathay4t
Copy link
Member

cathay4t commented Jun 25, 2023

@jreppnow Thanks for the patch! Please rebase to latest commit.

I personally dislike the idea of rich_nlas feature and plan to remove it in next release 0.17.0. Hence please remove the use of rich_nlas from your code. Thanks!

I guess this VLAN QoS support also require effort on rtnetlink crate, can you provide a PR to rtnetlink with example code approving the code here is actual working?

Thank you!

@jreppnow
Copy link
Contributor Author

Hi @cathay4t,

  1. I have made the requested changes here (rebase and removal of rich_nlas feature).
  2. Made a (preliminary) PR (add support for vlan QOS rtnetlink#24) to rtnetlink making use of the changes here. See the notes there for more details.

@codecov
Copy link

codecov bot commented Jun 29, 2023

Codecov Report

Merging #33 (224d5b9) into main (b6de604) will increase coverage by 1.15%.
The diff coverage is 84.41%.

@@            Coverage Diff             @@
##             main      #33      +/-   ##
==========================================
+ Coverage   45.08%   46.23%   +1.15%     
==========================================
  Files          75       75              
  Lines        6208     6276      +68     
==========================================
+ Hits         2799     2902     +103     
+ Misses       3409     3374      -35     
Impacted Files Coverage Δ
src/rtnl/link/nlas/link_infos.rs 50.92% <84.41%> (+5.78%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@cathay4t cathay4t left a comment

Choose a reason for hiding this comment

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

Looks great to me.

Please change the commit message title since we are not using rick_nlas anymore in this patch.

After that, we are good to go.

@cathay4t cathay4t dismissed their stale review July 10, 2023 03:15

The title is good enough

@cathay4t
Copy link
Member

My bad the commit title is good enough. Merging.

@cathay4t cathay4t merged commit 2d33edb into rust-netlink:main Jul 10, 2023
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.

2 participants