summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-01-22 20:05:15 +0100
committerChristian Breunig <christian@breunig.cc>2024-01-22 20:05:15 +0100
commita821b8c603999665ce8a77acb0e44a743811992a (patch)
treeaa103b58e3d0a8d47f37bc18d90908b1d13c3329
parent90a50f8c21433188257766be1b971cae365a7a0c (diff)
downloadvyos-1x-a821b8c603999665ce8a77acb0e44a743811992a.tar.gz
vyos-1x-a821b8c603999665ce8a77acb0e44a743811992a.zip
vrf: T5973: ensure Kernel module is loaded
This prevents the following error when configuring the first VRF: sysctl: cannot stat /proc/sys/net/vrf/strict_mode: No such file or directory
-rwxr-xr-xsrc/conf_mode/vrf.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/conf_mode/vrf.py b/src/conf_mode/vrf.py
index 9b1b6355f..aac9b0616 100755
--- a/src/conf_mode/vrf.py
+++ b/src/conf_mode/vrf.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2020-2023 VyOS maintainers and contributors
+# Copyright (C) 2020-2024 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -27,6 +27,7 @@ from vyos.ifconfig import Interface
from vyos.template import render
from vyos.template import render_to_string
from vyos.utils.dict import dict_search
+from vyos.utils.kernel import check_kmod
from vyos.utils.network import get_interface_config
from vyos.utils.network import get_vrf_members
from vyos.utils.network import interface_exists
@@ -43,6 +44,8 @@ airbag.enable()
config_file = '/etc/iproute2/rt_tables.d/vyos-vrf.conf'
nft_vrf_config = '/tmp/nftables-vrf-zones'
+k_mod = ['vrf']
+
def has_rule(af : str, priority : int, table : str):
""" Check if a given ip rule exists """
if af not in ['-4', '-6']:
@@ -329,6 +332,7 @@ def apply(vrf):
if __name__ == '__main__':
try:
+ check_kmod(k_mod)
c = get_config()
verify(c)
generate(c)