summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorl0crian1 <ryan.claridge13@gmail.com>2026-08-03 13:58:16 -0400
committersarthurdev <965089+sarthurdev@users.noreply.github.com>2026-09-24 17:22:59 +0200
commitda354b88d916f4e7ba1e888a0e3501a5307ec3b5 (patch)
tree4f800b26689d9e002f7c14da362efd26666a042f /python
parent3aed4c9c216375ff4f5ad3b0a000b6fd30836846 (diff)
downloadvyos-1x-da354b88d916f4e7ba1e888a0e3501a5307ec3b5.tar.gz
vyos-1x-da354b88d916f4e7ba1e888a0e3501a5307ec3b5.zip
T9152: Updated nft -c check to return actual error message
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/interface.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index b58eccd43..b567f4ca9 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -920,12 +920,23 @@ class Interface(Control):
rpf_dict['loose_handle'] = handle
def _apply_rpf_nft_config(self, rpf_dict):
+ from subprocess import STDOUT
+
rpf_template = '/run/nftables-source-validation.conf'
render(rpf_template, 'firewall/nftables-source-validation.j2', rpf_dict)
- tmp = run(['nft', '-c', '-f', rpf_template])
- if tmp > 0:
- raise ConfigError('Source validation configuration file errors encountered!')
- run(['nft', '-f', rpf_template])
+
+ cmdl(
+ ['nft', '-c', '--file', rpf_template],
+ stderr=STDOUT,
+ raising=ConfigError,
+ message='Source validation nftables check failed',
+ )
+ cmdl(
+ ['nft', '-f', rpf_template],
+ stderr=STDOUT,
+ raising=ConfigError,
+ message='Failed to apply source validation nftables config',
+ )
def set_ipv4_source_validation(self, mode):
"""