From b370844c597f5eeaba54f736a3e1240d2368f8b5 Mon Sep 17 00:00:00 2001 From: Suvarna Meenakshi Date: Thu, 21 Sep 2023 22:00:13 +0000 Subject: [PATCH 1/2] Revert "[SNMP][IPv6]: Fix to use link local IPv6 address as snmp agentAddress (#16013)" This reverts commit ebe8c8c22362f8699d55644bdee2cc9e74f9fa0d. --- dockers/docker-snmp/snmpd.conf.j2 | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/dockers/docker-snmp/snmpd.conf.j2 b/dockers/docker-snmp/snmpd.conf.j2 index 182056b636e1..cf7f8f385138 100644 --- a/dockers/docker-snmp/snmpd.conf.j2 +++ b/dockers/docker-snmp/snmpd.conf.j2 @@ -30,27 +30,16 @@ agentAddress {{ protocol(agentip) }}:[{{ agentip }}]{% if port %}:{{ port }}{% e {% endfor %} {% elif NAMESPACE_COUNT is not defined or NAMESPACE_COUNT|int <= 1 %} {% if MGMT_INTERFACE is defined %} -{% for intf, ip in MGMT_INTERFACE %} -{% set agentip = ip.split('/')[0]|lower %} -{% set zoneid = '' %} -# Use interface as zoneid for link local ipv6 -{% if agentip.startswith('fe80') %} -{% set zoneid = '%' + intf %} -{% endif %} -agentAddress {{ protocol(agentip) }}:[{{ agentip }}{{ zoneid }}]:161 +{% for if, ip in MGMT_INTERFACE %} +{% set agentip = ip.split('/')[0] %} +agentAddress {{ protocol(agentip) }}:[{{ agentip }}]:161 {% endfor %} {% endif %} {% if LOOPBACK_INTERFACE is defined %} {% for lo in LOOPBACK_INTERFACE %} {% if lo | length == 2 %} -{% set intf = lo[0] %} -{% set agentip = lo[1].split('/')[0]|lower %} -{% set zoneid = '' %} -# Use interface as zoneid for link local ipv6 -{% if agentip.startswith('fe80') %} -{% set zoneid = '%' + intf %} -{% endif %} -agentAddress {{ protocol(agentip) }}:[{{ agentip }}{{ zoneid }}]:161 +{% set agentip = lo[1].split('/')[0] %} +agentAddress {{ protocol(agentip) }}:[{{ agentip }}]:161 {% endif %} {% endfor %} {% endif %} From fe544c8c17bff48a790900f74c1fa1d063d9e159 Mon Sep 17 00:00:00 2001 From: Suvarna Meenakshi Date: Thu, 21 Sep 2023 22:00:25 +0000 Subject: [PATCH 2/2] Revert "[SNMP][IPv6]: Fix SNMP IPv6 reachability issue in certain scenarios (#15487) (#15874)" This reverts commit 83aa8b81805743a730c04d201a430d4a9888560a. --- dockers/docker-snmp/snmpd.conf.j2 | 28 ++-------------------------- dockers/docker-snmp/start.sh | 3 --- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/dockers/docker-snmp/snmpd.conf.j2 b/dockers/docker-snmp/snmpd.conf.j2 index cf7f8f385138..585fb5353e5b 100644 --- a/dockers/docker-snmp/snmpd.conf.j2 +++ b/dockers/docker-snmp/snmpd.conf.j2 @@ -13,36 +13,12 @@ # AGENT BEHAVIOUR # -# Listen for connections on all ip addresses, including eth0, ipv4 lo for multi-asic platform -# Listen on managment and loopback0 ips for single asic platform +# Listen for connections on all ip addresses, including eth0, ipv4 lo # -{% macro protocol(ip_addr) %} -{%- if ip_addr|ipv6 -%} -{{ 'udp6' }} -{%- else -%} -{{ 'udp' }} -{%- endif -%} -{% endmacro %} - {% if SNMP_AGENT_ADDRESS_CONFIG %} {% for (agentip, port, vrf) in SNMP_AGENT_ADDRESS_CONFIG %} -agentAddress {{ protocol(agentip) }}:[{{ agentip }}]{% if port %}:{{ port }}{% endif %}{% if vrf %}%{{ vrf }}{% endif %}{{ "" }} -{% endfor %} -{% elif NAMESPACE_COUNT is not defined or NAMESPACE_COUNT|int <= 1 %} -{% if MGMT_INTERFACE is defined %} -{% for if, ip in MGMT_INTERFACE %} -{% set agentip = ip.split('/')[0] %} -agentAddress {{ protocol(agentip) }}:[{{ agentip }}]:161 -{% endfor %} -{% endif %} -{% if LOOPBACK_INTERFACE is defined %} -{% for lo in LOOPBACK_INTERFACE %} -{% if lo | length == 2 %} -{% set agentip = lo[1].split('/')[0] %} -agentAddress {{ protocol(agentip) }}:[{{ agentip }}]:161 -{% endif %} +agentAddress {{ agentip }}{% if port %}:{{ port }}{% endif %}{% if vrf %}%{{ vrf }}{% endif %}{{ "" }} {% endfor %} -{% endif %} {% else %} agentAddress udp:161 agentAddress udp6:161 diff --git a/dockers/docker-snmp/start.sh b/dockers/docker-snmp/start.sh index 559cdfdc341e..aefd0bfc3db6 100755 --- a/dockers/docker-snmp/start.sh +++ b/dockers/docker-snmp/start.sh @@ -16,14 +16,11 @@ mkdir -p /etc/ssw /etc/snmp # Parse snmp.yml and insert the data in Config DB /usr/bin/snmp_yml_to_configdb.py -ADD_PARAM=$(printf '%s {"NAMESPACE_COUNT":"%s"}' "-a" "$NAMESPACE_COUNT") - SONIC_CFGGEN_ARGS=" \ -d \ -y /etc/sonic/sonic_version.yml \ -t /usr/share/sonic/templates/sysDescription.j2,/etc/ssw/sysDescription \ -t /usr/share/sonic/templates/snmpd.conf.j2,/etc/snmp/snmpd.conf \ - $ADD_PARAM \ " sonic-cfggen $SONIC_CFGGEN_ARGS