MCPcopy
hub / github.com/google/gvisor / checkFamily

Method checkFamily

pkg/sentry/socket/netstack/netstack.go:772–782  ·  view source on GitHub ↗

checkFamily returns true iff the specified address family may be used with the socket. If exact is true, then the specified address family must be an exact match with the socket's family.

(family uint16, exact bool)

Source from the content-addressed store, hash-verified

770// If exact is true, then the specified address family must be an exact match
771// with the socket's family.
772func (s *sock) checkFamily(family uint16, exact bool) bool {
773 if family == uint16(s.family) {
774 return true
775 }
776 if !exact && family == linux.AF_INET && s.family == linux.AF_INET6 {
777 if !s.Endpoint.SocketOptions().GetV6Only() {
778 return true
779 }
780 }
781 return false
782}
783
784// mapFamily maps the AF_INET ANY address to the IPv4-mapped IPv6 ANY if the
785// receiver's family is AF_INET6.

Callers 3

ConnectMethod · 0.95
BindMethod · 0.95
SendMsgMethod · 0.95

Calls 2

GetV6OnlyMethod · 0.80
SocketOptionsMethod · 0.65

Tested by

no test coverage detected