Skip to content
Merged
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
5 changes: 4 additions & 1 deletion src/guest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ async fn process_client(mut vsock: VsockStream, peer_address: VsockAddr) -> Resu
} else if internal_address.ip() == IpAddr::V6([0, 0, 0, 0, 0, 0, 0, 0].into()) {
internal_address.set_ip(IpAddr::V6([0, 0, 0, 0, 0, 0, 0, 1].into()));
}
let socket = TcpSocket::new_v4().context("unable to create tcp socket")?;
let socket = match internal_address.ip() {
IpAddr::V4(_) => TcpSocket::new_v4().context("unable to create IPv4 TCP socket")?,
IpAddr::V6(_) => TcpSocket::new_v6().context("unable to create IPv6 TCP socket")?,
};
socket.bind(source_address)?;
match timeout(CONNECTION_TIMEOUT, socket.connect(internal_address)).await {
Ok(Ok(stream)) => {
Expand Down