Bug 6360 - smbd logs nuisance host name/address mismatch errors
Summary: smbd logs nuisance host name/address mismatch errors
Alias: None
Product: Samba 3.3
Classification: Unclassified
Component: File services (show other bugs)
Version: 3.3.4
Hardware: Other Linux
: P3 trivial
Target Milestone: ---
Assignee: Volker Lendecke
QA Contact: Samba QA Contact
Depends on:
Reported: 2009-05-14 13:12 UTC by Ole Hansen
Modified: 2020-12-21 23:55 UTC (History)
1 user (show)

See Also:

Proposed fix for IPv6-related name/address mismatch (2.69 KB, patch)
2009-05-14 13:25 UTC, Ole Hansen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ole Hansen 2009-05-14 13:12:51 UTC
On an IPv6-enabled Linux samba server, smbd clutters syslog (and client log files) with nuisance messages:

Steps to reproduce:
Run samba server on IPv6-enabled machine and connect to shares from clients.

Actual results:
syslog messages like
May  8 15:19:48 server smbd[442]: [2009/05/08 15:19:48,  0] lib/util_sock.c:matchname(1749)
May  8 15:19:48 server smbd[442]:   matchname: host name/address mismatch: ::ffff: != client.example.com

Expected results:
No such messages. client.example.com has IPv4 address Address and name should match.

samba 3.3.4 on Fedora 9/x86

Also observed on:
samba 3.2.x on Fedora 9/x86
Comment 1 Ole Hansen 2009-05-14 13:25:11 UTC
Created attachment 4157 [details]
Proposed fix for IPv6-related name/address mismatch

Here is a proposed patch for the host name/address mismatch messages. It fixes the matchname function to work properly with IPv4-mapped IPv6 addresses. (This might fix other problems, too.) If the sockaddr argument belongs to family AF_INET6, and if it represents an IPv4-mapped address, then getaddrinfo is called with additional flags AI_V4MAPPED|AI_ALL. The result list then also contains the hosts IPv4 addresses in mapped form, so the comparison with sockaddr can be done properly (apples to apples ;)) 

Unfortunately, for this to work, interpret_string_addr_internal() needs to get an additional argument (the address family). That should be acceptable as it is a local function only, so all its callers are in the same file. Alternatively, one could call getaddrinfo directly from within matchname, at the cost of code duplication.
Comment 2 Nathaniel W. Turner 2010-01-27 18:25:09 UTC
+1 on the patch in comment 1

Version-Tested: 3.3.7 (on CentOS 4)

Without this patch, hostname-based whitelists fail to function properly on systems that support IPv6 but are deployed on IPv4-only networks (which describes most systems I've come in contact with).  With the patch, which looks reasonable to me, hostname-based whitelists work as expected.

This is a regression from samba 3.0.x, where this worked correctly.
Comment 3 Chris Wilson 2013-02-05 11:46:02 UTC
This bug is still present in samba-3.5.10-125.el6.i686 on CentOS 6. Please could we have it fixed?
Comment 4 Björn Jacke 2020-12-21 23:55:08 UTC
This is not an issue with recent versions, I think, if you see this issue with 4.12 or newer, feel free to reopen this bug.