Skip to content
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

snmpv1 trap ipv6, error "unknown host: 2000::1996" #395

Closed
phongting opened this issue Dec 27, 2021 · 1 comment
Closed

snmpv1 trap ipv6, error "unknown host: 2000::1996" #395

phongting opened this issue Dec 27, 2021 · 1 comment

Comments

@phongting
Copy link

version: net-snmp 5.9.1
When I snmptraped with ipv6 in the agent-addr parameter, snmptrap reported the error: "unknown host: 2000::1996".
/usr/local/net-snmp/bin/snmptrap -v1 -c test [2000::1995]:162 '' 2000::1996 6 0 1000 snmpInSetRequests.0 c 0

If I replace ipv4 with '2000::1996', it would send seccess:
/usr/local/net-snmp/bin/snmptrap -v1 -c test [2000::1995]:162 '' 192.168.1.1 6 0 1000 snmpInSetRequests.0 c 0

Viewing the code, I find snmptrap parsing the arg of agent-addr with function 'netsnmp_gethostbyname_v4()':
apps\snmptrap.c:273

agent = argv[arg];
if (agent != NULL && strlen(agent) != 0) {
    int ret = netsnmp_gethostbyname_v4(agent, pdu_in_addr_t);
    if (ret < 0) {
        fprintf(stderr, "unknown host: %s\n", agent);
        goto out;
    }
} else {
    *pdu_in_addr_t = get_myaddr();
}
@bvanassche
Copy link
Contributor

SNMPv1 traps only support IPv4 agent addresses according to https://datatracker.ietf.org/doc/html/rfc1157.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants