Pull request: 5208-dhcp-range

Merge in DNS/adguard-home from 5208-dhcp-range to master

Closes #5208.

Squashed commit of the following:

commit b7bd646823545d5d1f3c42c5461ec65b874e2bbc
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Tue Dec 6 18:55:03 2022 +0300

    client: restore non-en locales

commit 8e306201c2a35eccb525b84aef5d7e3aa54b5446
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Tue Dec 6 18:45:51 2022 +0300

    client: rm unused locales

commit 087cf2e3fe48245686a7e9631afe5322323e5add
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Tue Dec 6 18:25:54 2022 +0300

    all: log changes

commit f1f9d7908226e5ecce3a33d82f2ba32200f6af31
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Tue Dec 6 18:23:06 2022 +0300

    client: imp dhcp err msgs

commit b9d8d7029756a9ee482c7c855f48b0ca6136e833
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Tue Dec 6 15:44:44 2022 +0300

    WIP
This commit is contained in:
Eugene Burkov 2022-12-07 14:29:01 +03:00
parent 6d1adf74b1
commit f0cf6cce9a
4 changed files with 10 additions and 18 deletions

View File

@ -36,6 +36,7 @@ See also the [v0.107.20 GitHub milestone][ms-v0.107.20].
### Fixed
- Wrong validation error messages on the DHCP configuration page ([#5208]).
- Slow upstream checks making the API unresponsive ([#5193]).
- The TLS initialization errors preventing AdGuard Home from starting ([#5189]).
Instead, AdGuard Home disables encryption and shows an error message on the
@ -46,6 +47,7 @@ See also the [v0.107.20 GitHub milestone][ms-v0.107.20].
[#5189]: https://github.com/AdguardTeam/AdGuardHome/issues/5189
[#5190]: https://github.com/AdguardTeam/AdGuardHome/issues/5190
[#5193]: https://github.com/AdguardTeam/AdGuardHome/issues/5193
[#5208]: https://github.com/AdguardTeam/AdGuardHome/issues/5208

View File

@ -37,8 +37,6 @@
"dhcp_ipv6_settings": "DHCP IPv6 Settings",
"form_error_required": "Required field",
"form_error_ip4_format": "Invalid IPv4 address",
"form_error_ip4_range_start_format": "Invalid IPv4 address of the range start",
"form_error_ip4_range_end_format": "Invalid IPv4 address of the range end",
"form_error_ip4_gateway_format": "Invalid IPv4 address of the gateway",
"form_error_ip6_format": "Invalid IPv6 address",
"form_error_ip_format": "Invalid IP address",
@ -51,9 +49,8 @@
"out_of_range_error": "Must be out of range \"{{start}}\"-\"{{end}}\"",
"lower_range_start_error": "Must be lower than range start",
"greater_range_start_error": "Must be greater than range start",
"greater_range_end_error": "Must be greater than range end",
"subnet_error": "Addresses must be in one subnet",
"gateway_or_subnet_invalid": "Subnet mask invalid",
"gateway_or_subnet_invalid": "Invalid subnet mask",
"dhcp_form_gateway_input": "Gateway IP",
"dhcp_form_subnet_input": "Subnet mask",
"dhcp_form_range_title": "Range of IP addresses",

View File

@ -74,7 +74,6 @@ const FormDHCPv4 = ({
className="form-control"
placeholder={t(ipv4placeholders.subnet_mask)}
validate={[
validateIpv4,
validateRequired,
validateGatewaySubnetMask,
]}
@ -97,7 +96,6 @@ const FormDHCPv4 = ({
placeholder={t(ipv4placeholders.range_start)}
validate={[
validateIpv4,
validateGatewaySubnetMask,
validateIpForGatewaySubnetMask,
]}
disabled={!isInterfaceIncludesIpv4}
@ -113,7 +111,6 @@ const FormDHCPv4 = ({
validate={[
validateIpv4,
validateIpv4RangeEnd,
validateGatewaySubnetMask,
validateIpForGatewaySubnetMask,
]}
disabled={!isInterfaceIncludesIpv4}

View File

@ -77,11 +77,11 @@ export const validateNotInRange = (value, allValues) => {
const { range_start, range_end } = allValues.v4;
if (range_start && validateIpv4(range_start)) {
return 'form_error_ip4_range_start_format';
return undefined;
}
if (range_end && validateIpv4(range_end)) {
return 'form_error_ip4_range_end_format';
return undefined;
}
const isAboveMin = range_start && ip4ToInt(value) >= ip4ToInt(range_start);
@ -94,14 +94,6 @@ export const validateNotInRange = (value, allValues) => {
});
}
if (!range_end && isAboveMin) {
return 'lower_range_start_error';
}
if (!range_start && isBelowMax) {
return 'greater_range_end_error';
}
return undefined;
};
@ -118,7 +110,7 @@ export const validateGatewaySubnetMask = (_, allValues) => {
const { subnet_mask, gateway_ip } = allValues.v4;
if (validateIpv4(gateway_ip)) {
return 'form_error_ip4_gateway_format';
return 'gateway_or_subnet_invalid';
}
return parseSubnetMask(subnet_mask) ? undefined : 'gateway_or_subnet_invalid';
@ -138,6 +130,10 @@ export const validateIpForGatewaySubnetMask = (value, allValues) => {
gateway_ip, subnet_mask,
} = allValues.v4;
if ((gateway_ip && validateIpv4(gateway_ip)) || (subnet_mask && validateIpv4(subnet_mask))) {
return undefined;
}
const subnetPrefix = parseSubnetMask(subnet_mask);
if (!isIpInCidr(value, `${gateway_ip}/${subnetPrefix}`)) {