RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1485755 - Misleading "Address family for hostname not supported" from snmptrapd
Summary: Misleading "Address family for hostname not supported" from snmptrapd
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: net-snmp
Version: 7.3
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: rc
: ---
Assignee: Josef Ridky
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks: 1660473
TreeView+ depends on / blocked
 
Reported: 2017-08-28 01:33 UTC by k-endou
Modified: 2019-10-29 10:26 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-10-23 08:49:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Proposed fix which adds IPv4-compatible IPv6 address support to netsnmp_udp6_parse_security() (3.47 KB, patch)
2018-08-10 15:27 UTC, Richard D Alloway
no flags Details | Diff

Description k-endou 2017-08-28 01:33:06 UTC
Description of problem:
"authCommunity" directive with an IP address as "SOURCE" parameter causes snmptrapd to generate an error log "Address family for hostname not supported", which is quite misleading.

Version-Release number of selected component (if applicable):
net-snmp-5.7.2-24.el7_2.1.x86_64

How reproducible:
when an IP address or an IP network address ( IP/mask-length ) in a "authCommunity" directive in /etc/snmp/snmptrapd.conf
ex. authCommunity log,execute,net public 192.168.0.1

Steps to Reproduce:
1. create snmptrapd.conf with the following command.
  # echo "authCommunity log,execute,net public 192.168.0.1" > /etc/snmp/snmptrapd.conf
2. start snmptrapd daemon.
  # snmptrapd -Lf /tmp/s.log

Actual results:
an error message appears in the log file "/tmp/s.log" like:
---
 /etc/snmp/snmptrapd.conf: line 1: Error: Address family for hostname not supported
 net-snmp: 1 error(s) in config file(s)
 NET-SNMP version 5.7.2
---

Expected results:
no errors should be reported.

Additional info:
this seems a bug in IP address parsing functionality of snmptrapd.
i watched with gdb how the daemon parse an address.
the daemon did parse twice per address, both as IPv4 at first and as IPv6 at second, even if the address had proved to be a valid IPv4 address.
i think this second trial ( parsing addres as IPv6 ) generated the error message.

the gdb log below shows:
 first, the daemon called inet_pton() with AF_INET(2) in netsnmp_udp_parse_security(). this was IPv4 address parsing.
 second, the daemon called inet_pton() with AF_INET6(10) in netsnmp_udp6_parse_security(). this was IPv6 address parsing.
---
# gdb /usr/sbin/snmptrapd
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-94.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/sbin/snmptrapd...Reading symbols from /usr/sbin/snmptrapd...(no debugging symbols found)...done.
(no debugging symbols found)...done.
Missing separate debuginfos, use: debuginfo-install net-snmp-5.7.2-24.el7_2.1.x86_64
(gdb) b main
Breakpoint 1 at 0x2ea0
(gdb) run -Lf /tmp/s.log
Starting program: /usr/sbin/snmptrapd -Lf /tmp/s.log
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Breakpoint 1, 0x0000555555556ea0 in main ()
(gdb) b inet_pton
Breakpoint 2 at 0x7ffff5a42240
(gdb) c
Continuing.

Breakpoint 2, 0x00007ffff5a42240 in inet_pton () from /lib64/libc.so.6
(gdb) p $rdi
$1 = 2
(gdb) x/s $rsi
0x7fffffff5290: "192.168.0.1"
(gdb) where
#0  0x00007ffff5a42240 in inet_pton () from /lib64/libc.so.6
#1  0x00007ffff6b88548 in netsnmp_udp_parse_security () from /lib64/libnetsnmp.so.31
#2  0x00007ffff74fb79b in vacm_gen_com2sec () from /lib64/libnetsnmpagent.so.31
#3  0x00007ffff74fc800 in vacm_create_simple () from /lib64/libnetsnmpagent.so.31
#4  0x00007ffff74fc8d0 in vacm_parse_authcommunity () from /lib64/libnetsnmpagent.so.31
#5  0x00007ffff6b5c436 in run_config_handler () from /lib64/libnetsnmp.so.31
#6  0x00007ffff6b5cffd in read_config () from /lib64/libnetsnmp.so.31
#7  0x00007ffff6b5dffb in read_config_files_in_path () from /lib64/libnetsnmp.so.31
#8  0x00007ffff6b5e418 in read_config_files_of_type () from /lib64/libnetsnmp.so.31
#9  0x00007ffff6b5e4a3 in read_config_files () from /lib64/libnetsnmp.so.31
#10 0x00007ffff6b5e5f4 in read_configs () from /lib64/libnetsnmp.so.31
#11 0x00005555555577eb in main ()
(gdb) c
Continuing.

Breakpoint 2, 0x00007ffff5a42240 in inet_pton () from /lib64/libc.so.6
(gdb) p $rdi
$2 = 10
(gdb) x/s $rsi
0x7fffffff5270: "192.168.0.1"
(gdb) where
#0  0x00007ffff5a42240 in inet_pton () from /lib64/libc.so.6
#1  0x00007ffff6b865b1 in netsnmp_udp6_parse_security () from /lib64/libnetsnmp.so.31
#2  0x00007ffff74fb79b in vacm_gen_com2sec () from /lib64/libnetsnmpagent.so.31
#3  0x00007ffff74fc226 in vacm_create_simple () from /lib64/libnetsnmpagent.so.31
#4  0x00007ffff74fc8d0 in vacm_parse_authcommunity () from /lib64/libnetsnmpagent.so.31
#5  0x00007ffff6b5c436 in run_config_handler () from /lib64/libnetsnmp.so.31
#6  0x00007ffff6b5cffd in read_config () from /lib64/libnetsnmp.so.31
#7  0x00007ffff6b5dffb in read_config_files_in_path () from /lib64/libnetsnmp.so.31
#8  0x00007ffff6b5e418 in read_config_files_of_type () from /lib64/libnetsnmp.so.31
#9  0x00007ffff6b5e4a3 in read_config_files () from /lib64/libnetsnmp.so.31
#10 0x00007ffff6b5e5f4 in read_configs () from /lib64/libnetsnmp.so.31
#11 0x00005555555577eb in main ()
(gdb) c
Continuing.
Detaching after fork from child process 15338.
[Inferior 1 (process 15320) exited normally]
---

Comment 2 Josef Ridky 2017-10-13 12:55:55 UTC
Reported upstream: https://sourceforge.net/p/net-snmp/bugs/2805/

Comment 6 Richard D Alloway 2018-08-10 15:26:02 UTC
I was able to replicate this issue and the cause is that snmplib/transports/snmpUDPIPv6Domain.c does not take IPv4 addresses into account.

Attached is a patch which will add checking of IPv4 addresses as IPv4-compatible IPv6 address to netsnmp_udp6_parse_security() to resolve this issue.

The upstream bug report has also been updated with this solution: https://sourceforge.net/p/net-snmp/bugs/2805/#61ca .

-Rich Alloway (Rogue Wave)

Comment 7 Richard D Alloway 2018-08-10 15:27:10 UTC
Created attachment 1475110 [details]
Proposed fix which adds IPv4-compatible IPv6 address support to netsnmp_udp6_parse_security()


Note You need to log in before you can comment on or make changes to this bug.