summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/templates/dhcp-server/dhcpd.conf.tmpl5
-rw-r--r--interface-definitions/dhcp-server.xml.in9
-rwxr-xr-xsrc/conf_mode/dhcp_server.py2
3 files changed, 12 insertions, 4 deletions
diff --git a/data/templates/dhcp-server/dhcpd.conf.tmpl b/data/templates/dhcp-server/dhcpd.conf.tmpl
index c71934426..790f57bbb 100644
--- a/data/templates/dhcp-server/dhcpd.conf.tmpl
+++ b/data/templates/dhcp-server/dhcpd.conf.tmpl
@@ -32,9 +32,8 @@ option wpad-url code 252 = text;
{% endif %}
{% if failover is defined and failover is not none %}
-{% set dhcp_failover_name = 'VyOS-DHCP-failover-peer' %}
# DHCP failover configuration
-failover peer "{{ dhcp_failover_name }}" {
+failover peer "{{ failover.name }}" {
{% if failover.status == 'primary' %}
primary;
mclt 1800;
@@ -185,7 +184,7 @@ shared-network {{ network | replace('_','-') }} {
{% endif %}
pool {
{% if subnet_config.enable_failover is defined %}
- failover peer "{{ dhcp_failover_name }}";
+ failover peer "{{ failover.name }}";
deny dynamic bootp clients;
{% endif %}
{% if subnet_config.range is defined and subnet_config.range is not none %}
diff --git a/interface-definitions/dhcp-server.xml.in b/interface-definitions/dhcp-server.xml.in
index 4551d75a9..2707ce96d 100644
--- a/interface-definitions/dhcp-server.xml.in
+++ b/interface-definitions/dhcp-server.xml.in
@@ -34,6 +34,15 @@
</constraint>
</properties>
</leafNode>
+ <leafNode name="name">
+ <properties>
+ <help>Peer name used to identify connection</help>
+ <constraint>
+ <regex>[-_a-zA-Z0-9.]+</regex>
+ </constraint>
+ <constraintErrorMessage>Invalid failover peer name. May only contain letters, numbers and .-_</constraintErrorMessage>
+ </properties>
+ </leafNode>
<leafNode name="status">
<properties>
<help>Failover hierarchy</help>
diff --git a/src/conf_mode/dhcp_server.py b/src/conf_mode/dhcp_server.py
index 5b3809017..28f2a4ca5 100755
--- a/src/conf_mode/dhcp_server.py
+++ b/src/conf_mode/dhcp_server.py
@@ -247,7 +247,7 @@ def verify(dhcp):
if not failover_ok:
raise ConfigError('DHCP failover must be enabled for at least one subnet!')
- for key in ['source_address', 'remote', 'status']:
+ for key in ['name', 'remote', 'source_address', 'status']:
if key not in dhcp['failover']:
tmp = key.replace('_', '-')
raise ConfigError(f'DHCP failover requires "{tmp}" to be specified!')