summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interface-definitions/dhcp-relay.xml13
-rw-r--r--interface-definitions/dhcpv6-relay.xml13
-rwxr-xr-xsrc/conf_mode/dhcp_relay.py8
-rwxr-xr-xsrc/conf_mode/dhcpv6_relay.py8
-rwxr-xr-xsrc/migration-scripts/dhcp-relay/1-to-235
5 files changed, 37 insertions, 40 deletions
diff --git a/interface-definitions/dhcp-relay.xml b/interface-definitions/dhcp-relay.xml
index c918d25a3..f4cb36eea 100644
--- a/interface-definitions/dhcp-relay.xml
+++ b/interface-definitions/dhcp-relay.xml
@@ -49,19 +49,6 @@
<constraintErrorMessage>max-size must be a value between 64 and 1400</constraintErrorMessage>
</properties>
</leafNode>
- <leafNode name="port">
- <properties>
- <help>Port number to listen on</help>
- <valueHelp>
- <format>1-65535</format>
- <description>Port to listen on</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-65535"/>
- </constraint>
- <constraintErrorMessage>port must be a value between 1 and 65535</constraintErrorMessage>
- </properties>
- </leafNode>
<leafNode name="relay-agents-packets">
<properties>
<help>Policy to handle incoming DHCPv4 packets which already contain relay agent options (default: forward)</help>
diff --git a/interface-definitions/dhcpv6-relay.xml b/interface-definitions/dhcpv6-relay.xml
index d6e6daf51..15c76a098 100644
--- a/interface-definitions/dhcpv6-relay.xml
+++ b/interface-definitions/dhcpv6-relay.xml
@@ -31,19 +31,6 @@
</leafNode>
</children>
</tagNode>
- <leafNode name="listen-port">
- <properties>
- <help>UDP port to listen for requests on</help>
- <valueHelp>
- <format>1-65535</format>
- <description>Port to listen on</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-65535"/>
- </constraint>
- <constraintErrorMessage>port must be a value between 1 and 65535</constraintErrorMessage>
- </properties>
- </leafNode>
<leafNode name="max-hop-count">
<properties>
<help>Maximum hop count for which requests will be processed</help>
diff --git a/src/conf_mode/dhcp_relay.py b/src/conf_mode/dhcp_relay.py
index 61b494b7e..1b2abed9e 100755
--- a/src/conf_mode/dhcp_relay.py
+++ b/src/conf_mode/dhcp_relay.py
@@ -43,14 +43,13 @@ SERVERS="{{ server | join(' ') }}"
INTERFACES="{{ interface | join(' ') }}"
# Additional options that are passed to the DHCP relay daemon?
-OPTIONS="-4 {% if port -%} -p {{ port }}{%- endif %} {{ options | join(' ') }}"
+OPTIONS="-4 {{ options | join(' ') }}"
"""
default_config_data = {
'interface': [],
'server': [],
'options': [],
- 'port': '',
'hop_count': '10',
'relay_agent_packets': 'forward'
}
@@ -86,11 +85,6 @@ def get_config():
size = '-A ' + conf.return_value('max-size')
relay['options'].append(size)
- # Listen and transmit on port <xy>. This is mostly useful for debugging
- # purposes. Default is port 67 for DHCPv4/BOOTP, or port 547 for DHCPv6.
- if conf.exists('port'):
- relay['port'] = conf.return_value('port')
-
# Control the handling of incoming DHCPv4 packets which already contain
# relay agent options. If such a packet does not have giaddr set in its
# header, the DHCP standard requires that the packet be discarded. However,
diff --git a/src/conf_mode/dhcpv6_relay.py b/src/conf_mode/dhcpv6_relay.py
index 959bf0496..86e3f8265 100755
--- a/src/conf_mode/dhcpv6_relay.py
+++ b/src/conf_mode/dhcpv6_relay.py
@@ -31,13 +31,12 @@ config_tmpl = """
# Defaults for isc-dhcpv6-relay initscript sourced by /etc/init.d/isc-dhcpv6-relay
-OPTIONS="-6 -l {{ listen_addr | join('-l ') }} {% if port -%} -p {{ port }}{%- endif %} {{ options | join(' ') }} -u {{ upstream_addr | join('-u ') }}"
+OPTIONS="-6 -l {{ listen_addr | join('-l ') }} {{ options | join(' ') }} -u {{ upstream_addr | join('-u ') }}"
"""
default_config_data = {
'listen_addr': [],
'upstream_addr': [],
- 'port': '',
'options': [],
}
@@ -65,11 +64,6 @@ def get_config():
server = addr + '%' + intf
relay['upstream_addr'].append(server)
- # Listen and transmit on port <xy>. This is mostly useful for debugging
- # purposes. Default is port 67 for DHCPv4/BOOTP, or port 547 for DHCPv6.
- if conf.exists('listen-port'):
- relay['port'] = conf.return_value('listen-port')
-
# Maximum hop count. When forwarding packets, dhcrelay discards packets
# which have reached a hop count of COUNT. Default is 10. Maximum is 255.
if conf.exists('max-hop-count'):
diff --git a/src/migration-scripts/dhcp-relay/1-to-2 b/src/migration-scripts/dhcp-relay/1-to-2
new file mode 100755
index 000000000..b72da1028
--- /dev/null
+++ b/src/migration-scripts/dhcp-relay/1-to-2
@@ -0,0 +1,35 @@
+#!/usr/bin/env python3
+
+# Delete "set service dhcp-relay relay-options port" option
+# Delete "set service dhcpv6-relay listen-port" option
+
+import sys
+
+from vyos.configtree import ConfigTree
+
+if (len(sys.argv) < 1):
+ print("Must specify file name!")
+ sys.exit(1)
+
+file_name = sys.argv[1]
+
+with open(file_name, 'r') as f:
+ config_file = f.read()
+
+config = ConfigTree(config_file)
+
+if not (config.exists(['service', 'dhcp-relay', 'relay-options', 'port']) or config.exists(['service', 'dhcpv6-relay', 'listen-port'])):
+ # Nothing to do
+ sys.exit(0)
+else:
+ # Delete abandoned node
+ config.delete(['service', 'dhcp-relay', 'relay-options', 'port'])
+ # Delete abandoned node
+ config.delete(['service', 'dhcpv6-relay', 'listen-port'])
+
+ try:
+ with open(file_name, 'w') as f:
+ f.write(config.to_string())
+ except OSError as e:
+ print("Failed to save the modified config: {}".format(e))
+ sys.exit(1)