Skip to content

Commit e266b7c

Browse files
stefano-garzarellaasomers
authored andcommitted
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 feb8fe6 commit e266b7c

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
@@ -1507,17 +1507,11 @@ pub fn test_vsock() {
15071507
SockFlag::empty(), None)
15081508
.expect("socket failed");
15091509

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

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

0 commit comments

Comments
 (0)