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

fix(ipv6): allow disabling IPv6 resolve #6023

Merged
merged 7 commits into from
Jan 12, 2022
Merged

fix(ipv6): allow disabling IPv6 resolve #6023

merged 7 commits into from
Jan 12, 2022

Conversation

leslie-tsang
Copy link
Member

@leslie-tsang leslie-tsang commented Jan 5, 2022

What this PR does / why we need it:

Sync apisix.enable_ipv6 config to the generated nginx.conf resolver section

fix #6017

Pre-submission checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

@@ -552,6 +552,7 @@ Please modify "admin_key" in conf/config.yaml .
admin_server_addr = admin_server_addr,
control_server_addr = control_server_addr,
prometheus_server_addr = prometheus_server_addr,
enable_ipv6 = yaml_conf.apisix.enable_ipv6,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The enable_ipv6 is already imported below

@@ -130,7 +130,7 @@ end


function _M.new(opts)
opts.ipv6 = true
opts.ipv6 = opts.ipv6 or true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not = local_conf.apisix.enable_ipv6? And we need a test for it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not = local_conf.apisix.enable_ipv6?

IMO, = local_conf.apisix.enable_ipv6 is a breaking change, Imagine a scenario where a third party or serverless plugin uses this function to parse ipv6, this change will causes an unexpected behavior, I wander if this is a fictitious demand.
Do let me know WDYT. Thanks.

And we need a test for it.

Sure, I will add it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use

if opts.ipv6 == nil then
  ...
end

so user can specify the ipv6 option to overwrite the default one.

AFAIK, we don't promise the DNS client always handles IPv6 query and the enable_ipv6 is enabled by default, so it's not a break change. (Even if users don't consider it is a bug fix)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I will add test case for it in next PR

opts.ipv6 = true
local local_conf = config_local.local_conf()

if opts.ipv6 == nil then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spend some time digging into it. Look like it should be enable_ipv6, and it only works with the nameserver. See http://kong.github.io/lua-resty-dns-client/modules/resty.dns.client.html#init

This field is incorrect from the beginning...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤣 done

@spacewander spacewander changed the title fix(ngx_tpl): sync ipv6 config to resolver fix(ipv6): allow disabling IPv6 resolve Jan 12, 2022
@spacewander spacewander merged commit ff4e289 into apache:master Jan 12, 2022
@leslie-tsang leslie-tsang deleted the fix/resolver-sync-with-yaml-setting branch January 20, 2022 08:48
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

Successfully merging this pull request may close these issues.

request help: Provide a configuration to disable ipv6
4 participants