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

Unable to pass the vsock CID via connect #266

Open
quanweiZhou opened this issue Dec 17, 2024 · 0 comments · May be fixed by #267
Open

Unable to pass the vsock CID via connect #266

quanweiZhou opened this issue Dec 17, 2024 · 0 comments · May be fixed by #267
Assignees

Comments

@quanweiZhou
Copy link
Collaborator

Description of problem

Both connect() and do_bind() functions are currently hardcoded the CIDs.
For connect() hardcoded as VMADDR_CID_HOST

ttrpc-rust/src/common.rs

Lines 168 to 175 in d2a0ce1

/// Creates a unix socket for client.
pub(crate) unsafe fn client_connect(sockaddr: &str) -> Result<RawFd> {
let (fd, _, sockaddr) = make_socket((sockaddr, VMADDR_CID_HOST))?;
connect(fd, sockaddr.as_ref())?;
Ok(fd)
}

For do_bind() hardcoded as VMADDR_CID_ANY

ttrpc-rust/src/common.rs

Lines 159 to 166 in d2a0ce1

pub(crate) fn do_bind(sockaddr: &str) -> Result<(RawFd, Domain)> {
let (fd, domain, sockaddr) = make_socket((sockaddr, VMADDR_CID_ANY))?;
setsockopt(fd, sockopt::ReusePort, &true)?;
bind(fd, sockaddr.as_ref()).map_err(err_to_others_err!(e, ""))?;
Ok((fd, domain))
}

Expected result

Parse cid and port from address("vsock://cid:port")

@quanweiZhou quanweiZhou self-assigned this Dec 17, 2024
@quanweiZhou quanweiZhou linked a pull request Dec 17, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant