[snmp] trap redirection question

Birgit Arkesteijn birgit at westhawk.co.uk
Tue Jun 19 12:25:10 BST 2007


Hi Josh,

I was on holiday last week, hence my late reply.

It's the first of the two:
The context receives and compares the IP address of the machine
from which the datagram packet was received.

(see java.net.DatagramPacket.getAddress())


More in details (not sure you care):
stack.AbstractSnmpContext.rawPduReceived(RawPduEvent evt)
{
     String hostAddress = evt.getHostAddress();
     int version = evt.getVersion();
     if (version == this.getVersion())
     {
         if (hostAddress != null
             && hostAddress.equals(this.getSendToHostAddress()) == true)
         {
             // process message and consume event
             ...
         }
         ...
     }
     ...
}


evt.getHostAddress() returns the value that originates as
'receiveFromHostAddr':

net.StandardSocket.receive(int maxRecvSize)
{
     ...
     DatagramPacket p = new DatagramPacket(data, maxRecvSize);
     ...
     soc.receive(p);
     receiveFromHostAddr = p.getAddress();
     ...
     item = new StreamPortItem(receiveFromHostAddr.getHostAddress(), ....
     ...
}


Hope this answers your question.

BTW, did you fix/solve your "snmpv3 context receiver thread destoyed"
problem?

Cheers, Birgit



Josh Bers wrote:
> I would like to use a trap redirector to forward traps received from 
> an agent on port 162 to a Westhawk based manager application 
> listening on some other port. My question is how does the Westhawk
> stack demultiplex SNMP v1 traps to the appropriate trap context?
> 
> Does it use the IP address found in the src field of the ip header of
> the trap message or does it use the agent-addr field of the trap PDU
> itself to determine which context should receive the trap?
 >
 > thanks,
 >
 > Josh
 > _______________________________________________
 > snmp mailing list
 > snmp at snmp.westhawk.co.uk
 > http://snmp.westhawk.co.uk/mailman/listinfo/snmp

-- 
-- Birgit Arkesteijn, birgit at westhawk.co.uk,
-- Westhawk Ltd, Albion Wharf, 19 Albion Street, Manchester M1 5LN, UK
-- Company no: 1769350
-- Registered Office:
-- 15 London Road, Stockton Heath, Warrington WA4 6SJ. UK.
-- tel.: +44 (0)161 237 0660
-- <URL: http://www.westhawk.co.uk>


More information about the snmp mailing list