summaryrefslogtreecommitdiff
path: root/src/conf_mode/protocols_pim.py
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2020-11-27 13:45:21 +0700
committerGitHub <noreply@github.com>2020-11-27 13:45:21 +0700
commit1972691e7fe2a94e9f28e20b5eb5b404bff2dd19 (patch)
tree013f046489d3ce57e6358cf91990c43e9ee50562 /src/conf_mode/protocols_pim.py
parent64d6e689a8274845a49e6931eda6cda04615de42 (diff)
parent5df05983c663f39953d4779086754416ab94f65f (diff)
downloadvyos-1x-1972691e7fe2a94e9f28e20b5eb5b404bff2dd19.tar.gz
vyos-1x-1972691e7fe2a94e9f28e20b5eb5b404bff2dd19.zip
Merge pull request #618 from DmitriyEshenko/fix-igmp-pim
pim: igmp: igmp-proxy: T2744: Add check to prevent pimd and igmp-prox…
Diffstat (limited to 'src/conf_mode/protocols_pim.py')
-rwxr-xr-xsrc/conf_mode/protocols_pim.py28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/conf_mode/protocols_pim.py b/src/conf_mode/protocols_pim.py
index 6d333e19a..8a9f034d5 100755
--- a/src/conf_mode/protocols_pim.py
+++ b/src/conf_mode/protocols_pim.py
@@ -21,8 +21,9 @@ from sys import exit
from vyos.config import Config
from vyos import ConfigError
-from vyos.util import call
+from vyos.util import call, process_named_running
from vyos.template import render
+from signal import SIGTERM
from vyos import airbag
airbag.enable()
@@ -36,6 +37,8 @@ def get_config(config=None):
conf = Config()
pim_conf = {
'pim_conf' : False,
+ 'igmp_conf' : False,
+ 'igmp_proxy_conf' : False,
'old_pim' : {
'ifaces' : {},
'rp' : {}
@@ -48,6 +51,12 @@ def get_config(config=None):
if not (conf.exists('protocols pim') or conf.exists_effective('protocols pim')):
return None
+ if conf.exists('protocols igmp-proxy'):
+ pim_conf['igmp_proxy_conf'] = True
+
+ if conf.exists('protocols igmp'):
+ pim_conf['igmp_conf'] = True
+
if conf.exists('protocols pim'):
pim_conf['pim_conf'] = True
@@ -92,6 +101,10 @@ def verify(pim):
return None
if pim['pim_conf']:
+ # Check conflict with IGMP-Proxy
+ if pim['igmp_proxy_conf']:
+ raise ConfigError(f"IGMP proxy and PIM cannot be both configured at the same time")
+
# Check interfaces
if not pim['pim']['ifaces']:
raise ConfigError(f"PIM require defined interfaces!")
@@ -126,9 +139,16 @@ def apply(pim):
if pim is None:
return None
- if os.path.exists(config_file):
- call("vtysh -d pimd -f " + config_file)
- os.remove(config_file)
+ pim_pid = process_named_running('pimd')
+ if pim['igmp_conf'] or pim['pim_conf']:
+ if not pim_pid:
+ call(f'pimd -d -F traditional --daemon -A 127.0.0.1')
+
+ if os.path.exists(config_file):
+ call("vtysh -d pimd -f " + config_file)
+ os.remove(config_file)
+ elif pim_pid:
+ os.kill(int(pim_pid), SIGTERM)
return None