Skip to content

Commit 8e0efd3

Browse files
authored
refactor(vsock): more permissive binding for make public scope (#13)
Combine scope 2 (Public) and scope 3 (Any) to have the same behavior, both allowing binding to any IP address. This simplifies the logic by removing the public IP check since both scopes now permit unrestricted IP binding.
1 parent ed7ff79 commit 8e0efd3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/devices/src/virtio/vsock/ip_filter.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,8 @@ impl IpFilterConfig {
8585
// Scope 1: Group - Allow binding within the subnet if no specific IP given
8686
// If no subnet is specified, behaves like scope 0 (deny all)
8787
1 => self.subnet.map_or(false, |subnet| subnet.contains(bind_ip)),
88-
// Scope 2: Public - Allow binding to public IPs if no specific IP given
89-
2 => !Self::is_private(bind_ip),
90-
// Scope 3: Any - Allow binding to any IP if no specific IP given
91-
3 => true,
88+
// Scope 2 & 3: Any & Public - Allow binding to any IP if no specific IP given
89+
2 | 3 => true,
9290
_ => false, // Invalid scope (scope 0 already handled)
9391
}
9492
}

0 commit comments

Comments
 (0)