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

ECS not working properly in version 1.15.0 #654

Closed
jfb8856606 opened this issue Mar 25, 2022 · 3 comments
Closed

ECS not working properly in version 1.15.0 #654

jfb8856606 opened this issue Mar 25, 2022 · 3 comments
Assignees

Comments

@jfb8856606
Copy link

Describe the bug
Refer #605, this PR will cause ECS not to work properly while retry a query or restart the CNAME.

To reproduce
Steps to reproduce the behavior:

  1. Set forward upstream and set send-client-subnet=0.0.0.0/0 and client-subnet-always-forward: yes
  2. Query a domain that has a NAME RR(such as www.baidu.com) from unbound.
  3. The first query to upstream will add ECS opt, but the second(restart CNAME rr) will not add ECS opt;
  4. Or while the upstream did not reply in time, the retry query will not add ECS opt also.

Expected behavior
Every request forwarded to upstream should carry the ECS option。

System:

  • Unbound version:1.15.0
  • OS:CentOS 8.0
  • unbound -V output:
Version 1.15.0

Configure line: --enable-subnet --with-libevent --with-pthreads --with-ssl --enable-dnscrypt
Linked libs: libevent 2.1.8-stable (it uses epoll), OpenSSL 1.1.1k  FIPS 25 Mar 2021
Linked modules: dns64 subnetcache respip validator iterator
DNSCrypt feature available

BSD licensed, see LICENSE in source package for details.
Report bugs to unbound-bugs@nlnetlabs.nl or https://github.com/NLnetLabs/unbound/issues

Additional information
I tried to modify it as below and it works fine, but I am not sure if the modification is correct.

diff --git a/services/outside_network.c b/services/outside_network.c
index a7e5fa3..59f7076 100644
--- a/services/outside_network.c
+++ b/services/outside_network.c
@@ -3373,7 +3373,8 @@ outnet_serviced_query(struct outside_network* outnet,
        /* Restore the option list; we can explicitly use the copied one from
         * now on. */
        per_upstream_opt_list = qstate->edns_opts_back_out;
-       qstate->edns_opts_back_out = backed_up_opt_list;
+       if (backed_up_opt_list)
+               qstate->edns_opts_back_out = backed_up_opt_list;

        if((client_string_addr = edns_string_addr_lookup(
                &env->edns_strings->client_strings, addr, addrlen))) {
@gthess gthess self-assigned this Apr 29, 2022
@gthess
Copy link
Member

gthess commented Apr 29, 2022

Hi, this seems to work correctly for me. However there have been some changes for ECS since 1.15.0 namely (8e8ccfe, 7749d98). Can you try with those fixes or just the latest from the master branch?

@jfb8856606
Copy link
Author

thank you for your reply, I will try with these fixes and the latest from the master branch?

@jfb8856606
Copy link
Author

They work correctly.

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

2 participants