Closed andrewsykim closed 4 years ago
Ran tests on CentOS 7 (3.10 kernel):
[root@ipvs-test ipvs]# uname -a
Linux ipvs-test 3.10.0-1062.18.1.el7.x86_64 #1 SMP Tue Mar 17 23:49:17 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[root@ipvs-test ipvs]# go test ./...
ok github.com/moby/ipvs 1.367s
? github.com/moby/ipvs/ns [no test files]
I mean this seems pretty gross but its only for old kernels, someone should file a bug with Red Hat to add family into their broken franeknkernel.
ping @arkodg @kolyshkin PTAL
The netlink address attribute returns IPv4 addresses in a way that is not easily consumable by Go's standard net library. For example, an IPv4 address like 10.0.0.1 is received from netlink as:
which Go's net library considers an IPv6 address based on this check.
Due to this limitation, this PR updates the address family check for destination servers (only in older kernels < 3.18) so that any address attribute value that has 12 leading 0s is considered an IPv4 address, otherwise we assume the address family is IPv6.