SNMP fails to resolve domains when DNS record is longer than 64 characters
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
net-snmp (Ubuntu) |
Fix Released
|
Undecided
|
Lena Voytek | ||
Jammy |
Fix Released
|
Undecided
|
Lena Voytek | ||
Kinetic |
Fix Released
|
Undecided
|
Lena Voytek | ||
Lunar |
Fix Released
|
Undecided
|
Lena Voytek |
Bug Description
[Impact]
Currently, users who would like to query domains with a name length of 63 characters or more are unable to, and instead receive an Unknown Host error.
This fix should be backported to stable releases as net-snmp should be capable of querying all relevant domains, and this includes very long ones.
The bug is fixed by making the limited-size static string into a dynamic one.
[Test Plan]
The fix can be tested with the following:
# lxc launch images:ubuntu/jammy test-net-snmp
# lxc exec test-net-snmp bash
# apt update && apt dist-upgrade -y
# apt install snmp -y
- Attempt to connect to an existing domain containing over 63 characters:
# snmpstatus -v2c -c public aaaaaaaaaaaaaaa
- Before the fix, it will show the following
Created directory: /var/lib/
snmpstatus: Unknown host (aaaaaaaaaaaaaa
- After the fix, it succeeds or correctly shows that snmpd is not running on the domain
Timeout: No Response from aaaaaaaaaaaaaaa
[Where problems could occur]
Since this change swaps from static allocation to dynamic to handle larger addresses, regressions would most likely be related to memory leaks. If this change fails to account for all situations, the address variable may not be freed, leading to greater memory usage. Also, without the size limit, overwhelmingly large address inputs may also cause issues.
[Original Description]
Hello all,
We recently encountered a bug in net-snmp V5.9.1 related to DNS name length (https:/
Here's a summary :
What I did :
snmpstatus -v2c -c public aaaaaaaaaaaaaaa
What I expected to happen :
Get a timeout from this domain because there's no snmpd running, and I wouldn't use public as a community anyway.
What I got :
snmpstatus: Unknown host (aaaaaaaaaaaaaa
This domain does exist, and does ping properly (also has V4, this is not the problem here):
PING aaaaaaaaaaaaaaa
64 bytes from 2001:41d0:
64 bytes from 2001:41d0:
Upon discussing with a net-snmp github dev, they found out that a change to a feature introduced a char addr[64] to store the host address. They changed it to char addr* to work with >64 characters domains, and its working properly now.
This bug breaks some of our monitoring when updating our librenms ubuntu host to 22.04, which is an issue.
I am of course available if any additional information is needed.
Cheers,
Tanguy
Related branches
- Lena Voytek (community): Approve
- git-ubuntu bot: Pending requested
- Sergio Durigan Junior: Pending requested
- Canonical Server Reporter: Pending requested
-
Diff: 188 lines (+166/-0)3 files modifieddebian/changelog (+7/-0)
debian/patches/restore-support-for-long-dns-names.patch (+158/-0)
debian/patches/series (+1/-0)
- Lena Voytek (community): Approve
- Canonical Server Reporter: Pending requested
- Sergio Durigan Junior: Pending requested
- git-ubuntu bot: Pending requested
-
Diff: 188 lines (+166/-0)3 files modifieddebian/changelog (+7/-0)
debian/patches/restore-support-for-long-dns-names.patch (+158/-0)
debian/patches/series (+1/-0)
- Sergio Durigan Junior (community): Approve
-
Diff: 49 lines (+11/-3)2 files modifieddebian/changelog (+7/-0)
debian/patches/restore-support-for-long-dns-names.patch (+4/-3)
- git-ubuntu bot: Approve
- Sergio Durigan Junior (community): Approve
- Canonical Server Reporter: Pending requested
-
Diff: 187 lines (+165/-0)3 files modifieddebian/changelog (+7/-0)
debian/patches/restore-support-for-long-dns-names.patch (+157/-0)
debian/patches/series (+1/-0)
- git-ubuntu bot: Approve
- Sergio Durigan Junior (community): Approve
- Canonical Server Reporter: Pending requested
-
Diff: 232 lines (+164/-0) (has conflicts)6 files modifieddebian/changelog (+18/-0)
debian/patches/CVE-2022-4479x-1.patch (+59/-0)
debian/patches/CVE-2022-4479x-2.patch (+22/-0)
debian/patches/CVE-2022-4479x-3.patch (+47/-0)
debian/patches/restore-support-for-long-dns-names.patch (+12/-0)
debian/patches/series (+6/-0)
- git-ubuntu bot: Approve
- Athos Ribeiro (community): Approve
- Canonical Server: Pending requested
- Canonical Server Reporter: Pending requested
-
Diff: 187 lines (+165/-0)3 files modifieddebian/changelog (+7/-0)
debian/patches/restore-support-for-long-dns-names.patch (+157/-0)
debian/patches/series (+1/-0)
description: | updated |
description: | updated |
Changed in net-snmp (Ubuntu Kinetic): | |
status: | New → In Progress |
Changed in net-snmp (Ubuntu Jammy): | |
status: | Confirmed → In Progress |
Changed in net-snmp (Ubuntu Jammy): | |
assignee: | nobody → Lena Voytek (lvoytek) |
Changed in net-snmp (Ubuntu Kinetic): | |
assignee: | nobody → Lena Voytek (lvoytek) |
Changed in net-snmp (Ubuntu Lunar): | |
assignee: | nobody → Lena Voytek (lvoytek) |
Changed in net-snmp (Ubuntu Jammy): | |
status: | Fix Committed → In Progress |
Changed in net-snmp (Ubuntu Kinetic): | |
status: | Fix Committed → In Progress |
Hello,
Thank you for submitting this bug report. I created a PPA (https:/ /launchpad. net/~lvoytek/ +archive/ ubuntu/ net-snmp- fix-long- domain- names) for 22.04 with the fix provided by upstream, and it seems to work for me. If you would like to test it yourself you can run the following commands:
$ sudo add-apt-repository ppa:lvoytek/ net-snmp- fix-long- domain- names
$ sudo apt update
$ sudo apt upgrade
If this works for you then I can get started adding it to Ubuntu 22.04 and other affected versions
Thanks!