Got another problem trying to get ProxyForwarding working. I have a ProxyForwarder configured and it correctly forwards a packet to a target. The target sends the response back. But the forwarder does not process the response. Instead, it times out, removes the request, and as soon as it removes the request, the response suddenly gets received (and dropped). Any idea why that might be?
Are we supposed to provide transport mappings? If so how? Maybe that has something to do with it.
Agent version 2.5.3
16:30:32,431 INFO [stdout] (DefaultUDPTransportMapping_127.0.0.1/161) 16:30:32.430 [DefaultUDPTransportMapping_127.0.0.1/161] DEBUG org.snmp4j.transport.DefaultUdpTransportMapping - Sending message to 127.0.0.1/163 with length 44: 30:2a:02:01:01:04:07:70:75:62:6c:69:63:32:a0:1c:02:04:4e:78:6c:5d:02:01:00:02:01:00:30:0e:30:0c:06:08:2b:06:01:02:01:01:05:00:05:00 - user= client= event= success=
16:30:34,432 INFO [stdout] (Timer-4) 16:30:34.431 [Timer-4] DEBUG org.snmp4j.Snmp - Request timed out: 1316514909 - user= client= event= success=
16:30:34,433 INFO [stdout] (DefaultUDPTransportMapping_127.0.0.1/161) 16:30:34.433 [DefaultUDPTransportMapping_127.0.0.1/161] DEBUG org.snmp4j.Snmp - Removed pending request with handle: PduHandle - user= client= event= success=
16:30:34,436 INFO [stdout] (DefaultUDPTransportMapping_127.0.0.1/161) 16:30:34.436 [DefaultUDPTransportMapping_127.0.0.1/161] INFO org.snmp4j.agent.mo.snmp.ProxyForwarderImpl - Received proxy response from null is null - user= client=
In the provided log, I do not see that any received message. Thus, I assume that the request simply timed out (the log message might be misleading in that case: if the peer address is null, this indicates a timeout).
What could (as almost always) be problem too, is if some of the involved devices use the same engine ID. This will make the forwarding impossible (with authentication enabled).
Thanks Frank, The problem we have is the synchronous nature of the UdpTransport. Here is the issue:
We have a proxyForwarder running and an SnmpAgent running on the same host (separate processes). The proxyForwarder is configured to forward requests the the SnmpAgent. Both are Snmp4J (version 2.5.x).
The ProxyForwarder correctly forwards requests to the agent. The agent correctly sends a response back to the ProxyForwarder. But the ProxyForwarder does not process the response. Instead it times out, and not until after it times out does it process the response message (which it drops).
The problem is that the UdpTransport (DefaultUdpTransportMapping) is not listening for messages while its processing a request. So the response is not received until after the original request times out.
Do we need to create a second UdpTransport to be used for forwarding packets? If so how will it know to forward on that transport? That is, if we create another UdpTransport, then it can forward the request on the that transport, and it will still be listening for response messages.
In short, what is the proper way to configure transportMappings for a ProxyForwarder? Seems that we need one for input (received messages) and one for forwarded messages/responses.