Skip to content

Commit 532e238

Browse files
Fix test_vsock failure on VMADDR_CID_LOCAL testing
Starting from Linux 5.6, VMADDR_CID_LOCAL is supported to do local communication (loopback device). Before Linux 5.6 it was called VMADDR_CID_RESERVED and was not supported, so we could expect an EADDRNOTAVAIL, but now this address is supported and handled by the 'vsock_loopback' kernel module loaded automatically if no other vsock transports are loaded. Issue #1310 Issue #1403 Signed-off-by: Stefano Garzarella <[email protected]>
1 parent fde9ebc commit 532e238

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

test/sys/test_socket.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,17 +1508,11 @@ pub fn test_vsock() {
15081508
SockFlag::empty(), None)
15091509
.expect("socket failed");
15101510

1511-
// VMADDR_CID_HYPERVISOR and VMADDR_CID_LOCAL are reserved, so we expect
1512-
// an EADDRNOTAVAIL error.
1511+
// VMADDR_CID_HYPERVISOR is reserved, so we expect an EADDRNOTAVAIL error.
15131512
let sockaddr = SockAddr::new_vsock(libc::VMADDR_CID_HYPERVISOR, port);
15141513
assert_eq!(bind(s1, &sockaddr).err(),
15151514
Some(Error::Sys(Errno::EADDRNOTAVAIL)));
15161515

1517-
let sockaddr = SockAddr::new_vsock(libc::VMADDR_CID_LOCAL, port);
1518-
assert_eq!(bind(s1, &sockaddr).err(),
1519-
Some(Error::Sys(Errno::EADDRNOTAVAIL)));
1520-
1521-
15221516
let sockaddr = SockAddr::new_vsock(libc::VMADDR_CID_ANY, port);
15231517
assert_eq!(bind(s1, &sockaddr), Ok(()));
15241518
listen(s1, 10).expect("listen failed");

0 commit comments

Comments
 (0)