summaryrefslogtreecommitdiff
path: root/src/conf_mode/vrf.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-01-22 20:05:15 +0100
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-01-30 11:12:52 +0000
commit4d3df44028571c49bdc590778a7c6214373c7297 (patch)
tree4d79f273ea8fe55b3daffb6127697a8ab1a39207 /src/conf_mode/vrf.py
parent29045dff3845dbc26d8a0e16f44dcabc4a96bc53 (diff)
downloadvyos-1x-4d3df44028571c49bdc590778a7c6214373c7297.tar.gz
vyos-1x-4d3df44028571c49bdc590778a7c6214373c7297.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 (cherry picked from commit a821b8c603999665ce8a77acb0e44a743811992a)
Diffstat (limited to 'src/conf_mode/vrf.py')
-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)