Hi

 

We have found net-snmp 5.4 behaves differently to 5.3.1 with regard to
snmp requests sent to a broadcast IP address. Eg. 192.168.1.255. We are
running linux.

 

5.3.1 responds no problem; 5.4 sees the request but is unable to send a
response.

 

This is because in 5.4 in snmplib/snmpUDPDomain.c it tries hard to send
back the request on the local address it was received on. In this case
it is the broadcast address to which the OS returns EINVAL on the
sendmsg call.

 

The workaround is simply instead of using netsnmp_udp_sendto to send the
packet, which attempts to specify which local address should be used to
send from, to use 'sendto'. This restores the  behaviour of 5.3.1

 

i.e.

 

#if defined(linux) && defined(IP_PKTINFO)

            rc = netsnmp_udp_sendto(t->sock, addr_pair ?
&(addr_pair->local_addr) : NULL, to, buf, size);

#else

            rc = sendto(t->sock, buf, size, 0, to, sizeof(struct
sockaddr));

#endif /* linux && IP_PKTINFO */

 

Becomes

 

#if 0

            rc = netsnmp_udp_sendto(t->sock, addr_pair ?
&(addr_pair->local_addr) : NULL, to, buf, size);

#else

            rc = sendto(t->sock, buf, size, 0, to, sizeof(struct
sockaddr));

#endif /* linux && IP_PKTINFO */

 

Best regards

 

John Gumb

TANDBERG Telecom UK Ltd

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to