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 netlink structs to all notbsd platforms #922

Merged
merged 5 commits into from Feb 25, 2018

Conversation

faern
Copy link
Contributor

@faern faern commented Feb 21, 2018

Adding the remaining structs from <linux/netlink.h>. Sadly very duplicated, but that's how it ended up when added to all "notbsd" platforms except musl. If there is a better way to structure it to reduce duplication I'm all ears!

@rust-highfive
Copy link

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@faern
Copy link
Contributor Author

faern commented Feb 22, 2018

Working on adding some genetlink.h constants as well. So consider this PR work in progress for a little longer!

Copy link
Contributor Author

@faern faern left a comment

Choose a reason for hiding this comment

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

Done adding genetlink/netlink structs and fields for this PR now. Ready for review.

pub const NLMSG_ERROR: ::c_int = 0x2;
pub const NLMSG_DONE: ::c_int = 0x3;
pub const NLMSG_OVERRUN: ::c_int = 0x4;
pub const NLMSG_MIN_TYPE: ::c_int = 0x10;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was able to move these up one level. Covers more platforms and with less duplication.

@faern
Copy link
Contributor Author

faern commented Feb 22, 2018

This PR now fixes #921 as well as my use case. Should include everything to make https://github.com/jbaublitz/neli/blob/master/src/c/netlink.c obsolete. Ping @jbaublitz

pub const GENL_CMD_CAP_DO: ::c_int = 0x02;
pub const GENL_CMD_CAP_DUMP: ::c_int = 0x04;
pub const GENL_CMD_CAP_HASPOL: ::c_int = 0x08;
cfg_if! {
Copy link
Member

Choose a reason for hiding this comment

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

Could the location of these definitions get tweaked a bit to avoid the cfg_if! annotations here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, done!

@alexcrichton
Copy link
Member

Looks good to me, thanks! Just one small nit but otherwise seems good to go

@faern faern force-pushed the add-netlink-structs branch 4 times, most recently from aa3aad4 to e5051a0 Compare February 25, 2018 00:51
@faern
Copy link
Contributor Author

faern commented Feb 25, 2018

Now the tests started to fail on a constant added by me in a previous PR. The value of the NFT_*_MAXNAMELEN constants seems to have been increased from 32 to 256 on most platforms. So I had to add some cfg_if! trickery to get it to pass the tests again.

@kristate
Copy link
Contributor

@faern

Now the tests started to fail on a constant added by me in a previous PR. The value of the NFT_*_MAXNAMELEN constants seems to have been increased from 32 to 256 on most platforms.

Okay, once #924 or 95befb4 lands, I will rebase and push #924. thanks.

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Feb 25, 2018

📌 Commit 95befb4 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Feb 25, 2018

⌛ Testing commit 95befb4 with merge 2c97816...

bors added a commit that referenced this pull request Feb 25, 2018
Add netlink structs to all notbsd platforms

Adding the remaining structs from `<linux/netlink.h>`. Sadly very duplicated, but that's how it ended up when added to all "notbsd" platforms except musl. If there is a better way to structure it to reduce duplication I'm all ears!
@bors
Copy link
Contributor

bors commented Feb 25, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 2c97816 to master...

@bors bors merged commit 95befb4 into rust-lang:master Feb 25, 2018
@faern faern deleted the add-netlink-structs branch February 25, 2018 21:21
bors added a commit that referenced this pull request Apr 12, 2018
Make netlink struct fields public

I realized my netlink structs were a bit unusable if their fields are not public 🤦‍♂️

Follow up and improvement to #922
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.

None yet

5 participants