-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix to use IPv6 linklocal address as snmp agent address #18350
Conversation
Signed-off-by: Suvarna Meenakshi <sumeenak@microsoft.com>
Signed-off-by: Suvarna Meenakshi <sumeenak@microsoft.com>
@SuvarnaMeenakshi seems the current unit test was broken, would you please check? |
Signed-off-by: Suvarna Meenakshi <sumeenak@microsoft.com>
done, please help review the changes. thank you. |
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] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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.
@qiluo-msft Can you please review? |
@qiluo-msft , @SuvarnaMeenakshi is it safe to merge/cherry-pick this change? |
@SuvarnaMeenakshi Please raise a new PR for 202405 branch to address the conflict. Thanks |
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
@SuvarnaMeenakshi , Do we have already PR Vs. 202405 ? |
@dprital yes, the changes are already merged to 202405.
|
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
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
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)