Skip to content

Commit

Permalink
[change] Wireguard: do not remove default options
Browse files Browse the repository at this point in the history
In one case I experienced the MTU not being set
to the expected default of 1280. Including the
default value in the configuration can't hurt.
  • Loading branch information
nemesifier committed Jun 11, 2024
1 parent 291f517 commit 089faae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 0 additions & 5 deletions netjsonconfig/backends/wireguard/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ def __intermediate_vpn(self, config, remove=None):
config[self._forward_property_map[option]] = config.pop(option)
else:
config.pop(option, None)
# Remove default options
if config.get('Table') == 'auto':
config.pop('Table')
if config.get('MTU') == 1280:
config.pop('MTU')
config['peers'] = self.__intermediate_peers(config.get('peers', []))
return self.sorted_dict(config)

Expand Down
2 changes: 2 additions & 0 deletions tests/wireguard/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@ def test_confs(self):
PreDown = ip rule delete ipproto tcp dport 22 table 1234
PrivateKey = QFdbnuYr7rrF4eONCAs7FhZwP7BXX/jD/jq2LXCpaXI=
SaveConfig = true
Table = auto
# wireguard config: test2
[Interface]
Address = 10.0.1.1/24
DNS = 10.0.1.1,10.0.0.1
ListenPort = 40843
MTU = 1280
PrivateKey = AFdbnuYr7rrF4eONCAs7FhZwP7BXX/jD/jq2LXCpaXI=
Table = 1234
"""
Expand Down

0 comments on commit 089faae

Please sign in to comment.