Ser*_*gey 6 linux server-message-block cifs dfs
Linux 提供了一种工具,让内核及其模块依靠用户空间工具来解析 DNS 名称。例如,CIFS 使用它来支持 DFS 中的推荐。
我看到的问题是我无法让内核解析特定的 DNS 名称,我不明白它为什么会失败。
为了了解根本原因,我通过运行以下命令在 CIFS 和内核 dns 解析器中启用了调试输出:
echo "1" > /sys/module/dns_resolver/parameters/debug # dns_resolver
echo "7" > /proc/fs/cifs/cifsFYI # CIFS
Run Code Online (Sandbox Code Playgroud)
这是发生故障时我在 dmesg 中看到的内容:
fs/cifs/cifs_dfs_ref.c: DFS: ref path: \ESOTEST\dfstest\FS_SERV
fs/cifs/cifs_dfs_ref.c: DFS: node path: \FS\FS_SERV
fs/cifs/cifs_dfs_ref.c: DFS: fl: 2, srv_type: 0
fs/cifs/cifs_dfs_ref.c: DFS: ref_flags: 0, path_consumed: 24
fs/cifs/netmisc.c: address conversion returned 0 for FS
fs/cifs/netmisc.c: address conversion returned 0 for FS
[ls ] ==> dns_query((null),FS,2,(null))
fs/cifs/dns_resolve.c: dns_resolve_server_name_to_ip: unable to resolve: FS
fs/cifs/cifs_dfs_ref.c: cifs_compose_mount_options: Failed to resolve server part of \\FS\FS_SERV to IP:
Run Code Online (Sandbox Code Playgroud)
-22
这是成功解决方案的输出:
fs/cifs/cifs_dfs_ref.c: DFS: node path: \ESOTEST\File-Server
fs/cifs/cifs_dfs_ref.c: DFS: fl: 2, srv_type: 0
fs/cifs/cifs_dfs_ref.c: DFS: ref_flags: 0, path_consumed: 28
fs/cifs/netmisc.c: address conversion returned 0 for ESOTEST
fs/cifs/netmisc.c: address conversion returned 0 for ESOTEST
[ls ] ==> dns_query((null),ESOTEST,7,(null))
[ls ] call request_key(,ESOTEST,)
[ls ] ==> dns_resolver_match(ESOTEST,ESOTEST)
[ls ] <== dns_resolver_match() = 1
[ls ] <== dns_query() = 14
fs/cifs/dns_resolve.c: dns_resolve_server_name_to_ip: resolved: ESOTEST to 192.168.56.102
fs/cifs/cifsfs.c: Devname: \\ESOTEST\File-Server flags: 0
Run Code Online (Sandbox Code Playgroud)
我使用 Windows 作为 DNS 服务器,我可以从机器解析名称“FS”:
$ ping FS
PING FS.esodomain.com (192.168.56.104) 56(84) bytes of data.
64 bytes from fs.esodomain.com (192.168.56.104): icmp_seq=1 ttl=128 time=1.37 ms
64 bytes from fs.esodomain.com (192.168.56.104): icmp_seq=2 ttl=128 time=0.630 ms
Run Code Online (Sandbox Code Playgroud)
我也尝试使用 key.dns_resolver 手动执行测试,它似乎有效:
$ key.dns_resolver -vv -D "FS" 'hello'
I: Key description: 'dns_resolver;-1;-1;0;FS'
I: Callout info: 'hello'
D: Get A/AAAA RR for hostname:'FS', options:'hello'
D: Opt hello
D: Resolve 'FS' with 1ff
D: getaddrinfo = 0
D: RR: 0,2,1,6,10,(null)
D: append '192.168.56.104'
I: The key instantiation data is '192.168.56.104'
Run Code Online (Sandbox Code Playgroud)
/etc/request-key.conf 的内容是:
create dns_resolver * * /sbin/key.dns_resolver %k
create user debug:* negate /bin/keyctl negate %k 30 %S
create user debug:* rejected /bin/keyctl reject %k 30 %c %S
create user debug:* expired /bin/keyctl reject %k 30 %c %S
create user debug:* revoked /bin/keyctl reject %k 30 %c %S
create user debug:loop:* * |/bin/cat
create user debug:* * /usr/share/keyutils/request-key-debug.sh %k %d %c %S
negate * * * /bin/keyctl negate %k 30 %S
Run Code Online (Sandbox Code Playgroud)
我摆弄这个的原因是我试图让 Windows DFS 共享成功挂载。我能够挂载和访问根服务器上托管的文件夹,但是当我尝试访问引用外部服务器的子文件夹时,我得到:
ls: cannot access /mnt/dfstest/FS_SERV/: Invalid argument
Run Code Online (Sandbox Code Playgroud)
我在 3.7.10 内核上:
Linux gentoo 3.7.10-gentoo-r1 #3 SMP Fri Apr 19 17:32:20 PDT 2013 x86_64 Intel(R) Xeon(R) CPU E5620 @ 2.40GHz GenuineIntel GNU/Linux
Run Code Online (Sandbox Code Playgroud)
在网络捕获中,当我看到对“ESOTEST”的请求时,我没有看到任何对“FS”的 DNS 请求。这表明该请求从未被提出。
您建议采取哪些后续步骤来解决此问题?
这似乎是由Linux内核引起的。具体来说,通过 dns_resolver。甚至没有尝试解决“FS”。
dns_resolver (net/dns_resolver/dns_query.c) 中的以下几行似乎导致了这种情况:
if (namelen < 3)
return -EINVAL;
Run Code Online (Sandbox Code Playgroud)
我不知道为什么会有这张支票。我将尝试将另一台服务器从“FS”重命名为更长的名称。我将尝试在删除此检查的情况下重新编译内核。
更新:是的,这就是原因,它在将主机名重命名为更长的名称后工作
| 归档时间: |
|
| 查看次数: |
3314 次 |
| 最近记录: |