[Twisted-Python] UDP answer from different IP

Phil Mayers p.mayers at imperial.ac.uk
Thu Apr 6 04:16:35 EDT 2006

Wolfgang Eichler wrote:
> I would like to clarify the situation and describe my current
> work-around:
> My twisted application is on client machine A. It sends  SNMP
> requests to server machine B.
> Machine B has two interfaces to the network with IP ''
> and '' . Here runs some arbitrary SNMP Agent.
> When sending the getNext-message getRequestKey() returns:
> (('', 6665), 782)

Then the SNMP code you're using is wrong. As you have found, it is 
EXTREMELY common for this to happen (the SNMP reply to come from a 
different IP than the request was sent to). Whether it's a wrong thing 
for the router/host to do is irrelevant for practical purposes - lots 
and lots of network equipment, some of it very expensive, does it.

My SNMP code does as you suggest, just uses the port number and ID number.

> I wonder why we need the IP address and port at this point, since the
> ID (782) is unique to machine A and port 25000 and is sufficient to
> identify the request to which this incoming message belongs.
> I patched in snmpprotocol.py:

I can't see if that's the specific right thing to patch since I'm not 
familiar with TwistedSNMP, but as I say I have a python/C-helper SNMP 
stack, and it does exactly as you suggest, so if it works I'd say you've 
fixed it.

More information about the Twisted-Python mailing list