mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
Merge pull request #192 from jgrip/master
Fix tinc plugin in switch mode
This commit is contained in:
commit
5b367c2192
2 changed files with 9 additions and 1 deletions
|
|
@ -71,6 +71,9 @@ class Network(NetwConfObject):
|
|||
def get_local_address(self):
|
||||
return self._payload['intaddress']
|
||||
|
||||
def get_mode(self):
|
||||
return self._payload['mode']
|
||||
|
||||
def get_debuglevel(self):
|
||||
if len(self._payload['debuglevel']) > 1:
|
||||
return self._payload['debuglevel'][1]
|
||||
|
|
|
|||
|
|
@ -67,6 +67,11 @@ def deploy(config_filename):
|
|||
# interface name to use
|
||||
interface_name = 'tinc%s' % network.get_id()
|
||||
|
||||
# type of interface to use
|
||||
interface_type = 'tun'
|
||||
if network.get_mode() == 'switch':
|
||||
interface_type = 'tap'
|
||||
|
||||
# dump Network and host config
|
||||
for conf_obj in network.all():
|
||||
if conf_obj.is_valid():
|
||||
|
|
@ -84,7 +89,7 @@ def deploy(config_filename):
|
|||
|
||||
# configure and rename new tun device, place all in group "tinc" symlink associated tun device
|
||||
if interface_name not in interfaces:
|
||||
tundev = subprocess.check_output(['/sbin/ifconfig','tun','create']).split()[0]
|
||||
tundev = subprocess.check_output(['/sbin/ifconfig',interface_type,'create']).split()[0]
|
||||
subprocess.call(['/sbin/ifconfig',tundev,'name',interface_name])
|
||||
subprocess.call(['/sbin/ifconfig',interface_name,'group','tinc'])
|
||||
if os.path.islink('/dev/%s' % interface_name):
|
||||
|
|
|
|||
Loading…
Reference in a new issue