Skip to content

Commit

Permalink
feat: set default route for tun device
Browse files Browse the repository at this point in the history
- ref #1432
- Linux platform will add default route when tun device was created by
  default
- This commit will add default route on macOS by default
  • Loading branch information
zonyitoo committed Feb 19, 2024
1 parent 8fc1fad commit 54353ae
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/shadowsocks-service/src/local/tun/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ impl Tun {
netmask
);

// Set default route
if let Err(err) = sys::set_route_configuration(&self.device.get_ref()).await {
warn!("[TUN] tun device set route failed, error: {}", err);
}

let address_broadcast = address_net.broadcast();

let mut packet_buffer = vec![0u8; 65536 + IFF_PI_PREFIX_LEN].into_boxed_slice();
Expand Down

0 comments on commit 54353ae

Please sign in to comment.