From b91753e746c421b0e2bc82e2c2dd5aeb169a5406 Mon Sep 17 00:00:00 2001
From: Ildar Kamalov <i.kamalov@adguard.com>
Date: Wed, 18 Dec 2019 13:17:24 +0300
Subject: [PATCH] + client: handle Disable IPv6 setting

---
 client/src/__locales/en.json                       |  6 ++++--
 client/src/components/Settings/Dns/Config/Form.js  | 12 ++++++++++++
 client/src/components/Settings/Dns/Config/index.js |  2 ++
 client/src/reducers/dnsConfig.js                   |  1 +
 4 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/client/src/__locales/en.json b/client/src/__locales/en.json
index 7d5b84fb..09ec7e34 100644
--- a/client/src/__locales/en.json
+++ b/client/src/__locales/en.json
@@ -431,5 +431,7 @@
     "try_again": "Try again",
     "domain_desc": "Enter the domain name or wildcard you want to be rewritten.",
     "example_rewrite_domain": "rewrite responses for this domain name only.",
-    "example_rewrite_wildcard": "rewrite responses for all <0>example.org</0> subdomains."
-}
\ No newline at end of file
+    "example_rewrite_wildcard": "rewrite responses for all <0>example.org</0> subdomains.",
+    "disable_ipv6": "Disable IPv6",
+    "disable_ipv6_desc": "If this feature is enabled, all DNS queries for IPv6 addresses (type AAAA) will be dropped."
+}
diff --git a/client/src/components/Settings/Dns/Config/Form.js b/client/src/components/Settings/Dns/Config/Form.js
index 33c25f06..271ae3c5 100644
--- a/client/src/components/Settings/Dns/Config/Form.js
+++ b/client/src/components/Settings/Dns/Config/Form.js
@@ -65,6 +65,18 @@ let Form = ({
                     />
                 </div>
             </div>
+            <div className="col-12">
+                <div className="form__group form__group--settings">
+                    <Field
+                        name="disable_ipv6"
+                        type="checkbox"
+                        component={renderSelectField}
+                        placeholder={t('disable_ipv6')}
+                        disabled={processing}
+                        subtitle={t('disable_ipv6_desc')}
+                    />
+                </div>
+            </div>
             <div className="col-12">
                 <div className="form__group form__group--settings mb-4">
                     <label className="form__label form__label--with-desc">
diff --git a/client/src/components/Settings/Dns/Config/index.js b/client/src/components/Settings/Dns/Config/index.js
index 6404a416..c9478190 100644
--- a/client/src/components/Settings/Dns/Config/index.js
+++ b/client/src/components/Settings/Dns/Config/index.js
@@ -16,6 +16,7 @@ const Config = ({ t, dnsConfig, setDnsConfig }) => {
         blocking_ipv4,
         blocking_ipv6,
         edns_cs_enabled,
+        disable_ipv6,
         processingSetConfig,
     } = dnsConfig;
 
@@ -33,6 +34,7 @@ const Config = ({ t, dnsConfig, setDnsConfig }) => {
                         blocking_ipv4,
                         blocking_ipv6,
                         edns_cs_enabled,
+                        disable_ipv6,
                     }}
                     onSubmit={handleFormSubmit}
                     processing={processingSetConfig}
diff --git a/client/src/reducers/dnsConfig.js b/client/src/reducers/dnsConfig.js
index 5c7c2b88..d124db0f 100644
--- a/client/src/reducers/dnsConfig.js
+++ b/client/src/reducers/dnsConfig.js
@@ -44,6 +44,7 @@ const dnsConfig = handleActions(
         blocking_ipv4: DEFAULT_BLOCKING_IPV4,
         blocking_ipv6: DEFAULT_BLOCKING_IPV6,
         edns_cs_enabled: false,
+        disable_ipv6: false,
     },
 );