Re: SNMPD v5.8 Error opening specified endpoint
Bill Fenner <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <CAF4Soga-g6y7vnLJA9C__dFrTLAwuG_1YtDGdeSxA0P+NvN1JQ@mail.gmail.com> |
On Thu, Aug 23, 2018 at 9:24 AM Martin Frlin <[email protected]> wrote: > Ok, additional information. > Compare this line in v5.8: > https://sourceforge.net/p/net-snmp/code/ci/master/tree/agent/agent_trap.c#l358 > with this line > https://sourceforge.net/p/net-snmp/code/ci/v5.7.3/tree/agent/agent_trap.c#l251 > > You will see that v5.7 does not set a source. And because it does not set > a source it does not bind. > > But maybe we want to bind? (Source says we want to reduce open ports but I > don't understand this) > > Ok, but why bind on port 161? If understand correctly we want to SEND > traps. So we should bind localhost:<random high level port> -> > localhost:162 (address of our snmptrapd), but this does not happen. > Instead we get (note that netsnmp prints to->from): > netsnmp_udpbase: binding socket: 9 to UDP: [0.0.0.0]:0->[127.0.0.1]:161 > netsnmp_udpbase: socket 9 bound to UDP: [127.0.0.1]:162->[127.0.0.1]:161 > > So why is socket bound on port 161 instead of some random high level port? > I didn't find where in code port 161 is set. > It comes from the code that parses transport specifications. But it's assuming that it's parsing a destination, not a source. Even if you told that code that you were doing the lookup in the context of a trap, it would use 162. So I think the solution is that either port is unbound or random high level > port is chosen for binding. > > I've also tried to set > clientaddr 127.0.0.1:<some high level port> > clientaddrUsesPort yes > because documentation says this will be used for clients but it also does > not work. > Can you try adding "-s 127.0.0.1:<some high level port>" to your trapsink line instead? You can also try ":0". I found a few bugs in the clientaddr changes before 5.8 went out, but I don't use trapsink so didn't notice this one. There are a bunch of hacks in the clientaddr support that would clearly have been better to push into the transport parsing instead. Bill > V V čet., 23. avg. 2018 ob 11:47 je oseba Martin Frlin < > [email protected]> napisala: > >> If you have line: >> trapsink localhost public >> in your config v5.8 fails to start. Meanwhile v5.3 starts with no >> problems. >> >> Am I missing something or is this a bug?. >> >> This output was generated using exactly the same config >> v5.8 >> # snmpd -Dnetsnmp_udpbase -Lo -f >> registered debug token netsnmp_udpbase, 1 >> Log handling defined - disabling stderr >> netsnmp_udpbase: open remote UDP: [127.0.0.1]:162->[0.0.0.0]:0 >> netsnmp_udpbase: binding socket: 9 to UDP: [0.0.0.0]:0->[127.0.0.1]:161 >> netsnmp_udpbase: socket 9 bound to UDP: [127.0.0.1]:162->[127.0.0.1]:161 >> Turning on AgentX master support. >> netsnmp_udpbase: open local UDP: [127.0.0.1]:161->[0.0.0.0]:0 >> netsnmp_udpbase: set IP_PKTINFO >> netsnmp_udpbase: binding socket: 8 to UDP: [0.0.0.0]:0->[127.0.0.1]:161 >> netsnmp_udpbase: failed to bind for clientaddr: 98 Address already in use >> Error opening specified endpoint "udp:127.0.0.1:161" >> Server Exiting with code 1 >> >> >> v5.3 >> # snmpd -Dnetsnmp_udpbase -Lo -f >> registered debug token netsnmp_udpbase, 1 >> Log handling defined - disabling stderr >> netsnmp_udpbase: open remote UDP: [127.0.0.1]:162->[0.0.0.0]:0 >> netsnmp_udpbase: client open UDP: [127.0.0.1]:162->[0.0.0.0]:0 >> Turning on AgentX master support. >> netsnmp_udpbase: open local UDP: [127.0.0.1]:161->[0.0.0.0]:0 >> netsnmp_udpbase: set IP_PKTINFO >> > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Net-snmp-users mailing list > [email protected] > Please see the following page to unsubscribe or change other options: > https://lists.sourceforge.net/lists/listinfo/net-snmp-users > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Net-snmp-users mailing list [email protected] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users