diff --git a/CHANGELOG.md b/CHANGELOG.md
index 21046925..7b8f5d97 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -32,6 +32,8 @@ and this project adheres to
### Fixed
+- DHCP lease validation incorrectly letting users assign the IP address of the
+ gateway as the address of the lease ([#4698]).
- Updater no longer expects a hardcoded name for `AdGuardHome` executable
([#4219]).
- Inconsistent names of runtime clients from hosts files ([#4683]).
@@ -44,6 +46,7 @@ and this project adheres to
[#4219]: https://github.com/AdguardTeam/AdGuardHome/issues/4219
[#4677]: https://github.com/AdguardTeam/AdGuardHome/issues/4677
[#4683]: https://github.com/AdguardTeam/AdGuardHome/issues/4683
+[#4698]: https://github.com/AdguardTeam/AdGuardHome/issues/4698
[#4699]: https://github.com/AdguardTeam/AdGuardHome/issues/4699
[ddr-draft]: https://datatracker.ietf.org/doc/html/draft-ietf-add-ddr-08
diff --git a/client/src/__locales/en.json b/client/src/__locales/en.json
index dd885677..9fc65cac 100644
--- a/client/src/__locales/en.json
+++ b/client/src/__locales/en.json
@@ -47,6 +47,7 @@
"form_error_server_name": "Invalid server name",
"form_error_subnet": "Subnet \"{{cidr}}\" does not contain the IP address \"{{ip}}\"",
"form_error_positive": "Must be greater than 0",
+ "form_error_gateway_ip": "Lease can't have the IP address of the gateway",
"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",
diff --git a/client/src/components/Settings/Dhcp/StaticLeases/Form.js b/client/src/components/Settings/Dhcp/StaticLeases/Form.js
index 625e87e2..0525f6a3 100644
--- a/client/src/components/Settings/Dhcp/StaticLeases/Form.js
+++ b/client/src/components/Settings/Dhcp/StaticLeases/Form.js
@@ -10,6 +10,7 @@ import {
validateMac,
validateRequiredValue,
validateIpv4InCidr,
+ validateIpGateway,
} from '../../../../helpers/validators';
import { FORM_NAME } from '../../../../helpers/constants';
import { toggleLeaseModal } from '../../../../actions';
@@ -57,6 +58,7 @@ const Form = ({
validateRequiredValue,
validateIpv4,
validateIpv4InCidr,
+ validateIpGateway,
]}
/>
@@ -101,6 +103,7 @@ Form.propTypes = {
ip: PropTypes.string.isRequired,
hostname: PropTypes.string.isRequired,
cidr: PropTypes.string.isRequired,
+ gatewayIp: PropTypes.string,
}),
pristine: PropTypes.bool.isRequired,
handleSubmit: PropTypes.func.isRequired,
diff --git a/client/src/components/Settings/Dhcp/StaticLeases/Modal.js b/client/src/components/Settings/Dhcp/StaticLeases/Modal.js
index 8ad0f009..0baf487e 100644
--- a/client/src/components/Settings/Dhcp/StaticLeases/Modal.js
+++ b/client/src/components/Settings/Dhcp/StaticLeases/Modal.js
@@ -13,6 +13,7 @@ const Modal = ({
cidr,
rangeStart,
rangeEnd,
+ gatewayIp,
}) => {
const dispatch = useDispatch();
@@ -42,6 +43,7 @@ const Modal = ({
cidr,
rangeStart,
rangeEnd,
+ gatewayIp,
}}
onSubmit={handleSubmit}
processingAdding={processingAdding}
@@ -61,6 +63,7 @@ Modal.propTypes = {
cidr: PropTypes.string.isRequired,
rangeStart: PropTypes.string,
rangeEnd: PropTypes.string,
+ gatewayIp: PropTypes.string,
};
export default withTranslation()(Modal);
diff --git a/client/src/components/Settings/Dhcp/StaticLeases/index.js b/client/src/components/Settings/Dhcp/StaticLeases/index.js
index a63f78cd..2374f044 100644
--- a/client/src/components/Settings/Dhcp/StaticLeases/index.js
+++ b/client/src/components/Settings/Dhcp/StaticLeases/index.js
@@ -24,6 +24,7 @@ const StaticLeases = ({
cidr,
rangeStart,
rangeEnd,
+ gatewayIp,
}) => {
const [t] = useTranslation();
const dispatch = useDispatch();
@@ -106,6 +107,7 @@ const StaticLeases = ({
cidr={cidr}
rangeStart={rangeStart}
rangeEnd={rangeEnd}
+ gatewayIp={gatewayIp}
/>
>
);
@@ -119,6 +121,7 @@ StaticLeases.propTypes = {
cidr: PropTypes.string.isRequired,
rangeStart: PropTypes.string,
rangeEnd: PropTypes.string,
+ gatewayIp: PropTypes.string,
};
cellWrap.propTypes = {
diff --git a/client/src/components/Settings/Dhcp/index.js b/client/src/components/Settings/Dhcp/index.js
index a84e0a93..bd3a45e3 100644
--- a/client/src/components/Settings/Dhcp/index.js
+++ b/client/src/components/Settings/Dhcp/index.js
@@ -278,6 +278,7 @@ const Dhcp = () => {
cidr={cidr}
rangeStart={dhcp?.values?.v4?.range_start}
rangeEnd={dhcp?.values?.v4?.range_end}
+ gatewayIp={dhcp?.values?.v4?.gateway_ip}
/>