summaryrefslogtreecommitdiff
path: root/docs/source/faq/getting-peer-information.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/source/faq/getting-peer-information.rst')
-rw-r--r--docs/source/faq/getting-peer-information.rst32
1 files changed, 32 insertions, 0 deletions
diff --git a/docs/source/faq/getting-peer-information.rst b/docs/source/faq/getting-peer-information.rst
new file mode 100644
index 0000000..cf78802
--- /dev/null
+++ b/docs/source/faq/getting-peer-information.rst
@@ -0,0 +1,32 @@
+
+Getting peer address information
+--------------------------------
+
+Q. How do I find out peer transport address or security information within
+ my receiving app (CommandResponder or Notification Receiver)?
+
+A. SNMP architecture forces you to distinguish communicating entities only
+ on the basis of their community names (SNMPv1/v2c) or
+ ContextEngineId/ContextName pair (SNMPv3).
+
+ In other words, if one SNMP Manager should anyhow differ from another,
+ then they should use distinct community names or SNMP contexts.
+ Transport information should never be used for the identification purposes,
+ as in some cases it proves to be unreliable (cases include NAT device or
+ a proxy in the middle, not to mention address spoofing).
+
+ As practice reveals, even perfect design does not always cope well with
+ the imperfect world. So we had to pinch a logic hole from the scope of an
+ SNMP app down to transport layer. Now with the
+ getTransportInfo(stateReference) method call you could get peer transport
+ information upon receiving its SNMP message.
+
+.. code-block:: python
+
+ # Callback function for receiving notifications
+ def cbFun(snmpEngine,
+ stateReference,
+ contextEngineId, contextName,
+ varBinds,
+ cbCtx):
+ transportDomain, transportAddress = snmpEngine.msgAndPduDsp.getTransportInfo(stateReference)