Date: Thu, 26 Mar 2015 18:53:36 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-ports-bugs@FreeBSD.org Subject: [Bug 198931] Fix net/mDNSResponder errors "Tried to register a NetworkInterfaceInfo [IPv6] with invalid mask <C2><AB>ZERO ADDRESS<C2><BB>" Message-ID: <bug-198931-13@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198931 Bug ID: 198931 Summary: Fix net/mDNSResponder errors "Tried to register a NetworkInterfaceInfo [IPv6] with invalid mask <C2><AB>ZERO ADDRESS<C2><BB>" Product: Ports & Packages Version: Latest Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: Individual Port(s) Assignee: sunpoet@FreeBSD.org Reporter: dim@FreeBSD.org Assignee: sunpoet@FreeBSD.org Flags: maintainer-feedback?(sunpoet@FreeBSD.org) Created attachment 154840 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=154840&action=edit Fix incorrect address family for IPv6 netmasks Since quite some time, net/mDNSResponder has been spamming my logs with the following type of errors, which occur whenever it is starting up: Mar 25 21:33:26 tensor mDNSResponder: mDNS_RegisterInterface: Error! Tried to register a NetworkInterfaceInfo 2001:07B8:03A7:0000:020E:0CFF:FEA0:E4A2 with invalid mask <C2><AB>ZERO ADDRESS<C2><BB> Mar 25 21:33:26 tensor mDNSResponder: mDNS_RegisterInterface: Error! Tried to register a NetworkInterfaceInfo 2001:07B8:03A7:0001:02D0:B7FF:FEA0:8C26 with invalid mask <C2><AB>ZERO ADDRESS<C2><BB> Mar 25 21:33:26 tensor mDNSResponder: mDNS_RegisterInterface: Error! Tried to register a NetworkInterfaceInfo 2001:07B8:02FF:0146:0000:0000:0000:0002 with invalid mask <C2><AB>ZERO ADDRESS<C2><BB> Mar 25 21:33:26 tensor mDNSResponder: mDNS_RegisterInterface: Error! Tried to register a NetworkInterfaceInfo 2001:07B8:03A7:0000:020E:0CFF:FEA0:E4A2 with invalid mask <C2><AB>ZERO ADDRESS<C2><BB> Mar 25 21:33:26 tensor mDNSResponder: mDNS_RegisterInterface: Error! Tried to register a NetworkInterfaceInfo 2001:07B8:03A7:0001:02D0:B7FF:FEA0:8C26 with invalid mask <C2><AB>ZERO ADDRESS<C2><BB> Mar 25 21:33:26 tensor mDNSResponder: mDNS_RegisterInterface: Error! Tried to register a NetworkInterfaceInfo 2001:07B8:02FF:0146:0000:0000:0000:0002 with invalid mask <C2><AB>ZERO ADDRESS<C2><BB> Mar 25 21:33:26 tensor mDNSResponder: mDNS_RegisterInterface: Error! Tried to register a NetworkInterfaceInfo 2001:07B8:03A7:0000:020E:0CFF:FEA0:E4A2 with invalid mask <C2><AB>ZERO ADDRESS<C2><BB> Mar 25 21:33:26 tensor mDNSResponder: mDNS_RegisterInterface: Error! Tried to register a NetworkInterfaceInfo 2001:07B8:03A7:0001:02D0:B7FF:FEA0:8C26 with invalid mask <C2><AB>ZERO ADDRESS<C2><BB> And many more like this, usually for interfaces which have been configured with a global IPv6 address. For each of these addresses, the prefixlen is actually 64, and therefore the mask is definitely not a "ZERO ADDRESS". I did some digging, and found that mDNSPosix/mDNSUNP.c's get_ifi_info() function uses the SIOCGIFNETMASK_IN6 ioctl to retrieve the netmask: 411 case AF_INET6: 412 sinptr6 = (struct sockaddr_in6 *) &ifr->ifr_addr; ... 430 memset(&ifr6, 0, sizeof(ifr6)); 431 memcpy(&ifr6.ifr_name, &ifr->ifr_name, sizeof(ifr6.ifr_name )); 432 memcpy(&ifr6.ifr_ifru.ifru_addr, &ifr->ifr_addr, sizeof(ifr6.ifr_ifru.ifru_addr)); 433 if (ioctl(sockf6, SIOCGIFNETMASK_IN6, &ifr6) < 0) { ... 449 ifi->ifi_netmask = (struct sockaddr*)calloc(1, sizeof(struct sockaddr_in6)); 450 if (ifi->ifi_netmask == NULL) goto gotError; 451 sinptr6 = (struct sockaddr_in6 *) &ifr6.ifr_ifru.ifru_addr; 452 memcpy(ifi->ifi_netmask, sinptr6, sizeof(struct sockaddr_in6)); However, it turns out that SIOCGIFNETMASK does *not* always fill the sin6_family field of the returned address: in some cases (I have not been able to determine what the cause is) it is returned as 0, even when sin6_len is correctly set to 28 for an IPv6 address. There is already a comment about a similar situation for IPv4 addresses, a little earlier in the function: 332 case AF_INET: 333 sinptr = (struct sockaddr_in *) &ifr->ifr_addr; ... 361 sinptr = (struct sockaddr_in *) &ifrcopy.ifr_addr; 362 /* The BSD ioctls (including Mac OS X) stick some weird values in for sin_len and sin_family */ 363 #ifndef NOT_HAVE_SA_LEN 364 sinptr->sin_len = sizeof(struct sockaddr_in); 365 #endif 366 sinptr->sin_family = AF_INET; 367 memcpy(ifi->ifi_netmask, sinptr, sizeof(struct sockaddr_in)); Later on, the zero sin6_family field leads to a problem in mDNSPosix/mDNSPosix.c's SockAddrTomDNSAddr() function, because this checks the field, and *only* converts the adress to a mDNSAddr struct when the family is either AF_INET or AF_INET6. Therefore, the SetupOneInterface() function results in a zeroed mask, and that leads to the above error messages. The fix is to set sinptr6->sin6_family = AF_INET6 manually, analogous to the IPv4 situation. -- You are receiving this mail because: You are the assignee for the bug.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-198931-13>