johnyburd / net-route

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

Fix MacOS bug in list_routes that causes assertion failure #17

Closed gregor-netdebug closed 7 months ago

gregor-netdebug commented 8 months ago

The list_routes() function uses sysctl to query all the routes on the system. First it learns the size of the buffer it needs, allocates that buffer, and then it requests the routes with sysctl. However, it is possible that not the whole buffer is used. In that case we need to use/check the length returned by sysctl and not use the length of the original buffer.

johnyburd commented 7 months ago

thanks :)