Fix to use IPv6 linklocal address as snmp agent address#18350
Merged
lguohan merged 3 commits intosonic-net:masterfrom May 12, 2024
Merged
Fix to use IPv6 linklocal address as snmp agent address#18350lguohan merged 3 commits intosonic-net:masterfrom
lguohan merged 3 commits intosonic-net:masterfrom
Conversation
Signed-off-by: Suvarna Meenakshi <sumeenak@microsoft.com>
Signed-off-by: Suvarna Meenakshi <sumeenak@microsoft.com>
This was referenced Mar 13, 2024
Collaborator
|
@SuvarnaMeenakshi seems the current unit test was broken, would you please check? |
Signed-off-by: Suvarna Meenakshi <sumeenak@microsoft.com>
Contributor
Author
done, please help review the changes. thank you. |
qiluo-msft
reviewed
Apr 11, 2024
| for intf in list(mgmt_intf.keys()) + list(lo_intfs.keys()): | ||
| ip_addr = ipaddress.ip_address(UNICODE_TYPE(intf[1].split('/')[0])) | ||
| if ip_addr.version == 6 and ip_addr.is_link_local: | ||
| agent_addr = str(ip_addr) + '%' + intf[0] |
Collaborator
Contributor
Author
There was a problem hiding this comment.
- This is not a config_db schema change
- Yang change is already in place
- this change is mainly to append %(zone) if the IP address is a link local IP Address, inside the SNMP_AGENT_ADDRESS_CONFIG table which is used here: https://github.com/sonic-net/sonic-buildimage/blob/master/dockers/docker-snmp/snmpd.conf.j2#L29
We cannot make this change in the template directly, because "zone" refers to the "interface name" to which the respective IP address belongs to, so we need to know what is the interface name while adding the IP address.
Contributor
|
@qiluo-msft Can you please review? |
Contributor
|
@qiluo-msft , @SuvarnaMeenakshi is it safe to merge/cherry-pick this change? |
Contributor
|
@SuvarnaMeenakshi Please raise a new PR for 202405 branch to address the conflict. Thanks |
SuvarnaMeenakshi
added a commit
to sonic-net/sonic-utilities
that referenced
this pull request
Aug 5, 2024
What I did If link local IPv6 address is added as SNMP agent address, it will fail. This PR requires changes in snmpd.conf.j2 template here sonic-net/sonic-buildimage#18350 How I did it Append scope id to ipv6 link local IP address. How to verify it Able to configure link local ipv6 address as snmp agent address sudo config snmpagentaddress add fe80::a%eth0
Collaborator
|
@SuvarnaMeenakshi , Do we have already PR Vs. 202405 ? |
Contributor
Author
@dprital yes, the changes are already merged to 202405. |
mssonicbld
pushed a commit
to mssonicbld/sonic-utilities
that referenced
this pull request
Aug 12, 2024
What I did If link local IPv6 address is added as SNMP agent address, it will fail. This PR requires changes in snmpd.conf.j2 template here sonic-net/sonic-buildimage#18350 How I did it Append scope id to ipv6 link local IP address. How to verify it Able to configure link local ipv6 address as snmp agent address sudo config snmpagentaddress add fe80::a%eth0
mssonicbld
pushed a commit
to sonic-net/sonic-utilities
that referenced
this pull request
Aug 12, 2024
What I did If link local IPv6 address is added as SNMP agent address, it will fail. This PR requires changes in snmpd.conf.j2 template here sonic-net/sonic-buildimage#18350 How I did it Append scope id to ipv6 link local IP address. How to verify it Able to configure link local ipv6 address as snmp agent address sudo config snmpagentaddress add fe80::a%eth0
nmoray
pushed a commit
to nmoray/sonic-utilities
that referenced
this pull request
Jun 25, 2025
What I did If link local IPv6 address is added as SNMP agent address, it will fail. This PR requires changes in snmpd.conf.j2 template here sonic-net/sonic-buildimage#18350 How I did it Append scope id to ipv6 link local IP address. How to verify it Able to configure link local ipv6 address as snmp agent address sudo config snmpagentaddress add fe80::a%eth0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why I did it
#17045 modified minigraph parser to use management and loopback IPs to support SNMP query over IPv6. With this fix, if mgmt or loopback IP contains link local IP, that will not work as link local IP has to be appended with scope id associating the IP address to a specific interface. This PR change is to ensure that snmp works with link local IPv6 address.
Work item tracking
How I did it
How to verify it
Verified by configuring link local ipv6 address.
Last login: Wed Mar 13 01:45:09 2024 from 10.1.84.57
admin@<>:~$ sudo netstat -tulnp | grep 161
...
udp6 0 0 fe80::f6ee:31ff:fe9:161 :::* 70355/snmpd
..
Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)