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

Setting route `0.0.0.0/1` makes the `bind_device_by_index_v4` of socket2 unusable #25

Open xmh0511 opened 6 months ago

xmh0511 commented 6 months ago

When setting 0.0.0.0/1, almost traffic are routing to tun, and bind_device_by_index_v4 is used to make the socket binding to the specified network interface such that the traffic of the socket does not pass through the routing table. However, it seems not work when using net-route, the approach does work when using tproxy-config.

The error is

called Result::unwrap() on an Err value: Os { code: 51, kind: NetworkUnreachable, message: "Network is unreachable" }