libc icon indicating copy to clipboard operation
libc copied to clipboard

Add RTF_*, RTA_*, RTAX_*, RTM_* definitions on BSDs

Open tesuji opened this issue 1 year ago • 7 comments

Grep from:

  • https://github.com/freebsd/freebsd-src/raw/main/sys/net/route.h
  • https://github.com/DragonFlyBSD/DragonFlyBSD/raw/master/sys/net/route.h
  • https://github.com/NetBSD/src/raw/trunk/sys/net/route.h
  • https://github.com/openbsd/src/raw/master/sys/net/route.h

Closes #3711.

@rustbot review

tesuji avatar May 19 '24 16:05 tesuji

r? @JohnTitor

rustbot has assigned @JohnTitor. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

rustbot avatar May 19 '24 16:05 rustbot

Some changes occurred in OpenBSD module

cc @semarie

Some changes occurred in OpenBSD module

cc @semarie

rustbot avatar May 19 '24 16:05 rustbot

Do you plan to unify with macOS (same ancestor) by moving RTM_ADD and other constants with same values to src/unix/bsd/mod.rs ?

jbeich avatar May 20 '24 04:05 jbeich

Please, don't remove *_MAX unless applied to macOS as well:

error[E0425]: cannot find value `RTAX_MAX` in crate `libc`
   --> cargo-crates/iroh-net-0.16.2/src/net/interfaces/bsd.rs:875:46
    |
875 |     let mut addrs = Vec::with_capacity(libc::RTAX_MAX as usize);
    |                                              ^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `RTAX_MAX` in crate `libc`
   --> cargo-crates/iroh-net-0.16.2/src/net/interfaces/bsd.rs:879:23
    |
879 |     for i in 0..libc::RTAX_MAX as usize {
    |                       ^^^^^^^^ not found in `libc`
    |
help: you might have meant to write `.` instead of `..`
    |
879 -     for i in 0..libc::RTAX_MAX as usize {
879 +     for i in 0.libc::RTAX_MAX as usize {
    |

jbeich avatar May 21 '24 12:05 jbeich

At first glance this looks okay, but there are a couple things needed. Could you please do the following?

  1. Target main
  2. Squash the commits
  3. Update the libc-test/semver files since this now affects more platforms. A couple lines were touched, but there were a lot of constants added.

tgross35 avatar Aug 15 '24 18:08 tgross35

@rustbot author

tgross35 avatar Aug 16 '24 09:08 tgross35

Some changes occurred in solarish module

cc @jclulow, @pfmooney

rustbot avatar Sep 04 '24 18:09 rustbot

It'd be great to land this, so https://github.com/mozilla/mtu/pull/29 would work on the BSDs.

larseggert avatar Oct 02 '24 11:10 larseggert

Going to wait on the backport until https://github.com/rust-lang/libc/pull/3970 is figured out.

tgross35 avatar Oct 16 '24 06:10 tgross35