From be49f336550f5b6dabd1b8d068237f541f37148a Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 30 Aug 2020 20:08:12 +0200 Subject: nat: T2814: nftables module for NAT has been renamed Depending on the underlaying Kernel version load the corresponding Kernel module. --- src/conf_mode/nat.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/conf_mode') 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, -- cgit v1.2.3