Date: Sun, 29 May 2011 07:40:49 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r222444 - head/contrib/ntp/ntpd Message-ID: <201105290740.p4T7engw020080@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bz Date: Sun May 29 07:40:48 2011 New Revision: 222444 URL: http://svn.freebsd.org/changeset/base/222444 Log: The argument to setsockopt for IP_MULTICAST_LOOP depends on operating system and is decided upon by configure and could be an u_int or a u_char. For FreeBSD it is a u_char. For IPv6 however RFC 3493, 5.2 defines the argument to IPV6_MULTICAST_LOOP to be an unsigned integer so make sure we always use that using a second variable for the IPV6 case. This is to get rid of these error messages every 5 minutes on some systems: ntpd[1530]: setsockopt IPV6_MULTICAST_LOOP failure: Invalid argument on socket 22, addr fe80::... for multicast address ff02::101 While here also fix the copy&paste error in the log message for IPV6_MULTICAST_LOOP. Reviewed by: roberto Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems MFC after: 10 days Filed as: Bug 1936 on ntp.org Modified: head/contrib/ntp/ntpd/ntp_io.c Modified: head/contrib/ntp/ntpd/ntp_io.c ============================================================================== --- head/contrib/ntp/ntpd/ntp_io.c Sun May 29 05:45:56 2011 (r222443) +++ head/contrib/ntp/ntpd/ntp_io.c Sun May 29 07:40:48 2011 (r222444) @@ -1753,7 +1753,12 @@ void enable_multicast_if(struct interface *iface, struct sockaddr_storage *maddr) { #ifdef MCAST +#ifdef IP_MULTICAST_LOOP /*u_char*/ TYPEOF_IP_MULTICAST_LOOP off = 0; +#endif +#ifdef IPV6_MULTICAST_LOOP + u_int off6 = 0; /* RFC 3493, 5.2. defines type unsigned int */ +#endif switch (maddr->ss_family) { @@ -1797,9 +1802,9 @@ enable_multicast_if(struct interface *if * Don't send back to itself, but allow it to fail to set it */ if (setsockopt(iface->fd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, - (char *) &off, sizeof(off)) == -1) { + (char *) &off6, sizeof(off6)) == -1) { netsyslog(LOG_ERR, - "setsockopt IP_MULTICAST_LOOP failure: %m on socket %d, addr %s for multicast address %s", + "setsockopt IPV6_MULTICAST_LOOP failure: %m on socket %d, addr %s for multicast address %s", iface->fd, stoa(&iface->sin), stoa(maddr)); } #endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105290740.p4T7engw020080>