Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply patch to tun 0.7 #7649

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 11 additions & 48 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,6 @@ strip = true
opt-level = 3
[profile.release.package."classic-mceliece-rust"]
opt-level = 3

[patch.crates-io]
tun = { git = 'https://github.com/mullvad/rust-tun.git', branch = 'mullvad' }
2 changes: 1 addition & 1 deletion talpid-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ hickory-server = { workspace = true, features = ["resolver"] }
talpid-platform-metadata = { path = "../talpid-platform-metadata" }
pcap = { version = "2.1", features = ["capture-stream"] }
pnet_packet = { workspace = true }
tun = { version = "0.5.5", features = ["async"] }
tun = { workspace = true }
nix = { version = "0.28", features = ["socket", "signal"] }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
Expand Down
10 changes: 5 additions & 5 deletions talpid-core/src/split_tunnel/macos/tun.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use tokio::{
io::{AsyncReadExt, AsyncWriteExt},
sync::broadcast,
};
use tun::Device;
use tun::AbstractDevice;

/// IP address used by the ST utun
const ST_IFACE_IPV4: Ipv4Addr = Ipv4Addr::new(10, 123, 123, 123);
Expand Down Expand Up @@ -194,7 +194,7 @@ async fn create_utun() -> Result<tun::AsyncDevice, Error> {
tun_config.address(ST_IFACE_IPV4).up();
let tun_device =
tun::create_as_async(&tun_config).map_err(Error::CreateSplitTunnelInterface)?;
let tun_name = tun_device.get_ref().name().to_owned();
let tun_name = tun_device.tun_name().unwrap().to_owned();
add_ipv6_address(&tun_name, ST_IFACE_IPV6).await?;
Ok(tun_device)
}
Expand Down Expand Up @@ -231,7 +231,7 @@ fn redirect_packets(
route_manager: RouteManagerHandle,
classify: ClassifyFn,
) -> Result<SplitTunnelHandle, Error> {
let pktap_stream = capture_outbound_packets(st_tun_device.get_ref().name())?;
let pktap_stream = capture_outbound_packets(&st_tun_device.tun_name().unwrap())?;
redirect_packets_for_pktap_stream(
st_tun_device,
Box::pin(pktap_stream),
Expand Down Expand Up @@ -260,15 +260,15 @@ fn redirect_packets_for_pktap_stream(
) -> Result<SplitTunnelHandle, Error> {
let mtu_listener = vpn_interface.as_ref().map(|vpn_interface| {
tokio::spawn(mtu_updater(
st_tun_device.get_ref().name().to_owned(),
st_tun_device.tun_name().unwrap().to_owned(),
vpn_interface.name.clone(),
route_manager.clone(),
))
});

let (default_stream, default_write, read_buffer_size) = open_default_bpf(&default_interface)?;

let st_utun_name = st_tun_device.get_ref().name().to_owned();
let st_utun_name = st_tun_device.tun_name().unwrap().to_owned();

let (abort_tx, abort_rx) = broadcast::channel(1);
let abort_read_rx = abort_tx.subscribe();
Expand Down
Loading