[libvirt] sockettest failures on macOS

Roman Bolshakov r.bolshakov at yadro.com
Thu Aug 8 13:38:23 UTC 2019


Hello dear list,

As of now there're two test failures of sockettest on macOS:

  38) Test format ::ffff family AF_UNSPEC                               ...
  Offset 2
  Expect [ffff]
  Actual [0.0.255.255]
                                                                        ... FAILED
  89) Test localhost 0177.0.0.01                                        ... FAILED


The first test possibly hits the following observed [1] behaviour of
getnameinfo in macOS:
  ::ffff is turned into ::0.0.255.255
  ::fffe is turned into ::0.0.255.254
  ::ffff:0 is turned into ::255.255.0.0
  ::fffe:0 is turned into ::255.254.0.0
  ::ffff:0:0 is turned into ::ffff:0.0.0.0
  ::fffe:0:0 is turned into ::fffe:0:0

So it seems like the addresses with hzeroed upper words are treated like
IPv4-translated addresses.

The second test fails because getaddrinfo on macOS doesn't interpret
octal IPv4 addresses. Only inet_aton can be used for that.

The issue was hit by python and dotnet core:
https://bugs.python.org/issue27612
https://github.com/dotnet/corefx/issues/8362

Should we implement a workaround for virSocketAddrParseInternal that
would determine numeric IPv4 address and parse them using inet_aton?

Or may be we should use gnulib's getaddrinfo? POSIX has explicit statement:
  If the specified address family is AF_INET or AF_UNSPEC, address strings
  using Internet standard dot notation as specified in inet_addr are
  valid.

I don't know if gnulib implements that properly on macOS but it might
worth to give it a try and fix the behavior to match POSIX otherwise.

Or we can just skip both tests for __APPLE__?

1. https://gist.github.com/roolebo/1a95e11def1f19caa5bde319c2f9c89a

Thank you,
Roman




More information about the libvir-list mailing list