diff options
author | DmitriyEshenko <dmitriy.eshenko@vyos.io> | 2020-11-25 19:05:47 +0000 |
---|---|---|
committer | DmitriyEshenko <dmitriy.eshenko@vyos.io> | 2020-11-26 14:46:31 +0000 |
commit | 5df05983c663f39953d4779086754416ab94f65f (patch) | |
tree | 928fc04abdd3a48ff61da80f1e7c8717568bf3c7 /src/conf_mode/igmp_proxy.py | |
parent | cf36b7ab1e1eb9d91b0877b55115d9a6ad2f196c (diff) | |
download | vyos-1x-5df05983c663f39953d4779086754416ab94f65f.tar.gz vyos-1x-5df05983c663f39953d4779086754416ab94f65f.zip |
pim: igmp: igmp-proxy: T2744: Add check to prevent pimd and igmp-proxy conflict
Diffstat (limited to 'src/conf_mode/igmp_proxy.py')
-rwxr-xr-x | src/conf_mode/igmp_proxy.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/conf_mode/igmp_proxy.py b/src/conf_mode/igmp_proxy.py index 754f46566..d7d8ffd5e 100755 --- a/src/conf_mode/igmp_proxy.py +++ b/src/conf_mode/igmp_proxy.py @@ -33,6 +33,8 @@ config_file = r'/etc/igmpproxy.conf' default_config_data = { 'disable': False, 'disable_quickleave': False, + 'igmp_conf': False, + 'pim_conf': False, 'interfaces': [], } @@ -42,6 +44,13 @@ def get_config(config=None): conf = config else: conf = Config() + + if conf.exists('protocols igmp'): + igmp_proxy['igmp_conf'] = True + + if conf.exists('protocols pim'): + igmp_proxy['pim_conf'] = True + base = ['protocols', 'igmp-proxy'] if not conf.exists(base): return None @@ -125,11 +134,14 @@ def generate(igmp_proxy): def apply(igmp_proxy): if igmp_proxy is None or igmp_proxy['disable']: - # IGMP Proxy support is removed in the commit - call('systemctl stop igmpproxy.service') - if os.path.exists(config_file): - os.unlink(config_file) + # IGMP Proxy support is removed in the commit + call('systemctl stop igmpproxy.service') + if os.path.exists(config_file): + os.unlink(config_file) else: + if igmp_proxy['igmp_conf'] or igmp_proxy['pim_conf']: + raise ConfigError('IGMP proxy and PIM cannot be both configured at the same time') + call('systemctl restart igmpproxy.service') return None |