summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-08-30 20:08:12 +0200
committerChristian Poessinger <christian@poessinger.com>2020-08-30 20:09:37 +0200
commitbe49f336550f5b6dabd1b8d068237f541f37148a (patch)
tree6e3272345b9284fe89b4749e2fd68ac604bcd5fb /src/conf_mode
parent9f3f7812eeec009e12133d3cd354d4a63e378ac8 (diff)
downloadvyos-1x-be49f336550f5b6dabd1b8d068237f541f37148a.tar.gz
vyos-1x-be49f336550f5b6dabd1b8d068237f541f37148a.zip
nat: T2814: nftables module for NAT has been renamed
Depending on the underlaying Kernel version load the corresponding Kernel module.
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/nat.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/conf_mode/nat.py b/src/conf_mode/nat.py
index 97cd36223..f79f0f42b 100755
--- a/src/conf_mode/nat.py
+++ b/src/conf_mode/nat.py
@@ -19,6 +19,8 @@ import json
import os
from copy import deepcopy
+from distutils.version import LooseVersion
+from platform import release as kernel_version
from sys import exit
from netifaces import interfaces
@@ -33,7 +35,10 @@ from vyos import ConfigError
from vyos import airbag
airbag.enable()
-k_mod = ['nft_nat', 'nft_chain_nat_ipv4']
+if LooseVersion(kernel_version()) > LooseVersion('5.1'):
+ k_mod = ['nft_nat', 'nft_chain_nat']
+else:
+ k_mod = ['nft_nat', 'nft_chain_nat_ipv4']
default_config_data = {
'deleted': False,