By default, at least on Linux, opening a PF_INET6 socket also grabs the matching IPv4 port. This patch stops that.
Only tested on Linux. Unknown how this will work on *BSD or WinXX.
---
udp6.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/udp6.c b/udp6.c
index f098b8c..54df133 100644
--- a/udp6.c
+++ b/udp6.c
@@ -121,6 +121,10 @@ static int open_socket_ipv6(const char *name, struct
in6_addr mc_addr[2], short
*interface_index = index;
+ if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on))) {
+ pr_err("setsockopt IPV6_V6ONLY failed: %m");
+ goto no_option;
+ }
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))) {
pr_err("setsockopt SO_REUSEADDR failed: %m");
goto no_option;
--
2.4.6
pgpGrezNM7A2k.pgp
Description: OpenPGP digital signature
------------------------------------------------------------------------------
_______________________________________________ Linuxptp-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
