diff options
author | zdc <zdc@users.noreply.github.com> | 2021-11-01 17:04:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-01 17:04:11 +0200 |
commit | 1b7c879b9fed2f4563477039bc6ddf4dc0db5829 (patch) | |
tree | a0ea609a933a4d2e54d5712e2b1671a19181c372 /src/conf_mode/snmp.py | |
parent | 3fd2ff423b6c6e992b2ed531c7ba99fb9e1a2123 (diff) | |
parent | 85bf315f71b411e3cdcd19793c4f7e1e5efed917 (diff) | |
download | vyos-1x-1b7c879b9fed2f4563477039bc6ddf4dc0db5829.tar.gz vyos-1x-1b7c879b9fed2f4563477039bc6ddf4dc0db5829.zip |
Merge branch 'current' into T3350-sagitta
Diffstat (limited to 'src/conf_mode/snmp.py')
-rwxr-xr-x | src/conf_mode/snmp.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/conf_mode/snmp.py b/src/conf_mode/snmp.py index 23e45a5b7..2a420b193 100755 --- a/src/conf_mode/snmp.py +++ b/src/conf_mode/snmp.py @@ -52,6 +52,7 @@ default_config_data = { 'communities': [], 'smux_peers': [], 'location' : '', + 'protocol' : 'udp', 'description' : '', 'contact' : '', 'route_table': 'False', @@ -151,6 +152,9 @@ def get_config(): if conf.exists('location'): snmp['location'] = conf.return_value('location') + if conf.exists('protocol'): + snmp['protocol'] = conf.return_value('protocol') + if conf.exists('smux-peer'): snmp['smux_peers'] = conf.return_values('smux-peer') @@ -404,13 +408,14 @@ def verify(snmp): for listen in snmp['listen_address']: addr = listen[0] port = listen[1] + protocol = snmp['protocol'] if is_ipv4(addr): # example: udp:127.0.0.1:161 - listen = 'udp:' + addr + ':' + port + listen = f'{protocol}:{addr}:{port}' elif snmp['ipv6_enabled']: # example: udp6:[::1]:161 - listen = 'udp6:' + '[' + addr + ']' + ':' + port + listen = f'{protocol}6:[{addr}]:{port}' # We only wan't to configure addresses that exist on the system. # Hint the user if they don't exist |