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 Linux constants: rtm_protocol and routing message attributes #2996

Closed
wants to merge 1 commit into from

Conversation

oherrala
Copy link
Contributor

@oherrala oherrala commented Nov 7, 2022

Some of these constants are seen in Netlink messages. This is prerequisite to fix neli to also properly decode the values.

@rust-highfive
Copy link

r? @JohnTitor

(rust-highfive has picked a reviewer for you, use r? to override)

@JohnTitor
Copy link
Member

JohnTitor commented Nov 7, 2022

Could you also tweak files on https://github.com/rust-lang/libc/tree/master/libc-test/semver?

@oherrala
Copy link
Contributor Author

oherrala commented Nov 8, 2022

@JohnTitor Thanks! I tweaked relevant semver files.

@SteveLauC
Copy link
Contributor

I guess you probably also need a squash:)

@oherrala
Copy link
Contributor Author

oherrala commented Nov 8, 2022

@SteveLauC I squashed everything into single commit.

@xpromache
Copy link

Thanks for adding those constants to libc. I wanted myself to add some but I was a bit intimidated by the libc project (I'm completely new to Rust and don't understand much of it yet...).
Would you be so kind to add also the constants from /usr/include/linux/fib_rules.h?

They are required for working with the linux routing policy database (equivalent of ip rule command). Then I can add some structures to allow neli to edit the ip rules.

thx

@JohnTitor
Copy link
Member

Let's go ahead, for now. We could add more items anytime.
@bors r+

@bors
Copy link
Contributor

bors commented Nov 13, 2022

📌 Commit d86893d has been approved by JohnTitor

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Nov 13, 2022

⌛ Testing commit d86893d with merge 2ae8b18...

bors added a commit that referenced this pull request Nov 13, 2022
Add Linux constants: rtm_protocol and routing message attributes

Some of these constants are seen in Netlink messages. This is prerequisite to fix [neli](https://github.com/jbaublitz/neli) to also properly decode the values.
@bors
Copy link
Contributor

bors commented Nov 13, 2022

💔 Test failed - checks-actions

@oherrala
Copy link
Contributor Author

I'm not sure what's failing and why. Two cases are both Musl, but what's happening?

I tried running the CI tests locally (sh ./ci/run-docker.sh arm-unknown-linux-musleabihf and sh ./ci/run-docker.sh mipsel-unknown-linux-musl) but couldn't reproduce the error.

@JohnTitor
Copy link
Member

JohnTitor commented Nov 20, 2022

I'm not sure why it didn't reproduce on your end but I guess it's a culprit that our kernel header version using on MUSL CI is old (4.19.88):

KERNEL_HEADER_VER="4.19.88"

For instance, RTA_NH_ID was added in v5.3: torvalds/linux@65ee00a

I think it's okay to skip tests for them on musl until we support musl 1.2 and test items on more recent kernel versions.

@oherrala
Copy link
Contributor Author

@JohnTitor Sorry for the delay! I shuffled some tests around and now everything seems to pass.

@JohnTitor
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jan 25, 2023

📌 Commit cc1e674 has been approved by JohnTitor

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jan 25, 2023

⌛ Testing commit cc1e674 with merge bbe2e8d...

bors added a commit that referenced this pull request Jan 25, 2023
Add Linux constants: rtm_protocol and routing message attributes

Some of these constants are seen in Netlink messages. This is prerequisite to fix [neli](https://github.com/jbaublitz/neli) to also properly decode the values.
@bors
Copy link
Contributor

bors commented Jan 25, 2023

💔 Test failed - checks-actions

@bors
Copy link
Contributor

bors commented Mar 12, 2023

☔ The latest upstream changes (presumably #3148) made this pull request unmergeable. Please resolve the merge conflicts.

…rom Linux

For rtm_protocol definitions the Linux header file
(include/uapi/linux/rtnetlink.h) has comment:

  Values of protocol >= RTPROT_STATIC are not interpreted by kernel;
  they are just passed from user and back as is.  It will be used by
  hypothetical multiple routing daemons.  Note that protocol values
  should be standardized in order to avoid conflicts.

This commit is based on values from

  https://github.com/torvalds/linux/blob/f0c4d9fc9cc9462659728d168387191387e903cc/include/uapi/linux/rtnetlink.h#L274-L307

and

 https://github.com/torvalds/linux/blob/f0c4d9fc9cc9462659728d168387191387e903cc/include/uapi/linux/rtnetlink.h#L358-L393
@JohnTitor
Copy link
Member

Sorry, missed the last force push (seems I didn't get the notification for that), @bors r+

@bors
Copy link
Contributor

bors commented Apr 19, 2023

📌 Commit 4128937 has been approved by JohnTitor

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Apr 19, 2023

⌛ Testing commit 4128937 with merge e46444b...

bors added a commit that referenced this pull request Apr 19, 2023
Add Linux constants: rtm_protocol and routing message attributes

Some of these constants are seen in Netlink messages. This is prerequisite to fix [neli](https://github.com/jbaublitz/neli) to also properly decode the values.
@bors
Copy link
Contributor

bors commented Apr 19, 2023

💔 Test failed - checks-actions

@JohnTitor
Copy link
Member

Failed on musl:

   cargo:warning=/checkout/target/mips-unknown-linux-musl/debug/build/libc-test-d5bd13cdc10401eb/out/main.c:31691:77: error: 'RTPROT_KEEPALIVED' undeclared here (not in a function); did you mean 'SO_KEEPALIVE'?
  cargo:warning=             static const unsigned char __test_const_RTPROT_KEEPALIVED_val = RTPROT_KEEPALIVED;
  cargo:warning=                                                                             ^~~~~~~~~~~~~~~~~
  cargo:warning=                                                                             SO_KEEPALIVE
  cargo:warning=/checkout/target/mips-unknown-linux-musl/debug/build/libc-test-d5bd13cdc10401eb/out/main.c:31703:72: error: 'RTPROT_OPENR' undeclared here (not in a function); did you mean 'RTPROT_OSPF'?
  cargo:warning=             static const unsigned char __test_const_RTPROT_OPENR_val = RTPROT_OPENR;
  cargo:warning=                                                                        ^~~~~~~~~~~~
  cargo:warning=                                                                        RTPROT_OSPF
  cargo:warning=cc1: error: unrecognized command line option '-Wno-unknown-warning-option' [-Werror]
  cargo:warning=cc1: error: unrecognized command line option '-Wno-address-of-packed-member' [-Werror]
  cargo:warning=cc1: all warnings being treated as errors

Could you tweak the test to ignore these consts on musl?
@rustbot author

@JohnTitor
Copy link
Member

Closing as inactive, feel free to resolve the above comment and re-submit a PR if you're still interested in this change. Thanks for your contribution anyway!

@JohnTitor JohnTitor closed this Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants