From 86cb96ae1861908ea1fa6d1b0cbd1832661c8571 Mon Sep 17 00:00:00 2001 From: Charles Surett Date: Fri, 2 Apr 2021 17:40:02 -0400 Subject: interfaces: dhcp-client: T3454: add reject option Sometimes a modem might give a local IP before it retrieves a WAN IP. This can be an issue with failover routes, since the default route will get overridden. (cherry picked from commit e8535616aae2bf0c20aacee6a4d0761183bae6d9) --- data/templates/dhcp-client/ipv4.tmpl | 4 ++++ interface-definitions/include/dhcp-options.xml.i | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/data/templates/dhcp-client/ipv4.tmpl b/data/templates/dhcp-client/ipv4.tmpl index 71b429db6..c934b7cdb 100644 --- a/data/templates/dhcp-client/ipv4.tmpl +++ b/data/templates/dhcp-client/ipv4.tmpl @@ -20,5 +20,9 @@ interface "{{ ifname }}" { # The require statement lists options that must be sent in order for an offer to be # accepted. Offers that do not contain all the listed options will be ignored! require subnet-mask; +{% if dhcp_options.reject is defined and dhcp_options.reject is not none %} + # Block addresses coming from theses dhcp servers if configured. + reject {{ dhcp_options.reject | join(', ') }}; +{% endif %} } diff --git a/interface-definitions/include/dhcp-options.xml.i b/interface-definitions/include/dhcp-options.xml.i index 8972b53e9..39a3dbb2e 100644 --- a/interface-definitions/include/dhcp-options.xml.i +++ b/interface-definitions/include/dhcp-options.xml.i @@ -37,6 +37,24 @@ + + + IP addresses or subnets from which to reject DHCP leases + + ipv4 + IPv4 address to match + + + ipv4net + IPv4 prefix to match + + + + + + + + -- cgit v1.2.3