summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-11-29 16:53:15 +0100
committerGitHub <noreply@github.com>2021-11-29 16:53:15 +0100
commit289e4194f0b2c6bffbddd9c0a09c3331a529d1f2 (patch)
treeec22b6f4c865312c7394c36a740a28bd76a919a2 /src
parentb675c8b6187c4b77759e3f96c9c92dd382dabeae (diff)
parent725074edddbd8532d6af6f2e42583fe8a10e8eea (diff)
downloadvyos-1x-289e4194f0b2c6bffbddd9c0a09c3331a529d1f2.tar.gz
vyos-1x-289e4194f0b2c6bffbddd9c0a09c3331a529d1f2.zip
Merge pull request #1076 from DmitriyEshenko/current-22112021-01
tftp: T4012: Add TFTP VRF support
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/tftp_server.py9
-rw-r--r--src/systemd/tftpd@.service2
2 files changed, 8 insertions, 3 deletions
diff --git a/src/conf_mode/tftp_server.py b/src/conf_mode/tftp_server.py
index 2409eec1f..ef726670c 100755
--- a/src/conf_mode/tftp_server.py
+++ b/src/conf_mode/tftp_server.py
@@ -24,6 +24,7 @@ from sys import exit
from vyos.config import Config
from vyos.configdict import dict_merge
+from vyos.configverify import verify_vrf
from vyos.template import render
from vyos.template import is_ipv4
from vyos.util import call
@@ -65,10 +66,11 @@ def verify(tftpd):
if 'listen_address' not in tftpd:
raise ConfigError('TFTP server listen address must be configured!')
- for address in tftpd['listen_address']:
+ for address, address_config in tftpd['listen_address'].items():
if not is_addr_assigned(address):
print(f'WARNING: TFTP server listen address "{address}" not ' \
'assigned to any interface!')
+ verify_vrf(address_config)
return None
@@ -83,7 +85,7 @@ def generate(tftpd):
return None
idx = 0
- for address in tftpd['listen_address']:
+ for address, address_config in tftpd['listen_address'].items():
config = deepcopy(tftpd)
port = tftpd['port']
if is_ipv4(address):
@@ -91,6 +93,9 @@ def generate(tftpd):
else:
config['listen_address'] = f'[{address}]:{port} -6'
+ if 'vrf' in address_config:
+ config['vrf'] = address_config['vrf']
+
file = config_file + str(idx)
render(file, 'tftp-server/default.tmpl', config)
idx = idx + 1
diff --git a/src/systemd/tftpd@.service b/src/systemd/tftpd@.service
index 266bc0962..a674bf598 100644
--- a/src/systemd/tftpd@.service
+++ b/src/systemd/tftpd@.service
@@ -7,7 +7,7 @@ RequiresMountsFor=/run
Type=forking
#NotifyAccess=main
EnvironmentFile=-/etc/default/tftpd%I
-ExecStart=/usr/sbin/in.tftpd "$DAEMON_ARGS"
+ExecStart=/bin/sh -c "${VRF_ARGS} /usr/sbin/in.tftpd ${DAEMON_ARGS}"
Restart=on-failure
[Install]