johnyburd / net-route

Rust crate providing a cross platform interface for interacting with the routing table
https://docs.rs/net-route/
21 stars 14 forks source link

Doesn't compile on macOS 14.2.1 #11

Closed Skyxim closed 10 months ago

Skyxim commented 10 months ago

OS: macOS 14.2.1 (23C71) CPU: Apple M1

error[E0560]: struct `bind::rt_metrics` has no field named `rmx_state`
   --> /Users/frost/.cargo/registry/src/index.crates.io-6f17d22bba15001f/net-route-0.2.8/src/platform_impl/macos/macos.rs:231:13
    |
231 |             rmx_state: 0,
    |             ^^^^^^^^^ `bind::rt_metrics` does not have this field
    |
    = note: all struct fields are already assigned
error[E0308]: mismatched types
   --> /Users/frost/.cargo/registry/src/index.crates.io-6f17d22bba15001f/net-route-0.2.8/src/platform_impl/macos/macos.rs:232:25
    |
232 |             rmx_filler: [0u32; 3],
    |                         ^^^^^^^^^ expected an array with a fixed size of 4 elements, found one with 3 elements

new rt_metrics struct

struct rt_metrics {
    u_int32_t       rmx_locks;      /* Kernel leaves these values alone */
    u_int32_t       rmx_mtu;        /* MTU for this path */
    u_int32_t       rmx_hopcount;   /* max hops expected */
    int32_t         rmx_expire;     /* lifetime for route, e.g. redirect */
    u_int32_t       rmx_recvpipe;   /* inbound delay-bandwidth product */
    u_int32_t       rmx_sendpipe;   /* outbound delay-bandwidth product */
    u_int32_t       rmx_ssthresh;   /* outbound gateway buffer limit */
    u_int32_t       rmx_rtt;        /* estimated round trip time */
    u_int32_t       rmx_rttvar;     /* estimated rtt variance */
    u_int32_t       rmx_pksent;     /* packets sent using this route */
    u_int32_t       rmx_filler[4];  /* will be used for TCP's peer-MSS cache */
};
johnyburd commented 10 months ago

Seems to be an apple silicon specific issue 🤔. I can't reproduce on 14.2.1 Intel

johnyburd commented 10 months ago

Can you confirm if you can compile using the branch in #12 ?

Skyxim commented 10 months ago

Can you confirm if you can compile using the branch in #12 ?

It can be compiled, thx