Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSP解析结果优先级低的问题 #14

Open
wangquent opened this issue Apr 14, 2020 · 15 comments
Open

NSP解析结果优先级低的问题 #14

wangquent opened this issue Apr 14, 2020 · 15 comments

Comments

@wangquent
Copy link

系统的解析结果优先级在自己注册的nsp解析结果之前(只有禁用系统解析,应用才会用自定义的nsp解析结果),这个问题有解吗

@wangquent
Copy link
Author

proxifier貌似没有这个问题

@wangquent
Copy link
Author

同时安装profixier的情况下,优先级 Proxifier nsp >sys nsp > 自定义的nsp, 这样就没办法解决dns污染的问题了

@wangquent
Copy link
Author

此外我发现微软有提供一个namespace v2的版本,看文档也没明白这个版本相对于原来的有什么区别

@liulilittle
Copy link
Owner

因为它在启用的时候已经禁了,这个需要改注册表项的;;;这个你要看下NSP/LSP注册的表项;里面有个enabled选项。实在不知道注册表项路由,你就开沙箱跑proxifier;看它写的哪里。

@wangquent
Copy link
Author

因为它在启用的时候已经禁了,这个需要改注册表项的;;;这个你要看下NSP/LSP注册的表项;里面有个enabled选项。实在不知道注册表项路由,你就开沙箱跑proxifier;看它写的哪里。

我看在win7下, proxifier确实是禁用系统的nsp解析;不过在win10下,proxifier就没有禁用了,我用Order函数排序后,感觉是自己的NSP被第一个执行了,也返回了结果,只是系统还是去依次去从其他命名空间去解析,并把所有结果进行了排序,经过排序后优先级变低了。(通过ping一些不存在的域名,可以发现其实自己的nsp早已经打印出结果,但是ping等了一会才返回)

我从这里看到有个人给出了一个方案,在NSLookupServiceNext中,返回ipv6数据,我验证后,发现通过ping确实是可以排序在其他nsp的结果之前,不过在浏览器貌似没能识别返回的结果
https://social.msdn.microsoft.com/Forums/Windowsdesktop/en-US/de7ab4c3-2670-4e33-af68-f1367915ba8e/namespace-documentationusage-lupdualaddr-lupaddrconfig?forum=windowssdk

@wangquent
Copy link
Author

我试了下在Proxifier开启local dn解析,ping的结果是 "::FFFF:127.8.0.1",感觉Proxifier在win10下应该也是用这种黑科技来达到这个效果

@wangquent
Copy link
Author

不过我还是不能理解NSP的机制,难道是要等所有的NSP提供者都完成解析之后,通过排序各个NSP的解析结果然后再返回?这样感觉好像又不符合逻辑,假如某一个NSP提供者无法针对某个域名进行解析,需要等待到超时,这样岂不是拖慢了整个的dns解析。。。

@liulilittle
Copy link
Owner

NSP/Next 我记得是可以控制后面的NSP不执行的。

@wangquent
Copy link
Author

NSP/Next 我记得是可以控制后面的NSP不执行的。

还记得具体是怎么样操作嘛。。。。需要这种操作 看了一圈文档都没找到应该怎么做

@liulilittle
Copy link
Owner

好像是返回TRUE,返回FALSE让后面一个处理

@wangquent
Copy link
Author

好像是返回TRUE,返回FALSE让后面一个处理

是说NSPLookupServiceNext里面 behavior那个地方的退出条件吗。。。

@liulilittle
Copy link
Owner

你可以自己研究下看看呢,我两三年没弄这个东西了----(主要是太麻烦)

@liulilittle
Copy link
Owner

NSPLookupServiceBegin(函数只返回第一个句柄,NSP在最顶部被优先执行 NSPLookupServiceBegin 应该就可以由你的NSP去处理NSPLookupServiceNext)

This function initiates a client query that is constrained by the information contained within a WSAQUERYSET (Windows Sockets) structure. This function only returns a handle, which should be used by subsequent calls to the NSPLookupServiceNext (Windows Sockets) function to get the actual results.

@wangquent
Copy link
Author

你可以自己研究下看看呢,我两三年没弄这个东西了----(主要是太麻烦)

确实很麻烦,而且感觉官方文档也不太清晰(当然也是我没有领悟到精髓。。)

@kahotv
Copy link

kahotv commented Jul 7, 2022

顺序问题解决了
https://github.com/kahotv/fakensp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants