summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorMatthias Fetzer <fetzerms@users.noreply.github.com>2019-06-10 13:59:19 +0200
committerDaniil Baturin <daniil@baturin.org>2019-08-31 05:47:35 +0200
commit6167fab1737ef59f223ee6c7fff0a493c76d9793 (patch)
tree7643bf787ab11a5a4628472041846c267272661b /src/conf_mode
parent050acd4f135ef5fc738fc32410700a4249369d1b (diff)
downloadvyos-1x-6167fab1737ef59f223ee6c7fff0a493c76d9793.tar.gz
vyos-1x-6167fab1737ef59f223ee6c7fff0a493c76d9793.zip
[wireguard] T1428: Add handling of fwmark setting (#70)
[wireguard] T1428: correct handling of the fwmark option
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/wireguard.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/conf_mode/wireguard.py b/src/conf_mode/wireguard.py
index 169d57800..8234fad0b 100755
--- a/src/conf_mode/wireguard.py
+++ b/src/conf_mode/wireguard.py
@@ -63,6 +63,7 @@ def get_config():
'lport' : '',
'status' : 'exists',
'state' : 'enabled',
+ 'fwmark' : 0x00,
'mtu' : '1420',
'peer' : {}
}
@@ -95,6 +96,9 @@ def get_config():
### listen port
if c.exists(cnf + ' port'):
config_data['interfaces'][intfc]['lport'] = c.return_value(cnf + ' port')
+ ### fwmark
+ if c.exists(cnf + ' fwmark'):
+ config_data['interfaces'][intfc]['fwmark'] = c.return_value(cnf + ' fwmark')
### description
if c.exists(cnf + ' description'):
config_data['interfaces'][intfc]['descr'] = c.return_value(cnf + ' description')
@@ -296,6 +300,10 @@ def configure_interface(c, intf):
if c['interfaces'][intf]['lport']:
wg_config['port'] = c['interfaces'][intf]['lport']
+ ## fwmark
+ if c['interfaces'][intf]['fwmark']:
+ wg_config['fwmark'] = c['interfaces'][intf]['fwmark']
+
## endpoint
if c['interfaces'][intf]['peer'][p]['endpoint']:
wg_config['endpoint'] = c['interfaces'][intf]['peer'][p]['endpoint']
@@ -314,6 +322,7 @@ def configure_interface(c, intf):
### assemble wg command
cmd = "sudo wg set " + intf
cmd += " listen-port " + str(wg_config['port'])
+ cmd += " fwmark " + str(wg_config['fwmark'])
cmd += " private-key " + wg_config['private-key']
cmd += " peer " + wg_config['pubkey']
cmd += " preshared-key " + wg_config['psk']