aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/snmp')
-rw-r--r--lib/snmp/Makefile7
-rw-r--r--lib/snmp/doc/src/Makefile138
-rw-r--r--lib/snmp/doc/src/depend.mk83
-rw-r--r--lib/snmp/doc/src/files.mk1
-rw-r--r--lib/snmp/doc/src/make.dep77
-rw-r--r--lib/snmp/doc/src/notes.xml1336
-rw-r--r--lib/snmp/doc/src/notes_history.xml924
-rw-r--r--lib/snmp/doc/src/snmp_agent_config_files.xml60
-rw-r--r--lib/snmp/doc/src/snmp_agent_netif.xml203
-rw-r--r--lib/snmp/doc/src/snmp_community_mib.xml26
-rw-r--r--lib/snmp/doc/src/snmp_target_mib.xml24
-rw-r--r--lib/snmp/doc/src/snmpa.xml250
-rw-r--r--lib/snmp/doc/src/snmpa_conf.xml25
-rw-r--r--lib/snmp/doc/src/snmpc.xml15
-rw-r--r--lib/snmp/doc/src/snmpc_cmd.xml34
-rw-r--r--lib/snmp/doc/src/snmpm.xml601
-rw-r--r--lib/snmp/mibs/Makefile.in37
-rw-r--r--lib/snmp/mibs/TRANSPORT-ADDRESS-MIB.mib417
-rw-r--r--lib/snmp/priv/conf/agent/target_addr.conf10
-rw-r--r--lib/snmp/src/agent/snmp_community_mib.erl17
-rw-r--r--lib/snmp/src/agent/snmp_notification_mib.erl9
-rw-r--r--lib/snmp/src/agent/snmp_target_mib.erl189
-rw-r--r--lib/snmp/src/agent/snmp_view_based_acm_mib.erl6
-rw-r--r--lib/snmp/src/agent/snmpa.erl64
-rw-r--r--lib/snmp/src/agent/snmpa_acm.erl28
-rw-r--r--lib/snmp/src/agent/snmpa_agent.erl325
-rw-r--r--lib/snmp/src/agent/snmpa_authentication_service.erl11
-rw-r--r--lib/snmp/src/agent/snmpa_conf.erl72
-rw-r--r--lib/snmp/src/agent/snmpa_internal.hrl3
-rw-r--r--lib/snmp/src/agent/snmpa_mpd.erl150
-rw-r--r--lib/snmp/src/agent/snmpa_net_if.erl81
-rw-r--r--lib/snmp/src/agent/snmpa_set_lib.erl8
-rw-r--r--lib/snmp/src/agent/snmpa_trap.erl231
-rw-r--r--lib/snmp/src/agent/snmpa_usm.erl17
-rw-r--r--lib/snmp/src/app/snmp.appup.src116
-rw-r--r--lib/snmp/src/compile/Makefile11
-rw-r--r--lib/snmp/src/compile/depend.mk2
-rw-r--r--lib/snmp/src/compile/snmpc.erl9
-rw-r--r--lib/snmp/src/compile/snmpc.src94
-rw-r--r--lib/snmp/src/compile/snmpc_lib.erl6
-rw-r--r--lib/snmp/src/compile/snmpc_lib.hrl15
-rw-r--r--lib/snmp/src/manager/snmpm.erl578
-rw-r--r--lib/snmp/src/manager/snmpm_config.erl515
-rw-r--r--lib/snmp/src/manager/snmpm_internal.hrl7
-rw-r--r--lib/snmp/src/manager/snmpm_mpd.erl49
-rw-r--r--lib/snmp/src/manager/snmpm_net_if.erl49
-rw-r--r--lib/snmp/src/manager/snmpm_server.erl751
-rw-r--r--lib/snmp/src/manager/snmpm_usm.erl7
-rw-r--r--lib/snmp/src/misc/snmp_conf.erl214
-rw-r--r--lib/snmp/src/misc/snmp_config.erl32
-rw-r--r--lib/snmp/src/misc/snmp_log.erl7
-rw-r--r--lib/snmp/src/misc/snmp_misc.erl13
-rw-r--r--lib/snmp/src/misc/snmp_note_store.erl15
-rw-r--r--lib/snmp/src/misc/snmp_pdus.erl46
-rw-r--r--lib/snmp/test/Makefile13
-rw-r--r--lib/snmp/test/snmp_agent_test.erl300
-rw-r--r--lib/snmp/test/snmp_agent_test_lib.erl17
-rw-r--r--lib/snmp/test/snmp_compiler_test.erl48
-rw-r--r--lib/snmp/test/snmp_manager_test.erl1253
-rw-r--r--lib/snmp/test/snmp_manager_user.erl137
-rw-r--r--[-rwxr-xr-x]lib/snmp/test/snmp_manager_user_old.erl0
-rw-r--r--lib/snmp/test/snmp_pdus_test.erl57
-rw-r--r--lib/snmp/test/test_config/Makefile18
-rw-r--r--lib/snmp/vsn.mk2
64 files changed, 6859 insertions, 3001 deletions
diff --git a/lib/snmp/Makefile b/lib/snmp/Makefile
index 20e3d4692a..4264531112 100644
--- a/lib/snmp/Makefile
+++ b/lib/snmp/Makefile
@@ -2,7 +2,7 @@
# %CopyrightBegin%
#
-# Copyright Ericsson AB 1996-2009. All Rights Reserved.
+# Copyright Ericsson AB 1996-2011. All Rights Reserved.
#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
@@ -67,7 +67,7 @@ do_configure: configure
configure: configure.in
autoconf
-.PHONY: info
+.PHONY: info gclean
info:
@echo "OS: $(OS)"
@@ -76,6 +76,9 @@ info:
@echo "SNMP_VSN: $(SNMP_VSN)"
@echo "APP_VSN: $(APP_VSN)"
+gclean:
+ git clean -fXd
+
# ----------------------------------------------------
# Application (source) release targets
diff --git a/lib/snmp/doc/src/Makefile b/lib/snmp/doc/src/Makefile
index 35ed63e103..df597c8ba7 100644
--- a/lib/snmp/doc/src/Makefile
+++ b/lib/snmp/doc/src/Makefile
@@ -28,14 +28,6 @@ VSN = $(SNMP_VSN)
APPLICATION=snmp
# ----------------------------------------------------
-# Include dependency
-# ----------------------------------------------------
-
-ifndef DOCSUPPORT
-include make.dep
-endif
-
-# ----------------------------------------------------
# Release directory specification
# ----------------------------------------------------
RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN)
@@ -88,40 +80,10 @@ MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3)
MAN6_FILES = $(XML_REF6_FILES:%_app.xml=$(MAN6DIR)/%.6)
MAN7_FILES = $(MIB_FILES:$(MIBSDIR)/%.mib=$(MAN7DIR)/%.7)
-ifdef DOCSUPPORT
-
HTML_REF_MAN_FILE = $(HTMLDIR)/index.html
TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf
-else
-
-TEX_FILES_BOOK = \
- $(BOOK_FILES:%.xml=%.tex)
-TEX_FILES_REF_MAN = \
- $(XML_REF1_FILES:%.xml=%.tex) \
- $(XML_REF3_FILES:%.xml=%.tex) \
- $(XML_REF6_FILES:%.xml=%.tex) \
- $(XML_APPLICATION_FILES:%.xml=%.tex)
-TEX_PART_FILES = $(XML_PART_FILES:%.xml=%.tex)
-TEX_FILES_USERS_GUIDE = \
- $(XML_CHAPTER_FILES:%.xml=%.tex)
-
-TOP_PDF_FILE = snmp-$(VSN).pdf
-TOP_PS_FILE = snmp-$(VSN).ps
-
-$(TOP_PDF_FILE): book.dvi ../../vsn.mk
- @echo "building $(TOP_PDF_FILE)"
- $(DVI2PS) $(DVIPS_FLAGS) -f $< | $(DISTILL) $(DISTILL_FLAGS) > $@
-
-$(TOP_PS_FILE): book.dvi ../../vsn.mk
- @echo "building $(TOP_PS_FILE)"
- $(DVI2PS) $(DVIPS_FLAGS) -f $< > $@
-
-TOP_HTML_FILES = $(INDEX_TARGET)
-
-endif
-
INDEX_FILE = index.html
INDEX_SRC = $(INDEX_FILE).src
INDEX_TARGET = $(DOCDIR)/$(INDEX_FILE)
@@ -141,8 +103,6 @@ DVIPS_FLAGS +=
$(HTMLDIR)/%.gif: %.gif # Copy them to ../html
$(INSTALL_DATA) $< $@
-ifdef DOCSUPPORT
-
docs: pdf html man
ldocs: local_docs $(INDEX_TARGET)
@@ -152,51 +112,11 @@ $(TOP_PDF_FILE): $(XML_FILES)
pdf: $(TOP_PDF_FILE)
html: gifs $(HTML_REF_MAN_FILE)
+html2: html $(INDEX_TARGET)
clean clean_docs: clean_html clean_man clean_pdf
rm -f errs core *~
-else
-
-ifeq ($(DOCTYPE),pdf)
-docs: pdf
-else
-ifeq ($(DOCTYPE),ps)
-docs: ps
-else
-docs: html gifs man
-endif
-endif
-
-pdf: $(TOP_PDF_FILE)
-
-ps: $(TOP_PS_FILE)
-
-html: $(HTML_FILES) $(TOP_HTML_FILES) gifs
-
-html2: gifs $(TOP_HTML_FILES) $(HTML_FILES) $(HTML_REF1_FILES) $(HTML_REF3_FILES) $(HTML_REF6_FILES) $(HTML_CHAP_FILES)
-
-clean: clean_tex clean_html clean_man clean_docs
-
-
-clean_tex:
- @echo "cleaning tex:"
- rm -f $(TEX_FILES_USERS_GUIDE)
- rm -f $(TEX_FILES_REF_MAN)
- rm -f $(TEX_PART_FILES)
- rm -f $(TEX_FILES_BOOK)
-
-clean_docs:
- @echo "cleaning docs:"
- rm -f $(TOP_PDF_FILE)
- rm -f $(TOP_PS_FILE)
- rm -f core $(LATEX_CLEAN)
-
-
-$(HTML_PART_FILES): notes.xml
-
-endif
-
$(INDEX_TARGET): $(INDEX_SRC) ../../vsn.mk # Create top make file
sed -e 's;%VSN%;$(VSN);' $< > $@ # inserting version number
@@ -228,6 +148,7 @@ clean_man:
clean_html:
@echo "cleaning html:"
rm -rf $(HTMLDIR)/*
+ rm -f $(INDEX_TARGET)
$(MAN7DIR)/%.7: $(MIBSDIR)/%.mib
@echo "processing $*"
@@ -248,8 +169,6 @@ $(MAN1DIR)/snmpc.1: snmpc_cmd.xml
include $(ERL_TOP)/make/otp_release_targets.mk
-ifdef DOCSUPPORT
-
release_docs_spec: docs
$(INSTALL_DIR) $(RELSYSDIR)/doc/pdf
$(INSTALL_DATA) $(TOP_PDF_FILE) $(RELSYSDIR)/doc/pdf
@@ -266,55 +185,13 @@ release_docs_spec: docs
$(INSTALL_DIR) $(RELEASE_PATH)/man/man7
$(INSTALL_DATA) $(MAN7DIR)/* $(RELEASE_PATH)/man/man7
-else
-
-
-ifeq ($(DOCTYPE),pdf)
-release_docs_spec: pdf
- $(INSTALL_DIR) $(RELEASE_PATH)/pdf
- $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELEASE_PATH)/pdf
-else
-ifeq ($(DOCTYPE),ps)
-release_docs_spec: ps
- $(INSTALL_DIR) $(RELEASE_PATH)/ps
- $(INSTALL_DATA) $(TOP_PS_FILE) $(RELEASE_PATH)/ps
-else
-release_docs_spec: docs
- $(INSTALL_DIR) $(RELSYSDIR)/doc/html
- $(INSTALL_DATA) $(GIF_FILES) $(EXTRA_FILES) $(HTML_FILES) \
- $(RELSYSDIR)/doc/html
- $(INSTALL_DATA) $(INFO_FILE) $(RELSYSDIR)
- $(INSTALL_DIR) $(RELEASE_PATH)/man/man1
- $(INSTALL_DATA) $(MAN1_FILES) $(RELEASE_PATH)/man/man1
- $(INSTALL_DIR) $(RELEASE_PATH)/man/man
- $(INSTALL_DATA) $(MAN3_FILES) $(RELEASE_PATH)/man/man3
- $(INSTALL_DIR) $(RELEASE_PATH)/man/man6
- $(INSTALL_DATA) $(MAN6_FILES) $(RELEASE_PATH)/man/man6
- $(INSTALL_DIR) $(RELEASE_PATH)/man/man7
- $(INSTALL_DATA) $(MAN7_FILES) $(RELEASE_PATH)/man/man7
- $(INSTALL_DATA) $(TOP_HTML_FILES) \
- $(RELSYSDIR)/doc
-endif
-endif
-
-endif
-
release_spec:
-ifdef DOCSUPPORT
info: info_xml info_man info_html
@echo "MAN1DIR: $(MAN1DIR)"
@echo "MAN3DIR: $(MAN3DIR)"
@echo "MAN6DIR: $(MAN6DIR)"
@echo "MAN7DIR: $(MAN7DIR)"
-else
-info: info_xml info_man info_html info_tex
- @echo "DVI2PS = $(DVI2PS)"
- @echo "DVIPS_FLAGS = $(DVIPS_FLAGS)"
- @echo ""
- @echo "DISTILL = $(DISTILL)"
- @echo "DISTILL_FLAGS = $(DISTILL_FLAGS)"
-endif
info_man:
@echo "man files:"
@@ -360,14 +237,3 @@ info_html:
@echo "HTML_REF3_FILES = $(HTML_REF3_FILES)"
@echo "HTML_REF6_FILES = $(HTML_REF6_FILES)"
@echo "HTML_CHAP_FILES = $(HTML_CHAP_FILES)"
-
-info_tex:
- @echo "tex files:"
- @echo "TEX_FILES_USERS_GUIDE = $(TEX_FILES_USERS_GUIDE)"
- @echo "TEX_FILES_REF_MAN = $(TEX_FILES_REF_MAN)"
- @echo "TEX_PART_FILES = $(TEX_PART_FILES)"
- @echo "TEX_FILES_BOOK = $(TEX_FILES_BOOK)"
-
-ifndef DOCSUPPORT
-include depend.mk
-endif
diff --git a/lib/snmp/doc/src/depend.mk b/lib/snmp/doc/src/depend.mk
deleted file mode 100644
index 20a523dd8c..0000000000
--- a/lib/snmp/doc/src/depend.mk
+++ /dev/null
@@ -1,83 +0,0 @@
-#-*-makefile-*- ; force emacs to enter makefile-mode
-
-# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2004-2011. All Rights Reserved.
-#
-# The contents of this file are subject to the Erlang Public License,
-# Version 1.1, (the "License"); you may not use this file except in
-# compliance with the License. You should have received a copy of the
-# Erlang Public License along with this software. If not, it can be
-# retrieved online at http://www.erlang.org/.
-#
-# Software distributed under the License is distributed on an "AS IS"
-# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
-# the License for the specific language governing rights and limitations
-# under the License.
-#
-# %CopyrightEnd%
-
-$(HTMLDIR)/part_notes.html: \
- part_notes_history.xml \
- part_notes.xml \
- notes_history.xml \
- notes.xml
-
-$(HTMLDIR)/part.html: \
- part.xml \
- snmp_intro.xml \
- snmp_agent_funct_descr.xml \
- snmp_manager_funct_descr.xml \
- snmp_mib_compiler.xml \
- snmp_config.xml \
- snmp_agent_config_files.xml \
- snmp_manager_config_files.xml \
- snmp_impl_example_agent.xml \
- snmp_impl_example_manager.xml \
- snmp_instr_functions.xml \
- snmp_def_instr_functions.xml \
- snmp_agent_netif.xml \
- snmp_manager_netif.xml \
- snmp_audit_trail_log.xml \
- snmp_advanced_agent.xml \
- snmp_app_a.xml \
- snmp_app_b.xml
-
-$(HTMLDIR)/ref_man.html: \
- ref_man.xml \
- snmp_app.xml \
- snmp.xml \
- snmpc.xml \
- snmpc_cmd.xml \
- snmpa.xml \
- snmpa_conf.xml \
- snmpa_discovery_handler.xml \
- snmpa_error_report.xml \
- snmpa_error.xml \
- snmpa_error_io.xml \
- snmpa_error_logger.xml \
- snmpa_local_db.xml \
- snmpa_mpd.xml \
- snmpa_network_interface.xml \
- snmpa_network_interface_filter.xml \
- snmpa_notification_delivery_info_receiver.xml \
- snmpa_notification_filter.xml \
- snmpa_supervisor.xml \
- snmp_community_mib.xml \
- snmp_framework_mib.xml \
- snmp_generic.xml \
- snmp_index.xml \
- snmp_notification_mib.xml \
- snmp_pdus.xml \
- snmp_standard_mib.xml \
- snmp_target_mib.xml \
- snmp_user_based_sm_mib.xml \
- snmp_view_based_acm_mib.xml \
- snmpm.xml \
- snmpm_conf.xml \
- snmpm_mpd.xml \
- snmpm_network_interface.xml \
- snmpm_network_interface_filter.xml \
- snmpm_user.xml
-
-
diff --git a/lib/snmp/doc/src/files.mk b/lib/snmp/doc/src/files.mk
index bd94cd6bac..61c91c9729 100644
--- a/lib/snmp/doc/src/files.mk
+++ b/lib/snmp/doc/src/files.mk
@@ -157,4 +157,5 @@ MIB_FILES = \
$(MIBSDIR)/SNMP-VIEW-BASED-ACM-MIB.mib \
$(MIBSDIR)/SNMP-USM-AES-MIB.mib \
$(MIBSDIR)/INET-ADDRESS-MIB.mib \
+ $(MIBSDIR)/TRANSPORT-ADDRESS-MIB.mib \
$(MIBSDIR)/OTP-SNMPEA-MIB.mib
diff --git a/lib/snmp/doc/src/make.dep b/lib/snmp/doc/src/make.dep
deleted file mode 100644
index 223e197f25..0000000000
--- a/lib/snmp/doc/src/make.dep
+++ /dev/null
@@ -1,77 +0,0 @@
-#-*-makefile-*- ; force emacs to enter makefile-mode
-
-# %CopyrightBegin%
-#
-# Copyright Ericsson AB 1999-2011. All Rights Reserved.
-#
-# The contents of this file are subject to the Erlang Public License,
-# Version 1.1, (the "License"); you may not use this file except in
-# compliance with the License. You should have received a copy of the
-# Erlang Public License along with this software. If not, it can be
-# retrieved online at http://www.erlang.org/.
-#
-# Software distributed under the License is distributed on an "AS IS"
-# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
-# the License for the specific language governing rights and limitations
-# under the License.
-#
-# %CopyrightEnd%
-
-# ----------------------------------------------------
-# >>>> Do not edit this file <<<<
-# This file was automaticly generated by
-# /home/otp/bin/docdepend
-# ----------------------------------------------------
-
-
-# ----------------------------------------------------
-# TeX files that the DVI file depend on
-# ----------------------------------------------------
-
-book.dvi: book.tex part.tex ref_man.tex snmp.tex snmp_advanced_agent.tex \
- snmp_agent_config_files.tex snmp_agent_funct_descr.tex \
- snmp_agent_netif.tex snmp_app.tex snmp_app_a.tex \
- snmp_app_b.tex snmp_audit_trail_log.tex \
- snmp_community_mib.tex \
- snmp_config.tex snmp_def_instr_functions.tex \
- snmp_framework_mib.tex snmp_generic.tex \
- snmp_impl_example_agent.tex \
- snmp_impl_example_manager.tex snmp_index.tex \
- snmp_instr_functions.tex snmp_intro.tex \
- snmp_manager_config_files.tex \
- snmp_manager_funct_descr.tex snmp_manager_netif.tex \
- snmp_mib_compiler.tex snmp_notification_mib.tex \
- snmp_pdus.tex snmp_standard_mib.tex snmp_target_mib.tex \
- snmp_user_based_sm_mib.tex snmp_view_based_acm_mib.tex \
- snmpa.tex snmpa_conf.tex snmpa_error.tex snmpa_error_io.tex \
- snmpa_error_logger.tex snmpa_error_report.tex \
- snmpa_local_db.tex snmpa_mpd.tex \
- snmpa_discovery_handler.tex \
- snmpa_network_interface.tex \
- snmpa_network_interface_filter.tex \
- snmpa_notification_delivery_info_receiver.tex \
- snmpa_notification_filter.tex \
- snmpa_supervisor.tex \
- snmpc.tex snmpc_cmd.tex snmpm.tex snmpm_conf.tex snmpm_mpd.tex \
- snmpm_network_interface.tex snmpm_network_interface_filter.tex \
- snmpm_user.tex
-
-# ----------------------------------------------------
-# Source inlined when transforming from source to LaTeX
-# ----------------------------------------------------
-
-book.tex: ref_man.xml
-
-# ----------------------------------------------------
-# Pictures that the DVI file depend on
-# ----------------------------------------------------
-
-book.dvi: MIB_mechanism.ps snmp-um-1-image-1.ps snmp-um-1-image-2.ps \
- snmp-um-1-image-3.ps
-
-book.dvi: snmp_agent_netif_1.ps
-
-book.dvi: getnext1.ps getnext2.ps getnext3.ps getnext4.ps
-
-book.dvi: snmp_manager_netif_1.ps
-
diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml
index 2efeb8ae3f..fd5a548b16 100644
--- a/lib/snmp/doc/src/notes.xml
+++ b/lib/snmp/doc/src/notes.xml
@@ -32,6 +32,416 @@
<file>notes.xml</file>
</header>
+
+ <section>
+ <title>SNMP Development Toolkit 4.21.3</title>
+ <p>Version 4.21.3 supports code replacement in runtime from/to
+ version 4.21.2, 4.21.1, 4.21 and 4.20.1. </p>
+
+ <section>
+ <title>Improvements and new features</title>
+<!--
+ <p>-</p>
+-->
+
+ <list type="bulleted">
+ <item>
+ <p>[compiler] Improved version info printout. </p>
+ <p>Own Id: OTP-9618</p>
+ </item>
+
+ </list>
+ </section>
+
+ <section>
+ <title>Fixed Bugs and Malfunctions</title>
+<!--
+ <p>-</p>
+-->
+
+ <list type="bulleted">
+ <item>
+ <p>[compiler] Fix the <c>--warnings/--W</c> option parsing in the
+ <seealso marker="snmpc(command)#option_warnings">snmpc</seealso>
+ wrapper (e)script.
+ The short warning option was incorrectly <c>--w</c>, instead
+ of as documented <c>--W</c>. This has now been corrected. </p>
+ <p>*** POTENTIAL INCOMPATIBILITY ***</p>
+ <p>Tuncer Ayaz</p>
+ <p>Own Id: OTP-9718</p>
+ </item>
+
+ </list>
+
+ </section>
+
+
+ <section>
+ <title>Incompatibilities</title>
+<!--
+ <p>-</p>
+-->
+
+ <list type="bulleted">
+ <item>
+ <p>[compiler] The short warning option has been changed from
+ <c>--w</c> to <c>--W</c> to comply with the documentation. </p>
+ <p>Tuncer Ayaz</p>
+ <p>Own Id: OTP-9718</p>
+ </item>
+
+
+ </list>
+ </section>
+
+ </section> <!-- 4.21.3 -->
+
+
+ <section>
+ <title>SNMP Development Toolkit 4.21.2</title>
+ <p>Version 4.21.2 supports code replacement in runtime from/to
+ version 4.21.1, 4.21, 4.20.1, 4.20 and 4.19. </p>
+
+ <section>
+ <title>Improvements and new features</title>
+ <p>-</p>
+
+<!--
+ <list type="bulleted">
+ <item>
+ <p>Bad note store GC timer deactivation.
+ Wrong field in the state record was set (timeout instead active). </p>
+ <p>Stefan Grundmann</p>
+ <p>Own Id: OTP-9690</p>
+ </item>
+
+ </list>
+-->
+
+ </section>
+
+ <section>
+ <title>Fixed Bugs and Malfunctions</title>
+<!--
+ <p>-</p>
+-->
+
+ <list type="bulleted">
+ <item>
+ <p>Bad note store GC timer deactivation.
+ Wrong field in the state record was set (timeout instead active). </p>
+ <p>Stefan Grundmann</p>
+ <p>Own Id: OTP-9690</p>
+ </item>
+
+ </list>
+ </section>
+
+
+ <section>
+ <title>Incompatibilities</title>
+ <p>-</p>
+ </section>
+
+ </section> <!-- 4.21.2 -->
+
+
+ <section>
+ <title>SNMP Development Toolkit 4.21.1</title>
+ <p>Version 4.21.1 supports code replacement in runtime from/to
+ version 4.20.1, 4.20 and 4.19. </p>
+
+ <section>
+ <title>Improvements and new features</title>
+<!--
+ <p>-</p>
+-->
+ <list type="bulleted">
+ <item>
+ <p>[compiler] Used wrong variable name (for
+ warnings-as-errors variable), which caused the
+ compiler to crash when using the snmpc (e)script. </p>
+ <p>Also added the option
+ <seealso marker="snmpc(command)#option_werror">--Werror</seealso>
+ for the SNMP MIB compiler (escript) frontend (to mimic
+ <seealso marker="erts:erlc">erlc</seealso>),
+ which specifies whether warnings should be treated as errors. </p>
+ <p>Own Id: OTP-9447</p>
+ </item>
+
+ <item>
+ <p>[agent] Some very minor debugging improvements. </p>
+ <p>Own Id: OTP-9446</p>
+ </item>
+ </list>
+
+ </section>
+
+ <section>
+ <title>Fixed Bugs and Malfunctions</title>
+ <p>-</p>
+
+<!--
+ <list type="bulleted">
+ <item>
+ <p>The snmp config tool could not handle (manager) audit trail config
+ because the option seqno was not handled. </p>
+ <p>Own Id: OTP-9354</p>
+ </item>
+
+ </list>
+-->
+ </section>
+
+
+ <section>
+ <title>Incompatibilities</title>
+ <p>-</p>
+ </section>
+
+ </section> <!-- 4.21.1 -->
+
+
+ <section>
+ <title>SNMP Development Toolkit 4.21</title>
+ <p>Version 4.21 supports code replacement in runtime from/to
+ version 4.20.1, 4.20 and 4.19. </p>
+
+ <section>
+ <title>Improvements and new features</title>
+<!--
+ <p>-</p>
+-->
+ <list type="bulleted">
+ <item>
+ <p>[manager] There was no way to specify transport domain.
+ The transport domains was assumed to be IPv4 (transportDomainUdpIpv4).
+ This has now been changed so that it can also be IPv6
+ (transportDomainUdpIpv6).
+ To facilitate this, the transport domain, <c>tdomain</c>,
+ is now a (new) valid option when
+ <seealso marker="snmpm#register_agent">registering</seealso>
+ a new agent (and
+ <seealso marker="snmpm#update_agent_info">updating</seealso>
+ agent info). </p>
+ <p>This also mean that the transport behaviour has changed. </p>
+ <p>Own Id: OTP-9305</p>
+ <p>Aux Id: Seq 11847</p>
+ </item>
+
+ <item>
+ <p>[compiler] Added the option
+ <seealso marker="snmpc#compile">warnings_as_errors</seealso>
+ (for the SNMP MIB compiler (escript) frontend, the option
+ <seealso marker="snmpc(command)#option_wae">--wae</seealso> is used)
+ which specifies whether warnings should be treated as errors. </p>
+ <p>Tuncer Ayaz</p>
+ <p>Own Id: OTP-9437</p>
+ </item>
+ </list>
+
+ </section>
+
+ <section>
+ <title>Fixed Bugs and Malfunctions</title>
+<!--
+ <p>-</p>
+-->
+
+ <list type="bulleted">
+ <item>
+ <p>The snmp config tool could not handle (manager) audit trail config
+ because the option seqno was not handled. </p>
+ <p>Own Id: OTP-9354</p>
+ </item>
+
+ <item>
+ <p>[agent] The SNMP ACM cache was not properly updated when
+ changes where made to the VACM security-to-group, access and
+ view-tree-family tables. </p>
+ <p>Own Id: OTP-9367</p>
+ <p>Aux Id: Seq 11858</p>
+ </item>
+
+ <item>
+ <p>Fixed install directory typo for man3. </p>
+ <p>Peter Lemenkov</p>
+ <p>Hans Ulrich Niedermann</p>
+ <p>Own Id: OTP-9442</p>
+ </item>
+
+ </list>
+ </section>
+
+
+ <section>
+ <title>Incompatibilities</title>
+ <p>-</p>
+ </section>
+
+ </section> <!-- 4.21 -->
+
+
+ <section>
+ <title>SNMP Development Toolkit 4.20.1</title>
+ <p>Version 4.20.1 supports code replacement in runtime from/to
+ version 4.20, 4.19 and 4.18.</p>
+
+ <section>
+ <title>Improvements and new features</title>
+ <p>-</p>
+<!--
+ <list type="bulleted">
+ <item>
+ <p>Added type specs for functions that do not return. </p>
+ <p>Kostis Sagonas</p>
+ <p>Own Id: OTP-9208</p>
+ </item>
+ </list>
+-->
+ </section>
+
+ <section>
+ <title>Fixed Bugs and Malfunctions</title>
+<!--
+ <p>-</p>
+-->
+ <list type="bulleted">
+ <item>
+ <p>[agent] Did not handle transport domains properly in some cases,
+ for instance trap sending. </p>
+ <p>Own Id: OTP-9400</p>
+ </item>
+
+ <item>
+ <p>[agent] Wrong default transport domain, snmpUDPDomain, instead
+ of transportDomainUdpIpv4. </p>
+ <p>Own Id: OTP-9425</p>
+ <p>Aux Id: Seq 11874</p>
+ </item>
+
+ </list>
+ </section>
+
+
+ <section>
+ <title>Incompatibilities</title>
+ <p>-</p>
+ </section>
+
+ </section> <!-- 4.20.1 -->
+
+
+ <section>
+ <title>SNMP Development Toolkit 4.20</title>
+ <p>Version 4.20 supports code replacement in runtime from/to
+ version 4.19 and 4.18.</p>
+
+ <section>
+ <title>Improvements and new features</title>
+<!--
+ <p>-</p>
+-->
+ <list type="bulleted">
+ <item>
+ <p>[agent] Added support for sending traps to IPv6 targets. </p>
+ <p>See the
+ <seealso marker="snmp_agent_config_files#target_addr">target address config file</seealso>,
+ the <seealso marker="snmpa_conf#target_addr_entry">target_addr_entry/11</seealso> function or
+ <seealso marker="snmp_target_mib#add_addr">add_addr/11</seealso> for more info. </p>
+ <p>Own Id: OTP-9088</p>
+ <p>Aux Id: Seq 11790</p>
+ </item>
+
+
+ <item>
+ <p>[agent] To be able to handle multiple engine-id(s) when
+ sending trap(s), the function
+ <seealso marker="snmp_community_mib#add_community">
+ add_community/6</seealso> has been added. </p>
+ <p>Own Id: OTP-9119</p>
+ <p>Aux Id: Seq 11792</p>
+ </item>
+
+ <item>
+ <p>[manager] The API for snmp requests has been augmented to
+ allow the caller to override some configuration. </p>
+ <p>This has been done by introducing a new set of API functions, see
+ <seealso marker="snmpm#sync_get2">sync_get2/3,4</seealso>,
+ <seealso marker="snmpm#async_get2">async_get2/3,4</seealso>,
+ <seealso marker="snmpm#sync_get_next2">sync_get_next2/3,4</seealso>,
+ <seealso marker="snmpm#async_get_next2">async_get_next2/3,4</seealso>,
+ <seealso marker="snmpm#sync_get_bulk2">sync_get_bulk2/5,6</seealso>,
+ <seealso marker="snmpm#async_get_bulk2">async_get_bulk2/5,6</seealso>,
+ <seealso marker="snmpm#sync_set2">sync_set2/3,4</seealso> and
+ <seealso marker="snmpm#async_set2">async_set2/3,4</seealso>
+ for more info. </p>
+ <p>Own Id: OTP-9162</p>
+ </item>
+
+ <item>
+ <p>[manager] The old API functions (for get and set
+ requests:
+ snmpm:g/3,4,5,6,7, snmpm:ag/3,4,5,6,7,
+ snmpm:gn/3,4,5,6,7, snmpm:agn/3,4,5,6,7,
+ snmpm:s/3,4,5,6,7, snmpm:s/3,4,5,6,7,
+ snmpm:gb/5,6,7,8,9 and snmpm:agb/5,6,7,8,9)
+ are now officially deprecated.
+ They will be removed as of R16B. </p>
+ <p>Own Id: OTP-9174</p>
+ </item>
+
+ <item>
+ <p>[agent] Pass extra info through the agent to the net-if
+ process when sending notifications. </p>
+ <p>See
+ <seealso marker="snmpa#send_notification2">
+ snmpa:send_notification2/3</seealso> for more info.
+ See also the incomming net-if messages when sending a
+ <seealso marker="snmp_agent_netif#im_send_pdu">trap</seealso>
+ (send_pdu message) and
+ <seealso marker="snmp_agent_netif#im_send_pdu_req">
+ notification</seealso> (send_pdu_req message). </p>
+ <p>Own Id: OTP-9183</p>
+ <p>Aux Id: Seq 11817</p>
+ </item>
+
+ <item>
+ <p>Added type specs for functions that do not return. </p>
+ <p>Kostis Sagonas</p>
+ <p>Own Id: OTP-9208</p>
+ </item>
+ </list>
+ </section>
+
+ <section>
+ <title>Fixed Bugs and Malfunctions</title>
+<!--
+ <p>-</p>
+-->
+
+ <list type="bulleted">
+ <item>
+ <p>Fixed endode/decode of values of type <c>Counter32</c>. </p>
+ <p>This type (<c>Counter32</c>) is an unsigned integer 32,
+ but is actually encoded as an signed integer 32.
+ The encode/decode functions however, treated it as if it was
+ encodeded as an unsigned integer 32. </p>
+ <p>Own Id: OTP-9022</p>
+ </item>
+
+ </list>
+ </section>
+
+
+ <section>
+ <title>Incompatibilities</title>
+ <p>-</p>
+ </section>
+
+ </section> <!-- 4.20 -->
+
+
<section>
<title>SNMP Development Toolkit 4.19</title>
<p>Version 4.19 supports code replacement in runtime from/to
@@ -126,6 +536,7 @@ snmp_view_basec_acm_mib:vacmAccessTable(set, RowIndex, Cols).
</section> <!-- 4.19 -->
+
<section>
<title>SNMP Development Toolkit 4.18</title>
<p>Version 4.18 supports code replacement in runtime from/to
@@ -226,7 +637,7 @@ snmp_view_basec_acm_mib:vacmAccessTable(set, RowIndex, Cols).
<p>The config utility
(<seealso marker="snmp#config">snmp:config/0</seealso>)
generated a default notify.conf
- with a bad name for the starndard trap entry (was "stadard trap",
+ with a bad name for the standard trap entry (was "stadard trap",
but should have been "standard trap"). This has been corrected. </p>
<p>Kenji Rikitake</p>
<p>Own Id: OTP-8433</p>
@@ -430,7 +841,7 @@ snmp_view_basec_acm_mib:vacmAccessTable(set, RowIndex, Cols).
<p>The config utility
(<seealso marker="snmp#config">snmp:config/0</seealso>)
generated a default notify.conf
- with a bad name for the starndard trap entry (was "stadard trap",
+ with a bad name for the standard trap entry (was "stadard trap",
but should have been "standard trap"). This has been corrected. </p>
<p>Kenji Rikitake</p>
<p>Own Id: OTP-8433</p>
@@ -509,927 +920,6 @@ snmp_view_basec_acm_mib:vacmAccessTable(set, RowIndex, Cols).
</section> <!-- 4.15 -->
- <section>
- <title>SNMP Development Toolkit 4.14</title>
-
- <p>Version 4.14 supports code replacement in runtime from/to
- version 4.13.5, 4.13.4, 4.13.3, 4.13.2, 4.13.1 and 4.13.</p>
-
- <section>
- <title>Improvements and new features</title>
- <!--
- <p>-</p>
- -->
-
- <list type="bulleted">
- <item>
- <p>[compiler] Include object- and notification groups in the
- compiled mib.
- This will make it possible to import groups from other mibs. </p>
- <p>Also the SNMPv2-MIB-file has been updated to a more
- up-to-date version. </p>
- <p>Own Id: OTP-8223</p>
- <!-- <p>Aux Id: Seq 11383</p> -->
- </item>
-
- <item>
- <p>[manager] Added support for message filtering in the
- network interface module provided with the application.
- The component that actually make the filter decisions
- is the network interface filter module. This module
- must implement the
- <seealso marker="snmpm_network_interface_filter">network interface filter behaviour</seealso>
- for message filtering.
- See also the Configuring chapter of
- the User's Guide to see how to configure this feature. </p>
- <p>See the
- <seealso marker="snmp_app#configuration_params">configuration</seealso>
- chapter for more info about the filter options.</p>
- <p>Own Id: OTP-8228</p>
- <p>Aux Id: Seq 11411</p>
- </item>
-
- <item>
- <p>The MIBs delivered as part of the application is now
- also available as man pages, section 7. </p>
- <p>Own Id: OTP-8237</p>
- <!-- <p>Aux Id: Seq 11383</p> -->
- </item>
-
- </list>
-
- </section>
-
- <section>
- <title>Reported Fixed Bugs and Malfunctions</title>
- <p>-</p>
-
- <!--
- <list type="bulleted">
- <item>
- <p>[agent] The main agent type header file contained some miss-information
- regarding the type of the entrytype field of the me-record, causing
- unneccessary confusion.</p>
- <p>Own Id: OTP-8116</p>
- <p>Aux Id: Seq 11312</p>
- </item>
-
- </list>
- -->
-
- </section>
-
- <section>
- <title>Incompatibilities</title>
- <p>-</p>
- </section>
- </section> <!-- 4.14 -->
-
-
- <section>
- <title>SNMP Development Toolkit 4.13.5</title>
-
- <p>Version 4.13.5 supports code replacement in runtime from/to
- version 4.13.4, 4.13.3, 4.13.2, 4.13.1 and 4.13.</p>
-
- <section>
- <title>Improvements and new features</title>
- <!--
- <p>-</p>
- -->
-
- <list type="bulleted">
- <item>
- <p>[agent] Improved the cache handling of the mib server. </p>
- <p>A number of new functions and config options for the mib server
- cache has been added. </p>
- <p>See
- <seealso marker="snmpa#invalidate_mibs_cache">invalidate_mibs_cache/0,1</seealso>,
- <seealso marker="snmpa#enable_mibs_cache">enable_mibs_cache/0,1</seealso>,
- <seealso marker="snmpa#disable_mibs_cache">disable_mibs_cache/0,1</seealso>,
- <seealso marker="snmpa#gc_mibs_cache">gc_mibs_cache/0,1,2,3</seealso>,
- <seealso marker="snmpa#enable_mibs_cache_autogc">enable_mibs_cache_autogc/0,1</seealso>,
- <seealso marker="snmpa#disable_mibs_cache_autogc">disable_mibs_cache_autogc/0,1</seealso>,
- <seealso marker="snmpa#update_mibs_cache_age">update_mibs_cache_age/1,2</seealso> and
- <seealso marker="snmpa#update_mibs_cache_gclimit">update_mibs_cache_gclimit/1,2</seealso> for more info. </p>
- <p>See also the
- <seealso marker="snmp_app#configuration_params">configuration</seealso>
- chapter for more info about the mib server cache options.</p>
- <p>Own Id: OTP-8182</p>
- <p>Aux Id: Seq 11383</p>
- </item>
-
- <item>
- <p>[agent] A manager could no longer use the SNMPv3 user "initial"
- as this was interpretated as the first step of the discovery. </p>
- <p>Introduced a new terminating option, <c>trigger_username</c> to
- make it possible to configure the username the agent reacts to.
- Default is <c>""</c>. </p>
- <p>See the
- <seealso marker="snmp_app#configuration_params">configuration</seealso>
- chapter for more info about the discovery options.</p>
- <p>Own Id: OTP-8120</p>
- <p>Aux Id: Seq 11361</p>
- </item>
-
- </list>
-
- </section>
-
- <section>
- <title>Reported Fixed Bugs and Malfunctions</title>
- <!--
- <p>-</p>
- -->
- <list type="bulleted">
- <item>
- <p>[agent] The main agent type header file contained some miss-information
- regarding the type of the entrytype field of the me-record, causing
- unneccessary confusion.</p>
- <p>Own Id: OTP-8116</p>
- <p>Aux Id: Seq 11312</p>
- </item>
-
- </list>
-
- </section>
-
- <section>
- <title>Incompatibilities</title>
- <p>-</p>
- </section>
- </section> <!-- 4.13.5 -->
-
-
- <section>
- <title>SNMP Development Toolkit 4.13.4</title>
-
- <p>Version 4.13.4 supports code replacement in runtime from/to
- version 4.13.3, 4.13.2, 4.13.1 and 4.13.</p>
-
- <section>
- <title>Improvements and new features</title>
- <p>-</p>
-
- <!--
- <list type="bulleted">
- <item>
- <p>[agent] Support for the discovery process. </p>
- <p>The agent can both initiate discovery itself (see the
- <seealso marker="snmp_agent_funct_descr#discovery">discovery</seealso> chapter
- for more info) and respond to discovery initiated by a manager.</p>
- <p>Own Id: OTP-7571</p>
- <p>Aux Id: Seq 11053</p>
- </item>
-
- </list>
- -->
-
- </section>
-
- <section>
- <title>Reported Fixed Bugs and Malfunctions</title>
- <!--
- <p>-</p>
- -->
- <list type="bulleted">
- <item>
- <p>[agent] Originating discovery problems. </p>
- <p>Invalid state variable update during second stage of
- discovery causes master agent crash. </p>
- <p>Also the net_if process failed to activate socket
- ({active, once}) after first discovery response was sent. </p>
- <p>Own Id: OTP-8044</p>
- <p>Aux Id: Seq 11295</p>
- </item>
-
- <item>
- <p>[agent] Terminating discovery problem. </p>
- <p>The reply to the second stage request should include a
- varbind with <c>usmStatsNotInTimeWindows</c>.</p>
- <p>Own Id: OTP-8062</p>
- <p>Aux Id: Seq 11318</p>
- </item>
-
- <item>
- <p>[agent] Originating discovery improvement. </p>
- <p>Added the ExtraInfo argument to the
- <seealso marker="snmpa#discovery">discovery</seealso> function.
- This argument will be passed on to the stage1_finish callback
- function. Also, the
- <seealso marker="snmpa#discovery">discovery</seealso> function
- will now always return <c>{ok, ManagerEngineID}</c> on successful
- discovery. </p>
- <p>The <seealso marker="snmpa_discovery_handler">discovery handler</seealso>
- behaviour updated accordingly. </p>
- <p>Own Id: OTP-8098</p>
- <p>Aux Id: Seq 11346</p>
- </item>
-
- </list>
-
- </section>
-
- <section>
- <title>Incompatibilities</title>
- <p>-</p>
- </section>
- </section> <!-- 4.13.4 -->
-
-
- <section>
- <title>SNMP Development Toolkit 4.13.3</title>
-
- <p>Version 4.13.3 supports code replacement in runtime from/to
- version 4.13.2, 4.13.1 and 4.13.</p>
-
- <section>
- <title>Improvements and new features</title>
- <p>-</p>
-
- <!--
- <list type="bulleted">
- <item>
- <p>[agent] Support for the discovery process. </p>
- <p>The agent can both initiate discovery itself (see the
- <seealso marker="snmp_agent_funct_descr#discovery">discovery</seealso> chapter
- for more info) and respond to discovery initiated by a manager.</p>
- <p>Own Id: OTP-7571</p>
- <p>Aux Id: Seq 11053</p>
- </item>
-
- </list>
- -->
-
- </section>
-
- <section>
- <title>Reported Fixed Bugs and Malfunctions</title>
- <!--
- <p>-</p>
- -->
- <list type="bulleted">
- <item>
- <p>[manager] A request for an oid of type BITS was actually
- returned as OCTET STRING. </p>
- <p>Values of type BITS are encoded as OCTET STRING,
- which makes it impossible for the decoder to know that
- they should really be of type BITS.
- Instead, this has to be done higher up in the stack, where
- there is knowledge of the MIB (assuming that the mib has
- been loaded, there is info about the type of the mibentry). </p>
- <p>This problem has now been fixed, but requires that the MIB
- defining this mib-entry is loaded! </p>
- <p>The utility function
- <seealso marker="snmpm#oid_to_type">oid_to_type</seealso>
- has been added, for debug purpose. </p>
- <p>The utility function(s)
- <seealso marker="snmp#octet_string_to_bits">octet_string_to_bits</seealso>
- and
- <seealso marker="snmp#bits_to_octet_string">bits_to_octet_string</seealso>
- has also been added. These can be used if the user prefers to
- handle the conversion on their own. </p>
- <p>Own Id: OTP-8015</p>
- <p>Aux Id: Seq 11285</p>
- </item>
-
- <item>
- <p>[agent] Fixed some issues with the discovery handling. </p>
- <p>Changed the API of the
- <seealso marker="snmpa#discovery">discovery</seealso>
- function to solve some
- of these problems. </p>
- <p>Introduced various options for controlling the discovery
- process. See the
- <seealso marker="snmp_app#configuration_params">configuration</seealso>
- chapter for more info about the discovery options.</p>
- <p>Own Id: OTP-8020</p>
- <p>Aux Id: Seq 11295</p>
- </item>
-
- </list>
-
- </section>
-
- <section>
- <title>Incompatibilities</title>
- <p>-</p>
- </section>
- </section> <!-- 4.13.3 -->
-
-
- <section>
- <title>SNMP Development Toolkit 4.13.2</title>
-
- <p>Version 4.13.2 supports code replacement in runtime from/to
- version 4.13.1 and 4.13.</p>
-
- <section>
- <title>Improvements and new features</title>
- <p>-</p>
-
- <!--
- <list type="bulleted">
- <item>
- <p>[agent] Support for the discovery process. </p>
- <p>The agent can both initiate discovery itself (see the
- <seealso marker="snmp_agent_funct_descr#discovery">discovery</seealso> chapter
- for more info) and respond to discovery initiated by a manager.</p>
- <p>Own Id: OTP-7571</p>
- <p>Aux Id: Seq 11053</p>
- </item>
-
- </list>
- -->
-
- </section>
-
- <section>
- <title>Reported Fixed Bugs and Malfunctions</title>
- <!--
- <p>-</p>
- -->
- <list type="bulleted">
- <item>
- <p>[manager] Failure during downed user cleanup.
- As part of the cleanup after a crashed user,
- the manager attempts to unregister the agents
- registered by this user. This however failed,
- causing a server crash. </p>
- <p>Own Id: OTP-7961</p>
- <p>Aux Id: Seq 11275</p>
- </item>
-
- <item>
- <p>[manager] Incorrectly documented value type for
- IpAddress (ip). The value type for IpAddress is
- documented as ip but is actually ia. The value type
- ip has been added. The old (not documented) value
- type ia still works. </p>
- <p>Own Id: OTP-7977</p>
- <p>Aux Id: Seq 11279</p>
- </item>
-
- <item>
- <p>[manager] EngineId lookup fails when using version-3. </p>
- <p>Own Id: OTP-7983</p>
- <p>Aux Id: Seq 11275</p>
- </item>
-
- <item>
- <p>[agent] As of version 4.13 the possible return values
- of the function
- <seealso marker="snmpa_mpd#process_packet">snmpa_mpd:process_packet/4</seealso>
- changed, but this was not documented. </p>
- <p>Own Id: OTP-7989</p>
- <p>Aux Id: Seq 11275</p>
- </item>
-
- </list>
-
- </section>
-
- <section>
- <title>Incompatibilities</title>
- <p>-</p>
- </section>
- </section> <!-- 4.13.2 -->
-
- <section>
- <title>SNMP Development Toolkit 4.13.1</title>
-
- <p>Version 4.13.1 supports code replacement in runtime from/to
- version 4.13.</p>
-
- <section>
- <title>Improvements and new features</title>
- <p>-</p>
-
- <!--
- <list type="bulleted">
- <item>
- <p>[agent] Support for the discovery process. </p>
- <p>The agent can both initiate discovery itself (see the
- <seealso marker="snmp_agent_funct_descr#discovery">discovery</seealso> chapter
- for more info) and respond to discovery initiated by a manager.</p>
- <p>Own Id: OTP-7571</p>
- <p>Aux Id: Seq 11053</p>
- </item>
-
- </list>
- -->
-
- </section>
-
- <section>
- <title>Reported Fixed Bugs and Malfunctions</title>
- <!--
- <p>-</p>
- -->
- <list type="bulleted">
- <item>
- <p>[manager] Registration of users had some issues. </p>
- <p>Not all of the registration functions where actually exported
- (<seealso marker="snmpm#register_user">register_user/4</seealso>
- and
- <seealso marker="snmpm#register_user_monitor">register_user_monitor/4</seealso>).
- This has now been fixed. </p>
- <p>Also, the registration did not succeed unless
- user implemented the *new* behaviour. This has now
- also been fixed (registration succeeds if the user
- implements either the new (i.e. updated
- <seealso marker="snmpm_user">snmpm_user</seealso>)
- or the old user behaviour (<c>snmpm_user_old</c>)). </p>
- <p>Own Id: OTP-7902</p>
- <p>Aux Id: Seq 11240</p>
- </item>
-
- </list>
-
- </section>
-
- <section>
- <title>Incompatibilities</title>
- <p>-</p>
- </section>
- </section> <!-- 4.13.1 -->
-
- <section>
- <title>SNMP Development Toolkit 4.13</title>
-<!--
- <p>Version 4.13 supports code replacement in runtime from/to
- version 4.12.1.</p>
--->
-
- <section>
- <title>Improvements and new features</title>
- <!--
- <p>-</p>
- -->
- <list type="bulleted">
- <item>
- <p>[agent] Support for the discovery process. </p>
- <p>The agent can both initiate discovery itself (see the
- <seealso marker="snmp_agent_funct_descr#discovery">discovery</seealso> chapter
- for more info) and respond to discovery initiated by a manager.</p>
- <p>Own Id: OTP-7571</p>
- <p>Aux Id: Seq 11053</p>
- </item>
-
- </list>
-
- </section>
-
- <section>
- <title>Reported Fixed Bugs and Malfunctions</title>
- <!--
- <p>-</p>
- -->
- <list type="bulleted">
- <item>
- <p>[agent] Unnecessary use of math:pow/2 could cause problems
- on systems without floating point support. </p>
- <p>Per Hedeland</p>
- <p>Own Id: OTP-7735</p>
- <!-- <p>Aux Id: Seq 10966</p> -->
- </item>
-
- <item>
- <p>[manager] A major flaw was discovered with the agent handling. </p>
- <p>First, <c>TargetName</c> was never used as intended, as a unique
- identifier for the target (agent in this case). </p>
- <p>Second, <c>TargetName</c> had a <em>default value</em>, which meant
- that several agents could have the same <c>TargetName</c>, causing
- unpredictable behaviour in the manager. </p>
- <p>Third, <c>EngineID</c> was not a mandatory config option and had
- furthermore also a <em>default value</em>. </p>
-
- <p>These problems has been solved in the following way: </p>
- <p>First, a new set of api functions has been introduced (and documented):
- <seealso marker="snmpm#register_user">register_user/4</seealso>,
- <seealso marker="snmpm#register_user_monitor">register_user_monitor/4</seealso>,
- <seealso marker="snmpm#register_agent">register_agent/3</seealso>,
- <seealso marker="snmpm#unregister_agent">unregister_agent/2</seealso>,
- <seealso marker="snmpm#agent_info">agent_info/2</seealso>,
- <seealso marker="snmpm#update_agent_info">update_agent_info/4</seealso>,
- <seealso marker="snmpm#sync_get">sync_get/3,4,5,6</seealso>,
- <seealso marker="snmpm#async_get">async_get/3,4,5,6</seealso>,
- <seealso marker="snmpm#sync_get_next">sync_get_next/3,4,5,6</seealso>,
- <seealso marker="snmpm#async_get_next">async_get_next/3,4,5,6</seealso>,
- <seealso marker="snmpm#sync_set">sync_set/3,4,5,6</seealso>,
- <seealso marker="snmpm#async_set">async_set/3,4,5,6</seealso>,
- <seealso marker="snmpm#sync_get_bulk">sync_get_bulk/5,6,7,8</seealso> and
- <seealso marker="snmpm#async_get_bulk">async_get_bulk/5,6,7,8</seealso>
- that all use <c>TargetName</c> (and not, as previously, <c>Addr</c>
- and <c>Port</c>) to identify the agent (also the return value of
- <seealso marker="snmpm#which_agents">which_agents</seealso> has
- been changed). </p>
- <p>Second, for backward compatibility, the old functions still
- exist, but are no longer documented and are now wrappers for the
- new functions, including erroneous default value for EngineID and
- all. The TargetName is however generated from the provided
- <c>Addr</c>, <c>Port</c> and <c>Version</c> config options. </p>
- <p>Third, the behaviour of the
- <seealso marker="snmpm_user">SNMP manager user</seealso> has
- been changed to reflect this, i.e.
- <seealso marker="snmpm_user#handle_pdu">handle_pdu/4</seealso>,
- <seealso marker="snmpm_user#handle_trap">handle_trap/3</seealso>,
- <seealso marker="snmpm_user#handle_inform">handle_inform/3</seealso>,
- <seealso marker="snmpm_user#handle_report">handle_report/3</seealso>
- and the return-value of
- <seealso marker="snmpm_user#handle_agent">handle_agent/4</seealso>.
- The old (non-documented) callback-functions (using Addr and Port)
- will still be called if the agent was registered using the old
- registration functions. </p>
-
- <p>Own Id: OTP-7836</p>
- <!-- <p>Aux Id: Seq 10966</p> -->
- </item>
-
- </list>
-
- </section>
-
- <section>
- <title>Incompatibilities</title>
- <p>-</p>
- </section>
- </section> <!-- 4.13 -->
-
- <section>
- <title>SNMP Development Toolkit 4.12.2</title>
- <p>Version 4.12.2 supports code replacement in runtime from/to
- version 4.12.1, 4.12, 4.11.2, 4.11.1 and 4.11.</p>
-
- <section>
- <title>Improvements and new features</title>
- <p>-</p>
- <!--
- <list type="bulleted">
- <item>
- <item>
- <p>[agent] Improvement of the inform reporting.
- It was previously not certain how many acks an
- application received, 0, 1 or 2. This has now been
- fixed, so that only 1 (one) ack is issued. </p>
- <p>Per Hedeland</p>
- <p>Own Id: OTP-7525</p>
- </item>
-
- </list>
- -->
-
- </section>
-
- <section>
- <title>Reported Fixed Bugs and Malfunctions</title>
- <!--
- <p>-</p>
- -->
- <list type="bulleted">
- <item>
- <p>[agent] Bad session cache (usm+camv-info) invalidation
- could cause user crash, through call(s) to (a number of)
- MIB API function(s) (undefined function). </p>
- <p>Own Id: OTP-7868</p>
- <!-- <p>Aux Id: Seq 11124</p> -->
- </item>
-
- </list>
-
- </section>
-
- <section>
- <title>Incompatibilities</title>
- <p>-</p>
- </section>
- </section> <!-- 4.12.2 -->
-
- <section>
- <title>SNMP Development Toolkit 4.12.1</title>
- <p>Version 4.12.1 supports code replacement in runtime from/to
- version 4.12, 4.11.2, 4.11.1 and 4.11.</p>
-
- <section>
- <title>Improvements and new features</title>
- <p>-</p>
- <!--
- <list type="bulleted">
- <item>
- <item>
- <p>[agent] Improvement of the inform reporting.
- It was previously not certain how many acks an
- application received, 0, 1 or 2. This has now been
- fixed, so that only 1 (one) ack is issued. </p>
- <p>Per Hedeland</p>
- <p>Own Id: OTP-7525</p>
- </item>
-
- </list>
- -->
-
- </section>
-
- <section>
- <title>Reported Fixed Bugs and Malfunctions</title>
- <!--
- <p>-</p>
- -->
- <list type="bulleted">
- <item>
- <p>Logging of messages with the GetBulk-request PDU
- incorrectly produced an erroneous entry in the
- log: "An error occurred". </p>
- <p>The reason for this was that the PDU-fields
- error_status and error_index is re-used for
- Non-repeaters and Max-repetitions for
- GetBulk-request PDUs, but this was not handled
- by the logging code. </p>
- <p>Own Id: OTP-7695</p>
- <p>Aux Id: Seq 11124</p>
- </item>
-
- <item>
- <p>[agent] An attempt to set the row status to active for an
- notReady table row, could result in an "inconsistentValue"
- error. </p>
- <p>The same problem existed when attempting to set row status
- to notInService for a row in notReady. </p>
- <p>Serge Aleynikov</p>
- <p>Own Id: OTP-7698</p>
- <!-- <p>Aux Id: Seq 10966</p> -->
- </item>
-
- </list>
-
- </section>
-
- <section>
- <title>Incompatibilities</title>
- <p>-</p>
- </section>
- </section> <!-- 4.12.1 -->
-
- <section>
- <title>SNMP Development Toolkit 4.12</title>
- <p>Version 4.12 supports code replacement in runtime from/to
- version 4.11.2, 4.11.1 and 4.11.</p>
-
- <section>
- <title>Improvements and new features</title>
- <!--
- <p>-</p>
- -->
- <list type="bulleted">
- <item>
- <p>[agent] A simple lookup cache has been added to improve
- the mib server lookup performance. </p>
- <p>This can be disabled with the mib_server
- <seealso marker="snmp_app">cache</seealso> option. </p>
- <p>Own Id: OTP-7346</p>
- </item>
-
- <item>
- <p>[agent] Improvement of the inform reporting.
- It was previously not certain how many acks an
- application received, 0, 1 or 2. This has now been
- fixed, so that only 1 (one) ack is issued. </p>
- <p>Per Hedeland</p>
- <p>Own Id: OTP-7525</p>
- </item>
-
- </list>
-
- </section>
-
- <section>
- <title>Reported Fixed Bugs and Malfunctions</title>
- <p>-</p>
- <!--
- <list type="bulleted">
- <item>
- <p>[manager] Encryption error when attempting to send
- version 3 inform-requests. </p>
- <p>Own Id: OTP-7432</p>
- <p>Aux Id: Seq 10966</p>
- </item>
-
- </list>
- -->
-
- </section>
-
- <section>
- <title>Incompatibilities</title>
- <p>-</p>
- </section>
- </section> <!-- 4.12 -->
-
- <section>
- <title>SNMP Development Toolkit 4.11.2</title>
- <p>Version 4.11.2 supports code replacement in runtime from/to
- version 4.11.1 and 4.11. </p>
-
- <section>
- <title>Improvements and new features</title>
- <p>-</p>
- <!--
- <list type="bulleted">
- <item>
- <p>Added utility functions for transforming DateAndTime
- as [int()] to strings;
- <seealso marker="snmp#dat2s">date_and_time_to_string/2</seealso>
- and
- <seealso marker="snmp#dat2s2">date_and_time_to_string2/1</seealso>. </p>
- <p>Also added new validation function
- <seealso marker="snmp#vdat">validate_date_and_time/2</seealso>. </p>
- <p>Own Id: OTP-7412</p>
- <p>Aux Id: Seq 10987</p>
- </item>
- </list>
- -->
- </section>
-
- <section>
- <title>Reported Fixed Bugs and Malfunctions</title>
- <!--
- <p>-</p>
- -->
- <list type="bulleted">
- <item>
- <p>[manager] Erroneous engine-id check when receiving version 3
- informs. </p>
- <p>Own Id: OTP-7570</p>
- <p>Aux Id: Seq 11060</p>
- </item>
-
- <item>
- <p>Receiving an snmp message with a very large version
- number could cause the erlang node to run out of
- memory and consequently crash. </p>
- <p>The standard specifies the snmp version as an
- (unlimited) INTEGER, but today only
- 0 (version 1), 1 (version 2) and 3 (version 3) is
- actually used. So, when decoding a message, a limit
- has been put on the snmp version integer in order
- to not allow this kind of a problem. </p>
- <p>Own Id: OTP-7575</p>
- <p>Aux Id: Seq 11064</p>
- </item>
-
- </list>
- </section>
-
- <section>
- <title>Incompatibilities</title>
- <p>-</p>
- </section>
- </section> <!-- 4.11.2 -->
-
-
- <section>
- <title>SNMP Development Toolkit 4.11.1</title>
- <p>Version 4.11.1 supports code replacement in runtime from/to
- version 4.11.</p>
-
- <section>
- <title>Improvements and new features</title>
- <!--
- <p>-</p>
- -->
- <list type="bulleted">
- <item>
- <p>[compiler] The MIB compiler did not retrieve the REFERENCE part
- of a SNMP MIB definition. </p>
- <p>This problem has been partly solved. For SNMP tables,
- the assocList field of the tables mib-entry record now contains
- this info (as <c>{reference, string()}</c>), <em>if</em> the
- MIB was compiled with the compiler option <em>+reference</em>. </p>
- <p>This solution is temporary, until such time as a permanent
- solution (and probably not backward compatible) is devised, which
- retrieves and stores all REFERENCE part(s) of a MIB. </p>
- <p>See the
- <seealso marker="snmpc#compiler_opts">compiler options</seealso>
- for more info. </p>
-
- <p>Serge Aleynikov</p>
- <p>Own Id: OTP-7426</p>
- </item>
-
- <item>
- <p>Added utility functions for transforming DateAndTime
- as [int()] to strings;
- <seealso marker="snmp#dat2s">date_and_time_to_string/2</seealso>
- and
- <seealso marker="snmp#dat2s2">date_and_time_to_string2/1</seealso>. </p>
- <p>Also added new validation function
- <seealso marker="snmp#vdat">validate_date_and_time/2</seealso>. </p>
- <p>Own Id: OTP-7412</p>
- <p>Aux Id: Seq 10987</p>
- </item>
-
- </list>
-
- </section>
-
- <section>
- <title>Reported Fixed Bugs and Malfunctions</title>
- <!--
- <p>-</p>
- -->
- <list type="bulleted">
- <item>
- <p>[manager] Encryption error when attempting to send
- version 3 inform-requests. </p>
- <p>Own Id: OTP-7432</p>
- <p>Aux Id: Seq 10966</p>
- </item>
-
- </list>
- </section>
-
- <section>
- <title>Incompatibilities</title>
- <p>-</p>
- </section>
- </section> <!-- 4.11.1 -->
-
- <section>
- <title>SNMP Development Toolkit 4.11</title>
- <p>Version 4.11 supports code replacement in runtime from/to
- version 4.10.3, 4.10.2, 4.10.1 and 4.10.</p>
-
- <section>
- <title>Improvements and new features</title>
- <!--
- <p>-</p>
- -->
- <list type="bulleted">
- <item>
- <p>[agent] Performance improvements in the case when an SNMP
- manager performs an snmpwalk. </p>
- <p>Martin Bj&ouml;rklund</p>
- <p>Own Id: OTP-7201</p>
- </item>
-
- <item>
- <p>The API for sending inform(s) has been improved. Also
- the documentation has been corrected and updated. See
- <seealso marker="snmpa#send_notification">snmpa:send_notification</seealso> and
- <seealso marker="snmpa_notification_delivery_info_receiver">snmpa_notification_delivery_info_receiver</seealso>
- for more info.</p>
- <p>Own Id: OTP-7287</p>
- <p>Aux Id: Seq 10926</p>
- </item>
-
- <item>
- <p>[agent] Performance of the internal database (local-db)
- has been improved.</p>
- <p>Own Id: OTP-7319</p>
- <p>Aux Id: Seq 10942</p>
- </item>
-
- <item>
- <p>[agent] Added utility functions,
- <seealso marker="snmpa#restart_worker">snmpa:restart_worker/0,1</seealso> and
- <seealso marker="snmpa#restart_set_worker">snmpa:restart_set_worker/0,1</seealso>,
- for restarting the agent worker processes (in case the agent is
- multi-threaded).</p>
- <p>Own Id: OTP-7369</p>
- </item>
-
- <item>
- <p>Add utility function to
- <seealso marker="snmp#read_mib">read</seealso>
- a compiled mib. </p>
- <p>Own Id: OTP-7371</p>
- </item>
-
- </list>
- </section>
-
- <section>
- <title>Reported Fixed Bugs and Malfunctions</title>
- <!--
- <p>-</p>
- -->
- <list type="bulleted">
- <item>
- <p>[manager] Encryption error when attempting to send
- version 3 inform-requests. </p>
- <p>Own Id: OTP-7377</p>
- <p>Aux Id: Seq 10966</p>
- </item>
-
- </list>
- </section>
-
- <section>
- <title>Incompatibilities</title>
- <p>-</p>
- </section>
- </section> <!-- 4.11 -->
-
<!-- section>
<title>Release notes history</title>
<p>For information about older versions see
diff --git a/lib/snmp/doc/src/notes_history.xml b/lib/snmp/doc/src/notes_history.xml
index 934df87866..722d02afbd 100644
--- a/lib/snmp/doc/src/notes_history.xml
+++ b/lib/snmp/doc/src/notes_history.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="latin1" ?>
+<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE chapter SYSTEM "chapter.dtd">
<chapter>
@@ -33,6 +33,928 @@
</header>
<section>
+ <title>SNMP Development Toolkit 4.14</title>
+
+ <p>Version 4.14 supports code replacement in runtime from/to
+ version 4.13.5, 4.13.4, 4.13.3, 4.13.2, 4.13.1 and 4.13.</p>
+
+ <section>
+ <title>Improvements and new features</title>
+ <!--
+ <p>-</p>
+ -->
+
+ <list type="bulleted">
+ <item>
+ <p>[compiler] Include object- and notification groups in the
+ compiled mib.
+ This will make it possible to import groups from other mibs. </p>
+ <p>Also the SNMPv2-MIB-file has been updated to a more
+ up-to-date version. </p>
+ <p>Own Id: OTP-8223</p>
+ <!-- <p>Aux Id: Seq 11383</p> -->
+ </item>
+
+ <item>
+ <p>[manager] Added support for message filtering in the
+ network interface module provided with the application.
+ The component that actually make the filter decisions
+ is the network interface filter module. This module
+ must implement the
+ <seealso marker="snmpm_network_interface_filter">network interface filter behaviour</seealso>
+ for message filtering.
+ See also the Configuring chapter of
+ the User's Guide to see how to configure this feature. </p>
+ <p>See the
+ <seealso marker="snmp_app#configuration_params">configuration</seealso>
+ chapter for more info about the filter options.</p>
+ <p>Own Id: OTP-8228</p>
+ <p>Aux Id: Seq 11411</p>
+ </item>
+
+ <item>
+ <p>The MIBs delivered as part of the application is now
+ also available as man pages, section 7. </p>
+ <p>Own Id: OTP-8237</p>
+ <!-- <p>Aux Id: Seq 11383</p> -->
+ </item>
+
+ </list>
+
+ </section>
+
+ <section>
+ <title>Reported Fixed Bugs and Malfunctions</title>
+ <p>-</p>
+
+ <!--
+ <list type="bulleted">
+ <item>
+ <p>[agent] The main agent type header file contained some miss-information
+ regarding the type of the entrytype field of the me-record, causing
+ unneccessary confusion.</p>
+ <p>Own Id: OTP-8116</p>
+ <p>Aux Id: Seq 11312</p>
+ </item>
+
+ </list>
+ -->
+
+ </section>
+
+ <section>
+ <title>Incompatibilities</title>
+ <p>-</p>
+ </section>
+ </section> <!-- 4.14 -->
+
+
+ <section>
+ <title>SNMP Development Toolkit 4.13.5</title>
+
+ <p>Version 4.13.5 supports code replacement in runtime from/to
+ version 4.13.4, 4.13.3, 4.13.2, 4.13.1 and 4.13.</p>
+
+ <section>
+ <title>Improvements and new features</title>
+ <!--
+ <p>-</p>
+ -->
+
+ <list type="bulleted">
+ <item>
+ <p>[agent] Improved the cache handling of the mib server. </p>
+ <p>A number of new functions and config options for the mib server
+ cache has been added. </p>
+ <p>See
+ <seealso marker="snmpa#invalidate_mibs_cache">invalidate_mibs_cache/0,1</seealso>,
+ <seealso marker="snmpa#enable_mibs_cache">enable_mibs_cache/0,1</seealso>,
+ <seealso marker="snmpa#disable_mibs_cache">disable_mibs_cache/0,1</seealso>,
+ <seealso marker="snmpa#gc_mibs_cache">gc_mibs_cache/0,1,2,3</seealso>,
+ <seealso marker="snmpa#enable_mibs_cache_autogc">enable_mibs_cache_autogc/0,1</seealso>,
+ <seealso marker="snmpa#disable_mibs_cache_autogc">disable_mibs_cache_autogc/0,1</seealso>,
+ <seealso marker="snmpa#update_mibs_cache_age">update_mibs_cache_age/1,2</seealso> and
+ <seealso marker="snmpa#update_mibs_cache_gclimit">update_mibs_cache_gclimit/1,2</seealso> for more info. </p>
+ <p>See also the
+ <seealso marker="snmp_app#configuration_params">configuration</seealso>
+ chapter for more info about the mib server cache options.</p>
+ <p>Own Id: OTP-8182</p>
+ <p>Aux Id: Seq 11383</p>
+ </item>
+
+ <item>
+ <p>[agent] A manager could no longer use the SNMPv3 user "initial"
+ as this was interpretated as the first step of the discovery. </p>
+ <p>Introduced a new terminating option, <c>trigger_username</c> to
+ make it possible to configure the username the agent reacts to.
+ Default is <c>""</c>. </p>
+ <p>See the
+ <seealso marker="snmp_app#configuration_params">configuration</seealso>
+ chapter for more info about the discovery options.</p>
+ <p>Own Id: OTP-8120</p>
+ <p>Aux Id: Seq 11361</p>
+ </item>
+
+ </list>
+
+ </section>
+
+ <section>
+ <title>Reported Fixed Bugs and Malfunctions</title>
+ <!--
+ <p>-</p>
+ -->
+ <list type="bulleted">
+ <item>
+ <p>[agent] The main agent type header file contained some miss-information
+ regarding the type of the entrytype field of the me-record, causing
+ unneccessary confusion.</p>
+ <p>Own Id: OTP-8116</p>
+ <p>Aux Id: Seq 11312</p>
+ </item>
+
+ </list>
+
+ </section>
+
+ <section>
+ <title>Incompatibilities</title>
+ <p>-</p>
+ </section>
+ </section> <!-- 4.13.5 -->
+
+
+ <section>
+ <title>SNMP Development Toolkit 4.13.4</title>
+
+ <p>Version 4.13.4 supports code replacement in runtime from/to
+ version 4.13.3, 4.13.2, 4.13.1 and 4.13.</p>
+
+ <section>
+ <title>Improvements and new features</title>
+ <p>-</p>
+
+ <!--
+ <list type="bulleted">
+ <item>
+ <p>[agent] Support for the discovery process. </p>
+ <p>The agent can both initiate discovery itself (see the
+ <seealso marker="snmp_agent_funct_descr#discovery">discovery</seealso> chapter
+ for more info) and respond to discovery initiated by a manager.</p>
+ <p>Own Id: OTP-7571</p>
+ <p>Aux Id: Seq 11053</p>
+ </item>
+
+ </list>
+ -->
+
+ </section>
+
+ <section>
+ <title>Reported Fixed Bugs and Malfunctions</title>
+ <!--
+ <p>-</p>
+ -->
+ <list type="bulleted">
+ <item>
+ <p>[agent] Originating discovery problems. </p>
+ <p>Invalid state variable update during second stage of
+ discovery causes master agent crash. </p>
+ <p>Also the net_if process failed to activate socket
+ ({active, once}) after first discovery response was sent. </p>
+ <p>Own Id: OTP-8044</p>
+ <p>Aux Id: Seq 11295</p>
+ </item>
+
+ <item>
+ <p>[agent] Terminating discovery problem. </p>
+ <p>The reply to the second stage request should include a
+ varbind with <c>usmStatsNotInTimeWindows</c>.</p>
+ <p>Own Id: OTP-8062</p>
+ <p>Aux Id: Seq 11318</p>
+ </item>
+
+ <item>
+ <p>[agent] Originating discovery improvement. </p>
+ <p>Added the ExtraInfo argument to the
+ <seealso marker="snmpa#discovery">discovery</seealso> function.
+ This argument will be passed on to the stage1_finish callback
+ function. Also, the
+ <seealso marker="snmpa#discovery">discovery</seealso> function
+ will now always return <c>{ok, ManagerEngineID}</c> on successful
+ discovery. </p>
+ <p>The <seealso marker="snmpa_discovery_handler">discovery handler</seealso>
+ behaviour updated accordingly. </p>
+ <p>Own Id: OTP-8098</p>
+ <p>Aux Id: Seq 11346</p>
+ </item>
+
+ </list>
+
+ </section>
+
+ <section>
+ <title>Incompatibilities</title>
+ <p>-</p>
+ </section>
+ </section> <!-- 4.13.4 -->
+
+
+ <section>
+ <title>SNMP Development Toolkit 4.13.3</title>
+
+ <p>Version 4.13.3 supports code replacement in runtime from/to
+ version 4.13.2, 4.13.1 and 4.13.</p>
+
+ <section>
+ <title>Improvements and new features</title>
+ <p>-</p>
+
+ <!--
+ <list type="bulleted">
+ <item>
+ <p>[agent] Support for the discovery process. </p>
+ <p>The agent can both initiate discovery itself (see the
+ <seealso marker="snmp_agent_funct_descr#discovery">discovery</seealso> chapter
+ for more info) and respond to discovery initiated by a manager.</p>
+ <p>Own Id: OTP-7571</p>
+ <p>Aux Id: Seq 11053</p>
+ </item>
+
+ </list>
+ -->
+
+ </section>
+
+ <section>
+ <title>Reported Fixed Bugs and Malfunctions</title>
+ <!--
+ <p>-</p>
+ -->
+ <list type="bulleted">
+ <item>
+ <p>[manager] A request for an oid of type BITS was actually
+ returned as OCTET STRING. </p>
+ <p>Values of type BITS are encoded as OCTET STRING,
+ which makes it impossible for the decoder to know that
+ they should really be of type BITS.
+ Instead, this has to be done higher up in the stack, where
+ there is knowledge of the MIB (assuming that the mib has
+ been loaded, there is info about the type of the mibentry). </p>
+ <p>This problem has now been fixed, but requires that the MIB
+ defining this mib-entry is loaded! </p>
+ <p>The utility function
+ <seealso marker="snmpm#oid_to_type">oid_to_type</seealso>
+ has been added, for debug purpose. </p>
+ <p>The utility function(s)
+ <seealso marker="snmp#octet_string_to_bits">octet_string_to_bits</seealso>
+ and
+ <seealso marker="snmp#bits_to_octet_string">bits_to_octet_string</seealso>
+ has also been added. These can be used if the user prefers to
+ handle the conversion on their own. </p>
+ <p>Own Id: OTP-8015</p>
+ <p>Aux Id: Seq 11285</p>
+ </item>
+
+ <item>
+ <p>[agent] Fixed some issues with the discovery handling. </p>
+ <p>Changed the API of the
+ <seealso marker="snmpa#discovery">discovery</seealso>
+ function to solve some
+ of these problems. </p>
+ <p>Introduced various options for controlling the discovery
+ process. See the
+ <seealso marker="snmp_app#configuration_params">configuration</seealso>
+ chapter for more info about the discovery options.</p>
+ <p>Own Id: OTP-8020</p>
+ <p>Aux Id: Seq 11295</p>
+ </item>
+
+ </list>
+
+ </section>
+
+ <section>
+ <title>Incompatibilities</title>
+ <p>-</p>
+ </section>
+ </section> <!-- 4.13.3 -->
+
+
+ <section>
+ <title>SNMP Development Toolkit 4.13.2</title>
+
+ <p>Version 4.13.2 supports code replacement in runtime from/to
+ version 4.13.1 and 4.13.</p>
+
+ <section>
+ <title>Improvements and new features</title>
+ <p>-</p>
+
+ <!--
+ <list type="bulleted">
+ <item>
+ <p>[agent] Support for the discovery process. </p>
+ <p>The agent can both initiate discovery itself (see the
+ <seealso marker="snmp_agent_funct_descr#discovery">discovery</seealso> chapter
+ for more info) and respond to discovery initiated by a manager.</p>
+ <p>Own Id: OTP-7571</p>
+ <p>Aux Id: Seq 11053</p>
+ </item>
+
+ </list>
+ -->
+
+ </section>
+
+ <section>
+ <title>Reported Fixed Bugs and Malfunctions</title>
+ <!--
+ <p>-</p>
+ -->
+ <list type="bulleted">
+ <item>
+ <p>[manager] Failure during downed user cleanup.
+ As part of the cleanup after a crashed user,
+ the manager attempts to unregister the agents
+ registered by this user. This however failed,
+ causing a server crash. </p>
+ <p>Own Id: OTP-7961</p>
+ <p>Aux Id: Seq 11275</p>
+ </item>
+
+ <item>
+ <p>[manager] Incorrectly documented value type for
+ IpAddress (ip). The value type for IpAddress is
+ documented as ip but is actually ia. The value type
+ ip has been added. The old (not documented) value
+ type ia still works. </p>
+ <p>Own Id: OTP-7977</p>
+ <p>Aux Id: Seq 11279</p>
+ </item>
+
+ <item>
+ <p>[manager] EngineId lookup fails when using version-3. </p>
+ <p>Own Id: OTP-7983</p>
+ <p>Aux Id: Seq 11275</p>
+ </item>
+
+ <item>
+ <p>[agent] As of version 4.13 the possible return values
+ of the function
+ <seealso marker="snmpa_mpd#process_packet">snmpa_mpd:process_packet/4</seealso>
+ changed, but this was not documented. </p>
+ <p>Own Id: OTP-7989</p>
+ <p>Aux Id: Seq 11275</p>
+ </item>
+
+ </list>
+
+ </section>
+
+ <section>
+ <title>Incompatibilities</title>
+ <p>-</p>
+ </section>
+ </section> <!-- 4.13.2 -->
+
+ <section>
+ <title>SNMP Development Toolkit 4.13.1</title>
+
+ <p>Version 4.13.1 supports code replacement in runtime from/to
+ version 4.13.</p>
+
+ <section>
+ <title>Improvements and new features</title>
+ <p>-</p>
+
+ <!--
+ <list type="bulleted">
+ <item>
+ <p>[agent] Support for the discovery process. </p>
+ <p>The agent can both initiate discovery itself (see the
+ <seealso marker="snmp_agent_funct_descr#discovery">discovery</seealso> chapter
+ for more info) and respond to discovery initiated by a manager.</p>
+ <p>Own Id: OTP-7571</p>
+ <p>Aux Id: Seq 11053</p>
+ </item>
+
+ </list>
+ -->
+
+ </section>
+
+ <section>
+ <title>Reported Fixed Bugs and Malfunctions</title>
+ <!--
+ <p>-</p>
+ -->
+ <list type="bulleted">
+ <item>
+ <p>[manager] Registration of users had some issues. </p>
+ <p>Not all of the registration functions where actually exported
+ (<seealso marker="snmpm#register_user">register_user/4</seealso>
+ and
+ <seealso marker="snmpm#register_user_monitor">register_user_monitor/4</seealso>).
+ This has now been fixed. </p>
+ <p>Also, the registration did not succeed unless
+ user implemented the *new* behaviour. This has now
+ also been fixed (registration succeeds if the user
+ implements either the new (i.e. updated
+ <seealso marker="snmpm_user">snmpm_user</seealso>)
+ or the old user behaviour (<c>snmpm_user_old</c>)). </p>
+ <p>Own Id: OTP-7902</p>
+ <p>Aux Id: Seq 11240</p>
+ </item>
+
+ </list>
+
+ </section>
+
+ <section>
+ <title>Incompatibilities</title>
+ <p>-</p>
+ </section>
+ </section> <!-- 4.13.1 -->
+
+ <section>
+ <title>SNMP Development Toolkit 4.13</title>
+<!--
+ <p>Version 4.13 supports code replacement in runtime from/to
+ version 4.12.1.</p>
+-->
+
+ <section>
+ <title>Improvements and new features</title>
+ <!--
+ <p>-</p>
+ -->
+ <list type="bulleted">
+ <item>
+ <p>[agent] Support for the discovery process. </p>
+ <p>The agent can both initiate discovery itself (see the
+ <seealso marker="snmp_agent_funct_descr#discovery">discovery</seealso> chapter
+ for more info) and respond to discovery initiated by a manager.</p>
+ <p>Own Id: OTP-7571</p>
+ <p>Aux Id: Seq 11053</p>
+ </item>
+
+ </list>
+
+ </section>
+
+ <section>
+ <title>Reported Fixed Bugs and Malfunctions</title>
+ <!--
+ <p>-</p>
+ -->
+ <list type="bulleted">
+ <item>
+ <p>[agent] Unnecessary use of math:pow/2 could cause problems
+ on systems without floating point support. </p>
+ <p>Per Hedeland</p>
+ <p>Own Id: OTP-7735</p>
+ <!-- <p>Aux Id: Seq 10966</p> -->
+ </item>
+
+ <item>
+ <p>[manager] A major flaw was discovered with the agent handling. </p>
+ <p>First, <c>TargetName</c> was never used as intended, as a unique
+ identifier for the target (agent in this case). </p>
+ <p>Second, <c>TargetName</c> had a <em>default value</em>, which meant
+ that several agents could have the same <c>TargetName</c>, causing
+ unpredictable behaviour in the manager. </p>
+ <p>Third, <c>EngineID</c> was not a mandatory config option and had
+ furthermore also a <em>default value</em>. </p>
+
+ <p>These problems has been solved in the following way: </p>
+ <p>First, a new set of api functions has been introduced (and documented):
+ <seealso marker="snmpm#register_user">register_user/4</seealso>,
+ <seealso marker="snmpm#register_user_monitor">register_user_monitor/4</seealso>,
+ <seealso marker="snmpm#register_agent">register_agent/3</seealso>,
+ <seealso marker="snmpm#unregister_agent">unregister_agent/2</seealso>,
+ <seealso marker="snmpm#agent_info">agent_info/2</seealso>,
+ <seealso marker="snmpm#update_agent_info">update_agent_info/4</seealso>,
+ <seealso marker="snmpm#sync_get">sync_get/3,4,5,6</seealso>,
+ <seealso marker="snmpm#async_get">async_get/3,4,5,6</seealso>,
+ <seealso marker="snmpm#sync_get_next">sync_get_next/3,4,5,6</seealso>,
+ <seealso marker="snmpm#async_get_next">async_get_next/3,4,5,6</seealso>,
+ <seealso marker="snmpm#sync_set">sync_set/3,4,5,6</seealso>,
+ <seealso marker="snmpm#async_set">async_set/3,4,5,6</seealso>,
+ <seealso marker="snmpm#sync_get_bulk">sync_get_bulk/5,6,7,8</seealso> and
+ <seealso marker="snmpm#async_get_bulk">async_get_bulk/5,6,7,8</seealso>
+ that all use <c>TargetName</c> (and not, as previously, <c>Addr</c>
+ and <c>Port</c>) to identify the agent (also the return value of
+ <seealso marker="snmpm#which_agents">which_agents</seealso> has
+ been changed). </p>
+ <p>Second, for backward compatibility, the old functions still
+ exist, but are no longer documented and are now wrappers for the
+ new functions, including erroneous default value for EngineID and
+ all. The TargetName is however generated from the provided
+ <c>Addr</c>, <c>Port</c> and <c>Version</c> config options. </p>
+ <p>Third, the behaviour of the
+ <seealso marker="snmpm_user">SNMP manager user</seealso> has
+ been changed to reflect this, i.e.
+ <seealso marker="snmpm_user#handle_pdu">handle_pdu/4</seealso>,
+ <seealso marker="snmpm_user#handle_trap">handle_trap/3</seealso>,
+ <seealso marker="snmpm_user#handle_inform">handle_inform/3</seealso>,
+ <seealso marker="snmpm_user#handle_report">handle_report/3</seealso>
+ and the return-value of
+ <seealso marker="snmpm_user#handle_agent">handle_agent/4</seealso>.
+ The old (non-documented) callback-functions (using Addr and Port)
+ will still be called if the agent was registered using the old
+ registration functions. </p>
+
+ <p>Own Id: OTP-7836</p>
+ <!-- <p>Aux Id: Seq 10966</p> -->
+ </item>
+
+ </list>
+
+ </section>
+
+ <section>
+ <title>Incompatibilities</title>
+ <p>-</p>
+ </section>
+ </section> <!-- 4.13 -->
+
+ <section>
+ <title>SNMP Development Toolkit 4.12.2</title>
+ <p>Version 4.12.2 supports code replacement in runtime from/to
+ version 4.12.1, 4.12, 4.11.2, 4.11.1 and 4.11.</p>
+
+ <section>
+ <title>Improvements and new features</title>
+ <p>-</p>
+ <!--
+ <list type="bulleted">
+ <item>
+ <item>
+ <p>[agent] Improvement of the inform reporting.
+ It was previously not certain how many acks an
+ application received, 0, 1 or 2. This has now been
+ fixed, so that only 1 (one) ack is issued. </p>
+ <p>Per Hedeland</p>
+ <p>Own Id: OTP-7525</p>
+ </item>
+
+ </list>
+ -->
+
+ </section>
+
+ <section>
+ <title>Reported Fixed Bugs and Malfunctions</title>
+ <!--
+ <p>-</p>
+ -->
+ <list type="bulleted">
+ <item>
+ <p>[agent] Bad session cache (usm+camv-info) invalidation
+ could cause user crash, through call(s) to (a number of)
+ MIB API function(s) (undefined function). </p>
+ <p>Own Id: OTP-7868</p>
+ <!-- <p>Aux Id: Seq 11124</p> -->
+ </item>
+
+ </list>
+
+ </section>
+
+ <section>
+ <title>Incompatibilities</title>
+ <p>-</p>
+ </section>
+ </section> <!-- 4.12.2 -->
+
+ <section>
+ <title>SNMP Development Toolkit 4.12.1</title>
+ <p>Version 4.12.1 supports code replacement in runtime from/to
+ version 4.12, 4.11.2, 4.11.1 and 4.11.</p>
+
+ <section>
+ <title>Improvements and new features</title>
+ <p>-</p>
+ <!--
+ <list type="bulleted">
+ <item>
+ <item>
+ <p>[agent] Improvement of the inform reporting.
+ It was previously not certain how many acks an
+ application received, 0, 1 or 2. This has now been
+ fixed, so that only 1 (one) ack is issued. </p>
+ <p>Per Hedeland</p>
+ <p>Own Id: OTP-7525</p>
+ </item>
+
+ </list>
+ -->
+
+ </section>
+
+ <section>
+ <title>Reported Fixed Bugs and Malfunctions</title>
+ <!--
+ <p>-</p>
+ -->
+ <list type="bulleted">
+ <item>
+ <p>Logging of messages with the GetBulk-request PDU
+ incorrectly produced an erroneous entry in the
+ log: "An error occurred". </p>
+ <p>The reason for this was that the PDU-fields
+ error_status and error_index is re-used for
+ Non-repeaters and Max-repetitions for
+ GetBulk-request PDUs, but this was not handled
+ by the logging code. </p>
+ <p>Own Id: OTP-7695</p>
+ <p>Aux Id: Seq 11124</p>
+ </item>
+
+ <item>
+ <p>[agent] An attempt to set the row status to active for an
+ notReady table row, could result in an "inconsistentValue"
+ error. </p>
+ <p>The same problem existed when attempting to set row status
+ to notInService for a row in notReady. </p>
+ <p>Serge Aleynikov</p>
+ <p>Own Id: OTP-7698</p>
+ <!-- <p>Aux Id: Seq 10966</p> -->
+ </item>
+
+ </list>
+
+ </section>
+
+ <section>
+ <title>Incompatibilities</title>
+ <p>-</p>
+ </section>
+ </section> <!-- 4.12.1 -->
+
+ <section>
+ <title>SNMP Development Toolkit 4.12</title>
+ <p>Version 4.12 supports code replacement in runtime from/to
+ version 4.11.2, 4.11.1 and 4.11.</p>
+
+ <section>
+ <title>Improvements and new features</title>
+ <!--
+ <p>-</p>
+ -->
+ <list type="bulleted">
+ <item>
+ <p>[agent] A simple lookup cache has been added to improve
+ the mib server lookup performance. </p>
+ <p>This can be disabled with the mib_server
+ <seealso marker="snmp_app">cache</seealso> option. </p>
+ <p>Own Id: OTP-7346</p>
+ </item>
+
+ <item>
+ <p>[agent] Improvement of the inform reporting.
+ It was previously not certain how many acks an
+ application received, 0, 1 or 2. This has now been
+ fixed, so that only 1 (one) ack is issued. </p>
+ <p>Per Hedeland</p>
+ <p>Own Id: OTP-7525</p>
+ </item>
+
+ </list>
+
+ </section>
+
+ <section>
+ <title>Reported Fixed Bugs and Malfunctions</title>
+ <p>-</p>
+ <!--
+ <list type="bulleted">
+ <item>
+ <p>[manager] Encryption error when attempting to send
+ version 3 inform-requests. </p>
+ <p>Own Id: OTP-7432</p>
+ <p>Aux Id: Seq 10966</p>
+ </item>
+
+ </list>
+ -->
+
+ </section>
+
+ <section>
+ <title>Incompatibilities</title>
+ <p>-</p>
+ </section>
+ </section> <!-- 4.12 -->
+
+ <section>
+ <title>SNMP Development Toolkit 4.11.2</title>
+ <p>Version 4.11.2 supports code replacement in runtime from/to
+ version 4.11.1 and 4.11. </p>
+
+ <section>
+ <title>Improvements and new features</title>
+ <p>-</p>
+ <!--
+ <list type="bulleted">
+ <item>
+ <p>Added utility functions for transforming DateAndTime
+ as [int()] to strings;
+ <seealso marker="snmp#dat2s">date_and_time_to_string/2</seealso>
+ and
+ <seealso marker="snmp#dat2s2">date_and_time_to_string2/1</seealso>. </p>
+ <p>Also added new validation function
+ <seealso marker="snmp#vdat">validate_date_and_time/2</seealso>. </p>
+ <p>Own Id: OTP-7412</p>
+ <p>Aux Id: Seq 10987</p>
+ </item>
+ </list>
+ -->
+ </section>
+
+ <section>
+ <title>Reported Fixed Bugs and Malfunctions</title>
+ <!--
+ <p>-</p>
+ -->
+ <list type="bulleted">
+ <item>
+ <p>[manager] Erroneous engine-id check when receiving version 3
+ informs. </p>
+ <p>Own Id: OTP-7570</p>
+ <p>Aux Id: Seq 11060</p>
+ </item>
+
+ <item>
+ <p>Receiving an snmp message with a very large version
+ number could cause the erlang node to run out of
+ memory and consequently crash. </p>
+ <p>The standard specifies the snmp version as an
+ (unlimited) INTEGER, but today only
+ 0 (version 1), 1 (version 2) and 3 (version 3) is
+ actually used. So, when decoding a message, a limit
+ has been put on the snmp version integer in order
+ to not allow this kind of a problem. </p>
+ <p>Own Id: OTP-7575</p>
+ <p>Aux Id: Seq 11064</p>
+ </item>
+
+ </list>
+ </section>
+
+ <section>
+ <title>Incompatibilities</title>
+ <p>-</p>
+ </section>
+ </section> <!-- 4.11.2 -->
+
+
+ <section>
+ <title>SNMP Development Toolkit 4.11.1</title>
+ <p>Version 4.11.1 supports code replacement in runtime from/to
+ version 4.11.</p>
+
+ <section>
+ <title>Improvements and new features</title>
+ <!--
+ <p>-</p>
+ -->
+ <list type="bulleted">
+ <item>
+ <p>[compiler] The MIB compiler did not retrieve the REFERENCE part
+ of a SNMP MIB definition. </p>
+ <p>This problem has been partly solved. For SNMP tables,
+ the assocList field of the tables mib-entry record now contains
+ this info (as <c>{reference, string()}</c>), <em>if</em> the
+ MIB was compiled with the compiler option <em>+reference</em>. </p>
+ <p>This solution is temporary, until such time as a permanent
+ solution (and probably not backward compatible) is devised, which
+ retrieves and stores all REFERENCE part(s) of a MIB. </p>
+ <p>See the
+ <seealso marker="snmpc#compiler_opts">compiler options</seealso>
+ for more info. </p>
+
+ <p>Serge Aleynikov</p>
+ <p>Own Id: OTP-7426</p>
+ </item>
+
+ <item>
+ <p>Added utility functions for transforming DateAndTime
+ as [int()] to strings;
+ <seealso marker="snmp#dat2s">date_and_time_to_string/2</seealso>
+ and
+ <seealso marker="snmp#dat2s2">date_and_time_to_string2/1</seealso>. </p>
+ <p>Also added new validation function
+ <seealso marker="snmp#vdat">validate_date_and_time/2</seealso>. </p>
+ <p>Own Id: OTP-7412</p>
+ <p>Aux Id: Seq 10987</p>
+ </item>
+
+ </list>
+
+ </section>
+
+ <section>
+ <title>Reported Fixed Bugs and Malfunctions</title>
+ <!--
+ <p>-</p>
+ -->
+ <list type="bulleted">
+ <item>
+ <p>[manager] Encryption error when attempting to send
+ version 3 inform-requests. </p>
+ <p>Own Id: OTP-7432</p>
+ <p>Aux Id: Seq 10966</p>
+ </item>
+
+ </list>
+ </section>
+
+ <section>
+ <title>Incompatibilities</title>
+ <p>-</p>
+ </section>
+ </section> <!-- 4.11.1 -->
+
+ <section>
+ <title>SNMP Development Toolkit 4.11</title>
+ <p>Version 4.11 supports code replacement in runtime from/to
+ version 4.10.3, 4.10.2, 4.10.1 and 4.10.</p>
+
+ <section>
+ <title>Improvements and new features</title>
+ <!--
+ <p>-</p>
+ -->
+ <list type="bulleted">
+ <item>
+ <p>[agent] Performance improvements in the case when an SNMP
+ manager performs an snmpwalk. </p>
+ <p>Martin Bj&ouml;rklund</p>
+ <p>Own Id: OTP-7201</p>
+ </item>
+
+ <item>
+ <p>The API for sending inform(s) has been improved. Also
+ the documentation has been corrected and updated. See
+ <seealso marker="snmpa#send_notification">snmpa:send_notification</seealso> and
+ <seealso marker="snmpa_notification_delivery_info_receiver">snmpa_notification_delivery_info_receiver</seealso>
+ for more info.</p>
+ <p>Own Id: OTP-7287</p>
+ <p>Aux Id: Seq 10926</p>
+ </item>
+
+ <item>
+ <p>[agent] Performance of the internal database (local-db)
+ has been improved.</p>
+ <p>Own Id: OTP-7319</p>
+ <p>Aux Id: Seq 10942</p>
+ </item>
+
+ <item>
+ <p>[agent] Added utility functions,
+ <seealso marker="snmpa#restart_worker">snmpa:restart_worker/0,1</seealso> and
+ <seealso marker="snmpa#restart_set_worker">snmpa:restart_set_worker/0,1</seealso>,
+ for restarting the agent worker processes (in case the agent is
+ multi-threaded).</p>
+ <p>Own Id: OTP-7369</p>
+ </item>
+
+ <item>
+ <p>Add utility function to
+ <seealso marker="snmp#read_mib">read</seealso>
+ a compiled mib. </p>
+ <p>Own Id: OTP-7371</p>
+ </item>
+
+ </list>
+ </section>
+
+ <section>
+ <title>Reported Fixed Bugs and Malfunctions</title>
+ <!--
+ <p>-</p>
+ -->
+ <list type="bulleted">
+ <item>
+ <p>[manager] Encryption error when attempting to send
+ version 3 inform-requests. </p>
+ <p>Own Id: OTP-7377</p>
+ <p>Aux Id: Seq 10966</p>
+ </item>
+
+ </list>
+ </section>
+
+ <section>
+ <title>Incompatibilities</title>
+ <p>-</p>
+ </section>
+ </section> <!-- 4.11 -->
+
+
+ <section>
<title>SNMP Development Toolkit 4.10.3</title>
<p>Version 4.10.3 supports code replacement in runtime from/to
version 4.10.2, 4.10.1 and 4.10.</p>
diff --git a/lib/snmp/doc/src/snmp_agent_config_files.xml b/lib/snmp/doc/src/snmp_agent_config_files.xml
index b62269d506..bd5c537522 100644
--- a/lib/snmp/doc/src/snmp_agent_config_files.xml
+++ b/lib/snmp/doc/src/snmp_agent_config_files.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="latin1" ?>
+<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE chapter SYSTEM "chapter.dtd">
<chapter>
@@ -367,56 +367,50 @@
<marker id="target_addr"></marker>
<title>Target Address Definitions</title>
<p>The information about Target Address Definitions should be
- stored in a file called
- <c>target_addr.conf</c>.
- </p>
+ stored in a file called <c>target_addr.conf</c>. </p>
<p>The corresponding tables are <c>snmpTargetAddrTable</c> in the
- SNMP-TARGET-MIB and <c>snmpTargetAddrExtTable</c> in the SNMP-COMMUNITY-MIB.
- </p>
- <p>Each entry is a term:
- </p>
- <p><c>{TargetName, Ip, Udp, Timeout, RetryCount, TagList, ParamsName, EngineId}.</c> or <br></br>
-<c>{TargetName, Ip, Udp, Timeout, RetryCount, TagList, ParamsName, EngineId, TMask, MaxMessageSize}.</c></p>
+ SNMP-TARGET-MIB and <c>snmpTargetAddrExtTable</c> in the
+ SNMP-COMMUNITY-MIB. </p>
+ <p>Each entry is a term: </p>
+ <p><c>{TargetName, Ip, Udp, Timeout, RetryCount, TagList, ParamsName, EngineId}.</c> <br></br> or <br></br>
+<c>{TargetName, Ip, Udp, Timeout, RetryCount, TagList, ParamsName, EngineId, TMask, MaxMessageSize}.</c> <br></br> or <br></br>
+<c>{TargetName, Domain, Ip, Udp, Timeout, RetryCount, TagList, ParamsName, EngineId, TMask, MaxMessageSize}.</c></p>
<list type="bulleted">
<item>
<p><c>TargetName</c> is a unique non-empty string.
</p>
</item>
<item>
- <p><c>Ip</c> is a list of four integers.
- </p>
+ <p><c>Domain</c> is one of the atoms:
+ <c>transportDomainUdpIpv4</c> | <c>transportDomainUdpIpv6</c>. </p>
</item>
<item>
- <p><c>Udp</c> is an integer.
- </p>
+ <p><c>Ip</c> is a list of four or eight integers. </p>
</item>
<item>
- <p><c>Timeout</c> is an integer.
- </p>
+ <p><c>Udp</c> is an integer. </p>
</item>
<item>
- <p><c>RetryCount</c> is an integer.
- </p>
+ <p><c>Timeout</c> is an integer. </p>
</item>
<item>
- <p><c>TagList</c> is a string.
- </p>
+ <p><c>RetryCount</c> is an integer. </p>
</item>
<item>
- <p><c>ParamsName</c> is a string.
- </p>
+ <p><c>TagList</c> is a string. </p>
</item>
<item>
- <p><c>EngineId</c> is a string or the atom <c>discovery</c>.
- </p>
+ <p><c>ParamsName</c> is a string. </p>
</item>
<item>
- <p><c>TMask</c> is a string of size 0, or size 6 (default: []).
- </p>
+ <p><c>EngineId</c> is a string or the atom <c>discovery</c>. </p>
</item>
<item>
- <p><c>MaxMessageSize</c> is an integer (default: 2048).
- </p>
+ <p><c>TMask</c> is a list of integer() of size 0,
+ size 6 or size 10 (default: []). </p>
+ </item>
+ <item>
+ <p><c>MaxMessageSize</c> is an integer (default: 2048). </p>
</item>
</list>
<p>Note that if <c>EngineId</c> has the value <c>discovery</c>,
@@ -429,14 +423,10 @@
<marker id="target_params"></marker>
<title>Target Parameters Definitions</title>
<p>The information about Target Parameters Definitions should be
- stored in a file called
- <c>target_params.conf</c>.
- </p>
+ stored in a file called <c>target_params.conf</c>. </p>
<p>The corresponding table is <c>snmpTargetParamsTable</c> in the
- SNMP-TARGET-MIB.
- </p>
- <p>Each entry is a term:
- </p>
+ SNMP-TARGET-MIB. </p>
+ <p>Each entry is a term: </p>
<p><c>{ParamsName, MPModel, SecurityModel, SecurityName, SecurityLevel}.</c></p>
<list type="bulleted">
<item>
diff --git a/lib/snmp/doc/src/snmp_agent_netif.xml b/lib/snmp/doc/src/snmp_agent_netif.xml
index 1f2dbe80db..8f1d860d58 100644
--- a/lib/snmp/doc/src/snmp_agent_netif.xml
+++ b/lib/snmp/doc/src/snmp_agent_netif.xml
@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="latin1" ?>
+<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE chapter SYSTEM "chapter.dtd">
<chapter>
<header>
<copyright>
- <year>1997</year><year>2009</year>
+ <year>1997</year><year>2011</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -65,16 +65,19 @@
</section>
<section>
+ <marker id="messages"></marker>
<title>Messages</title>
<p>The section <em>Messages</em> describes mandatory messages, which
Net if must send and be able to receive.
</p>
<section>
+ <marker id="outgoing_messages"></marker>
<title>Outgoing Messages</title>
<p>Net if must send the following message when it receives an
- SNMP PDU from the network that is aimed for the MasterAgent:
- </p>
+ SNMP PDU from the network that is aimed for the MasterAgent:
+ </p>
+ <marker id="om_snmp_pdu"></marker>
<pre>
MasterAgent ! {snmp_pdu, Vsn, Pdu, PduMS, ACMData, From, Extra}
</pre>
@@ -106,16 +109,18 @@ MasterAgent ! {snmp_pdu, Vsn, Pdu, PduMS, ACMData, From, Extra}
the request.</item>
</list>
<p>The following message is used to report that a response to a
- request has been received. The only request an agent can send
- is an Inform-Request.
- </p>
+ request has been received. The only request an agent can send
+ is an Inform-Request.
+ </p>
+ <marker id="om_snmp_response_received"></marker>
<pre>
Pid ! {snmp_response_received, Vsn, Pdu, From}
</pre>
<list type="bulleted">
<item><c>Pid</c> is the Process that waits for the response
for the request. The Pid was specified in the
- <c>send_pdu_req</c> message <seealso marker="#message">(see below)</seealso>.
+ <c>send_pdu_req</c> message
+ <seealso marker="#im_send_pdu_req">(see below)</seealso>.
</item>
<item><c>Vsn</c> is either <c>'version-1'</c>, <c>'version-2'</c>, or
<c>'version-3'</c>.
@@ -131,119 +136,153 @@ Pid ! {snmp_response_received, Vsn, Pdu, From}
</section>
<section>
+ <marker id="incoming_messages"></marker>
<title>Incoming Messages</title>
<p>This section describes the incoming messages which a Net if
- process must be able to receive.
- </p>
+ process must be able to receive.
+ </p>
<list type="bulleted">
<item>
+ <marker id="im_snmp_response"></marker>
<p><c>{snmp_response, Vsn, Pdu, Type, ACMData, To, Extra}</c></p>
<p>This message is sent to the Net if process from a master
agent as a response to a previously received request.
</p>
<list type="bulleted">
- <item><c>Vsn</c> is either <c>'version-1'</c>,
- <c>'version-2'</c>, or <c>'version-3'</c>.
+ <item>
+ <p><c>Vsn</c> is either <c>'version-1'</c>,
+ <c>'version-2'</c>, or <c>'version-3'</c>. </p>
</item>
- <item><c>Pdu</c> is an SNMP PDU record (as defined in
- snmp_types.hrl) with the SNMP response.
+ <item>
+ <p><c>Pdu</c> is an SNMP PDU record (as defined in
+ snmp_types.hrl) with the SNMP response. </p>
</item>
- <item><c>Type</c> is the <c>#pdu.type</c> of the original
- request.
+ <item>
+ <p><c>Type</c> is the <c>#pdu.type</c>
+ of the original request. </p>
</item>
- <item><c>ACMData</c> is data used by the Access Control
- Module in use. Normally this is just sent to
- <c>snmpa_mpd:generate_response_message</c> (see Reference Manual).
+ <item>
+ <p><c>ACMData</c> is data used by the Access Control
+ Module in use. Normally this is just sent to
+ <c>snmpa_mpd:generate_response_message</c>
+ (see Reference Manual). </p>
</item>
- <item><c>To</c> is the destination address. If UDP over IP
- is used, this should be a 2-tuple <c>{IP, UDPport}</c>,
- where <c>IP</c> is a 4-tuple with the IP address, and
- <c>UDPport</c> is an integer.
+ <item>
+ <p><c>To</c> is the destination address. If UDP over IP
+ is used, this should be a 2-tuple <c>{IP, UDPport}</c>,
+ where <c>IP</c> is a 4-tuple with the IP address, and
+ <c>UDPport</c> is an integer. </p>
</item>
- <item><c>Extra</c> is the term that the Net if process
- sent to the agent when the request was sent to the agent.
+ <item>
+ <p><c>Extra</c> is the term that the Net if process
+ sent to the agent when the request was sent to the agent. </p>
</item>
</list>
</item>
<item>
+ <marker id="im_discarded_pdu"></marker>
<p><c>{discarded_pdu, Vsn, ReqId, ACMData, Variable, Extra}</c></p>
<p>This message is sent from a master agent if it for some
- reason decided to discard the pdu.
- </p>
+ reason decided to discard the pdu. </p>
<list type="bulleted">
- <item><c>Vsn</c> is either <c>'version-1'</c>,
- <c>'version-2'</c>, or <c>'version-3'</c>.
+ <item>
+ <p><c>Vsn</c> is either <c>'version-1'</c>,
+ <c>'version-2'</c>, or <c>'version-3'</c>. </p>
</item>
- <item><c>ReqId</c> is the request id of the original
- request.
+ <item>
+ <p><c>ReqId</c> is the request id of the original request. </p>
</item>
- <item><c>ACMData</c> is data used by the Access Control
- Module in use. Normally this is just sent to
- <c>snmpa_mpd:generate_response_message</c> (see Reference Manual).
+ <item>
+ <p><c>ACMData</c> is data used by the Access Control
+ Module in use. Normally this is just sent to
+ <c>snmpa_mpd:generate_response_message</c>
+ (see Reference Manual). </p>
</item>
- <item><c>Variable</c> is the name of an snmp counter that
- represents the error, e.g. <c>snmpInBadCommunityUses</c>.
+ <item>
+ <p><c>Variable</c> is the name of an snmp counter that
+ represents the error, e.g. <c>snmpInBadCommunityUses</c>. </p>
</item>
- <item><c>Extra</c> is the term that the Net if process
- sent to the agent when the request was sent to the agent.
+ <item>
+ <p><c>Extra</c> is the term that the Net if process
+ sent to the agent when the request was sent to the agent. </p>
</item>
</list>
</item>
<item>
- <p><c>{send_pdu, Vsn, Pdu, MsgData, To}</c></p>
+ <marker id="im_send_pdu"></marker>
+ <p><c>{send_pdu, Vsn, Pdu, MsgData, To, Extra}</c></p>
<p>This message is sent from a master agent when a trap is
- to be sent.
- </p>
+ to be sent. </p>
<list type="bulleted">
- <item><c>Vsn</c> is either <c>'version-1'</c>,
- <c>'version-2'</c>, or <c>'version-3'</c>.
+ <item>
+ <p><c>Vsn</c> is either <c>'version-1'</c>,
+ <c>'version-2'</c>, or <c>'version-3'</c>.</p>
</item>
- <item><c>Pdu</c> is an SNMP PDU record (as defined in
- snmp_types.hrl) with the SNMP response.
+ <item>
+ <p><c>Pdu</c> is an SNMP PDU record (as defined in
+ snmp_types.hrl) with the SNMP response. </p>
+ </item>
+ <item>
+ <p><c>MsgData</c> is the message specific data used in
+ the SNMP message. This value is normally sent to
+ <c>snmpa_mpd:generate_message/4</c>. In SNMPv1 and
+ SNMPv2c, this message data is the community string. In
+ SNMPv3, it is the context information. </p>
</item>
- <item><c>MsgData</c> is the message specific data used in
- the SNMP message. This value is normally sent to
- <c>snmpa_mpd:generate_message/4</c>. In SNMPv1 and
- SNMPv2c, this message data is the community string. In
- SNMPv3, it is the context information.
+ <item>
+ <p><c>To</c> is a list of the destination addresses and
+ their corresponding security parameters. This value is
+ normally sent to <c>snmpa_mpd:generate_message/4</c>. </p>
</item>
- <item><c>To</c> is a list of the destination addresses and
- their corresponding security parameters. This value is
- normally sent to <c>snmpa_mpd:generate_message/4</c>.
+ <item>
+ <p><c>Extra</c> is any term that the notification sender
+ wishes to pass to the Net if process when sending a notification
+ (see
+ <seealso marker="snmpa#send_notification2">send notification
+ </seealso> for more info). </p>
</item>
</list>
</item>
<item>
- <p><c>{send_pdu_req, Vsn, Pdu, MsgData, To, Pid}</c></p>
- <p>This <marker id="message"></marker>
- message is sent from a master
- agent when a request is
- to be sent. The only request an agent can send is
- Inform-Request. The net if process needs to remember the
- request id and the Pid, and when a response is received for
- the request id, send it to Pid, using a
- <c>snmp_response_received</c> message.
- </p>
- <list type="bulleted">
- <item><c>Vsn</c> is either <c>'version-1'</c>,
- <c>'version-2'</c>, or <c>'version-3'</c>.
- </item>
- <item><c>Pdu</c> is an SNMP PDU record (as defined in
- snmp_types.hrl) with the SNMP response.
- </item>
- <item><c>MsgData</c> is the message specific data used in
- the SNMP message. This value is normally sent to
- <c>snmpa_mpd:generate_message/4</c>. In SNMPv1 and
- SNMPv2c, this message data is the community string. In
- SNMPv3, it is the context information.
+ <marker id="im_send_pdu_req"></marker>
+ <p><c>{send_pdu_req, Vsn, Pdu, MsgData, To, Pid, Extra}</c></p>
+ <p>This message is sent from a master agent when a request is to
+ be sent. The only request an agent can send is Inform-Request.
+ The net if process needs to remember the request id and the Pid,
+ and when a response is received for the request id, send it to Pid,
+ using a <c>snmp_response_received</c> message. </p>
+ <list type="bulleted">
+ <item>
+ <p><c>Vsn</c> is either <c>'version-1'</c>,
+ <c>'version-2'</c>, or <c>'version-3'</c>.</p>
+ </item>
+ <item>
+ <p><c>Pdu</c> is an SNMP PDU record (as defined in
+ snmp_types.hrl) with the SNMP response. </p>
+ </item>
+ <item>
+ <p><c>MsgData</c> is the message specific data used in
+ the SNMP message. This value is normally sent to
+ <c>snmpa_mpd:generate_message/4</c>. In SNMPv1 and
+ SNMPv2c, this message data is the community string. In
+ SNMPv3, it is the context information. </p>
+ </item>
+ <item>
+ <p><c>To</c> is a list of the destination addresses and
+ their corresponding security parameters. This value is
+ normally sent to <c>snmpa_mpd:generate_message/4</c>. </p>
+ </item>
+ <item>
+ <p><c>Pid</c> is a process identifier. </p>
+ </item>
+ <item>
+ <p><c>Extra</c> is any term that the notification sender
+ wishes to pass to the Net if process when sending a notification
+ (see
+ <seealso marker="snmpa#send_notification2">send notification
+ </seealso> for more info). </p>
</item>
- <item><c>To</c> is a list of the destination addresses and
- their corresponding security parameters. This value is
- normally sent to <c>snmpa_mpd:generate_message/4</c>.
- </item>
- <item><c>Pid</c> is a process identifier.
- </item>
- </list>
+ </list>
</item>
</list>
</section>
diff --git a/lib/snmp/doc/src/snmp_community_mib.xml b/lib/snmp/doc/src/snmp_community_mib.xml
index 7c7386af19..5e7bca3e27 100644
--- a/lib/snmp/doc/src/snmp_community_mib.xml
+++ b/lib/snmp/doc/src/snmp_community_mib.xml
@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="latin1" ?>
+<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">
<erlref>
<header>
<copyright>
- <year>1999</year><year>2009</year>
+ <year>1999</year><year>2011</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -35,11 +35,13 @@
<modulesummary>Instrumentation Functions for SNMP-COMMUNITY-MIB</modulesummary>
<description>
<p>The module <c>snmp_community_mib</c> implements the instrumentation
- functions for the
- SNMP-COMMUNITY-MIB, and functions for configuring the database.
- </p>
+ functions for the SNMP-COMMUNITY-MIB, and functions for configuring the
+ database. </p>
<p>The configuration files are described in the SNMP User's Manual.</p>
+
+ <marker id="configure"></marker>
</description>
+
<funcs>
<func>
<name>configure(ConfDir) -> void()</name>
@@ -68,8 +70,11 @@
</p>
<p>The configuration file read is: <c>community.conf</c>.
</p>
+
+ <marker id="reconfigure"></marker>
</desc>
</func>
+
<func>
<name>reconfigure(ConfDir) -> void()</name>
<fsummary>Configure the SNMP-COMMUNITY-MIB</fsummary>
@@ -96,28 +101,35 @@
where the configuration files are found.
</p>
<p>The configuration file read is: <c>community.conf</c>.</p>
+
<marker id="add_community"></marker>
</desc>
</func>
+
<func>
<name>add_community(Idx, CommName, SecName, CtxName, TransportTag) -> Ret</name>
+ <name>add_community(Idx, CommName, SecName, EngineId, CtxName, TransportTag) -> Ret</name>
<fsummary>Added one community</fsummary>
<type>
<v>Idx = string()</v>
<v>CommName = string()</v>
<v>SecName = string()</v>
+ <v>EngineId = string()</v>
<v>CtxName = string()</v>
<v>TransportTag = string()</v>
<v>Ret = {ok, Key} | {error, Reason}</v>
<v>Key = term()</v>
- <v>Reason = term()</v>
+ <v>Reason = term()</v>
</type>
<desc>
<p>Adds a community to the agent config.
- Equivalent to one line in the <c>community.conf</c> file.</p>
+ Equivalent to one line in the <c>community.conf</c> file.</p>
+ <p>With the <c>EngineId</c> argument it is possible to
+ override the configured engine-id (SNMP-FRAMEWORK-MIB).</p>
<marker id="delete_community"></marker>
</desc>
</func>
+
<func>
<name>delete_community(Key) -> Ret</name>
<fsummary>Delete one community</fsummary>
diff --git a/lib/snmp/doc/src/snmp_target_mib.xml b/lib/snmp/doc/src/snmp_target_mib.xml
index 4a36be19a3..d5151d41de 100644
--- a/lib/snmp/doc/src/snmp_target_mib.xml
+++ b/lib/snmp/doc/src/snmp_target_mib.xml
@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="latin1" ?>
+<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">
<erlref>
<header>
<copyright>
- <year>1998</year><year>2009</year>
+ <year>1998</year><year>2011</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -39,9 +39,21 @@
and functions for configuring the database. </p>
<p>The configuration files are described in the SNMP User's Manual.</p>
- <marker id="configure"></marker>
+ <marker id="types"></marker>
</description>
+ <section>
+ <title>DATA TYPES</title>
+ <code type="none"><![CDATA[
+transportDomain() = transportDomainUdpIpv4 | transportDomainUdpIpv6
+transportAddressIPv4() = [integer()], length 4
+transportAddressIPv6() = [integer()], length 8
+transportAddressMask() = [integer()], length 0 (default), 6 (IPv4) or 10 (IPv6)
+ ]]></code>
+
+ <marker id="configure"></marker>
+ </section>
+
<funcs>
<func>
<name>configure(ConfDir) -> void()</name>
@@ -118,17 +130,19 @@
<func>
<name>add_addr(Name, Ip, Port, Timeout, Retry, TagList, Params, EngineId, TMask, MMS) -> Ret</name>
+ <name>add_addr(Name, Domain, Ip, Port, Timeout, Retry, TagList, Params, EngineId, TMask, MMS) -> Ret</name>
<fsummary>Add one target address definition</fsummary>
<type>
<v>Name = string()</v>
- <v>Ip = [integer()], length 4</v>
+ <v>Domain = transportDomain()</v>
+ <v>Ip = transportAddressIPv4() | transportAddressIPv6() (depends on the value of Domain)</v>
<v>Port = integer()</v>
<v>Timeout = integer()</v>
<v>Retry = integer()</v>
<v>TagList = string()</v>
<v>ParamsName = string()</v>
<v>EngineId = string()</v>
- <v>TMask = string(), length 0 or 6</v>
+ <v>TMask = transportAddressMask() (depends on Domain)</v>
<v>MMS = integer()</v>
<v>Ret = {ok, Key} | {error, Reason}</v>
<v>Key = term()</v>
diff --git a/lib/snmp/doc/src/snmpa.xml b/lib/snmp/doc/src/snmpa.xml
index 1d680e80f5..27d89ea4e3 100644
--- a/lib/snmp/doc/src/snmpa.xml
+++ b/lib/snmp/doc/src/snmpa.xml
@@ -872,10 +872,138 @@ snmp_agent:register_subagent(SA1,[1,2,3], SA2).
then that sub-agent will be unregistered from all trees in
<c>Agent</c>. </p>
- <marker id="send_notification"></marker>
+ <marker id="send_notification2"></marker>
</desc>
</func>
+
+ <func>
+ <name>send_notification2(Agent, Notification, SendOpts) -> void()</name>
+ <fsummary>Send notification</fsummary>
+ <type>
+ <v>Agent = pid() | atom()</v>
+ <v>Notification = atom()</v>
+ <v>SendOpts = [send_option()]</v>
+ <v>send_option() = {receiver, receiver()} | {name, notify_name()} | {context, context_name()} | {varbinds, varbinds()} | {local_engine_id, string()} | {extra, extra_info()}</v>
+ <v>receiver() = no_receiver | {tag(), tag_receiver()} | notification_delivery_info()</v>
+ <v>tag() = term(()</v>
+ <v>tag_receiver() = pid() | registered_name() | {Mod, Func, Args}</v>
+ <v>registered_name() = atom()</v>
+ <v>Mod = atom()</v>
+ <v>Func = atom()</v>
+ <v>Args = list()</v>
+ <v>notify_name() = string()</v>
+ <v>context_name() = string()</v>
+ <v>varbinds() = [varbind()]</v>
+ <v>varbind() = {variable(), value()} | {column(), row_index(), value()} | {oid(), value()}</v>
+ <v>variable() = atom()</v>
+ <v>value() = term()</v>
+ <v>column() = atom()</v>
+ <v>row_index() = [int()]</v>
+ <v>extra_info() = term()</v>
+ </type>
+ <desc>
+ <p>Send the notification <c>Notification</c> to the management
+ targets defined for notify-name (<c>name</c>) in the
+ <c>snmpNotifyTable</c> in SNMP-NOTIFICATION-MIB from the
+ specified <c>context</c>. </p>
+
+ <p>If no <c>name</c> is specified (or if it is <c>""</c>), the
+ notification is sent to all management targets. </p>
+
+ <p>If no <c>context</c> is specified, the default context, <c>""</c>,
+ is used. </p>
+
+ <p>The send option <c>receiver</c> specifies where information
+ about delivery of Inform-Requests should be sent. The agent
+ sends Inform-Requests and waits for acknowledgments from the
+ management targets.
+ The <c>receiver</c> can have three values: </p>
+
+ <list type="bulleted">
+ <item>
+ <p><c>no_receiver</c> - No information is delivered. </p>
+ </item>
+
+ <item>
+ <p><c>notification_delivery_info()</c> - The information is
+ delivered via a function call according to this data. See the
+ <seealso marker="#data_types">DATA TYPES</seealso> section
+ above for details. </p>
+ </item>
+
+ <item>
+ <p><c>{tag(), tag_receiver()}</c> - The information is delivered
+ either via messages or via a function call according to the value
+ of <c>tag_receiver()</c>. </p>
+ <p>Delivery is done differently depending on the value
+ of <c>tag_receiver()</c>: </p>
+
+ <list>
+ <item>
+ <p><c>pid() | registered_name()</c> - The info will be delivered in
+ the following messages: </p>
+ <list>
+ <item>
+ <p><c>{snmp_targets, tag(), Addresses}</c></p>
+ <p>This informs the user which target addresses the
+ notification was sent to. </p>
+ </item>
+ <item>
+ <p><c>{snmp_notification, tag(), {got_response, Address}}</c></p>
+ <p>This informs the user that this target address
+ acknowledged the notification. </p>
+ </item>
+ <item>
+ <p><c>{snmp_notification, tag(), {no_response, Address}}</c></p>
+ <p>This informs the user that this target address
+ did not acknowledge the notification. </p>
+ </item>
+ </list>
+ <p>The notification is sent as an Inform-Request to each
+ target address in <c>Addresses</c> and if there are no
+ targets for which an Inform-Request is sent, <c>Addresses</c>
+ is the empty list <c>[]</c>. </p>
+ <p>The <c>tag_receiver()</c> will first be sent the
+ <c>snmp_targets</c> message, and then for each address in
+ <c>Addresses</c> list, one of the two <c>snmp_notification</c>
+ messages. </p>
+ </item>
+
+ <item>
+ <p><c>{Mod, Func, Args}</c> - The info will be delivered via
+ the function call: </p>
+ <p><c>Mod:Func([Msg | Args])</c></p>
+ <p>where <c>Msg</c> has the same content and purpose as the
+ messages descrived above.</p>
+ </item>
+
+ </list>
+ </item>
+ </list>
+
+ <note>
+ <p>The <c>extra</c> info is not normally interpreted by the agent,
+ instead it is passed through to the
+ <seealso marker="snmp_agent_netif">net-if</seealso> process. It is
+ up to the implementor of that process to make use of this data. </p>
+ <p>The version of net-if provided by this application makes no use
+ of this data, with one exception:
+ Any tuple containing the atom
+ <c>snmpa_default_notification_extra_info</c>
+ may be used by the agent and is therefor <em>reserved</em>. </p>
+ <p>See the net-if incomming messages for sending a
+ <seealso marker="snmp_agent_netif#im_send_pdu">
+ trap</seealso> and
+ <seealso marker="snmp_agent_netif#im_send_pdu_req">
+ notification</seealso> for more info. </p>
+ </note>
+
+ <marker id="send_notification"></marker>
+ </desc>
+ </func>
+
+
<func>
<name>send_notification(Agent, Notification, Receiver)</name>
<name>send_notification(Agent, Notification, Receiver, Varbinds)</name>
@@ -907,18 +1035,19 @@ snmp_agent:register_subagent(SA1,[1,2,3], SA2).
</type>
<desc>
<p>Sends the notification <c>Notification</c> to the
- management targets defined for <c>NotifyName</c> in the
- <c>snmpNotifyTable</c> in SNMP-NOTIFICATION-MIB from the
- specified context. If no <c>NotifyName</c> is specified (or
- if it is <c>""</c>), the notification is sent to all
- management targets (<c>Addresses</c> below). If no <c>ContextName</c>
- is specified, the default <c>""</c> context is used.
- </p>
+ management targets defined for <c>NotifyName</c> in the
+ <c>snmpNotifyTable</c> in SNMP-NOTIFICATION-MIB from the
+ specified context. </p>
+ <p>If no <c>NotifyName</c> is specified (or if it is <c>""</c>),
+ the notification is sent to all management targets
+ (<c>Addresses</c> below). </p>
+ <p>If no <c>ContextName</c> is specified, the default <c>""</c>
+ context is used. </p>
<p>The parameter <c>Receiver</c> specifies where information
- about delivery of Inform-Requests should be sent. The agent
- sends Inform-Requests and waits for acknowledgments from the
- managers. <c>Receiver</c> can have three values: </p>
+ about delivery of Inform-Requests should be sent. The agent
+ sends Inform-Requests and waits for acknowledgments from the
+ managers. <c>Receiver</c> can have three values: </p>
<list type="bulleted">
<item>
@@ -926,17 +1055,18 @@ snmp_agent:register_subagent(SA1,[1,2,3], SA2).
</item>
<item>
- <p><c>{Tag, Recv}</c> - The information is delivered either via messages
- or via a function call according to the value of <c>Recv</c>. </p>
- </item>
-
- <item>
<p><c>notification_delivery_info()</c> - The information is
delivered via a function call according to this data. See the
<seealso marker="#data_types">DATA TYPES</seealso> section
above for details. </p>
</item>
+ <item>
+ <p><c>{Tag, Recv}</c> - The information is delivered either via
+ messages or via a function call according to the value of
+ <c>Recv</c>. </p>
+ </item>
+
</list>
@@ -1064,86 +1194,20 @@ snmp_agent:register_subagent(SA1,[1,2,3], SA2).
(see SNMP-FRAMEWORK-MIB). </p>
</note>
-<!--
- <marker id="send_trap"></marker>
--->
- <marker id="discovery"></marker>
+ <p><c>ExtraInfo</c> is not normally used in any way by the agent.
+ It is intended to be passed along to the net-if process, which is
+ a component that a user can implement themself. The users own net-if
+ may then make use of ExtraInfo. The net-if provided with this
+ application does not process ExtraInfo. </p>
+ <p>There is one exception. <em>Any</em> tuple containing the atom
+ <c>snmpa_default_notification_extra_info</c> will, in this context,
+ be considered belonging to this application, and may be processed
+ by the agent. </p>
+
+ <marker id="discovery"></marker>
</desc>
</func>
-<!--
- <func>
- <name>send_trap(Agent,Trap,Community)</name>
- <name>send_trap(Agent,Trap,Community,Varbinds) -> void()</name>
- <fsummary>Send a trap</fsummary>
- <type>
- <v>Agent = pid() | atom()</v>
- <v>Trap = atom()</v>
- <v>Community = string()</v>
- <v>Varbinds = [Varbind]</v>
- <v>Varbind = {Variable, Value} | {Column, RowIndex, Value} | {OID, Value}</v>
- <v>Variable = atom()</v>
- <v>Column = atom()</v>
- <v>OID = oid()</v>
- <v>Value = term()</v>
- <v>RowIndex = [int()]</v>
- </type>
- <desc>
- <p>Note! This function is only kept for backwards
- compatibility reasons. Use <c>send_notification</c> instead.
- </p>
- <p>Sends the trap <c>Trap</c> to the managers defined for
- <c>Community</c> in the <c>intTrapDestTable</c> in
- OTP-SNMPEA-MIB. The optional argument <c>Varbinds</c> defines
- values for the objects in the trap. If no value is given for
- an object, the <c>Agent</c> performs a get-operation to
- retrieve the value.
- </p>
- <p><c>Varbinds</c> is a list of <c>Varbind</c>, where each
- <c>Varbind</c> is one of:
- </p>
- <list type="bulleted">
- <item><c>{Variable, Value}</c>, where <c>Variable</c> is the
- symbolic name of a scalar variable referred to in the trap
- specification.
- </item>
- <item><c>{Column, RowIndex, Value}</c>, where <c>Column</c>
- is the symbolic name of a column variable.
- <c>RowIndex</c> is a list of indices for the specified
- element. If this is the case, the OBJECT IDENTIFIER sent
- in the trap is the <c>RowIndex</c> appended to the OBJECT
- IDENTIFIER for the table column. This is the OBJECT
- IDENTIFIER which specifies the element.
- </item>
- <item><c>{OID, Value}</c>, where <c>OID</c> is the OBJECT
- IDENTIFIER for an instance of an object, scalar variable,
- or column variable.
- </item>
- </list>
- <p>For example, to specify that <c>sysLocation</c> should have the
- value <c>"upstairs"</c> in the trap, we could use one of:
- </p>
- <list type="bulleted">
- <item><c>{sysLocation, "upstairs"}</c> or</item>
- <item><c>{[1,3,6,1,2,1,1,6,0], "upstairs"}</c> or</item>
- <item><c>{?sysLocation_instance, "upstairs"}</c> (provided
- that the generated <c>.hrl</c> file is included)</item>
- </list>
- <p>If a variable in the trap is a table element, the
- <c>RowIndex</c> for the element must be given in the
- <c>Varbinds</c> list. In this case, the OBJECT IDENTIFIER sent
- in the trap is the OBJECT IDENTIFIER that identifies this
- element. This OBJECT IDENTIFIER could be used in a get
- operation later.
- </p>
- <p>This function is asynchronous, and does not return any
- information. If an error occurs, <c>snmp_error:user_err/2</c>
- is called and the trap is discarded. </p>
-
- <marker id="discovery"></marker>
- </desc>
- </func>
--->
<func>
<name>discovery(TargetName, Notification) -> {ok, ManagerEngineID} | {error, Reason}</name>
diff --git a/lib/snmp/doc/src/snmpa_conf.xml b/lib/snmp/doc/src/snmpa_conf.xml
index d873574c6e..a533c179ee 100644
--- a/lib/snmp/doc/src/snmpa_conf.xml
+++ b/lib/snmp/doc/src/snmpa_conf.xml
@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="latin1" ?>
+<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">
<erlref>
<header>
<copyright>
- <year>2006</year><year>2010</year>
+ <year>2006</year><year>2011</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -38,8 +38,21 @@
used for manipulating (write/append/read) the config files of the
SNMP agent. </p>
- <marker id="agent_entry"></marker>
+ <marker id="types"></marker>
</description>
+
+ <section>
+ <title>DATA TYPES</title>
+ <code type="none"><![CDATA[
+transportDomain() = transportDomainUdpIpv4 | transportDomainUdpIpv6
+transportAddressIPv4() = [integer()], length 4
+transportAddressIPv6() = [integer()], length 8
+transportAddressMask() = [integer()], length 0 (default), 6 (IPv4) or 10 (IPv6)
+ ]]></code>
+
+ <marker id="agent_entry"></marker>
+ </section>
+
<funcs>
<func>
<name>agent_entry(Tag, Val) -> agent_entry()</name>
@@ -381,17 +394,19 @@
<name>target_addr_entry(Name, Ip, TagList, ParamsName, EngineId, TMask) -> target_addr_entry()</name>
<name>target_addr_entry(Name, Ip, Udp, TagList, ParamsName, EngineId, TMask, MaxMessageSize) -> target_addr_entry()</name>
<name>target_addr_entry(Name, Ip, Udp, Timeout, RetryCount, TagList, ParamsName, EngineId, TMask, MaxMessageSize) -> target_addr_entry()</name>
+ <name>target_addr_entry(Name, Domain, Ip, Udp, Timeout, RetryCount, TagList, ParamsName, EngineId, TMask, MaxMessageSize) -> target_addr_entry()</name>
<fsummary>Create an target_addr entry</fsummary>
<type>
<v>Name = string()</v>
- <v>Ip = string()</v>
+ <v>Domain = transportDomain()</v>
+ <v>Ip = transportAddressIPv4() | transportAddressIPv6() (depends on Domain)</v>
<v>Udp = integer()</v>
<v>Timeout = integer()</v>
<v>RetryCount = integer()</v>
<v>TagList = string()</v>
<v>ParamsName = string()</v>
<v>EngineId = string()</v>
- <v>TMask = string()</v>
+ <v>TMask = transportAddressMask() (depends on Domain)</v>
<v>MaxMessageSize = integer()</v>
<v>target_addr_entry() = term()</v>
</type>
diff --git a/lib/snmp/doc/src/snmpc.xml b/lib/snmp/doc/src/snmpc.xml
index 771629492d..61d19251c5 100644
--- a/lib/snmp/doc/src/snmpc.xml
+++ b/lib/snmp/doc/src/snmpc.xml
@@ -48,7 +48,11 @@
<type>
<v>File = string()</v>
<v>Options = [opt()]</v>
- <v>opt() = db() | relaxed_row_name_assign_check() | deprecated() | description() | reference() | group_check() | i() | il() | imports() | module() | module_identity() | module_compliance() | agent_capabilities() | outdir() | no_defs() | verbosity() | warnings()</v>
+ <v>opt() = db() | relaxed_row_name_assign_check() | deprecated() |
+ description() | reference() | group_check() | i() | il() |
+ imports() | module() | module_identity() | module_compliance() |
+ agent_capabilities() | outdir() | no_defs() | verbosity() |
+ warnings() | warnings_as_errors()</v>
<v>db() = {db, volatile|persistent|mnesia}</v>
<v>deprecated() = {deprecated, bool()}</v>
<v>relaxed_row_name_assign_check() = relaxed_row_name_assign_check</v>
@@ -66,6 +70,7 @@
<v>outdir() = {outdir, dir()}</v>
<v>verbosity() = {verbosity, silence|warning|info|log|debug|trace}</v>
<v>warnings() = {warnings, bool()}</v>
+ <v>warnings_as_errors() = warnings_as_errors</v>
<v>dir() = string()</v>
<v>BinFileName = string()</v>
</type>
@@ -200,11 +205,17 @@
<item>
<p>The option <c>warnings</c> specifies whether warning
- messages should be shown. </p>
+ messages should be shown. </p>
<p>Default is <c>true</c>. </p>
</item>
+ <item>
+ <p>The option <c>warnings_as_errors</c>, if present, specifies
+ whether warnings should be treated as errors.</p>
+ </item>
+
</list>
+
<p>The MIB compiler understands both SMIv1 and SMIv2 MIBs. It
uses the <c>MODULE-IDENTITY</c> statement to determine if the MIB is
version 1 or 2.
diff --git a/lib/snmp/doc/src/snmpc_cmd.xml b/lib/snmp/doc/src/snmpc_cmd.xml
index 9358382a10..971f8a3cff 100644
--- a/lib/snmp/doc/src/snmpc_cmd.xml
+++ b/lib/snmp/doc/src/snmpc_cmd.xml
@@ -50,6 +50,8 @@
with definitions of Erlang constants for the objects in
the MIB, see
<seealso marker="snmpc#mib_to_hrl">mib_to_hrl/1</seealso>. </p>
+
+ <marker id="options"></marker>
</desc>
</func>
</funcs>
@@ -58,15 +60,18 @@
<title>Compiler options</title>
<p>The following options are supported (note that most of these relate
to the compilation of the MIB file):</p>
+ <marker id="option_help"></marker>
<taglist>
<tag>--help</tag>
<item>
<p>Prints help info.</p>
+ <marker id="option_version"></marker>
</item>
<tag>--version</tag>
<item>
<p>Prints application and mib format version.</p>
+ <marker id="option_verbosity"></marker>
</item>
<tag>--verbosity <em>verbosity</em></tag>
@@ -74,11 +79,22 @@
<p>Print debug info. </p>
<p><c>verbosity</c> = <c>trace</c> | <c>debug</c> | <c>log</c> | <c>info</c> | <c>silence</c></p>
<p>Defaults to <c>silence</c>.</p>
+ <marker id="option_w"></marker>
+ <marker id="option_warnings"></marker>
</item>
- <tag>--warnings</tag>
+ <tag>--warnings | --W</tag>
<item>
<p>Print warning messages. </p>
+ <marker id="option_wae"></marker>
+ <marker id="option_werror"></marker>
+ </item>
+
+ <tag>--wae | --Werror</tag>
+ <item>
+ <p>Warnings as errors.
+ Indicates that warnings shall be treated as errors. </p>
+ <marker id="option_odir"></marker>
</item>
<tag>--o <em>directory</em></tag>
@@ -86,6 +102,7 @@
<p>The directory where the compiler should place the output files.
If not specified, output files will be placed in the current working
directory.</p>
+ <marker id="option_idir"></marker>
</item>
<tag>--i <em>Directory</em></tag>
@@ -94,6 +111,7 @@
By default, the current working directory is always included. </p>
<p>This option can be present several times, each time specifying
<em>one</em> path. </p>
+ <marker id="option_ildir"></marker>
</item>
<tag>--il <em>Directory</em></tag>
@@ -106,6 +124,7 @@
the current version may be in the system). The current directory
and the "snmp-home"/priv/mibs/ are always listed last in the
include path. </p>
+ <marker id="option_sgc"></marker>
</item>
<tag>--sgc</tag>
@@ -114,42 +133,50 @@
group check of the mib compiler.
That is, should the OBJECT-GROUP and the NOTIFICATION-GROUP
macro(s) be checked for correctness or not. </p>
+ <marker id="option_dep"></marker>
</item>
<tag>--dep</tag>
<item>
<p>Keep deprecated definition(s).
If not specified the compiler will ignore deprecated definitions. </p>
+ <marker id="option_desc"></marker>
</item>
<tag>--desc</tag>
<item>
<p>The DESCRIPTION field will be included. </p>
+ <marker id="option_ref"></marker>
</item>
<tag>--ref</tag>
<item>
<p>The REFERENCE field will be included. </p>
+ <marker id="option_imp"></marker>
</item>
<tag>--imp</tag>
<item>
<p>The IMPORTS field will be included. </p>
+ <marker id="option_mi"></marker>
</item>
<tag>--mi</tag>
<item>
<p>The MODULE-IDENTITY field will be included. </p>
+ <marker id="option_mc"></marker>
</item>
<tag>--mc</tag>
<item>
<p>The MODULE-COMPLIANCE field will be included. </p>
+ <marker id="option_ac"></marker>
</item>
<tag>--ac</tag>
<item>
<p>The AGENT-CAPABILITIES field will be included. </p>
+ <marker id="option_mod"></marker>
</item>
<tag>--mod <em>module</em></tag>
@@ -157,6 +184,7 @@
<p>The module which implements all the instrumentation functions. </p>
<p>The name of all instrumentation functions must be the
same as the corresponding managed object it implements. </p>
+ <marker id="option_nd"></marker>
</item>
<tag>--nd</tag>
@@ -165,6 +193,7 @@
used if a managed object have no instrumentation function.
Instead this will be reported as an error, and the compilation
aborts. </p>
+ <marker id="option_rrnac"></marker>
</item>
<tag>--rrnac</tag>
@@ -176,6 +205,7 @@
This means that the error will be converted to a warning. </p>
<p>By default it is not included, but if this option is present
it will be. </p>
+ <marker id="see_also"></marker>
</item>
</taglist>
@@ -183,7 +213,7 @@
<section>
<title>SEE ALSO</title>
- <p><seealso marker="erlc">erlc(1)</seealso>,
+ <p><seealso marker="erts:erlc">erlc(1)</seealso>,
<seealso marker="compiler:compile">compile(3)</seealso>,
<seealso marker="snmp:snmpc">snmpc(3)</seealso></p>
</section>
diff --git a/lib/snmp/doc/src/snmpm.xml b/lib/snmp/doc/src/snmpm.xml
index 1ee391d9ba..c36a1b2a24 100644
--- a/lib/snmp/doc/src/snmpm.xml
+++ b/lib/snmp/doc/src/snmpm.xml
@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="latin1" ?>
+<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">
<erlref>
<header>
<copyright>
- <year>2004</year><year>2010</year>
+ <year>2004</year><year>2011</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -63,6 +63,10 @@ value_type() = o ('OBJECT IDENTIFIER') |
c64 ('Counter64') |
tt ('TimeTicks')
value() = term()
+community() = string()
+sec_model() = any | v1 | v2c | usm
+sec_name() = string()
+sec_level() = noAuthNoPriv | authNoPriv | authPriv
]]></code>
<marker id="monitor"></marker>
@@ -279,27 +283,27 @@ sec_level = noAuthNoPriv | authNoPriv | authPriv
<v>TargetName = target_name()</v>
<v>Config = [agent_config()]</v>
<v>agent_config() = {Item, Val}</v>
- <v>Item = engine_id | address | port | community | timeout | max_message_size | version | sec_model | sec_name | sec_level</v>
+ <v>Item = engine_id | address | port | community | timeout | max_message_size | version | sec_model | sec_name | sec_level | tdomain</v>
<v>Val = term()</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Explicitly instruct the manager to handle this agent, with
- <c>UserId</c> as the responsible user. </p>
- <p>Called to instruct the manager that this agent
- shall be handled. This function is used when
- the user knows in advance which agents the
- manager shall handle.
- Note that there is an alternate way to do the same thing:
- Add the agent to the manager config files (see
- <seealso marker="snmp_manager_config_files#agents">agents.conf</seealso>).</p>
+ <c>UserId</c> as the responsible user. </p>
+ <p>Called to instruct the manager that this agent shall be handled.
+ This function is used when the user knows in advance which agents
+ the manager shall handle.
+ Note that there is an alternate way to do the same thing:
+ Add the agent to the manager config files (see
+ <seealso marker="snmp_manager_config_files#agents">agents.conf</seealso>).</p>
<p><c>TargetName</c> is a non-empty string,
- uniquely identifying the agent. </p>
- <p>The type of <c>Val</c> depends on <c>Item</c>: </p>
+ uniquely identifying the agent. </p>
+ <p>The type of <c>Val</c> depends on <c>Item</c>: </p>
<code type="none"><![CDATA[
[mandatory] engine_id = string()
[mandatory] address = ip_address()
[optional] port = integer()
+[optional] tdomain = transportDomainUdpIpv4 | transportDomainUdpIpv6
[optional] community = string()
[optional] timeout = integer() | snmp_timer()
[optional] max_message_size = integer()
@@ -308,7 +312,9 @@ sec_level = noAuthNoPriv | authNoPriv | authPriv
[optional] sec_name = string()
[optional] sec_level = noAuthNoPriv | authNoPriv | authPriv
]]></code>
- <p>Note that if no <c>Port</c> is given, the default value is used.</p>
+ <p>Note that if no <c>tdomain</c> is given, the default value,
+ <c>transportDomainUdpIpv4</c>, is used.</p>
+ <p>Note that if no <c>port</c> is given, the default value is used.</p>
<marker id="unregister_agent"></marker>
</desc>
@@ -344,17 +350,25 @@ sec_level = noAuthNoPriv | authNoPriv | authPriv
</func>
<func>
+ <name>update_agent_info(UserId, TargetName, Info) -> ok | {error, Reason}</name>
<name>update_agent_info(UserId, TargetName, Item, Val) -> ok | {error, Reason}</name>
<fsummary>Update agent config</fsummary>
<type>
<v>UserId = term()</v>
<v>TargetName = target_name()</v>
- <v>Item = atom()</v>
- <v>Val = term()</v>
+ <v>Info = [{item(), item_value()}]</v>
+ <v>Item = item()</v>
+ <v>item() = atom()</v>
+ <v>Val = item_value()</v>
+ <v>item_value() = term()</v>
<v>Reason = term()</v>
</type>
<desc>
- <p>Update agent config.</p>
+ <p>Update agent config. The function <c>update_agent_info/3</c>
+ should be used when several values needs to be updated atomically. </p>
+ <p>See function
+ <seealso marker="#register_agent">register_agent</seealso>)
+ for more info about what kind of items are allowed. </p>
<marker id="which_agents"></marker>
</desc>
@@ -482,11 +496,65 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1
<p>Get a list of all registered usm users with engine-id
<c>EngineID</c>.</p>
- <marker id="sync_get"></marker>
+ <marker id="sync_get2"></marker>
</desc>
</func>
<func>
+ <name>sync_get2(UserId, TargetName, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
+ <name>sync_get2(UserId, TargetName, Oids, SendOpts) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
+ <fsummary>Synchronous <c>get-request</c></fsummary>
+ <type>
+ <v>UserId = term()</v>
+ <v>TargetName = target_name()</v>
+ <v>Oids = [oid()]</v>
+ <v>SendOpts = send_opts()</v>
+ <v>send_opts() = [send_opt()]</v>
+ <v>send_opt() = {context, string()} | {timeout, pos_integer()} | {extra, term()} | {community, community()} | {sec_model, sec_model()} | {sec_name, string()} | {sec_level, sec_level()} | {max_message_size, pos_integer()}</v>
+ <v>SnmpReply = snmp_reply()</v>
+ <v>Remaining = integer()</v>
+ <v>Reason = {send_failed, ReqId, ActualReason} | {invalid_sec_info, SecInfo, SnmpInfo} | term()</v>
+ <v>ReqId = term()</v>
+ <v>ActualReason = term()</v>
+ <v>SecInfo = [sec_info()]</v>
+ <v>sec_info() = {sec_tag(), ExpectedValue, ReceivedValue}</v>
+ <v>sec_tag() = atom()</v>
+ <v>ExpectedValue = ReceivedValue = term()</v>
+ <v>SnmpInfo = term()</v>
+ </type>
+ <desc>
+ <p>Synchronous <c>get-request</c>. </p>
+
+ <p><c>Remaining</c> is the remaining time of the given (or default)
+ timeout time.</p>
+
+ <p>When <em>Reason</em> is <em>{send_failed, ...}</em> it means that
+ the net_if process failed to send the message. This could happen
+ because of any number of reasons, i.e. encoding error.
+ <em>ActualReason</em> is the actual reason in this case. </p>
+
+ <p>The send option <c>extra</c> specifies an opaque data structure
+ passed on to the net-if process. The net-if process included in this
+ application makes, with one exception, no use of this info,
+ so the only use for it in such a option (when using the built in
+ net-if) would be tracing. The one usage exception is:
+ <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
+ element is reserved for internal use. </p>
+
+ <p>Some of the send options (<c>community</c>, <c>sec_model</c>,
+ <c>sec_name</c>, <c>sec_level</c> and <c>max_message_size</c>)
+ are <c>override options</c>. That is,
+ for <em>this</em> request, they override any configuration done
+ when the agent was registered. </p>
+
+ <p>For <c>SnmpInfo</c>, see the user callback function
+ <seealso marker="snmpm_user#handle_report">handle_report</seealso>.</p>
+
+ <marker id="sync_get"></marker>
+ </desc>
+ </func>
+
+ <func>
<name>sync_get(UserId, TargetName, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
<name>sync_get(UserId, TargetName, ContextName, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
<name>sync_get(UserId, TargetName, Oids, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
@@ -513,19 +581,63 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1
<desc>
<p>Synchronous <c>get-request</c>. </p>
<p><c>Remaining</c> is the remaining time of the given or
- default timeout time.</p>
+ default timeout time.</p>
<p>When <em>Reason</em> is <em>{send_failed, ...}</em> it means that
- the net_if process failed to send the message. This could happen
- because of any number of reasons, i.e. encoding error. <em>R</em>
- is the actual reason in this case. </p>
- <p><c>ExtraInfo</c> is an opaque data structure passed on to
- the net-if process. The net-if process included in this
- application makes no use of this info, so the only use for it
- in such a configuration (when using the built in net-if) would
- be tracing.</p>
+ the net_if process failed to send the message. This could happen
+ because of any number of reasons, i.e. encoding error. <em>R</em>
+ is the actual reason in this case. </p>
+ <p><c>ExtraInfo</c> is an opaque data structure passed on to
+ the net-if process. The net-if process included in this
+ application makes, with one exception, no use of this info,
+ so the only use for it in such a configuration (when using the
+ built in net-if) would be tracing. The one usage exception is:
+ <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
+ element is reserved for internal use. </p>
<p>For <c>SnmpInfo</c>, see the user callback function
<seealso marker="snmpm_user#handle_report">handle_report</seealso>.</p>
+ <marker id="async_get2"></marker>
+ </desc>
+ </func>
+
+ <func>
+ <name>async_get2(UserId, TargetName, Oids) -> {ok, ReqId} | {error, Reason}</name>
+ <name>async_get2(UserId, TargetName, Oids, SendOpts) -> {ok, ReqId} | {error, Reason}</name>
+ <fsummary>Asynchronous <c>get-request</c></fsummary>
+ <type>
+ <v>UserId = term()</v>
+ <v>TargetName = target_name()</v>
+ <v>Oids = [oid()]</v>
+ <v>SendOpts = send_opts()</v>
+ <v>send_opts() = [send_opt()]</v>
+ <v>send_opt() = {context, string()} | {timeout, pos_integer()} | {extra, term()} | {community, community()} | {sec_model, sec_model()} | {sec_name, string()} | {sec_level, sec_level()} | {max_message_size, pos_integer()}</v>
+ <v>ReqId = term()</v>
+ <v>Reason = term()</v>
+ </type>
+ <desc>
+ <p>Asynchronous <c>get-request</c>.</p>
+
+ <p>The reply, if it arrives, will be delivered to the user
+ through a call to the snmpm_user callback function
+ <c>handle_pdu</c>.</p>
+
+ <p>The send option <c>timeout</c> specifies for how long the request is
+ valid (after which the manager is free to delete it).</p>
+
+ <p>The send option <c>extra</c> specifies an opaque data structure
+ passed on to the net-if process. The net-if process included in this
+ application makes, with one exception, no use of this info,
+ so the only use for it in such a option (when using the built in
+ net-if) would be tracing. The one usage exception is:
+ <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
+ element is reserved for internal use. </p>
+
+ <p>Some of the send options (<c>community</c>, <c>sec_model</c>,
+ <c>sec_name</c>, <c>sec_level</c> and <c>max_message_size</c>)
+ are <c>override options</c>. That is,
+ for <em>this</em> request, they override any configuration done
+ when the agent was registered. </p>
+
<marker id="async_get"></marker>
</desc>
</func>
@@ -550,17 +662,73 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1
<desc>
<p>Asynchronous <c>get-request</c>.</p>
<p>The reply, if it arrives, will be delivered to the user
- through a call to the snmpm_user callback function
- <c>handle_pdu</c>.</p>
- <p>The <c>Expire</c> time indicates for how long the request is
- valid (after which the manager is free to delete it).</p>
- <p><c>ExtraInfo</c> is an opaque data structure passed on to
- the net-if process. The net-if process included in this
- application makes no use of this info, so the only use for it
- in such a configuration (when using the built in net-if) would
- be tracing.</p>
-
- <marker id="sync_get_next"></marker>
+ through a call to the snmpm_user callback function
+ <c>handle_pdu</c>.</p>
+ <p>The <c>Expire</c> time indicates for how long the request is
+ valid (after which the manager is free to delete it).</p>
+ <p><c>ExtraInfo</c> is an opaque data structure passed on to
+ the net-if process. The net-if process included in this
+ application makes, with one exception, no use of this info,
+ so the only use for it in such a configuration (when using the
+ built in net-if) would be tracing. The one usage exception is:
+ <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
+ element is reserved for internal use. </p>
+
+ <marker id="sync_get_next2"></marker>
+ </desc>
+ </func>
+
+ <func>
+ <name>sync_get_next2(UserId, TargetName, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
+ <name>sync_get_next2(UserId, TargetName, Oids, SendOpts) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
+ <fsummary>Synchronous <c>get-next-request</c></fsummary>
+ <type>
+ <v>UserId = term()</v>
+ <v>TargetName = target_name()</v>
+ <v>Oids = [oid()]</v>
+ <v>SendOpts = send_opts()</v>
+ <v>send_opts() = [send_opt()]</v>
+ <v>send_opt() = {context, string()} | {timeout, pos_integer()} | {extra, term()} | {community, community()} | {sec_model, sec_model()} | {sec_name, string()} | {sec_level, sec_level()} | {max_message_size, pos_integer()}</v>
+ <v>SnmpReply = snmp_reply()</v>
+ <v>Remaining = integer()</v>
+ <v>Reason = {send_failed, ReqId, ActualReason} | {invalid_sec_info, SecInfo, SnmpInfo} | term()</v>
+ <v>ReqId = term()</v>
+ <v>ActualReason = term()</v>
+ <v>SecInfo = [sec_info()]</v>
+ <v>sec_info() = {sec_tag(), ExpectedValue, ReceivedValue}</v>
+ <v>sec_tag() = atom()</v>
+ <v>ExpectedValue = ReceivedValue = term()</v>
+ <v>SnmpInfo = term()</v>
+ </type>
+ <desc>
+ <p>Synchronous <c>get-next-request</c>. </p>
+
+ <p><c>Remaining</c> is the remaining time of the given (or default)
+ timeout time.</p>
+
+ <p>When <em>Reason</em> is <em>{send_failed, ...}</em> it means that
+ the net_if process failed to send the message. This could happen
+ because of any number of reasons, i.e. encoding error.
+ <em>ActualReason</em> is the actual reason in this case. </p>
+
+ <p>The send option <c>extra</c> specifies an opaque data structure
+ passed on to the net-if process. The net-if process included in this
+ application makes, with one exception, no use of this info,
+ so the only use for it in such a option (when using the built in
+ net-if) would be tracing. The one usage exception is:
+ <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
+ element is reserved for internal use. </p>
+
+ <p>Some of the send options (<c>community</c>, <c>sec_model</c>,
+ <c>sec_name</c>, <c>sec_level</c> and <c>max_message_size</c>)
+ are <c>override options</c>. That is,
+ for <em>this</em> request, they override any configuration done
+ when the agent was registered. </p>
+
+ <p>For <c>SnmpInfo</c>, see the user callback function
+ <seealso marker="snmpm_user#handle_report">handle_report</seealso>.</p>
+
+ <marker id="sync_get_next"></marker>
</desc>
</func>
@@ -587,16 +755,57 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1
<p>Synchronous <c>get-next-request</c>. </p>
<p><c>Remaining</c> time of the given or default timeout time.</p>
<p>When <em>Reason</em> is <em>{send_failed, ...}</em> it means that
- the net_if process failed to send the message. This could happen
- because of any number of reasons, i.e. encoding error. <em>R</em>
- is the actual reason in this case. </p>
- <p><c>ExtraInfo</c> is an opaque data structure passed on to
- the net-if process. The net-if process included in this
- application makes no use of this info, so the only use for it
- in such a configuration (when using the built in net-if) would
- be tracing.</p>
-
- <marker id="async_get_next"></marker>
+ the net_if process failed to send the message. This could happen
+ because of any number of reasons, i.e. encoding error. <em>R</em>
+ is the actual reason in this case. </p>
+ <p><c>ExtraInfo</c> is an opaque data structure passed on to
+ the net-if process. The net-if process included in this
+ application makes, with one exception, no use of this info,
+ so the only use for it in such a configuration (when using the
+ built in net-if) would be tracing. The one usage exception is:
+ <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
+ element is reserved for internal use. </p>
+
+ <marker id="async_get_next2"></marker>
+ </desc>
+ </func>
+
+ <func>
+ <name>async_get_next2(UserId, TargetName, Oids) -> {ok, ReqId} | {error, Reason}</name>
+ <name>async_get_next2(UserId, TargetName, Oids, SendOpts) -> {ok, ReqId} | {error, Reason}</name>
+ <fsummary>Asynchronous <c>get-next-request</c></fsummary>
+ <type>
+ <v>UserId = term()</v>
+ <v>TargetName = target_name()</v>
+ <v>Oids = [oid()]</v>
+ <v>send_opt() = {context, string()} | {timeout, pos_integer()} | {extra, term()} | {community, community()} | {sec_model, sec_model()} | {sec_name, string()} | {sec_level, sec_level()} | {max_message_size, pos_integer()}</v>
+ <v>ReqId = integer()</v>
+ <v>Reason = term()</v>
+ </type>
+ <desc>
+ <p>Asynchronous <c>get-next-request</c>. </p>
+
+ <p>The reply will be delivered to the user through a call
+ to the snmpm_user callback function <c>handle_pdu</c>.</p>
+
+ <p>The send option <c>timeout</c> specifies for how long the request is
+ valid (after which the manager is free to delete it).</p>
+
+ <p>The send option <c>extra</c> specifies an opaque data structure
+ passed on to the net-if process. The net-if process included in this
+ application makes, with one exception, no use of this info,
+ so the only use for it in such a option (when using the built in
+ net-if) would be tracing. The one usage exception is:
+ <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
+ element is reserved for internal use. </p>
+
+ <p>Some of the send options (<c>community</c>, <c>sec_model</c>,
+ <c>sec_name</c>, <c>sec_level</c> and <c>max_message_size</c>)
+ are <c>override options</c>. That is,
+ for <em>this</em> request, they override any configuration done
+ when the agent was registered. </p>
+
+ <marker id="async_get_next"></marker>
</desc>
</func>
@@ -620,11 +829,75 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1
<desc>
<p>Asynchronous <c>get-next-request</c>. </p>
<p>The reply will be delivered to the user through a call
- to the snmpm_user callback function <c>handle_pdu</c>.</p>
+ to the snmpm_user callback function <c>handle_pdu</c>.</p>
<p>The <c>Expire</c> time indicates for how long the request is
- valid (after which the manager is free to delete it).</p>
+ valid (after which the manager is free to delete it).</p>
+ <p><c>ExtraInfo</c> is an opaque data structure passed on to
+ the net-if process. The net-if process included in this
+ application makes, with one exception, no use of this info,
+ so the only use for it in such a configuration (when using the
+ built in net-if) would be tracing. The one usage exception is:
+ <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
+ element is reserved for internal use. </p>
+
+ <marker id="sync_set2"></marker>
+ </desc>
+ </func>
- <marker id="sync_set"></marker>
+ <func>
+ <name>sync_set2(UserId, TargetName, VarsAndVals) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
+ <name>sync_set2(UserId, TargetName, VarsAndVals, SendOpts) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
+ <fsummary>Synchronous <c>set-request</c></fsummary>
+ <type>
+ <v>UserId = term()</v>
+ <v>TargetName = target_name()</v>
+ <v>VarsAndVals = vars_and_vals()</v>
+ <v>SendOpts = send_opts()</v>
+ <v>send_opts() = [send_opt()]</v>
+ <v>send_opt() = {context, string()} | {timeout, pos_integer()} | {extra, term()} | {community, community()} | {sec_model, sec_model()} | {sec_name, string()} | {sec_level, sec_level()} | {max_message_size, pos_integer()}</v>
+ <v>SnmpReply = snmp_reply()</v>
+ <v>Remaining = integer()</v>
+ <v>Reason = {send_failed, ReqId, ActualReason} | {invalid_sec_info, SecInfo, SnmpInfo} | term()</v>
+ <v>ReqId = term()</v>
+ <v>ActualReason = term()</v>
+ <v>SecInfo = [sec_info()]</v>
+ <v>sec_info() = {sec_tag(), ExpectedValue, ReceivedValue}</v>
+ <v>sec_tag() = atom()</v>
+ <v>ExpectedValue = ReceivedValue = term()</v>
+ <v>SnmpInfo = term()</v>
+ </type>
+ <desc>
+ <p>Synchronous <c>set-request</c>. </p>
+
+ <p><c>Remaining</c> is the remaining time of the given (or default)
+ timeout time.</p>
+
+ <p>When <em>Reason</em> is <em>{send_failed, ...}</em> it means that
+ the net_if process failed to send the message. This could happen
+ because of any number of reasons, i.e. encoding error.
+ <em>ActualReason</em> is the actual reason in this case. </p>
+
+ <p>When <em>var_and_val()</em> is <em>{oid(), value()}</em>, the
+ manager makes an educated guess based on the loaded mibs. </p>
+
+ <p>The send option <c>extra</c> specifies an opaque data structure
+ passed on to the net-if process. The net-if process included in this
+ application makes, with one exception, no use of this info,
+ so the only use for it in such a option (when using the built in
+ net-if) would be tracing. The one usage exception is:
+ <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
+ element is reserved for internal use. </p>
+
+ <p>Some of the send options (<c>community</c>, <c>sec_model</c>,
+ <c>sec_name</c>, <c>sec_level</c> and <c>max_message_size</c>)
+ are <c>override options</c>. That is,
+ for <em>this</em> request, they override any configuration done
+ when the agent was registered. </p>
+
+ <p>For <c>SnmpInfo</c>, see the user callback function
+ <seealso marker="snmpm_user#handle_report">handle_report</seealso>.</p>
+
+ <marker id="sync_set"></marker>
</desc>
</func>
@@ -651,18 +924,64 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1
<p>Synchronous <c>set-request</c>. </p>
<p><c>Remaining</c> time of the given or default timeout time.</p>
<p>When <em>Reason</em> is <em>{send_failed, ...}</em> it means that
- the net_if process failed to send the message. This could happen
- because of any number of reasons, i.e. encoding error. <em>R</em>
- is the actual reason in this case. </p>
- <p>When <em>var_and_val()</em> is <em>{oid(), value()}</em>, the
- manager makes an educated guess based on the loaded mibs. </p>
- <p><c>ExtraInfo</c> is an opaque data structure passed on to
- the net-if process. The net-if process included in this
- application makes no use of this info, so the only use for it
- in such a configuration (when using the built in net-if) would
- be tracing.</p>
-
- <marker id="async_set"></marker>
+ the net_if process failed to send the message. This could happen
+ because of any number of reasons, i.e. encoding error. <em>R</em>
+ is the actual reason in this case. </p>
+ <p>When <em>var_and_val()</em> is <em>{oid(), value()}</em>, the
+ manager makes an educated guess based on the loaded mibs. </p>
+ <p><c>ExtraInfo</c> is an opaque data structure passed on to
+ the net-if process. The net-if process included in this
+ application makes, with one exception, no use of this info,
+ so the only use for it in such a configuration (when using the
+ built in net-if) would be tracing. The one usage exception is:
+ <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
+ element is reserved for internal use. </p>
+
+ <marker id="async_set2"></marker>
+ </desc>
+ </func>
+
+ <func>
+ <name>async_set2(UserId, TargetName, VarsAndVals) -> {ok, ReqId} | {error, Reason}</name>
+ <name>async_set2(UserId, TargetName, VarsAndVals, SendOpts) -> {ok, ReqId} | {error, Reason}</name>
+ <fsummary>Asynchronous <c>set-request</c></fsummary>
+ <type>
+ <v>UserId = term()</v>
+ <v>TargetName = target_name()</v>
+ <v>VarsAndVals = vars_and_vals()</v>
+ <v>SendOpts = send_opts()</v>
+ <v>send_opts() = [send_opt()]</v>
+ <v>send_opt() = {context, string()} | {timeout, pos_integer()} | {extra, term()} | {community, community()} | {sec_model, sec_model()} | {sec_name, string()} | {sec_level, sec_level()} | {max_message_size, pos_integer()}</v>
+ <v>ReqId = term()</v>
+ <v>Reason = term()</v>
+ </type>
+ <desc>
+ <p>Asynchronous <c>set-request</c>. </p>
+
+ <p>The reply will be delivered to the user through a call
+ to the snmpm_user callback function <c>handle_pdu</c>.</p>
+
+ <p>The send option <c>timeout</c> specifies for how long the request is
+ valid (after which the manager is free to delete it).</p>
+
+ <p>When <em>var_and_val()</em> is <em>{oid(), value()}</em>, the
+ manager makes an educated guess based on the loaded mibs. </p>
+
+ <p>The send option <c>extra</c> specifies an opaque data structure
+ passed on to the net-if process. The net-if process included in this
+ application makes, with one exception, no use of this info,
+ so the only use for it in such a option (when using the built in
+ net-if) would be tracing. The one usage exception is:
+ <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
+ element is reserved for internal use. </p>
+
+ <p>Some of the send options (<c>community</c>, <c>sec_model</c>,
+ <c>sec_name</c>, <c>sec_level</c> and <c>max_message_size</c>)
+ are <c>override options</c>. That is,
+ for <em>this</em> request, they override any configuration done
+ when the agent was registered. </p>
+
+ <marker id="async_set"></marker>
</desc>
</func>
@@ -685,18 +1004,76 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1
<desc>
<p>Asynchronous <c>set-request</c>. </p>
<p>The reply will be delivered to the user through a call
- to the snmpm_user callback function <c>handle_pdu</c>.</p>
+ to the snmpm_user callback function <c>handle_pdu</c>.</p>
<p>The <c>Expire</c> time indicates for how long the request is
- valid (after which the manager is free to delete it).</p>
- <p>When <em>var_and_val()</em> is <em>{oid(), value()}</em>, the
- manager makes an educated guess based on the loaded mibs. </p>
- <p><c>ExtraInfo</c> is an opaque data structure passed on to
- the net-if process. The net-if process included in this
- application makes no use of this info, so the only use for it
- in such a configuration (when using the built in net-if) would
- be tracing.</p>
-
- <marker id="sync_get_bulk"></marker>
+ valid (after which the manager is free to delete it).</p>
+ <p>When <em>var_and_val()</em> is <em>{oid(), value()}</em>, the
+ manager makes an educated guess based on the loaded mibs. </p>
+ <p><c>ExtraInfo</c> is an opaque data structure passed on to
+ the net-if process. The net-if process included in this
+ application makes, with one exception, no use of this info,
+ so the only use for it in such a configuration (when using the
+ built in net-if) would be tracing. The one usage exception is:
+ <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
+ element is reserved for internal use. </p>
+
+ <marker id="sync_get_bulk2"></marker>
+ </desc>
+ </func>
+
+ <func>
+ <name>sync_get_bulk2(UserId, TragetName, NonRep, MaxRep, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
+ <name>sync_get_bulk2(UserId, TragetName, NonRep, MaxRep, Oids, SendOpts) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
+ <fsummary>Synchronous <c>get-bulk-request</c></fsummary>
+ <type>
+ <v>UserId = term()</v>
+ <v>TargetName = target_name()</v>
+ <v>NonRep = integer()</v>
+ <v>MaxRep = integer()</v>
+ <v>Oids = [oid()]</v>
+ <v>SendOpts = send_opts()</v>
+ <v>send_opts() = [send_opt()]</v>
+ <v>send_opt() = {context, string()} | {timeout, pos_integer()} | {extra, term()} | {community, community()} | {sec_model, sec_model()} | {sec_name, string()} | {sec_level, sec_level()} | {max_message_size, pos_integer()}</v>
+ <v>SnmpReply = snmp_reply()</v>
+ <v>Remaining = integer()</v>
+ <v>Reason = {send_failed, ReqId, ActualReason} | {invalid_sec_info, SecInfo, SnmpInfo} | term()</v>
+ <v>ReqId = term()</v>
+ <v>ActualReason = term()</v>
+ <v>SecInfo = [sec_info()]</v>
+ <v>sec_info() = {sec_tag(), ExpectedValue, ReceivedValue}</v>
+ <v>sec_tag() = atom()</v>
+ <v>ExpectedValue = ReceivedValue = term()</v>
+ <v>SnmpInfo = term()</v>
+ </type>
+ <desc>
+ <p>Synchronous <c>get-bulk-request</c> (See RFC1905).</p>
+
+ <p><c>Remaining</c> is the remaining time of the given (or default)
+ timeout time.</p>
+
+ <p>When <em>Reason</em> is <em>{send_failed, ...}</em> it means that
+ the net_if process failed to send the message. This could happen
+ because of any number of reasons, i.e. encoding error.
+ <em>ActualReason</em> is the actual reason in this case. </p>
+
+ <p>The send option <c>extra</c> specifies an opaque data structure
+ passed on to the net-if process. The net-if process included in this
+ application makes, with one exception, no use of this info,
+ so the only use for it in such a option (when using the built in
+ net-if) would be tracing. The one usage exception is:
+ <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
+ element is reserved for internal use. </p>
+
+ <p>Some of the send options (<c>community</c>, <c>sec_model</c>,
+ <c>sec_name</c>, <c>sec_level</c> and <c>max_message_size</c>)
+ are <c>override options</c>. That is,
+ for <em>this</em> request, they override any configuration done
+ when the agent was registered. </p>
+
+ <p>For <c>SnmpInfo</c>, see the user callback function
+ <seealso marker="snmpm_user#handle_report">handle_report</seealso>.</p>
+
+ <marker id="sync_get_bulk"></marker>
</desc>
</func>
@@ -723,17 +1100,60 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1
<desc>
<p>Synchronous <c>get-bulk-request</c> (See RFC1905).</p>
<p><c>Remaining</c> time of the given or default timeout time.</p>
- <p>When <em>Reason</em> is <em>{send_failed, ...}</em> it means that
- the net_if process failed to send the message. This could happen
- because of any number of reasons, i.e. encoding error. <em>R</em>
- is the actual reason in this case. </p>
- <p><c>ExtraInfo</c> is an opaque data structure passed on to
- the net-if process. The net-if process included in this
- application makes no use of this info, so the only use for it
- in such a configuration (when using the built in net-if) would
- be tracing.</p>
-
- <marker id="async_get_bulk"></marker>
+ <p>When <em>Reason</em> is <em>{send_failed, ...}</em> it means that
+ the net_if process failed to send the message. This could happen
+ because of any number of reasons, i.e. encoding error. <em>R</em>
+ is the actual reason in this case. </p>
+ <p><c>ExtraInfo</c> is an opaque data structure passed on to
+ the net-if process. The net-if process included in this
+ application makes, with one exception, no use of this info,
+ so the only use for it in such a configuration (when using the
+ built in net-if) would be tracing. The one usage exception is:
+ <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
+ element is reserved for internal use. </p>
+
+ <marker id="async_get_bulk2"></marker>
+ </desc>
+ </func>
+
+ <func>
+ <name>async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids) -> {ok, ReqId} | {error, Reason}</name>
+ <name>async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts) -> {ok, ReqId} | {error, Reason}</name>
+ <fsummary>Asynchronous <c>get-bulk-request</c></fsummary>
+ <type>
+ <v>UserId = term()</v>
+ <v>TargetName = target_name()</v>
+ <v>NonRep = integer()</v>
+ <v>MaxRep = integer()</v>
+ <v>Oids = [oid()]</v>
+ <v>SendOpts = send_opts()</v>
+ <v>send_opts() = [send_opt()]</v>
+ <v>send_opt() = {context, string()} | {timeout, pos_integer()} | {extra, term()} | {community, community()} | {sec_model, sec_model()} | {sec_name, string()} | {sec_level, sec_level()} | {max_message_size, pos_integer()}</v>
+ <v>ReqId = integer()</v>
+ <v>Reason = term()</v>
+ </type>
+ <desc>
+ <p>Asynchronous <c>get-bulk-request</c> (See RFC1905).</p>
+
+ <p>The reply will be delivered to the user through a call
+ to the snmpm_user callback function <c>handle_pdu</c>.</p>
+
+ <p>The send option <c>timeout</c> specifies for how long the request is
+ valid (after which the manager is free to delete it).</p>
+
+ <p>The send option <c>extra</c> specifies an opaque data structure
+ passed on to the net-if process. The net-if process included in this
+ application makes no use of this info, so the only use for it
+ in such a configuration (when using the built in net-if) would
+ be tracing.</p>
+
+ <p>Some of the send options (<c>community</c>, <c>sec_model</c>,
+ <c>sec_name</c>, <c>sec_level</c> and <c>max_message_size</c>)
+ are <c>override options</c>. That is,
+ for <em>this</em> request, they override any configuration done
+ when the agent was registered. </p>
+
+ <marker id="async_get_bulk"></marker>
</desc>
</func>
@@ -759,9 +1179,16 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1
<desc>
<p>Asynchronous <c>get-bulk-request</c> (See RFC1905).</p>
<p>The reply will be delivered to the user through a call
- to the snmpm_user callback function <c>handle_pdu</c>.</p>
+ to the snmpm_user callback function <c>handle_pdu</c>.</p>
<p>The <c>Expire</c> time indicates for how long the request is
- valid (after which the manager is free to delete it).</p>
+ valid (after which the manager is free to delete it).</p>
+ <p><c>ExtraInfo</c> is an opaque data structure passed on to
+ the net-if process. The net-if process included in this
+ application makes, with one exception, no use of this info,
+ so the only use for it in such a configuration (when using the
+ built in net-if) would be tracing. The one usage exception is:
+ <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
+ element is reserved for internal use. </p>
<marker id="cancel_async_request"></marker>
</desc>
diff --git a/lib/snmp/mibs/Makefile.in b/lib/snmp/mibs/Makefile.in
index 7aefb0ea34..993a67c6f2 100644
--- a/lib/snmp/mibs/Makefile.in
+++ b/lib/snmp/mibs/Makefile.in
@@ -41,8 +41,7 @@ RELSYSDIR = $(RELEASE_PATH)/lib/snmp-$(VSN)
# ----------------------------------------------------
# NOTE:
-# 1) Order is important; some MIBs include others
-# 2) The OTP-REG mib actually belongs to another
+# The OTP-REG mib actually belongs to another
# application (otp_mibs), and is exported by this
# app. But since that app is built later, we have
# to built it here in order to be able to build
@@ -61,7 +60,8 @@ MIBS_A = \
SNMP-USER-BASED-SM-MIB \
SNMP-VIEW-BASED-ACM-MIB \
SNMP-USM-AES-MIB \
- INET-ADDRESS-MIB
+ INET-ADDRESS-MIB \
+ TRANSPORT-ADDRESS-MIB
MIBS_B = OTP-SNMPEA-MIB
@@ -147,6 +147,35 @@ $(ERL_TOP)/lib/snmp/bin/snmp-v2tov1: $(ERL_TOP)/lib/snmp/bin/snmp-v2tov1.src
$(SNMP_BIN_TARGET_DIR)/OTP-REG.bin: $(ERL_TOP)/lib/$(OTP_MIBDIR)/mibs/OTP-REG.mib
$(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) -o $(SNMP_BIN_TARGET_DIR) $<
+# To support parallel make, we'll need explicit dependencies
+# to ensure that an imported MIB has been compiled when it's needed.
+
+$(SNMP_BIN_TARGET_DIR)/STANDARD-MIB.bin: \
+ $(SNMP_BIN_TARGET_DIR)/RFC1213-MIB.bin
+
+$(SNMP_BIN_TARGET_DIR)/SNMP-TARGET-MIB.bin: \
+ $(SNMP_BIN_TARGET_DIR)/SNMP-FRAMEWORK-MIB.bin
+
+$(SNMP_BIN_TARGET_DIR)/SNMP-NOTIFICATION-MIB.bin: \
+ $(SNMP_BIN_TARGET_DIR)/SNMP-FRAMEWORK-MIB.bin \
+ $(SNMP_BIN_TARGET_DIR)/SNMP-TARGET-MIB.bin
+
+$(SNMP_BIN_TARGET_DIR)/SNMP-COMMUNITY-MIB.bin: \
+ $(SNMP_BIN_TARGET_DIR)/SNMP-FRAMEWORK-MIB.bin \
+ $(SNMP_BIN_TARGET_DIR)/SNMP-TARGET-MIB.bin
+
+$(SNMP_BIN_TARGET_DIR)/SNMP-USER-BASED-SM-MIB.bin: \
+ $(SNMP_BIN_TARGET_DIR)/SNMP-FRAMEWORK-MIB.bin
+
+$(SNMP_BIN_TARGET_DIR)/SNMP-VIEW-BASED-ACM-MIB.bin: \
+ $(SNMP_BIN_TARGET_DIR)/SNMP-FRAMEWORK-MIB.bin
+
+$(SNMP_BIN_TARGET_DIR)/SNMP-USM-AES-MIB.bin: \
+ $(SNMP_BIN_TARGET_DIR)/SNMP-FRAMEWORK-MIB.bin
+
+$(SNMP_BIN_TARGET_DIR)/OTP-SNMPEA-MIB.bin: \
+ $(SNMP_BIN_TARGET_DIR)/OTP-REG.bin
+
clean:
rm -f $(TARGET_FILES)
@@ -184,7 +213,7 @@ info:
@echo "VSN = $(VSN)"
@echo "RELSYSDIR = $(RELSYSDIR)"
-v1/%.mib.v1: %.mib
+v1/%.mib.v1: %.mib $(ERL_TOP)/lib/snmp/bin/snmp-v2tov1
$(ERL_TOP)/lib/snmp/bin/snmp-v2tov1 -o $@ $<
diff --git a/lib/snmp/mibs/TRANSPORT-ADDRESS-MIB.mib b/lib/snmp/mibs/TRANSPORT-ADDRESS-MIB.mib
new file mode 100644
index 0000000000..7d450fbc2a
--- /dev/null
+++ b/lib/snmp/mibs/TRANSPORT-ADDRESS-MIB.mib
@@ -0,0 +1,417 @@
+TRANSPORT-ADDRESS-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+ MODULE-IDENTITY, OBJECT-IDENTITY, mib-2 FROM SNMPv2-SMI
+ TEXTUAL-CONVENTION FROM SNMPv2-TC;
+
+transportAddressMIB MODULE-IDENTITY
+ LAST-UPDATED "200211010000Z"
+ ORGANIZATION
+ "IETF Operations and Management Area"
+ CONTACT-INFO
+ "Juergen Schoenwaelder (Editor)
+ TU Braunschweig
+ Bueltenweg 74/75
+ 38106 Braunschweig, Germany
+ Phone: +49 531 391-3289
+
+ Send comments to <[email protected]>."
+ DESCRIPTION
+ "This MIB module provides commonly used transport
+ address definitions.
+
+ Copyright (C) The Internet Society (2002). This version of
+ this MIB module is part of RFC 3419; see the RFC itself for
+ full legal notices."
+
+ -- Revision log
+
+ REVISION "200211010000Z"
+ DESCRIPTION
+ "Initial version, published as RFC 3419."
+ ::= { mib-2 100 }
+
+
+transportDomains OBJECT IDENTIFIER ::= { transportAddressMIB 1 }
+
+transportDomainUdpIpv4 OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "The UDP over IPv4 transport domain. The corresponding
+ transport address is of type TransportAddressIPv4 for
+ global IPv4 addresses."
+ ::= { transportDomains 1 }
+
+transportDomainUdpIpv6 OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "The UDP over IPv6 transport domain. The corresponding
+ transport address is of type TransportAddressIPv6 for
+ global IPv6 addresses."
+ ::= { transportDomains 2 }
+
+transportDomainUdpIpv4z OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "The UDP over IPv4 transport domain. The corresponding
+ transport address is of type TransportAddressIPv4z for
+ scoped IPv4 addresses with a zone index."
+ ::= { transportDomains 3 }
+
+transportDomainUdpIpv6z OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "The UDP over IPv6 transport domain. The corresponding
+ transport address is of type TransportAddressIPv6z for
+ scoped IPv6 addresses with a zone index."
+ ::= { transportDomains 4 }
+
+transportDomainTcpIpv4 OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "The TCP over IPv4 transport domain. The corresponding
+ transport address is of type TransportAddressIPv4 for
+ global IPv4 addresses."
+ ::= { transportDomains 5 }
+
+transportDomainTcpIpv6 OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "The TCP over IPv6 transport domain. The corresponding
+ transport address is of type TransportAddressIPv6 for
+ global IPv6 addresses."
+ ::= { transportDomains 6 }
+
+transportDomainTcpIpv4z OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "The TCP over IPv4 transport domain. The corresponding
+ transport address is of type TransportAddressIPv4z for
+ scoped IPv4 addresses with a zone index."
+ ::= { transportDomains 7 }
+
+transportDomainTcpIpv6z OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "The TCP over IPv6 transport domain. The corresponding
+ transport address is of type TransportAddressIPv6z for
+ scoped IPv6 addresses with a zone index."
+ ::= { transportDomains 8 }
+
+transportDomainSctpIpv4 OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "The SCTP over IPv4 transport domain. The corresponding
+ transport address is of type TransportAddressIPv4 for
+ global IPv4 addresses. This transport domain usually
+ represents the primary address on multihomed SCTP
+ endpoints."
+ ::= { transportDomains 9 }
+
+transportDomainSctpIpv6 OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "The SCTP over IPv6 transport domain. The corresponding
+ transport address is of type TransportAddressIPv6 for
+ global IPv6 addresses. This transport domain usually
+ represents the primary address on multihomed SCTP
+ endpoints."
+ ::= { transportDomains 10 }
+
+transportDomainSctpIpv4z OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "The SCTP over IPv4 transport domain. The corresponding
+ transport address is of type TransportAddressIPv4z for
+ scoped IPv4 addresses with a zone index. This transport
+ domain usually represents the primary address on
+ multihomed SCTP endpoints."
+ ::= { transportDomains 11 }
+
+transportDomainSctpIpv6z OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "The SCTP over IPv6 transport domain. The corresponding
+ transport address is of type TransportAddressIPv6z for
+ scoped IPv6 addresses with a zone index. This transport
+ domain usually represents the primary address on
+ multihomed SCTP endpoints."
+ ::= { transportDomains 12 }
+
+transportDomainLocal OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "The Posix Local IPC transport domain. The corresponding
+ transport address is of type TransportAddressLocal.
+
+ The Posix Local IPC transport domain incorporates the
+ well-known UNIX domain sockets."
+ ::= { transportDomains 13 }
+
+transportDomainUdpDns OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "The UDP transport domain using fully qualified domain
+ names. The corresponding transport address is of type
+ TransportAddressDns."
+ ::= { transportDomains 14 }
+
+transportDomainTcpDns OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "The TCP transport domain using fully qualified domain
+ names. The corresponding transport address is of type
+ TransportAddressDns."
+ ::= { transportDomains 15 }
+
+transportDomainSctpDns OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "The SCTP transport domain using fully qualified domain
+ names. The corresponding transport address is of type
+ TransportAddressDns."
+ ::= { transportDomains 16 }
+
+TransportDomain ::= TEXTUAL-CONVENTION
+ STATUS current
+ DESCRIPTION
+ "A value that represents a transport domain.
+
+ Some possible values, such as transportDomainUdpIpv4, are
+ defined in this module. Other possible values can be
+ defined in other MIB modules."
+ SYNTAX OBJECT IDENTIFIER
+
+--
+-- The enumerated values of the textual convention below should
+-- be identical to the last sub-identifier of the OID registered
+-- for the same domain.
+--
+
+TransportAddressType ::= TEXTUAL-CONVENTION
+ STATUS current
+ DESCRIPTION
+ "A value that represents a transport domain. This is the
+ enumerated version of the transport domain registrations
+ in this MIB module. The enumerated values have the
+ following meaning:
+
+ unknown(0) unknown transport address type
+ udpIpv4(1) transportDomainUdpIpv4
+ udpIpv6(2) transportDomainUdpIpv6
+ udpIpv4z(3) transportDomainUdpIpv4z
+ udpIpv6z(4) transportDomainUdpIpv6z
+ tcpIpv4(5) transportDomainTcpIpv4
+ tcpIpv6(6) transportDomainTcpIpv6
+ tcpIpv4z(7) transportDomainTcpIpv4z
+ tcpIpv6z(8) transportDomainTcpIpv6z
+ sctpIpv4(9) transportDomainSctpIpv4
+ sctpIpv6(10) transportDomainSctpIpv6
+ sctpIpv4z(11) transportDomainSctpIpv4z
+ sctpIpv6z(12) transportDomainSctpIpv6z
+ local(13) transportDomainLocal
+ udpDns(14) transportDomainUdpDns
+ tcpDns(15) transportDomainTcpDns
+ sctpDns(16) transportDomainSctpDns
+
+ This textual convention can be used to represent transport
+ domains in situations where a syntax of TransportDomain is
+ unwieldy (for example, when used as an index).
+
+ The usage of this textual convention implies that additional
+ transport domains can only be supported by updating this MIB
+ module. This extensibility restriction does not apply for the
+ TransportDomain textual convention which allows MIB authors
+ to define additional transport domains independently in
+ other MIB modules."
+ SYNTAX INTEGER {
+ unknown(0),
+ udpIpv4(1),
+ udpIpv6(2),
+ udpIpv4z(3),
+ udpIpv6z(4),
+ tcpIpv4(5),
+ tcpIpv6(6),
+ tcpIpv4z(7),
+ tcpIpv6z(8),
+ sctpIpv4(9),
+ sctpIpv6(10),
+ sctpIpv4z(11),
+ sctpIpv6z(12),
+ local(13),
+ udpDns(14),
+ tcpDns(15),
+ sctpDns(16)
+ }
+
+TransportAddress ::= TEXTUAL-CONVENTION
+ STATUS current
+ DESCRIPTION
+ "Denotes a generic transport address.
+
+ A TransportAddress value is always interpreted within the
+ context of a TransportAddressType or TransportDomain value.
+ Every usage of the TransportAddress textual convention MUST
+ specify the TransportAddressType or TransportDomain object
+ which provides the context. Furthermore, MIB authors SHOULD
+ define a separate TransportAddressType or TransportDomain
+ object for each TransportAddress object. It is suggested that
+ the TransportAddressType or TransportDomain is logically
+ registered before the object(s) which use the
+ TransportAddress textual convention if they appear in the
+ same logical row.
+
+ The value of a TransportAddress object must always be
+ consistent with the value of the associated
+ TransportAddressType or TransportDomain object. Attempts
+ to set a TransportAddress object to a value which is
+ inconsistent with the associated TransportAddressType or
+ TransportDomain must fail with an inconsistentValue error.
+
+ When this textual convention is used as a syntax of an
+ index object, there may be issues with the limit of 128
+ sub-identifiers specified in SMIv2, STD 58. In this case,
+ the OBJECT-TYPE declaration MUST include a 'SIZE' clause
+ to limit the number of potential instance sub-identifiers."
+ SYNTAX OCTET STRING (SIZE (0..255))
+
+TransportAddressIPv4 ::= TEXTUAL-CONVENTION
+ DISPLAY-HINT "1d.1d.1d.1d:2d"
+ STATUS current
+ DESCRIPTION
+ "Represents a transport address consisting of an IPv4
+ address and a port number (as used for example by UDP,
+ TCP and SCTP):
+
+ octets contents encoding
+ 1-4 IPv4 address network-byte order
+ 5-6 port number network-byte order
+
+ This textual convention SHOULD NOT be used directly in object
+ definitions since it restricts addresses to a specific format.
+ However, if it is used, it MAY be used either on its own or
+ in conjunction with TransportAddressType or TransportDomain
+ as a pair."
+ SYNTAX OCTET STRING (SIZE (6))
+
+TransportAddressIPv6 ::= TEXTUAL-CONVENTION
+ DISPLAY-HINT "0a[2x:2x:2x:2x:2x:2x:2x:2x]0a:2d"
+ STATUS current
+ DESCRIPTION
+ "Represents a transport address consisting of an IPv6
+ address and a port number (as used for example by UDP,
+ TCP and SCTP):
+
+ octets contents encoding
+ 1-16 IPv6 address network-byte order
+ 17-18 port number network-byte order
+
+ This textual convention SHOULD NOT be used directly in object
+ definitions since it restricts addresses to a specific format.
+ However, if it is used, it MAY be used either on its own or
+ in conjunction with TransportAddressType or TransportDomain
+ as a pair."
+ SYNTAX OCTET STRING (SIZE (18))
+
+TransportAddressIPv4z ::= TEXTUAL-CONVENTION
+ DISPLAY-HINT "1d.1d.1d.1d%4d:2d"
+ STATUS current
+ DESCRIPTION
+ "Represents a transport address consisting of an IPv4
+ address, a zone index and a port number (as used for
+ example by UDP, TCP and SCTP):
+
+ octets contents encoding
+ 1-4 IPv4 address network-byte order
+ 5-8 zone index network-byte order
+ 9-10 port number network-byte order
+
+ This textual convention SHOULD NOT be used directly in object
+ definitions since it restricts addresses to a specific format.
+ However, if it is used, it MAY be used either on its own or
+ in conjunction with TransportAddressType or TransportDomain
+ as a pair."
+ SYNTAX OCTET STRING (SIZE (10))
+
+TransportAddressIPv6z ::= TEXTUAL-CONVENTION
+ DISPLAY-HINT "0a[2x:2x:2x:2x:2x:2x:2x:2x%4d]0a:2d"
+ STATUS current
+ DESCRIPTION
+ "Represents a transport address consisting of an IPv6
+ address, a zone index and a port number (as used for
+ example by UDP, TCP and SCTP):
+
+ octets contents encoding
+ 1-16 IPv6 address network-byte order
+ 17-20 zone index network-byte order
+ 21-22 port number network-byte order
+
+ This textual convention SHOULD NOT be used directly in object
+ definitions since it restricts addresses to a specific format.
+ However, if it is used, it MAY be used either on its own or
+ in conjunction with TransportAddressType or TransportDomain
+ as a pair."
+ SYNTAX OCTET STRING (SIZE (22))
+
+TransportAddressLocal ::= TEXTUAL-CONVENTION
+ DISPLAY-HINT "1a"
+ STATUS current
+ DESCRIPTION
+ "Represents a POSIX Local IPC transport address:
+
+ octets contents encoding
+ all POSIX Local IPC address string
+
+ The Posix Local IPC transport domain subsumes UNIX domain
+ sockets.
+
+ This textual convention SHOULD NOT be used directly in object
+ definitions since it restricts addresses to a specific format.
+ However, if it is used, it MAY be used either on its own or
+ in conjunction with TransportAddressType or TransportDomain
+ as a pair.
+
+ When this textual convention is used as a syntax of an
+ index object, there may be issues with the limit of 128
+ sub-identifiers specified in SMIv2, STD 58. In this case,
+ the OBJECT-TYPE declaration MUST include a 'SIZE' clause
+ to limit the number of potential instance sub-identifiers."
+ REFERENCE
+ "Protocol Independent Interfaces (IEEE POSIX 1003.1g)"
+ SYNTAX OCTET STRING (SIZE (1..255))
+
+TransportAddressDns ::= TEXTUAL-CONVENTION
+ DISPLAY-HINT "1a"
+ STATUS current
+ DESCRIPTION
+ "Represents a DNS domain name followed by a colon ':'
+ (ASCII character 0x3A) and a port number in ASCII.
+ The name SHOULD be fully qualified whenever possible.
+
+ Values of this textual convention are not directly useable as
+ transport-layer addressing information, and require runtime
+ resolution. As such, applications that write them must be
+ prepared for handling errors if such values are not
+ supported, or cannot be resolved (if resolution occurs at the
+ time of the management operation).
+
+ The DESCRIPTION clause of TransportAddress objects that may
+ have TransportAddressDns values must fully describe how (and
+ when) such names are to be resolved to IP addresses and vice
+ versa.
+
+ This textual convention SHOULD NOT be used directly in object
+ definitions since it restricts addresses to a specific format.
+ However, if it is used, it MAY be used either on its own or
+ in conjunction with TransportAddressType or TransportDomain
+ as a pair.
+
+ When this textual convention is used as a syntax of an
+ index object, there may be issues with the limit of 128
+ sub-identifiers specified in SMIv2, STD 58. In this case,
+ the OBJECT-TYPE declaration MUST include a 'SIZE' clause
+ to limit the number of potential instance sub-identifiers."
+ SYNTAX OCTET STRING (SIZE (1..255))
+
+END
diff --git a/lib/snmp/priv/conf/agent/target_addr.conf b/lib/snmp/priv/conf/agent/target_addr.conf
index 33a5d0d4c4..f48a6645a3 100644
--- a/lib/snmp/priv/conf/agent/target_addr.conf
+++ b/lib/snmp/priv/conf/agent/target_addr.conf
@@ -3,9 +3,13 @@
%% The data is inserted into the snmpTargetAddrTable defined
%% in SNMP-TARGET-MIB, and in the snmpTargeAddrExtTabke defined
%% in SNMP-COMMUNITY-MIB.
-%% Each row is a 9-tuple:
-%% {Name, Ip, Udp, Timeout, RetryCount, TagList, ParamsName, EngineId,
-%% TMask, MaxMessageSize}.
+%% Each row is a 10 or 11-tuple (Domain is optional):
+%% {Name,
+%% Domain, Ip, Port,
+%% Timeout, RetryCount, TagList, ParamsName, EngineId,
+%% TMask, MaxMessageSize}.
+%% The value of Domain decide the format of the Ip and TMask values.
+%% If not present, classic Ipv4 is assumed.
%% The EngineId value is only used if Inform-Requests are sent to this
%% target. If Informs are not sent, this value is ignored, and can be
%% e.g. an empty string. However, if Informs are sent, it is essential
diff --git a/lib/snmp/src/agent/snmp_community_mib.erl b/lib/snmp/src/agent/snmp_community_mib.erl
index 5644a43345..77307aa7ad 100644
--- a/lib/snmp/src/agent/snmp_community_mib.erl
+++ b/lib/snmp/src/agent/snmp_community_mib.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1999-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1999-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -25,7 +25,7 @@
snmpTargetAddrExtTable/3,
community2vacm/2, vacm2community/2,
get_target_addr_ext_mms/2]).
--export([add_community/5, delete_community/1]).
+-export([add_community/5, add_community/6, delete_community/1]).
-export([check_community/1]).
-include("SNMP-COMMUNITY-MIB.hrl").
@@ -128,12 +128,16 @@ read_community_config_files(Dir) ->
Comms.
check_community({Index, CommunityName, SecName, CtxName, TransportTag}) ->
+ EngineID = get_engine_id(),
+ check_community({Index, CommunityName, SecName,
+ EngineID, CtxName, TransportTag});
+check_community({Index, CommunityName, SecName,
+ EngineID, CtxName, TransportTag}) ->
snmp_conf:check_string(Index,{gt,0}),
snmp_conf:check_string(CommunityName),
snmp_conf:check_string(SecName),
snmp_conf:check_string(CtxName),
snmp_conf:check_string(TransportTag),
- EngineID = get_engine_id(),
Comm = {Index, CommunityName, SecName, EngineID, CtxName, TransportTag,
?'StorageType_nonVolatile', ?'RowStatus_active'},
{ok, Comm};
@@ -173,6 +177,13 @@ table_del_row(Tab, Key) ->
%% FIXME: does not work with mnesia
add_community(Idx, CommName, SecName, CtxName, TransportTag) ->
Community = {Idx, CommName, SecName, CtxName, TransportTag},
+ do_add_community(Community).
+
+add_community(Idx, CommName, SecName, EngineId, CtxName, TransportTag) ->
+ Community = {Idx, CommName, SecName, EngineId, CtxName, TransportTag},
+ do_add_community(Community).
+
+do_add_community(Community) ->
case (catch check_community(Community)) of
{ok, Row} ->
Key = element(1, Row),
diff --git a/lib/snmp/src/agent/snmp_notification_mib.erl b/lib/snmp/src/agent/snmp_notification_mib.erl
index 1cd69b430f..720ac749b8 100644
--- a/lib/snmp/src/agent/snmp_notification_mib.erl
+++ b/lib/snmp/src/agent/snmp_notification_mib.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1998-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1998-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -273,9 +273,12 @@ find_targets(Key, TargAddrs, Db, Res) ->
get_targets([{TagList, Addr, TargetName, Params, Timeout, Retry}|T],
Tag, Type, Name) ->
case snmp_misc:is_tag_member(Tag, TagList) of
- true -> [{Name, {Addr, TargetName, Params, type(Type, Timeout, Retry)}}|
- get_targets(T, Tag, Type, Name)];
+ true ->
+ ?vtrace("tag ~w *is* member", [Tag]),
+ [{Name, {Addr, TargetName, Params, type(Type, Timeout, Retry)}}|
+ get_targets(T, Tag, Type, Name)];
false ->
+ ?vtrace("tag ~w is *not* member", [Tag]),
get_targets(T, Tag, Type, Name)
end;
get_targets([], _Tag, _Type, _Name) ->
diff --git a/lib/snmp/src/agent/snmp_target_mib.erl b/lib/snmp/src/agent/snmp_target_mib.erl
index 270a5fd5b6..60bd3e0912 100644
--- a/lib/snmp/src/agent/snmp_target_mib.erl
+++ b/lib/snmp/src/agent/snmp_target_mib.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1998-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1998-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -26,16 +26,18 @@
snmpTargetParamsTable/1, snmpTargetParamsTable/3,
get_target_addrs/0, get_target_engine_id/1, set_target_engine_id/2,
is_valid_tag/3, get/3, table_next/2]).
--export([add_addr/10, delete_addr/1,
+-export([add_addr/10, add_addr/11, delete_addr/1,
add_params/5, delete_params/1]).
-export([check_target_addr/1, check_target_params/1]).
+-export([default_domain/0]).
--include("snmp_types.hrl").
--include("snmp_tables.hrl").
--include("SNMP-TARGET-MIB.hrl").
--include("SNMPv2-TC.hrl").
--include("SNMPv2-TM.hrl").
--include("SNMP-FRAMEWORK-MIB.hrl").
+-include_lib("snmp/include/snmp_types.hrl").
+-include_lib("snmp/include/snmp_tables.hrl").
+-include_lib("snmp/include/SNMP-TARGET-MIB.hrl").
+-include_lib("snmp/include/SNMPv2-TC.hrl").
+-include_lib("snmp/include/SNMPv2-TM.hrl").
+-include_lib("snmp/include/SNMP-FRAMEWORK-MIB.hrl").
+-include_lib("snmp/include/TRANSPORT-ADDRESS-MIB.hrl").
-define(VMODULE,"TARGET-MIB").
-include("snmp_verbosity.hrl").
@@ -49,6 +51,12 @@
%%-----------------------------------------------------------------
+
+default_domain() ->
+ snmpUDPDomain.
+
+
+%%-----------------------------------------------------------------
%% Func: configure/1
%% Args: Dir is the directory where the configuration files are found.
%% Purpose: If the tables doesn't exist, this function reads
@@ -139,39 +147,51 @@ read_target_config_files(Dir) ->
%% {Name, Ip, Udp, Timeout, RetryCount, TagList, Params, EngineId,
%% TMask, MMS}
%%-----------------------------------------------------------------
-check_target_addr({Name, Ip, Udp, Timeout, RetryCount, TagList,
- Params, EngineId, TMask, MMS}) ->
+
+check_target_addr({Name, Domain, Ip, Udp, Timeout, RetryCount, TagList,
+ Params, EngineId, TMask, MMS}) ->
?vtrace("check target address with:"
- "~n Name: ~s"
- "~n Ip: ~p"
- "~n Udp: ~p"
- "~n Timeout: ~p"
- "~n RetryCount: ~p"
- "~n TagList: ~p"
- "~n Params: ~p"
- "~n EngineId: ~p"
- "~n TMask: ~p"
- "~n MMS: ~p",
- [Name,Ip,Udp,Timeout,RetryCount,
- TagList,Params,EngineId,TMask,MMS]),
+ "~n Name: ~s"
+ "~n Domain: ~p"
+ "~n Ip: ~p"
+ "~n Udp: ~p"
+ "~n Timeout: ~p"
+ "~n RetryCount: ~p"
+ "~n TagList: ~p"
+ "~n Params: ~p"
+ "~n EngineId: ~p"
+ "~n TMask: ~p"
+ "~n MMS: ~p",
+ [Name,
+ Domain, Ip, Udp,
+ Timeout, RetryCount,
+ TagList, Params, EngineId, TMask, MMS]),
snmp_conf:check_string(Name,{gt,0}),
- snmp_conf:check_ip(Ip),
+ snmp_conf:check_domain(Domain),
+ snmp_conf:check_ip(Domain, Ip),
snmp_conf:check_integer(Udp, {gt, 0}),
snmp_conf:check_integer(Timeout, {gte, 0}),
snmp_conf:check_integer(RetryCount, {gte,0}),
snmp_conf:check_string(TagList),
snmp_conf:check_string(Params),
check_engine_id(EngineId),
- TAddr = Ip ++ [Udp div 256, Udp rem 256],
- check_mask(TMask, TAddr),
+ TAddress = snmp_conf:mk_taddress(Domain, Ip, Udp),
+ TDomain = snmp_conf:mk_tdomain(Domain),
+ check_tmask(TDomain, TMask, TAddress),
snmp_conf:check_packet_size(MMS),
?vtrace("check target address done",[]),
-
- Addr = {Name, ?snmpUDPDomain, TAddr, Timeout,
+ Addr = {Name, TDomain, TAddress, Timeout,
RetryCount, TagList, Params,
?'StorageType_nonVolatile', ?'RowStatus_active', EngineId,
TMask, MMS}, % Values for Augmenting table in SNMP-COMMUNITY-MIB
{ok, Addr};
+check_target_addr({Name, Ip, Udp, Timeout, RetryCount, TagList,
+ Params, EngineId, TMask, MMS}) ->
+ Domain = default_domain(),
+ check_target_addr({Name,
+ Domain, Ip, Udp,
+ Timeout, RetryCount, TagList,
+ Params, EngineId, TMask, MMS});
check_target_addr({Name, Ip, Udp, Timeout, RetryCount, TagList, Params,
EngineId}) ->
check_target_addr({Name, Ip, Udp, Timeout, RetryCount, TagList,
@@ -194,12 +214,13 @@ check_engine_id(discovery) ->
check_engine_id(EngineId) ->
snmp_conf:check_string(EngineId).
-check_mask([], _TAddr) ->
+
+check_tmask(_TDomain, [], _TAddress) ->
ok;
-check_mask(TMask, TAddr) when length(TMask) == length(TAddr) ->
- snmp_conf:check_taddress(TMask);
-check_mask(TMask, _TAddr) ->
- throw({error, {invalid_mask, TMask}}).
+check_tmask(TDomain, TMask, TAddress) when length(TMask) =:= length(TAddress) ->
+ snmp_conf:check_taddress(TDomain, TMask);
+check_tmask(_TDomain, TMask, _TAddr) ->
+ throw({error, {invalid_tmask, TMask}}).
%%-----------------------------------------------------------------
@@ -261,7 +282,13 @@ table_del_row(Tab, Key) ->
add_addr(Name, Ip, Port, Timeout, Retry, TagList,
Params, EngineId, TMask, MMS) ->
- Addr = {Name, Ip, Port, Timeout, Retry, TagList,
+ Domain = default_domain(),
+ add_addr(Name, Domain, Ip, Port, Timeout, Retry, TagList,
+ Params, EngineId, TMask, MMS).
+
+add_addr(Name, Domain, Ip, Port, Timeout, Retry, TagList,
+ Params, EngineId, TMask, MMS) ->
+ Addr = {Name, Domain, Ip, Port, Timeout, Retry, TagList,
Params, EngineId, TMask, MMS},
case (catch check_target_addr(Addr)) of
{ok, Row} ->
@@ -341,8 +368,11 @@ maybe_create_var(Var) ->
init_var(Var) -> ets:insert(snmp_agent_table, {Var, 0}).
vars() ->
- [snmpUnavailableContexts,
- snmpUnknownContexts].
+ [
+ snmpUnavailableContexts,
+ snmpUnknownContexts
+ ].
+
%%-----------------------------------------------------------------
%% API functions
@@ -353,10 +383,18 @@ is_valid_tag(Tag, TDomain, TAddress) ->
is_valid_tag(TDomain, TAddress, Tag, []).
is_valid_tag(TDomain, TAddress, Tag, Key) ->
+ ?vtrace("is_valid_tag -> entry with"
+ "~n TDomain: ~p"
+ "~n TAddress: ~p"
+ "~n Tag: ~p"
+ "~n Key: ~p", [TDomain, TAddress, Tag, Key]),
case table_next(snmpTargetAddrTable, Key) of
endOfTable ->
+ ?vtrace("is_valid_tag -> endOfTable", []),
false;
NextKey ->
+ ?vtrace("is_valid_tag -> next key found"
+ "~n NextKey: ~p", [NextKey]),
case get(snmpTargetAddrTable, NextKey, [?snmpTargetAddrTDomain,
?snmpTargetAddrTAddress,
?snmpTargetAddrTagList,
@@ -365,6 +403,8 @@ is_valid_tag(TDomain, TAddress, Tag, Key) ->
{value, TAddress}, % RFC2576: chapters 5.2.1 & 5.3
{value, TagList},
{value, []}] ->
+ ?vtrace("is_valid_tag -> found with exact match"
+ "~n TagList: ~p", [TagList]),
case snmp_misc:is_tag_member(Tag, TagList) of
true ->
?vtrace("is_valid_tag -> exact: "
@@ -380,9 +420,14 @@ is_valid_tag(TDomain, TAddress, Tag, Key) ->
{value, TAddress2},
{value, TagList},
{value, TMask}] when TMask =/= [] ->
+ ?vtrace("is_valid_tag -> found with exact match"
+ "~n TagList: ~p"
+ "~n TMask: ~p", [TagList, TMask]),
case snmp_misc:is_tmask_match(TAddress, TAddress2,
TMask) of
true ->
+ ?vtrace("is_valid_tag -> "
+ "tmask match - now check tag member", []),
case snmp_misc:is_tag_member(Tag, TagList) of
true ->
?vtrace("is_valid_tag -> masked: "
@@ -395,10 +440,12 @@ is_valid_tag(TDomain, TAddress, Tag, Key) ->
Tag, NextKey)
end;
false ->
+ ?vtrace("is_valid_tag -> tmask NO match", []),
is_valid_tag(TDomain, TAddress,
Tag, NextKey)
end;
_ ->
+ ?vtrace("is_valid_tag -> not found - try next", []),
is_valid_tag(TDomain, TAddress, Tag, NextKey)
end
end.
@@ -561,7 +608,9 @@ snmpTargetAddrTable(print) ->
[Prefix, element(?snmpTargetAddrName, Row),
Prefix, element(?snmpTargetAddrTDomain, Row),
case element(?snmpTargetAddrTDomain, Row) of
- ?snmpUDPDomain -> udp;
+ ?snmpUDPDomain -> snmpUDPDomain;
+ ?transportDomainUdpIpv4 -> transportDomainUdpIpv4;
+ ?transportDomainUdpIpv6 -> transportDomainUdpIpv6;
_ -> undefined
end,
Prefix, element(?snmpTargetAddrTAddress, Row),
@@ -610,14 +659,14 @@ snmpTargetAddrTable(get, RowIndex, Cols) ->
snmpTargetAddrTable(get_next, RowIndex, Cols) ->
next(snmpTargetAddrTable, RowIndex, Cols);
snmpTargetAddrTable(set, RowIndex, Cols0) ->
- %% BMK BMK BMK
- case (catch verify_targetAddrTable_cols(Cols0, [])) of
+ %% BMK BMK
+ case (catch verify_targetAddrTable_cols(Cols0)) of
{ok, Cols} ->
snmp_notification_mib:invalidate_cache(),
%% Add columns for augmenting table snmpTargetAddrExtTable and for
- %% target engine ID. Target engine ID is set to "". The function
+ %% target engine ID. Target engine ID is set to "". The function
%% get_target_engine_id will return "" unless a value is set using
- %% set_target_engine_id. If it is "" Informs can't be sent to the
+ %% set_target_engine_id. If it is "" Informs can't be sent to the
%% target.
NCols = Cols ++ [{?snmpTargetAddrEngineId, ""},
{?snmpTargetAddrTMask, []},
@@ -628,12 +677,12 @@ snmpTargetAddrTable(set, RowIndex, Cols0) ->
Error
end;
snmpTargetAddrTable(is_set_ok, RowIndex, Cols0) ->
- case (catch verify_targetAddrTable_cols(Cols0, [])) of
+ case (catch verify_targetAddrTable_cols(Cols0)) of
{ok, Cols} ->
%% Add columns for augmenting table snmpTargetAddrExtTable and for
- %% target engine ID. Target engine ID is set to "". The function
+ %% target engine ID. Target engine ID is set to "". The function
%% get_target_engine_id will return "" unless a value is set using
- %% set_target_engine_id. If it is "" Informs can't be sent to the
+ %% set_target_engine_id. If it is "" Informs can't be sent to the
%% target.
NCols = Cols ++ [{?snmpTargetAddrEngineId, ""},
{?snmpTargetAddrTMask, []},
@@ -647,55 +696,83 @@ snmpTargetAddrTable(Op, Arg1, Arg2) ->
Db = db(snmpTargetAddrTable),
snmp_generic:table_func(Op, Arg1, Arg2, Db).
+verify_targetAddrTable_cols(Cols) ->
+ ValidCols0 = verify_targetAddrTable_cols(Cols, []),
+ %% Make a last pass to verify TDomain and TAddress.
+ ValidCols0.
+
verify_targetAddrTable_cols([], Cols) ->
{ok, lists:reverse(Cols)};
-verify_targetAddrTable_cols([{Col, Val0}|Cols], Acc) ->
- Val = verify_targetAddrTable_col(Col, Val0),
- verify_targetAddrTable_cols(Cols, [{Col, Val}|Acc]).
+verify_targetAddrTable_cols([{Col, Val0}|Cols], ValidCols) ->
+ Val = verify_targetAddrTable_col(Col, Val0, ValidCols),
+ verify_targetAddrTable_cols(Cols, [{Col, Val}|ValidCols]).
-verify_targetAddrTable_col(?snmpTargetAddrName, Name) ->
+verify_targetAddrTable_col(?snmpTargetAddrName, Name, _) ->
case (catch snmp_conf:check_string(Name)) of
ok ->
Name;
_ ->
wrongValue(?snmpTargetAddrName)
end;
-verify_targetAddrTable_col(?snmpTargetAddrTAddress, TAddr) ->
- case (catch snmp_conf:check_taddress(TAddr)) of
+verify_targetAddrTable_col(?snmpTargetAddrTDomain, TDomain, _) ->
+ case (catch snmp_conf:check_tdomain(TDomain)) of
ok ->
- TAddr;
+ TDomain;
_ ->
- wrongValue(?snmpTargetAddrTAddress)
+ wrongValue(?snmpTargetAddrTDomain)
+ end;
+%% In order to (properly) validate the TAddress,
+%% the TDomain must already have been validated
+%% (the format of TAddress depends on TDomain).
+verify_targetAddrTable_col(?snmpTargetAddrTAddress, TAddress, ValidCols) ->
+ case lists:keysearch(?snmpTargetAddrTDomain, 1, ValidCols) of
+ {value, {?snmpTargetAddrTDomain, TDomain}} ->
+ case (catch snmp_conf:check_taddress(TDomain, TAddress)) of
+ ok ->
+ TAddress;
+ _ ->
+ wrongValue(?snmpTargetAddrTAddress)
+ end;
+ false ->
+ %% The user did not provide us with a TDomain, which
+ %% must mean that he/she intends to use the old domain.
+ TDomain = snmp_conf:mk_tdomain(default_domain()),
+ case (catch snmp_conf:check_taddress(TDomain, TAddress)) of
+ ok ->
+ TAddress;
+ _ ->
+ wrongValue(?snmpTargetAddrTAddress)
+ end
end;
-verify_targetAddrTable_col(?snmpTargetAddrTimeout, Timeout) ->
+verify_targetAddrTable_col(?snmpTargetAddrTimeout, Timeout, _) ->
case (catch snmp_conf:check_integer(Timeout)) of
ok when Timeout >= 0 ->
Timeout;
_ ->
wrongValue(?snmpTargetAddrTimeout)
end;
-verify_targetAddrTable_col(?snmpTargetAddrRetryCount, Retry) ->
+verify_targetAddrTable_col(?snmpTargetAddrRetryCount, Retry, _) ->
case (catch snmp_conf:check_integer(Retry)) of
ok when Retry >= 0 ->
Retry;
_ ->
wrongValue(?snmpTargetAddrRetryCount)
end;
-verify_targetAddrTable_col(?snmpTargetAddrTagList, TagList) ->
+verify_targetAddrTable_col(?snmpTargetAddrTagList, TagList, _) ->
case (catch snmp_conf:check_string(TagList)) of
ok ->
TagList;
_ ->
wrongValue(?snmpTargetAddrTagList)
end;
-verify_targetAddrTable_col(?snmpTargetAddrParams, Params) ->
+verify_targetAddrTable_col(?snmpTargetAddrParams, Params, _) ->
case (catch snmp_conf:check_string(Params)) of
ok ->
Params;
_ ->
wrongValue(?snmpTargetAddrParams)
end;
-verify_targetAddrTable_col(_, Val) ->
+verify_targetAddrTable_col(_, Val, _) ->
Val.
diff --git a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl
index 28469a7b4e..37f6dd3f26 100644
--- a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl
+++ b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl
@@ -247,6 +247,7 @@ add_sec2group(SecModel, SecName, GroupName) ->
Key = [Key1, length(Key2) | Key2],
case table_cre_row(vacmSecurityToGroupTable, Key, Row) of
true ->
+ snmpa_agent:invalidate_ca_cache(),
{ok, Key};
false ->
{error, create_failed}
@@ -260,6 +261,7 @@ add_sec2group(SecModel, SecName, GroupName) ->
delete_sec2group(Key) ->
case table_del_row(vacmSecurityToGroupTable, Key) of
true ->
+ snmpa_agent:invalidate_ca_cache(),
ok;
false ->
{error, delete_failed}
@@ -279,6 +281,7 @@ add_access(GroupName, Prefix, SecModel, SecLevel, Match, RV, WV, NV) ->
Key3 = [SM, SL],
Key = Key1 ++ Key2 ++ Key3,
snmpa_vacm:insert([{Key, Row}], false),
+ snmpa_agent:invalidate_ca_cache(),
{ok, Key};
{error, Reason} ->
{error, Reason};
@@ -287,6 +290,7 @@ add_access(GroupName, Prefix, SecModel, SecLevel, Match, RV, WV, NV) ->
end.
delete_access(Key) ->
+ snmpa_agent:invalidate_ca_cache(),
snmpa_vacm:delete(Key).
@@ -299,6 +303,7 @@ add_view_tree_fam(ViewIndex, SubTree, Status, Mask) ->
Key = [length(Key1) | Key1] ++ [length(Key2) | Key2],
case table_cre_row(vacmViewTreeFamilyTable, Key, Row) of
true ->
+ snmpa_agent:invalidate_ca_cache(),
{ok, Key};
false ->
{error, create_failed}
@@ -312,6 +317,7 @@ add_view_tree_fam(ViewIndex, SubTree, Status, Mask) ->
delete_view_tree_fam(Key) ->
case table_del_row(vacmViewTreeFamilyTable, Key) of
true ->
+ snmpa_agent:invalidate_ca_cache(),
ok;
false ->
{error, delete_failed}
diff --git a/lib/snmp/src/agent/snmpa.erl b/lib/snmp/src/agent/snmpa.erl
index 22fbd33add..50b169e4e7 100644
--- a/lib/snmp/src/agent/snmpa.erl
+++ b/lib/snmp/src/agent/snmpa.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -60,6 +60,7 @@
register_subagent/3, unregister_subagent/2,
+ send_notification2/3,
send_notification/3, send_notification/4, send_notification/5,
send_notification/6, send_notification/7,
send_trap/3, send_trap/4,
@@ -108,8 +109,9 @@
-export([print_mib_info/0, print_mib_tables/0, print_mib_variables/0]).
-include("snmpa_atl.hrl").
+-include("snmpa_internal.hrl").
--define(EXTRA_INFO, undefined).
+-define(DISCO_EXTRA_INFO, undefined).
%%-----------------------------------------------------------------
@@ -596,22 +598,56 @@ set_request_limit(Agent, NewLimit) ->
%% -
+send_notification2(Agent, Notification, SendOpts) ->
+ snmpa_agent:send_notification(Agent, Notification, SendOpts).
+
send_notification(Agent, Notification, Recv) ->
- send_notification(Agent, Notification, Recv, "", "", []).
+ SendOpts =
+ [
+ {receiver, Recv},
+ {varbinds, []},
+ {name, ""},
+ {context, ""},
+ {extra, ?DEFAULT_NOTIF_EXTRA_INFO}
+ ],
+ send_notification2(Agent, Notification, SendOpts).
send_notification(Agent, Notification, Recv, Varbinds) ->
- send_notification(Agent, Notification, Recv, "", "", Varbinds).
+ SendOpts =
+ [
+ {receiver, Recv},
+ {varbinds, Varbinds},
+ {name, ""},
+ {context, ""},
+ {extra, ?DEFAULT_NOTIF_EXTRA_INFO}
+ ],
+ send_notification2(Agent, Notification, SendOpts).
send_notification(Agent, Notification, Recv, NotifyName, Varbinds) ->
- send_notification(Agent, Notification, Recv, NotifyName, "", Varbinds).
+ SendOpts =
+ [
+ {receiver, Recv},
+ {varbinds, Varbinds},
+ {name, NotifyName},
+ {context, ""},
+ {extra, ?DEFAULT_NOTIF_EXTRA_INFO}
+ ],
+ send_notification2(Agent, Notification, SendOpts).
send_notification(Agent, Notification, Recv, NotifyName,
ContextName, Varbinds)
when (is_list(NotifyName) andalso
is_list(ContextName) andalso
is_list(Varbinds)) ->
- snmpa_agent:send_trap(Agent, Notification, NotifyName,
- ContextName, Recv, Varbinds).
+ SendOpts =
+ [
+ {receiver, Recv},
+ {varbinds, Varbinds},
+ {name, NotifyName},
+ {context, ContextName},
+ {extra, ?DEFAULT_NOTIF_EXTRA_INFO}
+ ],
+ send_notification2(Agent, Notification, SendOpts).
send_notification(Agent, Notification, Recv,
NotifyName, ContextName, Varbinds, LocalEngineID)
@@ -619,8 +655,16 @@ send_notification(Agent, Notification, Recv,
is_list(ContextName) andalso
is_list(Varbinds) andalso
is_list(LocalEngineID)) ->
- snmpa_agent:send_trap(Agent, Notification, NotifyName,
- ContextName, Recv, Varbinds, LocalEngineID).
+ SendOpts =
+ [
+ {receiver, Recv},
+ {varbinds, Varbinds},
+ {name, NotifyName},
+ {context, ContextName},
+ {extra, ?DEFAULT_NOTIF_EXTRA_INFO},
+ {local_engine_id, LocalEngineID}
+ ],
+ send_notification2(Agent, Notification, SendOpts).
%% Kept for backwards compatibility
send_trap(Agent, Trap, Community) ->
@@ -655,7 +699,7 @@ discovery(TargetName, Notification, Varbinds, DiscoHandler)
discovery(TargetName, Notification, ContextName, Varbinds, DiscoHandler).
discovery(TargetName, Notification, ContextName, Varbinds, DiscoHandler) ->
- ExtraInfo = ?EXTRA_INFO,
+ ExtraInfo = ?DISCO_EXTRA_INFO,
discovery(TargetName, Notification, ContextName, Varbinds, DiscoHandler,
ExtraInfo).
diff --git a/lib/snmp/src/agent/snmpa_acm.erl b/lib/snmp/src/agent/snmpa_acm.erl
index 6ad4f0b442..42a0d4d6a3 100644
--- a/lib/snmp/src/agent/snmpa_acm.erl
+++ b/lib/snmp/src/agent/snmpa_acm.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -62,11 +62,13 @@
%% {error, Reason} |
%% {discarded, Variable, Reason}
%% Types: Pdu = #pdu
-%% ACMData = acm_data() = {community, Community, Address} |
-%% {v3, MsgID, SecModel, SecName, SecLevel,
-%% ContextEngineID, ContextName, SecData}
+%% ACMData = acm_data() =
+%% {community, SecModel, Community, TDomain, TAddress} |
+%% {v3, MsgID, SecModel, SecName, SecLevel,
+%% ContextEngineID, ContextName, SecData}
%% Community = string()
-%% Address = ip() ++ udp() (list)
+%% TDomain = ?transportDomainUdpIpv4 | ?transportDomainUdpIpv6
+%% TAddress = ip() ++ udp() (list)
%% MsgID = integer() <not used>
%% SecModel = ?SEC_* (see snmp_types.hrl)
%% SecName = string()
@@ -114,7 +116,10 @@ error2status(_) -> genErr.
%% discarded: no error response is sent
%% authentication_failure: no error response is sent, a trap is generated
%%-----------------------------------------------------------------
-init_ca(Pdu, {community, SecModel, Community, TAddr}) ->
+init_ca(Pdu, {community, SecModel, Community, TAddress}) ->
+ TDomain = snmp_conf:mk_tdomain(snmp_target_mib:default_domain()),
+ init_ca(Pdu, {community, SecModel, Community, TDomain, TAddress});
+init_ca(Pdu, {community, SecModel, Community, TDomain, TAddress}) ->
%% This is a v1 or v2c request. Use SNMP-COMMUNITY-MIB to
%% map the community to vacm parameters.
?vtrace("check access for ~n"
@@ -126,18 +131,18 @@ init_ca(Pdu, {community, SecModel, Community, TAddr}) ->
_ -> read
end,
?vtrace("View type: ~p", [ViewType]),
- CaCacheKey = {Community, SecModel, TAddr, ViewType},
+ CaCacheKey = {Community, SecModel, TDomain, TAddress, ViewType},
case check_ca_cache(CaCacheKey) of
false ->
- case snmp_community_mib:community2vacm(Community,
- {?snmpUDPDomain,TAddr}) of
+ case snmp_community_mib:community2vacm(Community,
+ {TDomain, TAddress}) of
{SecName, _ContextEngineId, ContextName} ->
%% Maybe we should check that the contextEngineID
%% matches the local engineID?
%% It better, since we don't impl. proxy.
?vtrace("get mib view"
"~n Security name: ~p"
- "~n Context name: ~p",[SecName,ContextName]),
+ "~n Context name: ~p",[SecName, ContextName]),
case snmpa_vacm:get_mib_view(ViewType, SecModel, SecName,
?'SnmpSecurityLevel_noAuthNoPriv',
ContextName) of
@@ -153,7 +158,7 @@ init_ca(Pdu, {community, SecModel, Community, TAddr}) ->
end;
undefined ->
{authentication_failure, snmpInBadCommunityNames,
- {bad_community_name, TAddr, Community}}
+ {bad_community_name, TDomain, TAddress, Community}}
end;
Res ->
Res
@@ -219,6 +224,7 @@ upd_ca_cache(KeyVal) ->
invalidate_ca_cache() ->
erase(ca_cache).
+
%%-----------------------------------------------------------------
%% Func: check(Res) -> {ok, MibView} | {discarded, Variable, Reason}
%% Args: Res = {ok, AccessFunc} |
diff --git a/lib/snmp/src/agent/snmpa_agent.erl b/lib/snmp/src/agent/snmpa_agent.erl
index f70885b2ec..6322f0f21d 100644
--- a/lib/snmp/src/agent/snmpa_agent.erl
+++ b/lib/snmp/src/agent/snmpa_agent.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -30,7 +30,7 @@
-export([subagent_set/2,
load_mibs/2, unload_mibs/2, which_mibs/1, whereis_mib/2, info/1,
register_subagent/3, unregister_subagent/2,
- send_trap/6, send_trap/7,
+ send_notification/3,
register_notification_filter/5,
unregister_notification_filter/2,
which_notification_filter/1,
@@ -62,10 +62,16 @@
-export([increment_counter/3]).
-export([restart_worker/1, restart_set_worker/1]).
+%% For backward compatibillity
+-export([send_trap/6, send_trap/7]).
+
%% Internal exports
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3, tr_var/2, tr_varbind/1,
- handle_pdu/7, worker/2, worker_loop/1, do_send_trap/7]).
+ handle_pdu/7, worker/2, worker_loop/1,
+ do_send_trap/7, do_send_trap/8]).
+
+-include("snmpa_internal.hrl").
-ifndef(default_verbosity).
-define(default_verbosity,silence).
@@ -527,6 +533,11 @@ which_notification_filter(Agent) ->
call(Agent, which_notification_filter).
+send_notification(Agent, Notification, SendOpts) ->
+ Msg = {send_notif, Notification, SendOpts},
+ maybe_call(Agent, Msg).
+
+%% <BACKWARD-COMPAT>
send_trap(Agent, Trap, NotifyName, CtxName, Recv, Varbinds) ->
?d("send_trap -> entry with"
"~n self(): ~p"
@@ -538,13 +549,33 @@ send_trap(Agent, Trap, NotifyName, CtxName, Recv, Varbinds) ->
"~n Varbinds: ~p",
[self(), Agent, wis(Agent),
Trap, NotifyName, CtxName, Recv, Varbinds]),
- Msg = {send_trap, Trap, NotifyName, CtxName, Recv, Varbinds},
- case (wis(Agent) =:= self()) of
- false ->
- call(Agent, Msg);
- true ->
- Agent ! Msg
- end.
+ SendOpts = [
+ {receiver, Recv},
+ {varbinds, Varbinds},
+ {name, NotifyName},
+ {context, CtxName},
+ {extra, ?DEFAULT_NOTIF_EXTRA_INFO}
+ ],
+ send_notification(Agent, Trap, SendOpts).
+
+%% send_trap(Agent, Trap, NotifyName, CtxName, Recv, Varbinds) ->
+%% ?d("send_trap -> entry with"
+%% "~n self(): ~p"
+%% "~n Agent: ~p [~p]"
+%% "~n Trap: ~p"
+%% "~n NotifyName: ~p"
+%% "~n CtxName: ~p"
+%% "~n Recv: ~p"
+%% "~n Varbinds: ~p",
+%% [self(), Agent, wis(Agent),
+%% Trap, NotifyName, CtxName, Recv, Varbinds]),
+%% Msg = {send_trap, Trap, NotifyName, CtxName, Recv, Varbinds},
+%% case (wis(Agent) =:= self()) of
+%% false ->
+%% call(Agent, Msg);
+%% true ->
+%% Agent ! Msg
+%% end.
send_trap(Agent, Trap, NotifyName, CtxName, Recv, Varbinds, LocalEngineID) ->
?d("send_trap -> entry with"
@@ -558,14 +589,38 @@ send_trap(Agent, Trap, NotifyName, CtxName, Recv, Varbinds, LocalEngineID) ->
"~n LocalEngineID: ~p",
[self(), Agent, wis(Agent),
Trap, NotifyName, CtxName, Recv, Varbinds, LocalEngineID]),
- Msg =
- {send_trap, Trap, NotifyName, CtxName, Recv, Varbinds, LocalEngineID},
- case (wis(Agent) =:= self()) of
- false ->
- call(Agent, Msg);
- true ->
- Agent ! Msg
- end.
+ SendOpts = [
+ {receiver, Recv},
+ {varbinds, Varbinds},
+ {name, NotifyName},
+ {context, CtxName},
+ {extra, ?DEFAULT_NOTIF_EXTRA_INFO},
+ {local_engine_id, LocalEngineID}
+ ],
+ send_notification(Agent, Trap, SendOpts).
+
+%% send_trap(Agent, Trap, NotifyName, CtxName, Recv, Varbinds, LocalEngineID) ->
+%% ?d("send_trap -> entry with"
+%% "~n self(): ~p"
+%% "~n Agent: ~p [~p]"
+%% "~n Trap: ~p"
+%% "~n NotifyName: ~p"
+%% "~n CtxName: ~p"
+%% "~n Recv: ~p"
+%% "~n Varbinds: ~p"
+%% "~n LocalEngineID: ~p",
+%% [self(), Agent, wis(Agent),
+%% Trap, NotifyName, CtxName, Recv, Varbinds, LocalEngineID]),
+%% Msg =
+%% {send_trap, Trap, NotifyName, CtxName, Recv, Varbinds, LocalEngineID},
+%% case (wis(Agent) =:= self()) of
+%% false ->
+%% call(Agent, Msg);
+%% true ->
+%% Agent ! Msg
+%% end.
+
+%% </BACKWARD-COMPAT>
%% -- Discovery functions --
@@ -655,7 +710,14 @@ wis(Atom) when is_atom(Atom) ->
forward_trap(Agent, TrapRecord, NotifyName, CtxName, Recv, Varbinds) ->
- Agent ! {forward_trap, TrapRecord, NotifyName, CtxName, Recv, Varbinds}.
+ ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
+ forward_trap(Agent, TrapRecord, NotifyName, CtxName, Recv, Varbinds,
+ ExtraInfo).
+
+forward_trap(Agent, TrapRecord, NotifyName, CtxName, Recv, Varbinds,
+ ExtraInfo) ->
+ Agent ! {forward_trap, TrapRecord, NotifyName, CtxName, Recv, Varbinds,
+ ExtraInfo}.
%%-----------------------------------------------------------------
@@ -745,6 +807,22 @@ handle_info(worker_available, S) ->
?vdebug("worker available",[]),
{noreply, S#state{worker_state = ready}};
+handle_info({send_notif, Notification, SendOpts}, S) ->
+ ?vlog("[handle_info] send trap request:"
+ "~n Notification: ~p"
+ "~n SendOpts: ~p",
+ [Notification, SendOpts]),
+ case (catch handle_send_trap(cast, S, Notification, SendOpts)) of
+ {ok, NewS} ->
+ {noreply, NewS};
+ {'EXIT', R} ->
+ ?vinfo("Trap not sent:~n ~p", [R]),
+ {noreply, S};
+ _ ->
+ {noreply, S}
+ end;
+
+%% <BACKWARD-COMPAT>
handle_info({send_trap, Trap, NotifyName, ContextName, Recv, Varbinds}, S) ->
?vlog("[handle_info] send trap request:"
"~n Trap: ~p"
@@ -753,9 +831,10 @@ handle_info({send_trap, Trap, NotifyName, ContextName, Recv, Varbinds}, S) ->
"~n Recv: ~p"
"~n Varbinds: ~p",
[Trap, NotifyName, ContextName, Recv, Varbinds]),
+ ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
LocalEngineID = ?DEFAULT_LOCAL_ENGINE_ID,
- case catch handle_send_trap(S, Trap, NotifyName, ContextName,
- Recv, Varbinds, LocalEngineID) of
+ case (catch handle_send_trap(S, Trap, NotifyName, ContextName,
+ Recv, Varbinds, LocalEngineID, ExtraInfo)) of
{ok, NewS} ->
{noreply, NewS};
{'EXIT', R} ->
@@ -775,8 +854,9 @@ handle_info({send_trap, Trap, NotifyName, ContextName, Recv, Varbinds,
"~n Varbinds: ~p"
"~n LocalEngineID: ~p",
[Trap, NotifyName, ContextName, Recv, Varbinds, LocalEngineID]),
- case catch handle_send_trap(S, Trap, NotifyName, ContextName,
- Recv, Varbinds, LocalEngineID) of
+ ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
+ case (catch handle_send_trap(S, Trap, NotifyName, ContextName,
+ Recv, Varbinds, LocalEngineID, ExtraInfo)) of
{ok, NewS} ->
{noreply, NewS};
{'EXIT', R} ->
@@ -785,8 +865,31 @@ handle_info({send_trap, Trap, NotifyName, ContextName, Recv, Varbinds,
_ ->
{noreply, S}
end;
+%% </BACKWARD-COMPAT>
handle_info({forward_trap, TrapRecord, NotifyName, ContextName,
+ Recv, Varbinds, ExtraInfo}, S) ->
+ ?vlog("[handle_info] forward trap request:"
+ "~n TrapRecord: ~p"
+ "~n NotifyName: ~p"
+ "~n ContextName: ~p"
+ "~n Recv: ~p"
+ "~n Varbinds: ~p",
+ [TrapRecord, NotifyName, ContextName, Recv, Varbinds]),
+ LocalEngineID = ?DEFAULT_LOCAL_ENGINE_ID,
+ case (catch maybe_send_trap(S, TrapRecord, NotifyName, ContextName,
+ Recv, Varbinds, LocalEngineID, ExtraInfo)) of
+ {ok, NewS} ->
+ {noreply, NewS};
+ {'EXIT', R} ->
+ ?vinfo("Trap not sent:~n ~p", [R]),
+ {noreply, S};
+ _ ->
+ {noreply, S}
+ end;
+
+%% <BACKWARD-COMPAT>
+handle_info({forward_trap, TrapRecord, NotifyName, ContextName,
Recv, Varbinds}, S) ->
?vlog("[handle_info] forward trap request:"
"~n TrapRecord: ~p"
@@ -795,9 +898,10 @@ handle_info({forward_trap, TrapRecord, NotifyName, ContextName,
"~n Recv: ~p"
"~n Varbinds: ~p",
[TrapRecord, NotifyName, ContextName, Recv, Varbinds]),
+ ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
LocalEngineID = ?DEFAULT_LOCAL_ENGINE_ID,
case (catch maybe_send_trap(S, TrapRecord, NotifyName, ContextName,
- Recv, Varbinds, LocalEngineID)) of
+ Recv, Varbinds, LocalEngineID, ExtraInfo)) of
{ok, NewS} ->
{noreply, NewS};
{'EXIT', R} ->
@@ -806,6 +910,7 @@ handle_info({forward_trap, TrapRecord, NotifyName, ContextName,
_ ->
{noreply, S}
end;
+%% </BACKWARD-COMPAT>
handle_info({backup_done, Reply}, #state{backup = {_, From}} = S) ->
?vlog("[handle_info] backup done:"
@@ -908,6 +1013,23 @@ handle_call(restart_set_worker, _From, #state{set_worker = Pid} = S) ->
end,
{reply, ok, S};
+handle_call({send_notif, Notification, SendOpts}, _From, S) ->
+ ?vlog("[handle_info] send trap request:"
+ "~n Notification: ~p"
+ "~n SendOpts: ~p",
+ [Notification, SendOpts]),
+ case (catch handle_send_trap(call, S, Notification, SendOpts)) of
+ {ok, NewS} ->
+ {reply, ok, NewS};
+ {'EXIT', Reason} ->
+ ?vinfo("Trap not sent:~n ~p", [Reason]),
+ {reply, {error, {send_failed, Reason}}, S};
+ _ ->
+ ?vinfo("Trap not sent", []),
+ {reply, {error, send_failed}, S}
+ end;
+
+%% <BACKWARD-COMPAT>
handle_call({send_trap, Trap, NotifyName, ContextName, Recv, Varbinds},
_From, S) ->
?vlog("[handle_call] send trap request:"
@@ -917,19 +1039,20 @@ handle_call({send_trap, Trap, NotifyName, ContextName, Recv, Varbinds},
"~n Recv: ~p"
"~n Varbinds: ~p",
[Trap, NotifyName, ContextName, Recv, Varbinds]),
+ ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
LocalEngineID =
case S#state.type of
master_agent ->
?DEFAULT_LOCAL_ENGINE_ID;
_ ->
%% subagent -
- %% we don't need this, eventually the trap sent request
- %% will reach the master-agent and then it will look up
- %% the proper engine id.
+ %% we don't need this now, eventually the trap send
+ %% request will reach the master-agent and then it
+ %% will look up the proper engine id.
ignore
end,
case (catch handle_send_trap(S, Trap, NotifyName, ContextName,
- Recv, Varbinds, LocalEngineID)) of
+ Recv, Varbinds, LocalEngineID, ExtraInfo)) of
{ok, NewS} ->
{reply, ok, NewS};
{'EXIT', Reason} ->
@@ -951,8 +1074,9 @@ handle_call({send_trap, Trap, NotifyName,
"~n Varbinds: ~p"
"~n LocalEngineID: ~p",
[Trap, NotifyName, ContextName, Recv, Varbinds, LocalEngineID]),
+ ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
case (catch handle_send_trap(S, Trap, NotifyName, ContextName,
- Recv, Varbinds, LocalEngineID)) of
+ Recv, Varbinds, LocalEngineID, ExtraInfo)) of
{ok, NewS} ->
{reply, ok, NewS};
{'EXIT', Reason} ->
@@ -962,6 +1086,7 @@ handle_call({send_trap, Trap, NotifyName,
?vinfo("Trap not sent", []),
{reply, {error, send_failed}, S}
end;
+%% </BACKWARD-COMPAT>
handle_call({discovery,
TargetName, Notification, ContextName, Vbs, DiscoHandler,
@@ -1470,7 +1595,10 @@ handle_backup_res([{Who, Crap}|Results], Acc) ->
%% because we (for some reason) support the function
%% snmpa:current_community().
%%-----------------------------------------------------------------
-cheat({community, _SecModel, Community, _IpUdp}, Address, ContextName) ->
+cheat({community, SecModel, Community, _TAddress}, Address, ContextName) ->
+ {Community, Address, ContextName};
+cheat({community, _SecModel, Community, _TDomain, _TAddress},
+ Address, ContextName) ->
{Community, Address, ContextName};
cheat(_, Address, ContextName) ->
{"", Address, ContextName}.
@@ -1498,7 +1626,7 @@ invalidate_ca_cache() ->
MasterAgent ! invalidate_ca_cache;
false ->
%% This is running on a sub-agent node,
- %% so sent skip it
+ %% so skip it
ok
end;
_ -> % Not on this node
@@ -1523,19 +1651,24 @@ spawn_thread(Vsn, Pdu, PduMS, ACMData, Address, Extra) ->
proc_lib:spawn_link(?MODULE, handle_pdu, Args).
spawn_trap_thread(TrapRec, NotifyName, ContextName, Recv, Vbs,
- LocalEngineID) ->
+ LocalEngineID, ExtraInfo) ->
Dict = get(),
proc_lib:spawn_link(?MODULE, do_send_trap,
[TrapRec, NotifyName, ContextName,
- Recv, Vbs, LocalEngineID, Dict]).
+ Recv, Vbs, LocalEngineID, ExtraInfo, Dict]).
do_send_trap(TrapRec, NotifyName, ContextName, Recv, Vbs,
LocalEngineID, Dict) ->
+ ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
+ do_send_trap(TrapRec, NotifyName, ContextName, Recv, Vbs,
+ LocalEngineID, ExtraInfo, Dict).
+do_send_trap(TrapRec, NotifyName, ContextName, Recv, Vbs,
+ LocalEngineID, ExtraInfo, Dict) ->
lists:foreach(fun({Key, Val}) -> put(Key, Val) end, Dict),
put(sname,trap_sender_short_name(get(sname))),
?vlog("starting",[]),
snmpa_trap:send_trap(TrapRec, NotifyName, ContextName, Recv, Vbs,
- LocalEngineID, get(net_if)).
+ LocalEngineID, ExtraInfo, get(net_if)).
worker(Master, Dict) ->
lists:foreach(fun({Key, Val}) -> put(Key, Val) end, Dict),
@@ -1550,21 +1683,34 @@ worker_loop(Master) ->
handle_pdu(Vsn, Pdu, PduMS, ACMData, Address, Extra),
Master ! worker_available;
- %% We don't trap exits!
+ %% We don't trap EXITs!
{TrapRec, NotifyName, ContextName, Recv, Vbs} ->
?vtrace("worker_loop -> send trap:"
"~n ~p", [TrapRec]),
snmpa_trap:send_trap(TrapRec, NotifyName,
- ContextName, Recv, Vbs, get(net_if)),
+ ContextName, Recv, Vbs,
+ ?DEFAULT_NOTIF_EXTRA_INFO,
+ get(net_if)),
Master ! worker_available;
- %% We don't trap exits!
+ %% We don't trap EXITs!
{send_trap,
TrapRec, NotifyName, ContextName, Recv, Vbs, LocalEngineID} ->
?vtrace("worker_loop -> send trap:"
"~n ~p", [TrapRec]),
snmpa_trap:send_trap(TrapRec, NotifyName,
- ContextName, Recv, Vbs, LocalEngineID,
+ ContextName, Recv, Vbs,
+ LocalEngineID, ?DEFAULT_NOTIF_EXTRA_INFO,
+ get(net_if)),
+ Master ! worker_available;
+
+ {send_trap,
+ TrapRec, NotifyName, ContextName, Recv, Vbs, LocalEngineID, ExtraInfo} ->
+ ?vtrace("worker_loop -> send trap:"
+ "~n ~p", [TrapRec]),
+ snmpa_trap:send_trap(TrapRec, NotifyName,
+ ContextName, Recv, Vbs,
+ LocalEngineID, ExtraInfo,
get(net_if)),
Master ! worker_available;
@@ -1713,34 +1859,79 @@ handle_acm_error(Vsn, Reason, Pdu, ACMData, Address, Extra) ->
ok
end.
+get_opt(Key, Default, SendOpts) ->
+ case lists:keysearch(Key, 1, SendOpts) of
+ {value, {Key, Value}} ->
+ Value;
+ false ->
+ Default
+ end.
-handle_send_trap(S, TrapName, NotifyName, ContextName, Recv, Varbinds,
- LocalEngineID) ->
+handle_send_trap(call, #state{type = master_agent} = S,
+ Notification, SendOpts) ->
+ SendOpts2 =
+ case lists:keymember(local_engine_id, 1, SendOpts) of
+ true ->
+ SendOpts;
+ false ->
+ [{local_engine_id, ?DEFAULT_LOCAL_ENGINE_ID}|SendOpts]
+ end,
+ handle_send_trap(S, Notification, SendOpts2);
+handle_send_trap(call, S, Notification, SendOpts) ->
+ SendOpts2 =
+ case lists:keymember(local_engine_id, 1, SendOpts) of
+ true ->
+ SendOpts;
+ false ->
+ %% subagent -
+ %% we don't need this now, eventually the trap send
+ %% request will reach the master-agent and then it
+ %% will look up the proper engine id.
+ [{local_engine_id, ignore}|SendOpts]
+ end,
+ handle_send_trap(S, Notification, SendOpts2);
+handle_send_trap(_, S, Notification, SendOpts) ->
+ handle_send_trap(S, Notification, SendOpts).
+
+handle_send_trap(S, Notification, SendOpts) ->
+ NotifyName = get_opt(name, "", SendOpts),
+ ContextName = get_opt(context, "", SendOpts),
+ Recv = get_opt(receiver, no_receiver, SendOpts),
+ Varbinds = get_opt(varbinds, [], SendOpts),
+ ExtraInfo = get_opt(extra, ?DEFAULT_NOTIF_EXTRA_INFO, SendOpts),
+ LocalEngineID =
+ get_opt(local_engine_id, ?DEFAULT_LOCAL_ENGINE_ID, SendOpts),
+ handle_send_trap(S, Notification, NotifyName, ContextName, Recv, Varbinds,
+ LocalEngineID, ExtraInfo).
+
+handle_send_trap(#state{type = Type} = S,
+ Notification, NotifyName, ContextName, Recv, Varbinds,
+ LocalEngineID, ExtraInfo) ->
?vtrace("handle_send_trap -> entry with"
- "~n S#state.type: ~p"
+ "~n Agent type: ~p"
"~n TrapName: ~p"
"~n NotifyName: ~p"
"~n ContextName: ~p"
"~n LocalEngineID: ~p",
- [S#state.type, TrapName, NotifyName, ContextName, LocalEngineID]),
- case snmpa_trap:construct_trap(TrapName, Varbinds) of
+ [Type, Notification, NotifyName, ContextName, LocalEngineID]),
+ case snmpa_trap:construct_trap(Notification, Varbinds) of
{ok, TrapRecord, VarList} ->
?vtrace("handle_send_trap -> construction complete: "
"~n TrapRecord: ~p"
"~n VarList: ~p",
[TrapRecord, VarList]),
- case S#state.type of
+ case Type of
subagent ->
?vtrace("handle_send_trap -> [sub] forward trap",[]),
maybe_forward_trap(S, TrapRecord, NotifyName,
- ContextName, Recv, VarList),
+ ContextName, Recv, VarList, ExtraInfo),
{ok, S};
master_agent ->
?vtrace("handle_send_trap -> "
"[master] handle send trap",[]),
maybe_send_trap(S, TrapRecord, NotifyName,
ContextName, Recv, VarList,
- LocalEngineID)
+ LocalEngineID, ExtraInfo)
end;
error ->
error
@@ -1748,7 +1939,7 @@ handle_send_trap(S, TrapName, NotifyName, ContextName, Recv, Varbinds,
maybe_forward_trap(#state{parent = Parent, nfilters = NFs} = S,
- TrapRec, NotifyName, ContextName, Recv, V) ->
+ TrapRec, NotifyName, ContextName, Recv, V, ExtraInfo) ->
?vtrace("maybe_forward_trap -> entry with"
"~n NFs: ~p", [NFs]),
case filter_notification(NFs, [], TrapRec) of
@@ -1764,13 +1955,15 @@ maybe_forward_trap(#state{parent = Parent, nfilters = NFs} = S,
{send, [], TrapRec2} ->
?vtrace("maybe_forward_trap -> forward trap:"
"~n ~p", [TrapRec2]),
- forward_trap(Parent, TrapRec2, NotifyName, ContextName, Recv, V),
+ forward_trap(Parent, TrapRec2, NotifyName, ContextName, Recv, V,
+ ExtraInfo),
{ok, S};
{send, Removed, TrapRec2} ->
?vtrace("maybe_forward_trap -> forward trap:"
"~n ~p", [TrapRec2]),
- forward_trap(Parent, TrapRec2, NotifyName, ContextName, Recv, V),
+ forward_trap(Parent, TrapRec2, NotifyName, ContextName, Recv, V,
+ ExtraInfo),
NFs2 = del_notification_filter(Removed, NFs),
{ok, S#state{nfilters = NFs2}}
end.
@@ -1778,7 +1971,7 @@ maybe_forward_trap(#state{parent = Parent, nfilters = NFs} = S,
maybe_send_trap(#state{nfilters = NFs} = S,
TrapRec, NotifyName, ContextName, Recv, Varbinds,
- LocalEngineID) ->
+ LocalEngineID, ExtraInfo) ->
?vtrace("maybe_send_trap -> entry with"
"~n NFs: ~p", [NFs]),
case filter_notification(NFs, [], TrapRec) of
@@ -1796,7 +1989,7 @@ maybe_send_trap(#state{nfilters = NFs} = S,
"~n ~p", [TrapRec2]),
do_handle_send_trap(S, TrapRec2,
NotifyName, ContextName, Recv, Varbinds,
- LocalEngineID);
+ LocalEngineID, ExtraInfo);
{send, Removed, TrapRec2} ->
?vtrace("maybe_send_trap -> send trap:"
@@ -1804,36 +1997,37 @@ maybe_send_trap(#state{nfilters = NFs} = S,
NFs2 = del_notification_filter(Removed, NFs),
do_handle_send_trap(S#state{nfilters = NFs2}, TrapRec2,
NotifyName, ContextName, Recv, Varbinds,
- LocalEngineID)
+ LocalEngineID, ExtraInfo)
end.
do_handle_send_trap(S, TrapRec, NotifyName, ContextName, Recv, Varbinds,
- LocalEngineID) ->
+ LocalEngineID, ExtraInfo) ->
Vbs = snmpa_trap:try_initialise_vars(get(mibserver), Varbinds),
case S#state.type of
subagent ->
forward_trap(S#state.parent, TrapRec, NotifyName, ContextName,
- Recv, Vbs),
+ Recv, Vbs, ExtraInfo),
{ok, S};
master_agent when S#state.multi_threaded =:= false ->
?vtrace("do_handle_send_trap -> send trap:"
"~n ~p", [TrapRec]),
snmpa_trap:send_trap(TrapRec, NotifyName, ContextName,
- Recv, Vbs, LocalEngineID, get(net_if)),
+ Recv, Vbs, LocalEngineID, ExtraInfo,
+ get(net_if)),
{ok, S};
master_agent when S#state.worker_state =:= busy ->
%% Main worker busy => create new worker
?vtrace("do_handle_send_trap -> main worker busy: "
"spawn a trap sender", []),
spawn_trap_thread(TrapRec, NotifyName, ContextName, Recv, Vbs,
- LocalEngineID),
+ LocalEngineID, ExtraInfo),
{ok, S};
master_agent ->
%% Send to main worker
?vtrace("do_handle_send_trap -> send to main worker",[]),
S#state.worker ! {send_trap,
TrapRec, NotifyName, ContextName, Recv, Vbs,
- LocalEngineID},
+ LocalEngineID, ExtraInfo},
{ok, S#state{worker_state = busy}}
end.
@@ -1932,7 +2126,7 @@ send_discovery(S, From,
TargetName, Record, ContextName, InitVars,
DiscoHandler, ExtraInfo) ->
case snmpa_trap:send_discovery(TargetName, Record, ContextName,
- InitVars, get(net_if)) of
+ InitVars, get(net_if), ExtraInfo) of
{ok, Sender, SecLevel} ->
Disco = #disco{from = From,
rec = Record,
@@ -2009,9 +2203,12 @@ handle_discovery_response(#state{disco = #disco{target = TargetName,
#disco{rec = Record,
ctx = ContextName,
ivbs = InitVars} = Disco,
- case snmpa_trap:send_discovery(TargetName, Record,
+ case snmpa_trap:send_discovery(TargetName,
+ Record,
ContextName,
- InitVars, get(net_if)) of
+ InitVars,
+ get(net_if),
+ ExtraInfo) of
{ok, Sender, _SecLevel} ->
?vdebug("handle_discovery_response(1) -> "
"stage 2 trap sent", []),
@@ -3971,6 +4168,14 @@ user_err(F, A) ->
%% ---------------------------------------------------------------------
+maybe_call(Server, Req) ->
+ case (wis(Server) =:= self()) of
+ false ->
+ call(Server, Req);
+ true ->
+ Server ! Req
+ end.
+
call(Server, Req) ->
gen_server:call(Server, Req, infinity).
diff --git a/lib/snmp/src/agent/snmpa_authentication_service.erl b/lib/snmp/src/agent/snmpa_authentication_service.erl
index 572fab7fbf..b5ff8460c6 100644
--- a/lib/snmp/src/agent/snmpa_authentication_service.erl
+++ b/lib/snmp/src/agent/snmpa_authentication_service.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2009. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -29,11 +29,12 @@ behaviour_info(_) ->
%%-----------------------------------------------------------------
%% init_check_access(Pdu, ACMData)
%% Pdu = #pdu
-%% ACMData = acm_data() = {community, Community, Address} |
-%% {v3, MsgID, SecModel, SecName, SecLevel,
-%% ContextEngineID, ContextName, SecData}
+%% ACMData = acm_data() = {community, SecModel, Community, TDomain, TAddress} |
+%% {v3, MsgID, SecModel, SecName, SecLevel,
+%% ContextEngineID, ContextName, SecData}
%% Community = string()
-%% Address = ip() ++ udp() (list)
+%% TDomain = ?transportDomainUdpIpv4 | ?transportDomainUdpIpv6
+%% TAddress = ip() ++ udp() (list)
%% MsgID = integer() <not used>
%% SecModel = ?SEC_* (see snmp_types.hrl)
%% SecName = string()
diff --git a/lib/snmp/src/agent/snmpa_conf.erl b/lib/snmp/src/agent/snmpa_conf.erl
index b4fc716b3e..c17a6abbd7 100644
--- a/lib/snmp/src/agent/snmpa_conf.erl
+++ b/lib/snmp/src/agent/snmpa_conf.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2006-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2006-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -48,7 +48,7 @@
%% target_addr.conf
target_addr_entry/5, target_addr_entry/6,
- target_addr_entry/8, target_addr_entry/10,
+ target_addr_entry/8, target_addr_entry/10, target_addr_entry/11,
write_target_addr_config/2, write_target_addr_config/3,
append_target_addr_config/2,
read_target_addr_config/1,
@@ -424,7 +424,8 @@ target_addr_entry(Name,
EngineId,
TMask) ->
target_addr_entry(Name, Ip, 162, TagList,
- ParamsName, EngineId, TMask, 2048).
+ ParamsName, EngineId,
+ TMask, 2048).
target_addr_entry(Name,
Ip,
@@ -435,7 +436,8 @@ target_addr_entry(Name,
TMask,
MaxMessageSize) ->
target_addr_entry(Name, Ip, Udp, 1500, 3, TagList,
- ParamsName, EngineId, TMask, MaxMessageSize).
+ ParamsName, EngineId,
+ TMask, MaxMessageSize).
target_addr_entry(Name,
Ip,
@@ -447,7 +449,24 @@ target_addr_entry(Name,
EngineId,
TMask,
MaxMessageSize) ->
+ target_addr_entry(Name, snmp_target_mib:default_domain(), Ip, Udp,
+ Timeout, RetryCount, TagList,
+ ParamsName, EngineId,
+ TMask, MaxMessageSize).
+
+target_addr_entry(Name,
+ Domain,
+ Ip,
+ Udp,
+ Timeout,
+ RetryCount,
+ TagList,
+ ParamsName,
+ EngineId,
+ TMask,
+ MaxMessageSize) ->
{Name,
+ Domain,
Ip,
Udp,
Timeout,
@@ -465,9 +484,13 @@ write_target_addr_config(Dir, Conf) ->
"%% The data is inserted into the snmpTargetAddrTable defined\n"
"%% in SNMP-TARGET-MIB, and in the snmpTargetAddrExtTable defined\n"
"%% in SNMP-COMMUNITY-MIB.\n"
-"%% Each row is a 10-tuple:\n"
-"%% {Name, Ip, Udp, Timeout, RetryCount, TagList, ParamsName, EngineId,\n"
-"%% TMask, MaxMessageSize}.\n"
+"%% Each row is a 10 or 11-tuple (Domain is optional):\n"
+"%% {Name, \n"
+"%% Domain, Ip, Port, \n"
+"%% Timeout, RetryCount, TagList, ParamsName, EngineId,\n"
+"%% TMask, MaxMessageSize}.\n"
+"%% The value of Domain decide the format of the Ip and TMask values. \n"
+"%% If not present, classic Ipv4 is assumed. \n"
"%% The EngineId value is only used if Inform-Requests are sent to this\n"
"%% target. If Informs are not sent, this value is ignored, and can be\n"
"%% e.g. an empty string. However, if Informs are sent, it is essential\n"
@@ -521,16 +544,31 @@ write_target_addr_conf(Fd, Hdr, Conf) ->
write_target_addr_conf(Fd, Conf) ->
Fun = fun(Entry) -> do_write_target_addr_conf(Fd, Entry) end,
- lists:foreach(Fun, Conf).
+ lists:foreach(Fun, Conf),
+ ok.
do_write_target_addr_conf(Fd,
- {Name, Ip, Udp,
+ {Name,
+ Ip, Udp,
+ Timeout, RetryCount, TagList,
+ ParamsName, EngineId,
+ TMask, MaxMessageSize}) ->
+ Domain = snmp_target_mib:default_domain(),
+ do_write_target_addr_conf(Fd,
+ {Name,
+ Domain, Ip, Udp,
+ Timeout, RetryCount, TagList,
+ ParamsName, EngineId,
+ TMask, MaxMessageSize});
+do_write_target_addr_conf(Fd,
+ {Name,
+ Domain, Ip, Udp,
Timeout, RetryCount, TagList,
ParamsName, EngineId,
TMask, MaxMessageSize}) ->
io:format(Fd,
- "{\"~s\", ~w, ~w, ~w, ~w, \"~s\", \"~s\", \"~s\", ~w, ~w}.~n",
- [Name, Ip, Udp, Timeout, RetryCount, TagList,
+ "{\"~s\", ~w, ~w, ~w, ~w, ~w, \"~s\", \"~s\", \"~s\", ~w, ~w}.~n",
+ [Name, Domain, Ip, Udp, Timeout, RetryCount, TagList,
ParamsName, EngineId, TMask, MaxMessageSize]);
do_write_target_addr_conf(_Fd, Crap) ->
error({bad_target_addr_config, Crap}).
@@ -546,13 +584,13 @@ target_params_entry(Name, Vsn) ->
target_params_entry(Name, Vsn, SecName, SecLevel).
target_params_entry(Name, Vsn, SecName, SecLevel) ->
- MPModel = if Vsn == v1 -> v1;
- Vsn == v2 -> v2c;
- Vsn == v3 -> v3
+ MPModel = if Vsn =:= v1 -> v1;
+ Vsn =:= v2 -> v2c;
+ Vsn =:= v3 -> v3
end,
- SecModel = if Vsn == v1 -> v1;
- Vsn == v2 -> v2c;
- Vsn == v3 -> usm
+ SecModel = if Vsn =:= v1 -> v1;
+ Vsn =:= v2 -> v2c;
+ Vsn =:= v3 -> usm
end,
target_params_entry(Name, MPModel, SecModel, SecName, SecLevel).
diff --git a/lib/snmp/src/agent/snmpa_internal.hrl b/lib/snmp/src/agent/snmpa_internal.hrl
index 9fa874f119..a490a78f84 100644
--- a/lib/snmp/src/agent/snmpa_internal.hrl
+++ b/lib/snmp/src/agent/snmpa_internal.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2006-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2006-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -23,6 +23,7 @@
-include_lib("snmp/src/app/snmp_internal.hrl").
-define(DEFAULT_LOCAL_ENGINE_ID, snmp_framework_mib:get_engine_id()).
+-define(DEFAULT_NOTIF_EXTRA_INFO, {snmpa_default_notification_extra_info}).
-define(snmpa_info(F, A), ?snmp_info("agent", F, A)).
-define(snmpa_warning(F, A), ?snmp_warning("agent", F, A)).
diff --git a/lib/snmp/src/agent/snmpa_mpd.erl b/lib/snmp/src/agent/snmpa_mpd.erl
index fd75b98f84..4f50b1a674 100644
--- a/lib/snmp/src/agent/snmpa_mpd.erl
+++ b/lib/snmp/src/agent/snmpa_mpd.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -32,6 +32,7 @@
-include("SNMP-MPD-MIB.hrl").
-include("SNMPv2-TM.hrl").
-include("SNMP-FRAMEWORK-MIB.hrl").
+-include("TRANSPORT-ADDRESS-MIB.hrl").
-define(VMODULE,"MPD").
-include("snmp_verbosity.hrl").
@@ -115,8 +116,8 @@ reset() ->
%% Func: process_packet(Packet, TDomain, TAddress, State, Log) ->
%% {ok, SnmpVsn, Pdu, PduMS, ACMData} | {discarded, Reason}
%% Types: Packet = binary()
-%% TDomain = snmpUDPDomain | atom()
-%% TAddress = {Ip, Udp}
+%% TDomain = snmpUDPDomain | transportDomain()
+%% TAddress = {Ip, Udp} (*but* depends on TDomain)
%% State = #state
%% Purpose: This is the main Message Dispatching function. (see
%% section 4.2.1 in rfc2272)
@@ -182,24 +183,30 @@ discarded_pdu(Variable) -> inc(Variable).
%%-----------------------------------------------------------------
%% Handles a Community based message (v1 or v2c).
%%-----------------------------------------------------------------
-v1_v2c_proc(Vsn, NoteStore, Community, snmpUDPDomain,
+v1_v2c_proc(Vsn, NoteStore, Community, Domain,
{Ip, Udp}, LocalEngineID,
Data, HS, Log, Packet) ->
- TAddress = tuple_to_list(Ip) ++ [Udp div 256, Udp rem 256],
- AgentMS = get_engine_max_message_size(LocalEngineID),
- MgrMS = snmp_community_mib:get_target_addr_ext_mms(?snmpUDPDomain,
- TAddress),
- PduMS = case MgrMS of
- {ok, MMS} when MMS < AgentMS -> MMS - HS;
- _ -> AgentMS - HS
- end,
+ TDomain = snmp_conf:mk_tdomain(Domain),
+ TAddress = snmp_conf:mk_taddress(Domain, Ip, Udp),
+ AgentMS = get_engine_max_message_size(LocalEngineID),
+ MgrMS = snmp_community_mib:get_target_addr_ext_mms(TDomain, TAddress),
+ PduMS = case MgrMS of
+ {ok, MMS} when MMS < AgentMS -> MMS - HS;
+ _ -> AgentMS - HS
+ end,
case (catch snmp_pdus:dec_pdu(Data)) of
Pdu when is_record(Pdu, pdu) ->
Log(Pdu#pdu.type, Packet),
inc_snmp_in_vars(Pdu),
#pdu{request_id = ReqId} = Pdu,
- OkRes = {ok, Vsn, Pdu, PduMS,
- {community, sec_model(Vsn), Community, TAddress}},
+
+ %% <TDomain>
+ %% We have added TDomain, what are the consequences?
+ ACMData =
+ {community, sec_model(Vsn), Community, TDomain, TAddress},
+ OkRes = {ok, Vsn, Pdu, PduMS, ACMData},
+ %% </TDomain>
+
%% Make sure that we don't process duplicate SET request
%% twice. We don't know what could happen in that case.
%% The mgr does, so he has to generate a new SET request.
@@ -216,8 +223,6 @@ v1_v2c_proc(Vsn, NoteStore, Community, snmpUDPDomain,
snmp_note_store:set_note(NoteStore,
100, Key, true),
%% Uses ACMData that snmpa_acm knows of.
- %% snmpUDPDomain is implicit, since that's the only
- %% one we handle.
OkRes;
true ->
{discarded, duplicate_pdu}
@@ -275,12 +280,12 @@ v3_proc(NoteStore, Packet, LocalEngineID, V3Hdr, Data, Log) ->
"~n msgSecurityParameters = ~w",
[MsgID, MMS, MsgFlags, MsgSecurityModel, SecParams]),
%% 7.2.4
- SecModule = get_security_module(MsgSecurityModel),
+ SecModule = get_security_module(MsgSecurityModel),
%% 7.2.5
- SecLevel = check_sec_level(MsgFlags),
+ SecLevel = check_sec_level(MsgFlags),
IsReportable = snmp_misc:is_reportable(MsgFlags),
%% 7.2.6
- ?vtrace("v3_proc -> [7.2.6]"
+ ?vtrace("v3_proc -> [7.2.4-7.2.6]"
"~n SecModule = ~p"
"~n SecLevel = ~p"
"~n IsReportable = ~p",
@@ -531,7 +536,7 @@ check_sec_module_result(Res, V3Hdr, Data, LocalEngineID, IsReportable, Log) ->
?vdebug("security module result [7.2.6-b]:"
"~n Reason: ~p", [Reason]),
throw({discarded, {securityError, Reason}});
- {error, Reason, ErrorInfo} when IsReportable == true -> % case 7.2.6 a
+ {error, Reason, ErrorInfo} when IsReportable =:= true -> % case 7.2.6 a
?vdebug("security module result when reportable [7.2.6-a]:"
"~n Reason: ~p"
"~n ErrorInfo: ~p", [Reason, ErrorInfo]),
@@ -574,7 +579,7 @@ generate_response_msg(Vsn, RePdu, Type, ACMData, LocalEngineID, Log) ->
generate_response_msg(Vsn, RePdu, Type, ACMData, LocalEngineID, Log, 1).
generate_response_msg(Vsn, RePdu, Type,
- {community, _SecModel, Community, _IpUdp},
+ {community, _SecModel, Community, _TDomain, _TAddress},
LocalEngineID,
Log, _) ->
case catch snmp_pdus:enc_pdu(RePdu) of
@@ -977,12 +982,15 @@ generate_discovery_msg2(NoteStore, Pdu,
discovery_note_timeout(Timeout) ->
(Timeout div 100) + 1.
-generate_discovery_msg(NoteStore, {?snmpUDPDomain, [A,B,C,D,U1,U2]},
+generate_discovery_msg(NoteStore, {TDomain, TAddress},
Pdu, ScopedPduBytes,
ContextEngineID, ManagerEngineID,
SecModel, SecName, SecLevelFlag,
InitialUserName,
ContextName, Timeout) ->
+
+ {ok, {_Domain, Address}} = transform_taddr(TDomain, TAddress),
+
%% 7.1.7
?vdebug("generate_discovery_msg -> 7.1.7 (~w)", [ManagerEngineID]),
MsgID = generate_msg_id(),
@@ -1023,7 +1031,7 @@ generate_discovery_msg(NoteStore, {?snmpUDPDomain, [A,B,C,D,U1,U2]},
%% Log(Packet),
inc_snmp_out_vars(Pdu),
?vdebug("generate_discovery_msg -> done", []),
- {Packet, {{A,B,C,D}, U1 bsl 8 + U2}};
+ {Packet, Address};
Error ->
throw(Error)
@@ -1053,6 +1061,34 @@ generate_sec_discovery_msg(Message, SecModule,
end.
+transform_taddr(?snmpUDPDomain, TAddress) ->
+ transform_taddr(?transportDomainUdpIpv4, TAddress);
+transform_taddr(?transportDomainUdpIpv4, [A, B, C, D, P1, P2]) ->
+ Domain = transportDomainUdpIpv4,
+ Addr = {A,B,C,D},
+ Port = P1 bsl 8 + P2,
+ Address = {Addr, Port},
+ {ok, {Domain, Address}};
+transform_taddr(?transportDomainUdpIpv4, BadAddr) ->
+ {error, {bad_transportDomainUdpIpv4_address, BadAddr}};
+transform_taddr(?transportDomainUdpIpv6,
+ [A1, A2, A3, A4, A5, A6, A7, A8, P1, P2]) ->
+ Domain = transportDomainUdpIpv6,
+ Addr = {A1, A2, A3, A4, A5, A6, A7, A8},
+ Port = P1 bsl 8 + P2,
+ Address = {Addr, Port},
+ {ok, {Domain, Address}};
+transform_taddr(?transportDomainUdpIpv6, BadAddr) ->
+ {error, {bad_transportDomainUdpIpv6_address, BadAddr}};
+transform_taddr(BadTDomain, TAddress) ->
+ case lists:member(BadTDomain, snmp_conf:all_tdomains()) of
+ true ->
+ {error, {unsupported_tdomain, BadTDomain, TAddress}};
+ false ->
+ {error, {unknown_tdomain, BadTDomain, TAddress}}
+ end.
+
+
process_taddrs(Dests) ->
?vtrace("process_taddrs -> entry with"
"~n Dests: ~p", [Dests]),
@@ -1062,46 +1098,44 @@ process_taddrs([], Acc) ->
?vtrace("process_taddrs -> entry when done with"
"~n Acc: ~p", [Acc]),
lists:reverse(Acc);
-
+
%% v3
-process_taddrs([{{?snmpUDPDomain, [A,B,C,D,U1,U2]}, SecData} | T], Acc) ->
+process_taddrs([{{TDomain, TAddress}, SecData} | T], Acc) ->
?vtrace("process_taddrs -> entry when v3 with"
- "~n A: ~p"
- "~n B: ~p"
- "~n C: ~p"
- "~n D: ~p"
- "~n U1: ~p"
- "~n U2: ~p"
- "~n SecData: ~p", [A, B, C, D, U1, U2, SecData]),
- Entry = {{snmpUDPDomain, {{A,B,C,D}, U1 bsl 8 + U2}}, SecData},
- process_taddrs(T, [Entry | Acc]);
-%% Bad v3
-process_taddrs([{{TDomain, TAddr}, _SecData} | T], Acc) ->
- ?vtrace("process_taddrs -> entry when bad v3 with"
- "~n TDomain: ~p"
- "~n TAddr: ~p", [TDomain, TAddr]),
- user_err("Bad TDomain/TAddr: ~w/~w", [TDomain, TAddr]),
- process_taddrs(T, Acc);
+ "~n TDomain: ~p"
+ "~n TAddress: ~p"
+ "~n SecData: ~p", [TDomain, TAddress, SecData]),
+ case transform_taddr(TDomain, TAddress) of
+ {ok, DestAddr} ->
+ ?vtrace("process_taddrs -> transformed: "
+ "~n DestAddr: ~p", [DestAddr]),
+ Entry = {DestAddr, SecData},
+ process_taddrs(T, [Entry | Acc]);
+ {error, Reason} ->
+ ?vinfo("Failed transforming v3 domain and address"
+ "~n Reason: ~p", [Reason]),
+ user_err("Bad TDomain/TAddress: ~w/~w", [TDomain, TAddress]),
+ process_taddrs(T, Acc)
+ end;
%% v1 & v2
-process_taddrs([{?snmpUDPDomain, [A,B,C,D,U1,U2]} | T], Acc) ->
+process_taddrs([{TDomain, TAddress} | T], Acc) ->
?vtrace("process_taddrs -> entry when v1/v2 with"
- "~n A: ~p"
- "~n B: ~p"
- "~n C: ~p"
- "~n D: ~p"
- "~n U1: ~p"
- "~n U2: ~p", [A, B, C, D, U1, U2]),
- Entry = {snmpUDPDomain, {{A,B,C,D}, U1 bsl 8 + U2}},
- process_taddrs(T, [Entry | Acc]);
-%% Bad v1 or v2
-process_taddrs([{TDomain, TAddr} | T], Acc) ->
- ?vtrace("process_taddrs -> entry when bad v1/v2 with"
- "~n TDomain: ~p"
- "~n TAddr: ~p", [TDomain, TAddr]),
- user_err("Bad TDomain/TAddr: ~w/~w", [TDomain, TAddr]),
- process_taddrs(T, Acc);
+ "~n TDomain: ~p"
+ "~n TAddress: ~p", [TDomain, TAddress]),
+ case transform_taddr(TDomain, TAddress) of
+ {ok, DestAddr} ->
+ ?vtrace("process_taddrs -> transformed: "
+ "~n DestAddr: ~p", [DestAddr]),
+ Entry = DestAddr,
+ process_taddrs(T, [Entry | Acc]);
+ {error, Reason} ->
+ ?vinfo("Failed transforming v1/v2 domain and address: "
+ "~n Reason: ~p", [Reason]),
+ user_err("Bad TDomain/TAddress: ~w/~w", [TDomain, TAddress]),
+ process_taddrs(T, Acc)
+ end;
process_taddrs(Crap, Acc) ->
- throw({error, {taddrs_crap, Crap, Acc}}).
+ throw({error, {bad_taddrs, Crap, Acc}}).
mk_v1_v2_packet_list(To, Packet, Len, Pdu) ->
diff --git a/lib/snmp/src/agent/snmpa_net_if.erl b/lib/snmp/src/agent/snmpa_net_if.erl
index 97a7a63dee..79c85a6e4e 100644
--- a/lib/snmp/src/agent/snmpa_net_if.erl
+++ b/lib/snmp/src/agent/snmpa_net_if.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -314,6 +314,14 @@ loop(S) ->
NewS = maybe_handle_send_pdu(S, Vsn, Pdu, MsgData, To, undefined),
loop(NewS);
+ %% We dont use the extra-info at this time, ...
+ {send_pdu, Vsn, Pdu, MsgData, To, _ExtraInfo} ->
+ ?vdebug("send pdu: "
+ "~n Pdu: ~p"
+ "~n To: ~p", [Pdu, To]),
+ NewS = maybe_handle_send_pdu(S, Vsn, Pdu, MsgData, To, undefined),
+ loop(NewS);
+
%% Informs
{send_pdu_req, Vsn, Pdu, MsgData, To, From} ->
?vdebug("send pdu request: "
@@ -324,7 +332,18 @@ loop(S) ->
NewS = maybe_handle_send_pdu(S, Vsn, Pdu, MsgData, To, From),
loop(NewS);
+ %% We dont use the extra-info at this time, ...
+ {send_pdu_req, Vsn, Pdu, MsgData, To, From, _ExtraInfo} ->
+ ?vdebug("send pdu request: "
+ "~n Pdu: ~p"
+ "~n To: ~p"
+ "~n From: ~p",
+ [Pdu, To, toname(From)]),
+ NewS = maybe_handle_send_pdu(S, Vsn, Pdu, MsgData, To, From),
+ loop(NewS);
+
%% Discovery Inform
+ %% <BACKWARD-COMPAT>
{send_discovery, Pdu, MsgData, To, From} ->
?vdebug("received send discovery request: "
"~n Pdu: ~p"
@@ -333,6 +352,18 @@ loop(S) ->
[Pdu, To, toname(From)]),
NewS = handle_send_discovery(S, Pdu, MsgData, To, From),
loop(NewS);
+ %% </BACKWARD-COMPAT>
+
+ %% Discovery Inform
+ {send_discovery, Pdu, MsgData, To, From, ExtraInfo} ->
+ ?vdebug("received send discovery request: "
+ "~n Pdu: ~p"
+ "~n To: ~p"
+ "~n From: ~p"
+ "~n ExtraInfo: ~p",
+ [Pdu, To, toname(From), ExtraInfo]),
+ NewS = handle_send_discovery(S, Pdu, MsgData, To, From),
+ loop(NewS);
{discarded_pdu, _Vsn, ReqId, _ACMData, Variable, _Extra} ->
?vdebug("discard PDU: ~p", [Variable]),
@@ -504,7 +535,6 @@ handle_discovery_response(_Ip, _Port, #pdu{request_id = ReqId} = Pdu,
S
end.
-
handle_recv(#state{usock = Sock,
mpd_state = MpdState,
note_store = NS,
@@ -513,7 +543,9 @@ handle_recv(#state{usock = Sock,
LogF = fun(Type, Data) ->
log(Log, Type, Data, Ip, Port)
end,
- case (catch snmpa_mpd:process_packet(Packet, snmpUDPDomain, {Ip, Port},
+ Domain = snmp_conf:which_domain(Ip), % What the ****...
+ case (catch snmpa_mpd:process_packet(Packet,
+ Domain, {Ip, Port},
MpdState, NS, LogF)) of
{ok, _Vsn, Pdu, _PduMS, {discovery, ManagerEngineId}} ->
handle_discovery_response(Ip, Port, Pdu, ManagerEngineId, S);
@@ -636,7 +668,6 @@ process_taddrs([{{_Domain, AddrAndPort}, _SecData}|T], Acc) ->
process_taddrs([{_Domain, AddrAndPort}|T], Acc) ->
process_taddrs(T, [AddrAndPort|Acc]).
-
merge_taddrs(To1, To2) ->
merge_taddrs(To1, To2, []).
@@ -776,15 +807,49 @@ handle_send_pdu1(#state{log = Log,
usock = Sock,
filter = FilterMod}, Type, Addresses) ->
SendFun =
- fun({snmpUDPDomain, {Ip, Port}, Packet}) when is_binary(Packet) ->
- ?vdebug("sending packet:"
+ fun({snmpUDPDomain, {Ip, Port}, Packet})
+ when is_binary(Packet) ->
+ ?vdebug("[snmpUDPDomain] sending packet:"
+ "~n size: ~p"
+ "~n to: ~p:~p",
+ [sz(Packet), Ip, Port]),
+ maybe_udp_send(FilterMod, Log, Type, Sock, Ip, Port, Packet);
+
+ ({snmpUDPDomain, {Ip, Port}, {Packet, _LogData}})
+ when is_binary(Packet) ->
+ ?vdebug("[snmpUDPDomain] sending encrypted packet:"
+ "~n size: ~p"
+ "~n to: ~p:~p",
+ [sz(Packet), Ip, Port]),
+ maybe_udp_send(FilterMod, Log, Type, Sock, Ip, Port, Packet);
+
+ ({transportDomainUdpIpv4, {Ip, Port}, Packet})
+ when is_binary(Packet) ->
+ ?vdebug("[transportDomainUdpIpv4] sending packet:"
+ "~n size: ~p"
+ "~n to: ~p:~p",
+ [sz(Packet), Ip, Port]),
+ maybe_udp_send(FilterMod, Log, Type, Sock, Ip, Port, Packet);
+
+ ({transportDomainUdpIpv4, {Ip, Port}, {Packet, _LogData}})
+ when is_binary(Packet) ->
+ ?vdebug("[transportDomainUdpIpv4] sending encrypted packet:"
+ "~n size: ~p"
+ "~n to: ~p:~p",
+ [sz(Packet), Ip, Port]),
+ maybe_udp_send(FilterMod, Log, Type, Sock, Ip, Port, Packet);
+
+ ({transportDomainUdpIpv6, {Ip, Port}, Packet})
+ when is_binary(Packet) ->
+ ?vdebug("[transportDomainUdpIpv6] sending packet:"
"~n size: ~p"
"~n to: ~p:~p",
[sz(Packet), Ip, Port]),
maybe_udp_send(FilterMod, Log, Type, Sock, Ip, Port, Packet);
- ({snmpUDPDomain, {Ip, Port}, {Packet, _LogData}}) when is_binary(Packet) ->
- ?vdebug("sending encrypted packet:"
+ ({transportDomainUdpIpv6, {Ip, Port}, {Packet, _LogData}})
+ when is_binary(Packet) ->
+ ?vdebug("[transportDomainUdpIpv6] sending encrypted packet:"
"~n size: ~p"
"~n to: ~p:~p",
[sz(Packet), Ip, Port]),
diff --git a/lib/snmp/src/agent/snmpa_set_lib.erl b/lib/snmp/src/agent/snmpa_set_lib.erl
index 191029f6db..00c77a0cdb 100644
--- a/lib/snmp/src/agent/snmpa_set_lib.erl
+++ b/lib/snmp/src/agent/snmpa_set_lib.erl
@@ -378,15 +378,15 @@ dbg_apply(M,F,A) ->
Res
end,
case Result of
- {'EXIT', {undef, [{M, F, A} | _]}} ->
+ {'EXIT', {undef, [{M, F, A, _} | _]}} ->
{'EXIT', {hook_undef, {M, F, A}}};
- {'EXIT', {function_clause, [{M, F, A} | _]}} ->
+ {'EXIT', {function_clause, [{M, F, A, _} | _]}} ->
{'EXIT', {hook_function_clause, {M, F, A}}};
% XXX: Old format for compatibility
- {'EXIT', {undef, {M, F, A}}} ->
+ {'EXIT', {undef, {M, F, A, _}}} ->
{'EXIT', {hook_undef, {M, F, A}}};
- {'EXIT', {function_clause, {M, F, A}}} ->
+ {'EXIT', {function_clause, {M, F, A, _}}} ->
{'EXIT', {hook_function_clause, {M, F, A}}};
Result ->
diff --git a/lib/snmp/src/agent/snmpa_trap.erl b/lib/snmp/src/agent/snmpa_trap.erl
index 450cb2e9f4..567de020c0 100644
--- a/lib/snmp/src/agent/snmpa_trap.erl
+++ b/lib/snmp/src/agent/snmpa_trap.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -24,27 +24,34 @@
%% External exports
-export([construct_trap/2,
try_initialise_vars/2,
- send_trap/6, send_trap/7]).
--export([send_discovery/5]).
+ send_trap/6, send_trap/7, send_trap/8]).
+-export([send_discovery/6]).
%% Internal exports
--export([init_v2_inform/9,
- init_v3_inform/9, init_v3_inform/10,
+-export([init_v2_inform/9, init_v2_inform/10,
+ init_v3_inform/9, init_v3_inform/10, init_v3_inform/11,
send_inform/6]).
--export([init_discovery_inform/12, send_discovery_inform/5]).
-
--include("snmp_types.hrl").
--include("snmpa_internal.hrl").
--include("SNMPv2-MIB.hrl").
--include("SNMPv2-TM.hrl").
--include("SNMPv2-TC.hrl").
--include("SNMP-FRAMEWORK-MIB.hrl").
--include("SNMP-TARGET-MIB.hrl").
+-export([init_discovery_inform/13, send_discovery_inform/5]).
+
+%% <BACKWARD-COMPAT>
+-export([send_discovery/5,
+ init_discovery_inform/12]).
+%% </BACKWARD-COMPAT>
+
+-include_lib("snmp/include/snmp_types.hrl").
+-include_lib("snmp/src/agent/snmpa_internal.hrl").
+-include_lib("snmp/include/SNMPv2-MIB.hrl").
+-include_lib("snmp/include/SNMPv2-TM.hrl").
+-include_lib("snmp/include/SNMPv2-TC.hrl").
+-include_lib("snmp/include/SNMP-FRAMEWORK-MIB.hrl").
+-include_lib("snmp/include/SNMP-TARGET-MIB.hrl").
+-include_lib("snmp/include/TRANSPORT-ADDRESS-MIB.hrl").
-define(enterpriseSpecific, 6).
-define(VMODULE,"TRAP").
-include("snmp_verbosity.hrl").
+-include("snmpa_internal.hrl").
%%-----------------------------------------------------------------
@@ -335,25 +342,36 @@ make_varbind_list(Varbinds) ->
%% SnmpTargetAddrTable (using the Tag).
%%-----------------------------------------------------------------
send_trap(TrapRec, NotifyName, ContextName, Recv, Vbs, NetIf) ->
+ ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
+ LocalEngineID = ?DEFAULT_LOCAL_ENGINE_ID,
+ send_trap(TrapRec, NotifyName, ContextName, Recv, Vbs,
+ LocalEngineID, ExtraInfo, NetIf).
+
+send_trap(TrapRec, NotifyName, ContextName, Recv, Vbs, ExtraInfo, NetIf) ->
LocalEngineID = ?DEFAULT_LOCAL_ENGINE_ID,
send_trap(TrapRec, NotifyName, ContextName, Recv, Vbs,
- LocalEngineID, NetIf).
+ LocalEngineID, ExtraInfo, NetIf).
-send_trap(TrapRec, NotifyName, ContextName, Recv, Vbs, LocalEngineID, NetIf) ->
+send_trap(TrapRec, NotifyName, ContextName, Recv, Vbs, LocalEngineID,
+ ExtraInfo, NetIf) ->
(catch do_send_trap(TrapRec, NotifyName, ContextName, Recv, Vbs,
- LocalEngineID, NetIf)).
+ LocalEngineID, ExtraInfo, NetIf)).
do_send_trap(TrapRec, NotifyName, ContextName, Recv, Vbs,
- LocalEngineID, NetIf) ->
+ LocalEngineID, ExtraInfo, NetIf) ->
VarbindList = make_varbind_list(Vbs),
Dests = find_dests(NotifyName),
send_trap_pdus(Dests, ContextName, {TrapRec, VarbindList}, [], [], [],
- Recv, LocalEngineID, NetIf).
+ Recv, LocalEngineID, ExtraInfo, NetIf).
send_discovery(TargetName, Record, ContextName, Vbs, NetIf) ->
+ ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
+ send_discovery(TargetName, Record, ContextName, Vbs, NetIf, ExtraInfo).
+send_discovery(TargetName, Record, ContextName, Vbs, NetIf, ExtraInfo) ->
case find_dest(TargetName) of
{ok, Dest} ->
- send_discovery_pdu(Dest, Record, ContextName, Vbs, NetIf);
+ send_discovery_pdu(Dest, Record, ContextName, Vbs, NetIf,
+ ExtraInfo);
Error ->
Error
end.
@@ -440,11 +458,13 @@ split_variables([]) -> {[], []}.
%% NOTE: This function is executed in the master agent's context
%%-----------------------------------------------------------------
find_dests("") ->
+ ?vtrace("find destinations", []),
snmp_notification_mib:get_targets();
find_dests(NotifyName) ->
+ ?vtrace("find destinations for ~p", [NotifyName]),
case snmp_notification_mib:get_targets(NotifyName) of
[] ->
- ?vlog("No dests found for snmpNotifyName: ~p",[NotifyName]),
+ ?vlog("No dests found for NotifyName: ~p", [NotifyName]),
[];
Dests ->
Dests
@@ -529,7 +549,8 @@ find_dest(TargetName) ->
send_discovery_pdu({Dest, TargetName, {SecModel, SecName, SecLevel},
Timeout, Retry},
- Record, ContextName, Vbs, NetIf) ->
+ Record, ContextName, Vbs, NetIf,
+ ExtraInfo) ->
?vdebug("send_discovery_pdu -> entry with "
"~n Destination address: ~p"
"~n Target name: ~p"
@@ -539,9 +560,10 @@ send_discovery_pdu({Dest, TargetName, {SecModel, SecName, SecLevel},
"~n Timeout: ~p"
"~n Retry: ~p"
"~n Record: ~p"
- "~n ContextName: ~p",
+ "~n ContextName: ~p"
+ "~n ExtraInfo: ~p",
[Dest, TargetName, SecModel, SecName, SecLevel,
- Timeout, Retry, Record, ContextName]),
+ Timeout, Retry, Record, ContextName, ExtraInfo]),
case get_mib_view(SecModel, SecName, SecLevel, ContextName) of
{ok, MibView} ->
case check_all_varbinds(Record, Vbs, MibView) of
@@ -551,7 +573,7 @@ send_discovery_pdu({Dest, TargetName, {SecModel, SecName, SecLevel},
SecModel, SecName, SecLevel,
TargetName, ContextName,
Timeout, Retry,
- SysUpTime, NetIf);
+ SysUpTime, NetIf, ExtraInfo);
false ->
{error, {mibview_validation_failed, Vbs, MibView}}
end;
@@ -561,7 +583,7 @@ send_discovery_pdu({Dest, TargetName, {SecModel, SecName, SecLevel},
send_discovery_pdu(Record, Dest, Vbs,
SecModel, SecName, SecLevel, TargetName,
- ContextName, Timeout, Retry, SysUpTime, NetIf) ->
+ ContextName, Timeout, Retry, SysUpTime, NetIf, ExtraInfo) ->
{_Oid, IVbs} = mk_v2_trap(Record, Vbs, SysUpTime), % v2 refers to SMIv2;
Sender = proc_lib:spawn_link(?MODULE, init_discovery_inform,
[self(),
@@ -570,13 +592,25 @@ send_discovery_pdu(Record, Dest, Vbs,
ContextName,
Timeout, Retry,
IVbs, NetIf,
- get(verbosity)]),
+ get(verbosity),
+ ExtraInfo]),
{ok, Sender, SecLevel}.
init_discovery_inform(Parent,
Dest,
SecModel, SecName, SecLevel, TargetName,
ContextName, Timeout, Retry, Vbs, NetIf, Verbosity) ->
+ ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
+ init_discovery_inform(Parent,
+ Dest,
+ SecModel, SecName, SecLevel, TargetName,
+ ContextName, Timeout, Retry, Vbs, NetIf,
+ Verbosity, ExtraInfo).
+init_discovery_inform(Parent,
+ Dest,
+ SecModel, SecName, SecLevel, TargetName,
+ ContextName, Timeout, Retry, Vbs, NetIf,
+ Verbosity, ExtraInfo) ->
put(verbosity, Verbosity),
put(sname, madis),
Pdu = make_discovery_pdu(Vbs),
@@ -584,7 +618,7 @@ init_discovery_inform(Parent,
SecLevelFlag = mk_flag(SecLevel),
SecData = {SecModel, SecName, SecLevelFlag, TargetName},
MsgData = {SecData, ContextEngineId, ContextName},
- Msg = {send_discovery, Pdu, MsgData, Dest, self()},
+ Msg = {send_discovery, Pdu, MsgData, Dest, self(), ExtraInfo},
?MODULE:send_discovery_inform(Parent, Timeout*10, Retry, Msg, NetIf).
%% note_timeout(Timeout, Retry)
@@ -628,11 +662,11 @@ send_discovery_inform(Parent, Timeout, Retry, Msg, NetIf) ->
%% should be used for the target, and determine the message
%% specific parameters to be used.
%%-----------------------------------------------------------------
-send_trap_pdus([{DestAddr, TargetName, {MpModel, SecModel, SecName, SecLevel},
- Type} | T],
+send_trap_pdus([{DestAddr, TargetName,
+ {MpModel, SecModel, SecName, SecLevel}, Type} | T],
ContextName,
{TrapRec, Vbs}, V1Res, V2Res, V3Res, Recv,
- LocalEngineID, NetIf) ->
+ LocalEngineID, ExtraInfo, NetIf) ->
?vdebug("send trap pdus: "
"~n Destination address: ~p"
"~n Target name: ~p"
@@ -658,13 +692,13 @@ send_trap_pdus([{DestAddr, TargetName, {MpModel, SecModel, SecName, SecLevel},
send_trap_pdus(T, ContextName, {TrapRec, Vbs},
[{DestAddr, Community} | V1Res],
V2Res, V3Res, Recv,
- LocalEngineID, NetIf);
+ LocalEngineID, ExtraInfo, NetIf);
undefined ->
?vdebug("No community found for v1 dest: ~p",
[element(2, DestAddr)]),
send_trap_pdus(T, ContextName, {TrapRec, Vbs},
V1Res, V2Res, V3Res, Recv,
- LocalEngineID, NetIf)
+ LocalEngineID, ExtraInfo, NetIf)
end;
true when MpModel =:= ?MP_V2C ->
?vtrace("send_trap_pdus -> v2c mp model",[]),
@@ -679,13 +713,14 @@ send_trap_pdus([{DestAddr, TargetName, {MpModel, SecModel, SecName, SecLevel},
send_trap_pdus(T, ContextName, {TrapRec, Vbs},
V1Res,
[{DestAddr, Community, Type}|V2Res],
- V3Res, Recv, LocalEngineID, NetIf);
+ V3Res, Recv,
+ LocalEngineID, ExtraInfo, NetIf);
undefined ->
?vdebug("No community found for v2c dest: ~p",
[element(2, DestAddr)]),
send_trap_pdus(T, ContextName, {TrapRec, Vbs},
V1Res, V2Res, V3Res, Recv,
- LocalEngineID, NetIf)
+ LocalEngineID, ExtraInfo, NetIf)
end;
true when MpModel =:= ?MP_V3 ->
?vtrace("send_trap_pdus -> v3 mp model",[]),
@@ -694,20 +729,20 @@ send_trap_pdus([{DestAddr, TargetName, {MpModel, SecModel, SecName, SecLevel},
send_trap_pdus(T, ContextName, {TrapRec, Vbs},
V1Res, V2Res,
[{DestAddr, MsgData, Type} | V3Res],
- Recv, LocalEngineID, NetIf);
+ Recv, LocalEngineID, ExtraInfo, NetIf);
true ->
?vlog("bad MpModel ~p for dest ~p",
[MpModel, element(2, DestAddr)]),
send_trap_pdus(T, ContextName, {TrapRec, Vbs},
V1Res, V2Res, V3Res, Recv,
- LocalEngineID, NetIf);
+ LocalEngineID, ExtraInfo, NetIf);
_ ->
?vlog("no access for dest: "
"~n ~p in target ~p",
[element(2, DestAddr), TargetName]),
send_trap_pdus(T, ContextName, {TrapRec, Vbs},
V1Res, V2Res, V3Res, Recv,
- LocalEngineID, NetIf)
+ LocalEngineID, ExtraInfo, NetIf)
end;
{discarded, Reason} ->
?vlog("mib view error ~p for"
@@ -715,24 +750,27 @@ send_trap_pdus([{DestAddr, TargetName, {MpModel, SecModel, SecName, SecLevel},
"~n SecName: ~w",
[Reason, element(2, DestAddr), SecName]),
send_trap_pdus(T, ContextName, {TrapRec, Vbs},
- V1Res, V2Res, V3Res, Recv, LocalEngineID, NetIf)
+ V1Res, V2Res, V3Res, Recv,
+ LocalEngineID, ExtraInfo, NetIf)
end;
-send_trap_pdus([], ContextName, {TrapRec, Vbs}, V1Res, V2Res, V3Res,
- Recv, LocalEngineID, NetIf) ->
+send_trap_pdus([], ContextName, {TrapRec, Vbs},
+ V1Res, V2Res, V3Res, Recv,
+ LocalEngineID, ExtraInfo,
+ NetIf) ->
SysUpTime = snmp_standard_mib:sys_up_time(),
?vdebug("send trap pdus with sysUpTime ~p", [SysUpTime]),
InformRecvs = get_inform_recvs(V2Res ++ V3Res),
InformTargets = [Addr || {Addr, _, _, _} <- InformRecvs],
deliver_recv(Recv, snmp_targets, InformTargets),
- send_v1_trap(TrapRec, V1Res, Vbs, NetIf, SysUpTime),
- send_v2_trap(TrapRec, V2Res, Vbs, Recv, NetIf, SysUpTime),
- send_v3_trap(TrapRec, V3Res, Vbs, Recv, LocalEngineID, NetIf,
+ send_v1_trap(TrapRec, V1Res, Vbs, ExtraInfo, NetIf, SysUpTime),
+ send_v2_trap(TrapRec, V2Res, Vbs, Recv, ExtraInfo, NetIf, SysUpTime),
+ send_v3_trap(TrapRec, V3Res, Vbs, Recv, LocalEngineID, ExtraInfo, NetIf,
SysUpTime, ContextName).
-send_v1_trap(_TrapRec, [], _Vbs, _NetIf, _SysUpTime) ->
+send_v1_trap(_TrapRec, [], _Vbs, _ExtraInfo, _NetIf, _SysUpTime) ->
ok;
send_v1_trap(#trap{enterpriseoid = Enter, specificcode = Spec},
- V1Res, Vbs, NetIf, SysUpTime) ->
+ V1Res, Vbs, ExtraInfo, NetIf, SysUpTime) ->
?vdebug("prepare to send v1 trap "
"~n '~p'"
"~n with"
@@ -744,9 +782,10 @@ send_v1_trap(#trap{enterpriseoid = Enter, specificcode = Spec},
lists:foreach(fun({Community, Addrs}) ->
?vtrace("send v1 trap pdu to ~p",[Addrs]),
NetIf ! {send_pdu, 'version-1', TrapPdu,
- {community, Community}, Addrs}
+ {community, Community}, Addrs, ExtraInfo}
end, AddrCommunities);
-send_v1_trap(#notification{oid = Oid}, V1Res, Vbs, NetIf, SysUpTime) ->
+send_v1_trap(#notification{oid = Oid}, V1Res, Vbs, ExtraInfo, NetIf,
+ SysUpTime) ->
%% Use alg. in rfc2089 to map a v2 trap to a v1 trap
% delete Counter64 objects from vbs
?vdebug("prepare to send v1 trap '~p'",[Oid]),
@@ -768,31 +807,31 @@ send_v1_trap(#notification{oid = Oid}, V1Res, Vbs, NetIf, SysUpTime) ->
lists:foreach(fun({Community, Addrs}) ->
?vtrace("send v1 trap to ~p",[Addrs]),
NetIf ! {send_pdu, 'version-1', TrapPdu,
- {community, Community}, Addrs}
+ {community, Community}, Addrs, ExtraInfo}
end, AddrCommunities).
-send_v2_trap(_TrapRec, [], _Vbs, _Recv, _NetIf, _SysUpTime) ->
+send_v2_trap(_TrapRec, [], _Vbs, _Recv, _ExtraInfo, _NetIf, _SysUpTime) ->
ok;
-send_v2_trap(TrapRec, V2Res, Vbs, Recv, NetIf, SysUpTime) ->
+send_v2_trap(TrapRec, V2Res, Vbs, Recv, ExtraInfo, NetIf, SysUpTime) ->
?vdebug("prepare to send v2 trap",[]),
{_Oid, IVbs} = mk_v2_trap(TrapRec, Vbs, SysUpTime),
- TrapRecvs = get_trap_recvs(V2Res),
- InformRecvs = get_inform_recvs(V2Res),
- do_send_v2_trap(TrapRecvs, IVbs, NetIf),
- do_send_v2_inform(InformRecvs, IVbs, Recv, NetIf).
+ TrapRecvs = get_trap_recvs(V2Res),
+ InformRecvs = get_inform_recvs(V2Res),
+ do_send_v2_trap(TrapRecvs, IVbs, ExtraInfo, NetIf),
+ do_send_v2_inform(InformRecvs, IVbs, Recv, ExtraInfo, NetIf).
-send_v3_trap(_TrapRec, [], _Vbs, _Recv, _LocalEngineID,
+send_v3_trap(_TrapRec, [], _Vbs, _Recv, _LocalEngineID, _ExtraInfo,
_NetIf, _SysUpTime, _ContextName) ->
ok;
-send_v3_trap(TrapRec, V3Res, Vbs, Recv, LocalEngineID,
+send_v3_trap(TrapRec, V3Res, Vbs, Recv, LocalEngineID, ExtraInfo,
NetIf, SysUpTime, ContextName) ->
?vdebug("prepare to send v3 trap",[]),
{_Oid, IVbs} = mk_v2_trap(TrapRec, Vbs, SysUpTime), % v2 refers to SMIv2;
TrapRecvs = get_trap_recvs(V3Res), % same SMI for v3
InformRecvs = get_inform_recvs(V3Res),
- do_send_v3_trap(TrapRecvs, ContextName, IVbs, NetIf),
+ do_send_v3_trap(TrapRecvs, ContextName, IVbs, ExtraInfo, NetIf),
do_send_v3_inform(InformRecvs, ContextName, IVbs, Recv,
- LocalEngineID, NetIf).
+ LocalEngineID, ExtraInfo, NetIf).
mk_v2_trap(#notification{oid = Oid}, Vbs, SysUpTime) ->
@@ -830,60 +869,70 @@ get_inform_recvs(InformRecvs) ->
[{Addr, MsgData, Timeout, Retry} ||
{Addr, MsgData, {inform, Timeout, Retry}} <- InformRecvs].
-do_send_v2_trap([], _Vbs, _NetIf) ->
+do_send_v2_trap([], _Vbs, _ExtraInfo, _NetIf) ->
ok;
-do_send_v2_trap(Recvs, Vbs, NetIf) ->
+do_send_v2_trap(Recvs, Vbs, ExtraInfo, NetIf) ->
TrapPdu = make_v2_notif_pdu(Vbs, 'snmpv2-trap'),
AddrCommunities = mk_addr_communities(Recvs),
lists:foreach(fun({Community, Addrs}) ->
?vtrace("~n send v2 trap to ~p",[Addrs]),
NetIf ! {send_pdu, 'version-2', TrapPdu,
- {community, Community}, Addrs}
+ {community, Community}, Addrs, ExtraInfo}
end, AddrCommunities),
ok.
-do_send_v2_inform([], _Vbs, _Recv, _NetIf) ->
+do_send_v2_inform([], _Vbs, _Recv, _ExtraInfo, _NetIf) ->
ok;
-do_send_v2_inform(Recvs, Vbs, Recv, NetIf) ->
+do_send_v2_inform(Recvs, Vbs, Recv, ExtraInfo, NetIf) ->
lists:foreach(
fun({Addr, Community, Timeout, Retry}) ->
?vtrace("~n start inform sender to send v2 inform to ~p",
[Addr]),
proc_lib:spawn_link(?MODULE, init_v2_inform,
[Addr, Timeout, Retry, Vbs,
- Recv, NetIf, Community,
+ Recv, ExtraInfo, NetIf, Community,
get(verbosity), get(sname)])
end,
Recvs).
-do_send_v3_trap([], _ContextName, _Vbs, _NetIf) ->
+do_send_v3_trap([], _ContextName, _Vbs, _ExtraInfo, _NetIf) ->
ok;
-do_send_v3_trap(Recvs, ContextName, Vbs, NetIf) ->
+do_send_v3_trap(Recvs, ContextName, Vbs, ExtraInfo, NetIf) ->
TrapPdu = make_v2_notif_pdu(Vbs, 'snmpv2-trap'), % Yes, v2
ContextEngineId = snmp_framework_mib:get_engine_id(),
lists:foreach(fun(Recv) ->
?vtrace("~n send v3 notif to ~p",[Recv]),
NetIf ! {send_pdu, 'version-3', TrapPdu,
- {v3, ContextEngineId, ContextName}, [Recv]}
+ {v3, ContextEngineId, ContextName},
+ [Recv], ExtraInfo}
end, Recvs),
ok.
-do_send_v3_inform([], _ContextName, _Vbs, _Recv, _LocalEngineID, _NetIf) ->
+do_send_v3_inform([], _ContextName, _Vbs, _Recv,
+ _LocalEngineID, _ExtraInfo, _NetIf) ->
ok;
-do_send_v3_inform(Recvs, ContextName, Vbs, Recv, LocalEngineID, NetIf) ->
+do_send_v3_inform(Recvs, ContextName, Vbs, Recv,
+ LocalEngineID, ExtraInfo, NetIf) ->
lists:foreach(
fun({Addr, MsgData, Timeout, Retry}) ->
?vtrace("~n start inform sender to send v3 inform to ~p",
[Addr]),
proc_lib:spawn_link(?MODULE, init_v3_inform,
[{Addr, MsgData}, Timeout, Retry, Vbs,
- Recv, LocalEngineID, NetIf, ContextName,
+ Recv, LocalEngineID, ExtraInfo,
+ NetIf, ContextName,
get(verbosity), get(sname)])
end,
Recvs).
%% New process
-init_v2_inform(Addr, Timeout, Retry, Vbs, Recv, NetIf, Community,V,S) ->
+init_v2_inform(Addr, Timeout, Retry, Vbs, Recv, NetIf, Community, V, S) ->
+ ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
+ init_v2_inform(Addr, Timeout, Retry, Vbs, Recv, ExtraInfo, NetIf,
+ Community, V, S).
+
+init_v2_inform(Addr, Timeout, Retry, Vbs, Recv, ExtraInfo, NetIf,
+ Community, V, S) ->
%% Make a new Inform for each recipient; they need unique
%% request-ids!
put(verbosity,V),
@@ -892,17 +941,26 @@ init_v2_inform(Addr, Timeout, Retry, Vbs, Recv, NetIf, Community,V,S) ->
[Timeout,Retry]),
InformPdu = make_v2_notif_pdu(Vbs, 'inform-request'),
Msg = {send_pdu_req, 'version-2', InformPdu, {community, Community},
- [Addr], self()},
+ [Addr], self(), ExtraInfo},
?MODULE:send_inform(Addr, Timeout*10, Retry, Msg, Recv, NetIf).
%% New process
init_v3_inform(Addr, Timeout, Retry, Vbs, Recv, NetIf, ContextName, V, S) ->
+ ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
LocalEngineID = ?DEFAULT_LOCAL_ENGINE_ID,
- init_v3_inform(Addr, Timeout, Retry, Vbs, Recv, LocalEngineID,
+ init_v3_inform(Addr, Timeout, Retry, Vbs, Recv,
+ LocalEngineID, ExtraInfo,
+ NetIf, ContextName, V, S).
+
+init_v3_inform(Addr, Timeout, Retry, Vbs, Recv, LocalEngineID, NetIf,
+ ContextName, V, S) ->
+ ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
+ init_v3_inform(Addr, Timeout, Retry, Vbs, Recv,
+ LocalEngineID, ExtraInfo,
NetIf, ContextName, V, S).
-init_v3_inform(Addr, Timeout, Retry, Vbs, Recv, LocalEngineID,
+init_v3_inform(Addr, Timeout, Retry, Vbs, Recv, LocalEngineID, ExtraInfo,
NetIf, ContextName, V, S) ->
%% Make a new Inform for each recipient; they need unique
%% request-ids!
@@ -913,7 +971,7 @@ init_v3_inform(Addr, Timeout, Retry, Vbs, Recv, LocalEngineID,
InformPdu = make_v2_notif_pdu(Vbs, 'inform-request'), % Yes, v2
ContextEngineId = LocalEngineID,
Msg = {send_pdu_req, 'version-3', InformPdu,
- {v3, ContextEngineId, ContextName}, [Addr], self()},
+ {v3, ContextEngineId, ContextName}, [Addr], self(), ExtraInfo},
?MODULE:send_inform(Addr, Timeout*10, Retry, Msg, Recv, NetIf).
send_inform(Addr, _Timeout, -1, _Msg, Recv, _NetIf) ->
@@ -1001,9 +1059,27 @@ transform_taddr({?snmpUDPDomain, [A1, A2, A3, A4, P1, P2]}) -> % v2
Addr = {A1, A2, A3, A4},
Port = P1 bsl 8 + P2,
{Addr, Port};
+transform_taddr({?transportDomainUdpIpv4, [A1, A2, A3, A4, P1, P2]}) -> % v2
+ Addr = {A1, A2, A3, A4},
+ Port = P1 bsl 8 + P2,
+ {Addr, Port};
+transform_taddr({?transportDomainUdpIpv6,
+ [A1, A2, A3, A4, A5, A6, A7, A8, P1, P2]}) -> % v2
+ Addr = {A1, A2, A3, A4, A5, A6, A7, A8},
+ Port = P1 bsl 8 + P2,
+ {Addr, Port};
transform_taddr({{?snmpUDPDomain, [A1, A2, A3, A4, P1, P2]}, _MsgData}) -> % v3
Addr = {A1, A2, A3, A4},
Port = P1 bsl 8 + P2,
+ {Addr, Port};
+transform_taddr({{?transportDomainUdpIpv4, [A1, A2, A3, A4, P1, P2]}, _MsgData}) -> % v3
+ Addr = {A1, A2, A3, A4},
+ Port = P1 bsl 8 + P2,
+ {Addr, Port};
+transform_taddr({{?transportDomainUdpIpv6,
+ [A1, A2, A3, A4, A5, A6, A7, A8, P1, P2]}, _MsgData}) -> % v3
+ Addr = {A1, A2, A3, A4, A5, A6, A7, A8},
+ Port = P1 bsl 8 + P2,
{Addr, Port}.
@@ -1053,13 +1129,14 @@ mk_addr_communities(Recvs) ->
[{Addr, Comm} | T] = lists:keysort(2, Recvs),
mic(T, Comm, [Addr], []).
-mic([{Addr, Comm} | T], CurComm, AddrList, Res) when Comm == CurComm ->
+mic([{Addr, Comm} | T], CurComm, AddrList, Res) when Comm =:= CurComm ->
mic(T, CurComm, [Addr | AddrList], Res);
mic([{Addr, Comm} | T], CurComm, AddrList, Res) ->
mic(T, Comm, [Addr], [{CurComm, AddrList} | Res]);
mic([], CurComm, AddrList, Res) ->
[{CurComm, AddrList} | Res].
+
%%-----------------------------------------------------------------
%% Convert the SecurityLevel into a flag value used by snmpa_mpd
%%-----------------------------------------------------------------
diff --git a/lib/snmp/src/agent/snmpa_usm.erl b/lib/snmp/src/agent/snmpa_usm.erl
index f35d1f1916..6f54307f9f 100644
--- a/lib/snmp/src/agent/snmpa_usm.erl
+++ b/lib/snmp/src/agent/snmpa_usm.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1999-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1999-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -330,7 +330,6 @@ non_authoritative(SecName,
end
end.
-
is_auth(?usmNoAuthProtocol, _, _, _, SecName, _, _, _, _) -> % 3.2.5
error(usmStatsUnsupportedSecLevels,
?usmStatsUnsupportedSecLevels_instance, SecName); % OTP-5464
@@ -613,8 +612,7 @@ authenticate_outgoing(Message, UsmSecParams,
end,
?vtrace("authenticate_outgoing -> encode message only",[]),
snmp_pdus:enc_message_only(Message2).
-
-
+
%%-----------------------------------------------------------------
%% Auth and priv algorithms
@@ -753,14 +751,19 @@ set_engine_latest_time(SnmpEngineID, EngineTime) ->
%%-----------------------------------------------------------------
%% Utility functions
%%-----------------------------------------------------------------
+-spec error(term()) -> no_return().
error(Reason) ->
throw({error, Reason}).
+-spec error(term(), term()) -> no_return().
error(Reason, ErrorInfo) ->
throw({error, Reason, ErrorInfo}).
+-spec error(term(), term(), term()) -> no_return().
error(Variable, Oid, SecName) ->
error(Variable, Oid, SecName, []).
+
+-spec error(term(), term(), term(), [term()]) -> no_return().
error(Variable, Oid, SecName, Opts) ->
Val = inc(Variable),
ErrorInfo = {#varbind{oid = Oid,
@@ -772,7 +775,6 @@ error(Variable, Oid, SecName, Opts) ->
inc(Name) -> ets:update_counter(snmp_agent_table, Name, 1).
-
get_counter(Name) ->
case (catch ets:lookup(snmp_agent_table, Name)) of
[{_, Val}] ->
@@ -780,8 +782,3 @@ get_counter(Name) ->
_ ->
0
end.
-
-
-
-
-
diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src
index de0e5d6e14..af988fda26 100644
--- a/lib/snmp/src/app/snmp.appup.src
+++ b/lib/snmp/src/app/snmp.appup.src
@@ -22,61 +22,83 @@
%% ----- U p g r a d e -------------------------------------------------------
[
- {"4.18",
+ {"4.21.2",
[
- {load_module, snmp_misc, soft_purge, soft_purge, []},
- {load_module, snmpa_vacm, soft_purge, soft_purge, []},
- {load_module, snmpa, soft_purge, soft_purge,
- [snmp_community_mib,
- snmp_framework_mib,
- snmp_standard_mib,
- snmp_target_mib,
- snmp_user_based_sm_mib,
- snmp_view_based_acm_mib]},
- {load_module, snmp_community_mib, soft_purge, soft_purge,
- [snmpa_mib_lib]},
- {load_module, snmp_framework_mib, soft_purge, soft_purge,
- [snmpa_mib_lib]},
- {load_module, snmp_standard_mib, soft_purge, soft_purge,
- [snmpa_mib_lib]},
- {load_module, snmp_target_mib, soft_purge, soft_purge,
- [snmpa_mib_lib]},
- {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge,
- [snmpa_mib_lib]},
- {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge,
- [snmpa_mib_lib, snmpa_vacm]},
- {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}
]
- }
+ },
+ {"4.21.1",
+ [
+ {update, snmp_note_store, soft, soft_purge, soft_purge, []}
+ ]
+ },
+ {"4.21",
+ [
+ {update, snmp_note_store, soft, soft_purge, soft_purge, []},
+ {load_module, snmp_target_mib, soft_purge, soft_purge, []}
+ ]
+ },
+ {"4.20.1",
+ [
+ {load_module, snmp_target_mib, soft_purge, soft_purge, []},
+ {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []},
+ {load_module, snmpm, soft_purge, soft_purge,
+ [snmpm_server, snmpm_config, snmp_config]},
+ {load_module, snmp_conf, soft_purge, soft_purge, []},
+ {load_module, snmp_config, soft_purge, soft_purge, []},
+ {load_module, snmpm_mpd, soft_purge, soft_purge,
+ [snmp_conf, snmp_config, snmpm_config]},
+ {load_module, snmpa_mpd, soft_purge, soft_purge,
+ [snmp_conf, snmp_config]},
+ {load_module, snmpa_conf, soft_purge, soft_purge, [snmp_config]},
+ {update, snmp_note_store, soft, soft_purge, soft_purge, []},
+ {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mpd]},
+ {update, snmpm_config, soft, soft_purge, soft_purge, [snmp_conf]},
+ {update, snmpm_server, soft, soft_purge, soft_purge,
+ [snmpm_net_if, snmpm_mpd, snmpm_config]},
+ {update, snmpm_net_if, soft, soft_purge, soft_purge,
+ [snmp_conf, snmpm_mpd, snmpm_config]}
+ ]
+ }
],
%% ------D o w n g r a d e ---------------------------------------------------
[
- {"4.18",
+ {"4.21.2",
+ [
+ ]
+ },
+ {"4.21.1",
+ [
+ {update, snmp_note_store, soft, soft_purge, soft_purge, []}
+ ]
+ },
+ {"4.21",
+ [
+ {update, snmp_note_store, soft, soft_purge, soft_purge, []},
+ {load_module, snmp_target_mib, soft_purge, soft_purge, []}
+ ]
+ },
+ {"4.20.1",
[
- {load_module, snmp_misc, soft_purge, soft_purge, []},
- {load_module, snmpa_vacm, soft_purge, soft_purge, []},
- {load_module, snmpa, soft_purge, soft_purge,
- [snmp_community_mib,
- snmp_framework_mib,
- snmp_standard_mib,
- snmp_target_mib,
- snmp_user_based_sm_mib,
- snmp_view_based_acm_mib]},
- {load_module, snmp_community_mib, soft_purge, soft_purge,
- [snmpa_mib_lib]},
- {load_module, snmp_framework_mib, soft_purge, soft_purge,
- [snmpa_mib_lib]},
- {load_module, snmp_standard_mib, soft_purge, soft_purge,
- [snmpa_mib_lib]},
- {load_module, snmp_target_mib, soft_purge, soft_purge,
- [snmpa_mib_lib]},
- {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge,
- [snmpa_mib_lib]},
- {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge,
- [snmpa_mib_lib, snmpa_vacm]},
- {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}
+ {load_module, snmp_target_mib, soft_purge, soft_purge, []},
+ {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []},
+ {load_module, snmpm, soft_purge, soft_purge,
+ [snmpm_server, snmpm_config, snmp_config]},
+ {load_module, snmp_conf, soft_purge, soft_purge, []},
+ {load_module, snmp_config, soft_purge, soft_purge, []},
+ {load_module, snmpm_mpd, soft_purge, soft_purge,
+ [snmp_conf, snmp_config, snmpm_config]},
+ {load_module, snmpa_mpd, soft_purge, soft_purge,
+ [snmp_conf, snmp_config]},
+ {load_module, snmpa_conf, soft_purge, soft_purge, [snmp_config]},
+ {update, snmp_note_store, soft, soft_purge, soft_purge, []},
+ {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mpd]},
+ {update, snmpm_config, soft, soft_purge, soft_purge, [snmp_conf]},
+ {update, snmpm_server, soft, soft_purge, soft_purge,
+ [snmpm_net_if, snmpm_mpd, snmpm_config]},
+ {update, snmpm_net_if, soft, soft_purge, soft_purge,
+ [snmp_conf, snmpm_mpd, snmpm_config]}
]
}
]
diff --git a/lib/snmp/src/compile/Makefile b/lib/snmp/src/compile/Makefile
index 0ceaf276a6..627af6f185 100644
--- a/lib/snmp/src/compile/Makefile
+++ b/lib/snmp/src/compile/Makefile
@@ -45,11 +45,10 @@ RELSYSDIR = $(RELEASE_PATH)/lib/snmp-$(VSN)
include modules.mk
-ESCRIPT_BIN = $(ESCRIPT_SRC:%.src=$(BIN)/%)
-
-ERL_FILES = $(MODULES:%=%.erl)
-
-TARGET_FILES = $(MODULES:%=$(EBIN)/%.$(EMULATOR)) $(ESCRIPT_BIN)
+ESCRIPT_BIN = $(ESCRIPT_SRC:%.src=$(BIN)/%)
+ERL_FILES = $(MODULES:%=%.erl)
+EBIN_FILES = $(MODULES:%=$(EBIN)/%.$(EMULATOR))
+TARGET_FILES = $(EBIN_FILES) $(ESCRIPT_BIN)
GENERATED_PARSER = $(PARSER_MODULE:%=%.erl)
@@ -125,7 +124,7 @@ release_spec: opt
$(INSTALL_DIR) $(RELSYSDIR)/src/compiler
$(INSTALL_DATA) $(ESCRIPT_SRC) $(PARSER_SRC) $(ERL_FILES) $(INTERNAL_HRL_FILES) $(RELSYSDIR)/src/compiler
$(INSTALL_DIR) $(RELSYSDIR)/ebin
- $(INSTALL_DATA) $(TARGET_FILES) $(RELSYSDIR)/ebin
+ $(INSTALL_DATA) $(EBIN_FILES) $(RELSYSDIR)/ebin
$(INSTALL_DIR) $(RELSYSDIR)/bin
$(INSTALL_SCRIPT) $(ESCRIPT_BIN) $(RELSYSDIR)/bin
diff --git a/lib/snmp/src/compile/depend.mk b/lib/snmp/src/compile/depend.mk
index f7084f8bcd..3ee8dc4bec 100644
--- a/lib/snmp/src/compile/depend.mk
+++ b/lib/snmp/src/compile/depend.mk
@@ -44,6 +44,6 @@ $(EBIN)/snmpc_mib_gram.$(EMULATOR): \
../../include/snmp_types.hrl \
snmpc_mib_gram.erl
-$(BIN)/snmpc: snmpc.src
+$(BIN)/snmpc: snmpc.src ../../vsn.mk
$(PERL) -p -e 's?%VSN%?$(VSN)? ' < $< > $@
chmod 755 $@
diff --git a/lib/snmp/src/compile/snmpc.erl b/lib/snmp/src/compile/snmpc.erl
index 195c238184..5e6b81f1ec 100644
--- a/lib/snmp/src/compile/snmpc.erl
+++ b/lib/snmp/src/compile/snmpc.erl
@@ -108,6 +108,7 @@ compile(FileName) ->
%% {i, [import_dir_string()]} ["./"]
%% {il, [import_lib_dir_string()]} []
%% {warnings, bool()} true
+%% warnings_as_errors
%% {outdir, string()} "./"
%% description
%% reference
@@ -199,6 +200,8 @@ get_options([reference|Opts], Formats, Args) ->
get_options(Opts, ["~n reference"|Formats], Args);
get_options([{warnings, Val}|Opts], Formats, Args) ->
get_options(Opts, ["~n warnings: ~w"|Formats], [Val|Args]);
+get_options([warnings_as_errors|Opts], Formats, Args) ->
+ get_options(Opts, ["~n warnings_as_errors"|Formats], Args);
get_options([{verbosity, Val}|Opts], Formats, Args) ->
get_options(Opts, ["~n verbosity: ~w"|Formats], [Val|Args]);
get_options([imports|Opts], Formats, Args) ->
@@ -261,6 +264,8 @@ check_options([{group_check, Atom} | T]) when is_atom(Atom) ->
check_options([{warnings, Bool} | T]) ->
check_bool(warnings, Bool),
check_options(T);
+check_options([warnings_as_errors | T]) ->
+ check_options(T);
check_options([{db, volatile} | T]) ->
check_options(T);
check_options([{db, persistent} | T]) ->
@@ -331,6 +336,9 @@ get_agent_capabilities(Options) ->
get_module_compliance(Options) ->
get_bool_option(module_compliance, Options).
+get_warnings_as_errors(Options) ->
+ lists:member(warnings_as_errors, Options).
+
get_relaxed_row_name_assign_check(Options) ->
lists:member(relaxed_row_name_assign_check, Options).
@@ -409,6 +417,7 @@ init(From, MibFileName, Options) ->
put(reference, get_reference(Options)),
put(agent_capabilities, get_agent_capabilities(Options)),
put(module_compliance, get_module_compliance(Options)),
+ put(warnings_as_errors, get_warnings_as_errors(Options)),
File = filename:rootname(MibFileName, ".mib"),
put(filename, filename:basename(File ++ ".mib")),
R = case catch c_impl(File) of
diff --git a/lib/snmp/src/compile/snmpc.src b/lib/snmp/src/compile/snmpc.src
index 5f9b154bfa..868e0929b4 100644
--- a/lib/snmp/src/compile/snmpc.src
+++ b/lib/snmp/src/compile/snmpc.src
@@ -46,11 +46,12 @@
agent_capabilities = false,
module,
no_defaults = false,
- relaxed_row_name_assigne_check = false,
+ relaxed_row_name_assign_check = false,
%% The default verbosity (silence) will be filled in
%% during argument processing.
verbosity,
- warnings = false
+ warnings = false,
+ warnings_as_errors = false
}).
@@ -73,7 +74,8 @@
%% --rrnac
%% --version
%% --verbosity V
-%% --warnings
+%% --warnings | --W
+%% --Werror | --wae | --warnings_as_errors
main(Args) when is_list(Args) ->
case (catch process_args(Args)) of
ok ->
@@ -152,11 +154,12 @@ mk_mib_options(#state{outdir = OutDir,
agent_capabilities = AC,
module = Mod,
no_defaults = ND,
- relaxed_row_name_assigne_check = RRNAC,
+ relaxed_row_name_assign_check = RRNAC,
%% The default verbosity (silence) will be filled in
%% during argument processing.
verbosity = V,
- warnings = W}) ->
+ warnings = W,
+ warnings_as_errors = WAE}) ->
[{outdir, OutDir},
{db, DB},
{i, IDs},
@@ -178,7 +181,8 @@ mk_mib_options(#state{outdir = OutDir,
maybe_option(Imp, imports) ++
maybe_option(MI, module_identity) ++
maybe_option(MC, module_compliance) ++
- maybe_option(AC, agent_capabilities).
+ maybe_option(AC, agent_capabilities) ++
+ maybe_option(WAE, warnings_as_errors).
maybe_option(true, Opt) -> [Opt];
maybe_option(_, _) -> [].
@@ -217,7 +221,10 @@ process_args([], #state{verbosity = Verbosity0, file = MIB} = State) ->
process_args(["--help"|_Args], _State) ->
ok;
process_args(["--version"|_Args], #state{version = Version, mfv = MFV} = _State) ->
- {ok, lists:flatten(io_lib:format("snmpc ~s (~s)", [Version, MFV]))};
+ OtpVersion = otp_release(),
+ {ok, lists:flatten(
+ io_lib:format("snmpc ~s [Mib format version ~s] (OTP ~s)",
+ [Version, MFV, OtpVersion]))};
process_args(["--verbosity", Verbosity0|Args], #state{verbosity = V} = State)
when (V =:= undefined) ->
Verbosity = list_to_atom(Verbosity0),
@@ -230,6 +237,8 @@ process_args(["--verbosity", Verbosity0|Args], #state{verbosity = V} = State)
process_args(["--verbosity"|_Args], #state{verbosity = V})
when (V =/= undefined) ->
e(lists:flatten(io_lib:format("Verbosity already set to ~w", [V])));
+process_args(["--W"|Args], State) ->
+ process_args(Args, State#state{warnings = true});
process_args(["--warnings"|Args], State) ->
process_args(Args, State#state{warnings = true});
process_args(["--o", Dir|Args], State) ->
@@ -291,7 +300,13 @@ process_args(["--mod"|_Args], #state{module = M})
process_args(["--nd"|Args], State) ->
process_args(Args, State#state{no_defaults = true});
process_args(["--rrnac"|Args], State) ->
- process_args(Args, State#state{relaxed_row_name_assigne_check = true});
+ process_args(Args, State#state{relaxed_row_name_assign_check = true});
+process_args(["--Werror"|Args], State) ->
+ process_args(Args, State#state{warnings_as_errors = true});
+process_args(["--wae"|Args], State) ->
+ process_args(Args, State#state{warnings_as_errors = true});
+process_args(["--warnings_as_errors"|Args], State) ->
+ process_args(Args, State#state{warnings_as_errors = true});
process_args([MIB], State) ->
Ext = filename:extension(MIB),
if
@@ -326,7 +341,7 @@ usage() ->
"~n --verbosity <verbosity> - Print debug info."
"~n verbosity = trace | debug | log | info | silence"
"~n Defaults to silence."
- "~n --warnings - Print warning messages."
+ "~n --warnings | --W - Print warning messages."
"~n --o <output dir> - The output dir."
"~n Defaults to current working dir."
"~n --i <include dir> - Add this dir to the list of dirs that will be"
@@ -334,16 +349,19 @@ usage() ->
"~n The current workin dir will always be included. "
"~n --il <include_lib dir> - Add this dir to the list of dirs that will be"
"~n searched for imported (compiled) MIB files."
- "~n It assumes that the first element in the dir name"
- "~n correspond to an OTP application. For example snmp/mibs/"
- "~n The current workin dir and the <snmp-home>/priv/mibs "
+ "~n It assumes that the first element in the dir "
+ "~n name correspond to an OTP application. "
+ "~n For example snmp/mibs/ "
+ "~n The current workin dir and the "
+ "~n <snmp-home>/priv/mibs "
"~n are always listed last the includ path. "
"~n --db <DB> - Database to used for the default instrumentation."
"~n Defaults to volatile."
- "~n --sgc - This option (skip group check), if present, disables "
- "~n the \"group check\" of the mib compiler. "
- "~n That is, should the OBJECT-GROUP and the NOTIFICATION-GROUP "
- "~n macro(s) be checked for correctness or not. "
+ "~n --sgc - This option (skip group check), if present, "
+ "~n disables the \"group check\" of the mib compiler. "
+ "~n That is, should the OBJECT-GROUP and the "
+ "~n NOTIFICATION-GROUP macro(s) be checked for "
+ "~n correctness or not. "
"~n By default the check is done. "
"~n --dep - Keep deprecated definition(s)."
"~n If not specified the compiler will ignore"
@@ -354,23 +372,27 @@ usage() ->
"~n --mi - The MODULE-IDENTITY field will be included."
"~n --mc - The MODULE-COMPLIANCE field will be included."
"~n --ac - The AGENT-CAPABILITIES field will be included."
- "~n --mod <module> - The module which implements all the instrumentation"
- "~n functions. "
+ "~n --mod <module> - The module which implements all the "
+ "~n instrumentation functions. "
"~n The name of all instrumentation functions must"
"~n be the same as the corresponding managed object"
"~n it implements."
- "~n --nd - The default instrumentation functions will *not* be used"
- "~n if a managed object have no instrumentation function. "
- "~n Instead this will be reported as an error, and the "
- "~n compilation aborts. "
- "~n --rrnac - This option, if present, specifies that the row name "
- "~n assign check shall not be done strictly according to"
- "~n the SMI (which allows only the value 1). "
- "~n With this option, all values greater than zero is allowed"
- "~n (>= 1). This means that the error will be converted to "
+ "~n --nd - The default instrumentation functions will *not* "
+ "~n be used if a managed object have no "
+ "~n instrumentation function. Instead this will be "
+ "~n reported as an error, and the compilation aborts. "
+ "~n --rrnac - This option, if present, specifies that the row "
+ "~n name assign check shall not be done strictly "
+ "~n according to the SMI (which allows only the "
+ "~n value 1). With this option, all values greater "
+ "~n than zero is allowed (>= 1). "
+ "~n This means that the error will be converted to "
"~n a warning. "
- "~n By default it is not included, but if this option is "
- "~n present it will be. "
+ "~n By default it is not included, but if this "
+ "~n option is present it will be. "
+ "~n --wae | --Werror - Warnings as errors. "
+ "~n Indicates that warnings shall be treated as "
+ "~n errors. "
"~n "
"~n", []),
halt(1).
@@ -379,3 +401,17 @@ usage() ->
e(Reason) ->
throw({error, Reason}).
+
+otp_release() ->
+ system_info(otp_release, string).
+
+system_info(Tag, Type) ->
+ case (catch erlang:system_info(Tag)) of
+ {'EXIT', _} ->
+ "-";
+ Info when is_list(Info) andalso (Type =:= string) ->
+ Info;
+ Info ->
+ lists:flatten(io_lib:format("~w", [Info]))
+ end.
+
diff --git a/lib/snmp/src/compile/snmpc_lib.erl b/lib/snmp/src/compile/snmpc_lib.erl
index 4f71c47bfa..38bb8f3ac6 100644
--- a/lib/snmp/src/compile/snmpc_lib.erl
+++ b/lib/snmp/src/compile/snmpc_lib.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -1754,12 +1754,12 @@ error(FormatStr, Data, Line) when is_list(FormatStr) ->
exit(error).
print_error(FormatStr, Data) when is_list(FormatStr) ->
- ok = io:format("~s: Error: " ++ FormatStr,[get(filename)|Data]),
+ ok = io:format("~s: " ++ FormatStr,[get(filename)|Data]),
put(errors,yes),
io:format("~n").
print_error(FormatStr, Data,Line) when is_list(FormatStr) ->
- ok = io:format("~s: ~w: Error: " ++ FormatStr,[get(filename), Line |Data]),
+ ok = io:format("~s: ~w: " ++ FormatStr,[get(filename), Line |Data]),
put(errors,yes),
io:format("~n").
diff --git a/lib/snmp/src/compile/snmpc_lib.hrl b/lib/snmp/src/compile/snmpc_lib.hrl
index 000486e728..35ec9abd03 100644
--- a/lib/snmp/src/compile/snmpc_lib.hrl
+++ b/lib/snmp/src/compile/snmpc_lib.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2009. All Rights Reserved.
+%% Copyright Ericsson AB 2009-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -20,8 +20,17 @@
-ifndef(snmpc_lib).
-define(snmpc_lib, true).
--define(vwarning(F, A), ?verbosity(warning, F, A, ignore)).
--define(vwarning2(F, A, MibLine), ?verbosity(warning, F, A, MibLine)).
+-define(vwarning(F, A),
+ case get(warnings_as_errors) of
+ true -> snmpc_lib:error(F, A);
+ _ -> ?verbosity(warning, F, A, ignore)
+ end).
+
+-define(vwarning2(F, A, MibLine),
+ case get(warnings_as_errors) of
+ true -> snmpc_lib:error(F, A, MibLine);
+ _ -> ?verbosity(warning, F, A, MibLine)
+ end).
-define(vinfo(F, A), ?verbosity(info, F, A, ignore)).
-define(vinfo2(F, A, MibLine), ?verbosity(info, F, A, MibLine)).
-define(vlog(F, A), ?verbosity(log, F, A, ignore)).
diff --git a/lib/snmp/src/manager/snmpm.erl b/lib/snmp/src/manager/snmpm.erl
index 5b6321b4c3..6d2ac8d747 100644
--- a/lib/snmp/src/manager/snmpm.erl
+++ b/lib/snmp/src/manager/snmpm.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -50,22 +50,23 @@
register_agent/2, register_agent/3, register_agent/4,
unregister_agent/2, unregister_agent/3,
which_agents/0, which_agents/1,
- agent_info/2, update_agent_info/4,
+ agent_info/2, update_agent_info/3, update_agent_info/4,
register_usm_user/3, unregister_usm_user/2,
which_usm_users/0, which_usm_users/1,
usm_user_info/3, update_usm_user_info/4,
%%
- %% Basic SNMP API
- sync_get/3, sync_get/4, sync_get/5, sync_get/6,
- async_get/3, async_get/4, async_get/5, async_get/6,
- sync_get_next/3, sync_get_next/4, sync_get_next/5, sync_get_next/6,
- async_get_next/3, async_get_next/4, async_get_next/5, async_get_next/6,
- sync_set/3, sync_set/4, sync_set/5, sync_set/6,
- async_set/3, async_set/4, async_set/5, async_set/6,
- sync_get_bulk/5, sync_get_bulk/6, sync_get_bulk/7, sync_get_bulk/8,
- async_get_bulk/5, async_get_bulk/6, async_get_bulk/7, async_get_bulk/8,
+ %% Basic SNMP API (version "3").
+ sync_get2/3, sync_get2/4,
+ async_get2/3, async_get2/4,
+ sync_get_next2/3, sync_get_next2/4,
+ async_get_next2/3, async_get_next2/4,
+ sync_set2/3, sync_set2/4,
+ async_set2/3, async_set2/4,
+ sync_get_bulk2/5, sync_get_bulk2/6,
+ async_get_bulk2/5, async_get_bulk2/6,
+
cancel_async_request/2,
%%
@@ -91,7 +92,61 @@
-export([format_reason/1, format_reason/2]).
-%% Backward compatibillity exports
+%% Backward compatibility exports (API version "2")
+-export([
+ sync_get/3, sync_get/4, sync_get/5, sync_get/6,
+ async_get/3, async_get/4, async_get/5, async_get/6,
+ sync_get_next/3, sync_get_next/4, sync_get_next/5, sync_get_next/6,
+ async_get_next/3, async_get_next/4, async_get_next/5, async_get_next/6,
+ sync_set/3, sync_set/4, sync_set/5, sync_set/6,
+ async_set/3, async_set/4, async_set/5, async_set/6,
+ sync_get_bulk/5, sync_get_bulk/6, sync_get_bulk/7, sync_get_bulk/8,
+ async_get_bulk/5, async_get_bulk/6, async_get_bulk/7, async_get_bulk/8
+ ]).
+
+%% Backward compatibility exports (API version "1")
+-deprecated({agent_info, 3}).
+-deprecated({update_agent_info, 5}).
+-deprecated({g, 3}).
+-deprecated({g, 4}).
+-deprecated({g, 5}).
+-deprecated({g, 6}).
+-deprecated({g, 7}).
+-deprecated({ag, 3}).
+-deprecated({ag, 4}).
+-deprecated({ag, 5}).
+-deprecated({ag, 6}).
+-deprecated({ag, 7}).
+-deprecated({gn, 3}).
+-deprecated({gn, 4}).
+-deprecated({gn, 5}).
+-deprecated({gn, 6}).
+-deprecated({gn, 7}).
+-deprecated({agn, 3}).
+-deprecated({agn, 4}).
+-deprecated({agn, 5}).
+-deprecated({agn, 6}).
+-deprecated({agn, 7}).
+-deprecated({gb, 5}).
+-deprecated({gb, 6}).
+-deprecated({gb, 7}).
+-deprecated({gb, 8}).
+-deprecated({gb, 9}).
+-deprecated({agb, 5}).
+-deprecated({agb, 6}).
+-deprecated({agb, 7}).
+-deprecated({agb, 8}).
+-deprecated({agb, 9}).
+-deprecated({s, 3}).
+-deprecated({s, 4}).
+-deprecated({s, 5}).
+-deprecated({s, 6}).
+-deprecated({s, 7}).
+-deprecated({as, 3}).
+-deprecated({as, 4}).
+-deprecated({as, 5}).
+-deprecated({as, 6}).
+-deprecated({as, 7}).
-export([
agent_info/3, update_agent_info/5,
g/3, g/4, g/5, g/6, g/7,
@@ -108,12 +163,13 @@
-export([start_link/3, snmpm_start_verify/2, snmpm_start_verify/3]).
--include("snmp_debug.hrl").
+-include_lib("snmp/src/misc/snmp_debug.hrl").
+-include_lib("snmp/include/snmp_types.hrl").
-include("snmpm_atl.hrl").
--include("snmp_types.hrl").
+-include("snmpm_internal.hrl").
+-include("snmp_verbosity.hrl").
-define(DEFAULT_AGENT_PORT, 161).
--define(DEFAULT_CONTEXT, "").
%% This function is called when the snmp application
@@ -332,23 +388,23 @@ register_agent(UserId, TargetName, Config)
is_list(Config)) ->
do_register_agent(UserId, TargetName, [{reg_type, target_name} | Config]);
-%% Backward compatibillity
+%% Backward compatibility
%% Note that the agent engine id is a mandatory config option,
%% so this function *will* fail!
register_agent(UserId, Addr, Port) when is_integer(Port) ->
register_agent(UserId, Addr, Port, []);
-%% Backward compatibillity
+%% Backward compatibility
register_agent(UserId, Addr, Config) when is_list(Config) ->
register_agent(UserId, Addr, ?DEFAULT_AGENT_PORT, Config).
-%% Backward compatibillity
+%% Backward compatibility
%% Note that the agent engine id is a mandatory config option,
%% so this function *will* fail!
register_agent(UserId, Addr) ->
register_agent(UserId, Addr, ?DEFAULT_AGENT_PORT, []).
-%% Backward compatibillity
+%% Backward compatibility
register_agent(UserId, Addr, Port, Config0) ->
case lists:keymember(target_name, 1, Config0) of
false ->
@@ -368,7 +424,7 @@ register_agent(UserId, Addr, Port, Config0) ->
unregister_agent(UserId, TargetName) when is_list(TargetName) ->
snmpm_config:unregister_agent(UserId, TargetName);
-%% Backward compatibillity functions
+%% Backward compatibility functions
unregister_agent(UserId, Addr) ->
unregister_agent(UserId, Addr, ?DEFAULT_AGENT_PORT).
@@ -383,7 +439,7 @@ unregister_agent(UserId, Addr, Port) ->
agent_info(TargetName, Item) ->
snmpm_config:agent_info(TargetName, Item).
-%% Backward compatibillity
+%% Backward compatibility
agent_info(Addr, Port, Item) ->
case target_name(Addr, Port) of
{ok, TargetName} ->
@@ -392,25 +448,16 @@ agent_info(Addr, Port, Item) ->
Error
end.
+update_agent_info(UserId, TargetName, Info) when is_list(Info) ->
+ snmpm_config:update_agent_info(UserId, TargetName, Info).
+
update_agent_info(UserId, TargetName, Item, Val) ->
-%% p("update_agent_info -> entry with"
-%% "~n UserId: ~p"
-%% "~n TargetName: ~p"
-%% "~n Item: ~p"
-%% "~n Val: ~p", [UserId, TargetName, Item, Val]),
- snmpm_config:update_agent_info(UserId, TargetName, Item, Val).
-
-%% Backward compatibillity functions
+ update_agent_info(UserId, TargetName, [{Item, Val}]).
+
+%% Backward compatibility functions
update_agent_info(UserId, Addr, Port, Item, Val) ->
-%% p("update_agent_info -> entry with"
-%% "~n UserId: ~p"
-%% "~n Addr: ~p"
-%% "~n Port: ~p"
-%% "~n Item: ~p"
-%% "~n Val: ~p", [UserId, Addr, Port, Item, Val]),
case target_name(Addr, Port) of
{ok, TargetName} ->
-%% p("update_agent_info -> TargetName: ~p", [TargetName]),
update_agent_info(UserId, TargetName, Item, Val);
Error ->
Error
@@ -472,94 +519,54 @@ which_usm_users(EngineID) when is_list(EngineID) ->
%% --- synchroneous get-request ---
%%
+sync_get2(UserId, TargetName, Oids) ->
+ sync_get2(UserId, TargetName, Oids, []).
+
+sync_get2(UserId, TargetName, Oids, SendOpts)
+ when is_list(Oids) andalso is_list(SendOpts) ->
+ snmpm_server:sync_get2(UserId, TargetName, Oids, SendOpts).
+
+%% <BACKWARD-COMPAT>
sync_get(UserId, TargetName, Oids) ->
-%% p("sync_get -> entry with"
-%% "~n UserId: ~p"
-%% "~n TargetName: ~p"
-%% "~n Oids: ~p", [UserId, TargetName, Oids]),
- sync_get(UserId, TargetName, ?DEFAULT_CONTEXT, Oids).
-
-sync_get(UserId, TargetName, Context, Oids) when is_list(Oids) ->
-%% p("sync_get -> entry with"
-%% "~n UserId: ~p"
-%% "~n TargetName: ~p"
-%% "~n Context: ~p"
-%% "~n Oids: ~p", [UserId, TargetName, Context, Oids]),
- snmpm_server:sync_get(UserId, TargetName, Context, Oids);
-
-sync_get(UserId, TargetName, Oids, Timeout) when is_integer(Timeout) ->
-%% p("sync_get -> entry with"
-%% "~n UserId: ~p"
-%% "~n TargetName: ~p"
-%% "~n Oids: ~p"
-%% "~n Timeout: ~p", [UserId, TargetName, Oids, Timeout]),
- sync_get(UserId, TargetName, ?DEFAULT_CONTEXT, Oids, Timeout).
+ sync_get2(UserId, TargetName, Oids).
+
+sync_get(UserId, TargetName, Oids, Timeout)
+ when is_list(Oids) andalso is_integer(Timeout) ->
+ SendOpts = [{timeout, Timeout}],
+ sync_get2(UserId, TargetName, Oids, SendOpts);
+sync_get(UserId, TargetName, Context, [OH|_] = Oids)
+ when is_list(Context) andalso is_list(OH) ->
+ SendOpts = [{context, Context}],
+ sync_get2(UserId, TargetName, Oids, SendOpts).
sync_get(UserId, TargetName, Context, Oids, Timeout) ->
-%% p("sync_get -> entry with"
-%% "~n UserId: ~p"
-%% "~n TargetName: ~p"
-%% "~n Context: ~p"
-%% "~n Oids: ~p"
-%% "~n Timeout: ~p", [UserId, TargetName, Context, Oids, Timeout]),
- snmpm_server:sync_get(UserId, TargetName, Context, Oids, Timeout).
+ SendOpts = [{context, Context}, {timeout, Timeout}],
+ sync_get2(UserId, TargetName, Oids, SendOpts).
sync_get(UserId, TargetName, Context, Oids, Timeout, ExtraInfo) ->
-%% p("sync_get -> entry with"
-%% "~n UserId: ~p"
-%% "~n TargetName: ~p"
-%% "~n Context: ~p"
-%% "~n Oids: ~p"
-%% "~n Timeout: ~p"
-%% "~n ExtraInfo: ~p",
-%% [UserId, TargetName, Context, Oids, Timeout, ExtraInfo]),
- snmpm_server:sync_get(UserId, TargetName, Context, Oids, Timeout,
- ExtraInfo).
+ SendOpts = [{context, Context}, {timeout, Timeout}, {extra, ExtraInfo}],
+ sync_get2(UserId, TargetName, Oids, SendOpts).
+%% </BACKWARD-COMPAT>
+%% <DEPRECATED>
g(UserId, Addr, Oids) ->
-%% p("g -> entry with"
-%% "~n UserId: ~p"
-%% "~n Addr: ~p"
-%% "~n Oids: ~p", [UserId, Addr, Oids]),
g(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids).
g(UserId, Addr, CtxName, Oids) when is_list(CtxName) andalso is_list(Oids) ->
-%% p("g -> entry with"
-%% "~n UserId: ~p"
-%% "~n Addr: ~p"
-%% "~n CtxName: ~p"
-%% "~n Oids: ~p", [UserId, Addr, CtxName, Oids]),
g(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids);
g(UserId, Addr, Port, Oids) when is_integer(Port) andalso is_list(Oids) ->
-%% p("g -> entry with"
-%% "~n UserId: ~p"
-%% "~n Addr: ~p"
-%% "~n Port: ~p"
-%% "~n Oids: ~p", [UserId, Addr, Port, Oids]),
g(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids);
g(UserId, Addr, Oids, Timeout)
when is_list(Oids) andalso is_integer(Timeout) ->
-%% p("g -> entry with"
-%% "~n UserId: ~p"
-%% "~n Addr: ~p"
-%% "~n Oids: ~p"
-%% "~n Timeout: ~p", [UserId, Addr, Oids, Timeout]),
g(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids, Timeout).
g(UserId, Addr, Port, CtxName, Oids)
when is_integer(Port) andalso is_list(CtxName) andalso is_list(Oids) ->
-%% p("g -> entry with"
-%% "~n UserId: ~p"
-%% "~n Addr: ~p"
-%% "~n Port: ~p"
-%% "~n Context: ~p"
-%% "~n Oids: ~p", [UserId, Addr, Port, CtxName, Oids]),
case target_name(Addr, Port) of
{ok, TargetName} ->
-%% p("g -> TargetName: ~p", [TargetName]),
sync_get(UserId, TargetName, CtxName, Oids);
Error ->
Error
@@ -567,59 +574,28 @@ g(UserId, Addr, Port, CtxName, Oids)
g(UserId, Addr, Port, Oids, Timeout)
when is_integer(Port) andalso is_list(Oids) andalso is_integer(Timeout) ->
-%% p("g -> entry with"
-%% "~n UserId: ~p"
-%% "~n Addr: ~p"
-%% "~n Oids: ~p"
-%% "~n Timeout: ~p",
-%% [UserId, Addr, Oids, Timeout]),
g(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids, Timeout);
g(UserId, Addr, CtxName, Oids, Timeout)
when is_list(CtxName) andalso is_list(Oids) andalso is_integer(Timeout) ->
-%% p("g -> entry with"
-%% "~n UserId: ~p"
-%% "~n Addr: ~p"
-%% "~n CtxName: ~p"
-%% "~n Oids: ~p"
-%% "~n Timeout: ~p",
-%% [UserId, Addr, CtxName, Oids, Timeout]),
g(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids, Timeout).
g(UserId, Addr, Port, CtxName, Oids, Timeout) ->
-%% p("g -> entry with"
-%% "~n UserId: ~p"
-%% "~n Addr: ~p"
-%% "~n Port: ~p"
-%% "~n CtxName: ~p"
-%% "~n Oids: ~p"
-%% "~n Timeout: ~p",
-%% [UserId, Addr, Port, CtxName, Oids, Timeout]),
case target_name(Addr, Port) of
{ok, TargetName} ->
-%% p("g -> TargetName: ~p", [TargetName]),
sync_get(UserId, TargetName, CtxName, Oids, Timeout);
Error ->
Error
end.
g(UserId, Addr, Port, CtxName, Oids, Timeout, ExtraInfo) ->
-%% p("g -> entry with"
-%% "~n UserId: ~p"
-%% "~n Addr: ~p"
-%% "~n Port: ~p"
-%% "~n CtxName: ~p"
-%% "~n Oids: ~p"
-%% "~n Timeout: ~p"
-%% "~n ExtraInfo: ~p",
-%% [UserId, Addr, Port, CtxName, Oids, Timeout, ExtraInfo]),
case target_name(Addr, Port) of
{ok, TargetName} ->
-%% p("g -> TargetName: ~p", [TargetName]),
sync_get(UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo);
Error ->
Error
end.
+%% </DEPRECATED>
@@ -629,23 +605,36 @@ g(UserId, Addr, Port, CtxName, Oids, Timeout, ExtraInfo) ->
%% through a call to handle_pdu/5
%%
-async_get(UserId, TargetName, Oids) ->
- async_get(UserId, TargetName, ?DEFAULT_CONTEXT, Oids).
+async_get2(UserId, TargetName, Oids) ->
+ async_get2(UserId, TargetName, Oids, []).
-async_get(UserId, TargetName, Context, Oids) when is_list(Oids) ->
- snmpm_server:async_get(UserId, TargetName, Context, Oids);
+async_get2(UserId, TargetName, Oids, SendOpts)
+ when is_list(Oids) andalso is_list(SendOpts) ->
+ snmpm_server:async_get2(UserId, TargetName, Oids, SendOpts).
+
+%% <BACKWARD-COMPAT>
+async_get(UserId, TargetName, Oids) ->
+ async_get2(UserId, TargetName, Oids).
async_get(UserId, TargetName, Oids, Expire) when is_integer(Expire) ->
- async_get(UserId, TargetName, ?DEFAULT_CONTEXT, Oids, Expire).
+ SendOpts = [{timeout, Expire}],
+ async_get2(UserId, TargetName, Oids, SendOpts);
+async_get(UserId, TargetName, Context, Oids)
+ when is_list(Context) andalso is_list(Oids) ->
+ SendOpts = [{context, Context}],
+ async_get2(UserId, TargetName, Oids, SendOpts).
async_get(UserId, TargetName, Context, Oids, Expire) ->
- snmpm_server:async_get(UserId, TargetName, Context, Oids, Expire).
+ SendOpts = [{timeout, Expire}, {context, Context}],
+ async_get2(UserId, TargetName, Oids, SendOpts).
async_get(UserId, TargetName, Context, Oids, Expire, ExtraInfo) ->
- snmpm_server:async_get(UserId, TargetName, Context, Oids, Expire,
- ExtraInfo).
+ SendOpts = [{timeout, Expire}, {context, Context}, {extra, ExtraInfo}],
+ async_get2(UserId, TargetName, Oids, SendOpts).
+%% </BACKWARD-COMPAT>
+%% <DEPRECATED>
ag(UserId, Addr, Oids) ->
ag(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids).
@@ -690,31 +679,44 @@ ag(UserId, Addr, Port, CtxName, Oids, Expire, ExtraInfo) ->
Error ->
Error
end.
+%% </DEPRECATED>
%% --- synchroneous get_next-request ---
%%
-sync_get_next(UserId, TargetName, Oids) ->
- sync_get_next(UserId, TargetName, ?DEFAULT_CONTEXT, Oids).
+sync_get_next2(UserId, TargetName, Oids) ->
+ sync_get_next2(UserId, TargetName, Oids, []).
-sync_get_next(UserId, TargetName, Context, Oids)
- when is_list(Context) andalso is_list(Oids) ->
- snmpm_server:sync_get_next(UserId, TargetName, Context, Oids);
+sync_get_next2(UserId, TargetName, Oids, SendOpts)
+ when is_list(Oids) andalso is_list(SendOpts) ->
+ snmpm_server:sync_get_next2(UserId, TargetName, Oids, SendOpts).
+
+%% <BACKWARD-COMPAT>
+sync_get_next(UserId, TargetName, Oids) ->
+ sync_get_next2(UserId, TargetName, Oids).
sync_get_next(UserId, TargetName, Oids, Timeout)
when is_list(Oids) andalso is_integer(Timeout) ->
- sync_get_next(UserId, TargetName, ?DEFAULT_CONTEXT, Oids, Timeout).
+ SendOpts = [{timeout, Timeout}],
+ sync_get_next2(UserId, TargetName, Oids, SendOpts);
+sync_get_next(UserId, TargetName, Context, Oids)
+ when is_list(Context) andalso is_list(Oids) ->
+ SendOpts = [{context, Context}],
+ sync_get_next2(UserId, TargetName, Oids, SendOpts).
sync_get_next(UserId, TargetName, Context, Oids, Timeout) ->
- snmpm_server:sync_get_next(UserId, TargetName, Context, Oids, Timeout).
+ SendOpts = [{timeout, Timeout}, {context, Context}],
+ sync_get_next2(UserId, TargetName, Oids, SendOpts).
sync_get_next(UserId, TargetName, Context, Oids, Timeout, ExtraInfo) ->
- snmpm_server:sync_get_next(UserId, TargetName, Context, Oids, Timeout,
- ExtraInfo).
+ SendOpts = [{timeout, Timeout}, {context, Context}, {extra, ExtraInfo}],
+ sync_get_next2(UserId, TargetName, Oids, SendOpts).
+%% </BACKWARD-COMPAT>
+%% <DEPRECATED>
gn(UserId, Addr, Oids) ->
gn(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids).
@@ -759,30 +761,44 @@ gn(UserId, Addr, Port, CtxName, Oids, Timeout, ExtraInfo) ->
Error ->
Error
end.
+%% </DEPRECATED>
%% --- asynchroneous get_next-request ---
%%
+async_get_next2(UserId, TargetName, Oids) ->
+ async_get_next2(UserId, TargetName, Oids, []).
+
+async_get_next2(UserId, TargetName, Oids, SendOpts)
+ when is_list(Oids) andalso is_list(SendOpts) ->
+ snmpm_server:async_get_next2(UserId, TargetName, Oids, SendOpts).
+
+%% <BACKWARD-COMPAT>
async_get_next(UserId, TargetName, Oids) ->
- async_get_next(UserId, TargetName, ?DEFAULT_CONTEXT, Oids).
+ async_get_next2(UserId, TargetName, Oids).
+async_get_next(UserId, TargetName, Oids, Expire)
+ when is_list(Oids) andalso is_integer(Expire) ->
+ SendOpts = [{timeout, Expire}],
+ async_get_next2(UserId, TargetName, Oids, SendOpts);
async_get_next(UserId, TargetName, Context, Oids)
when is_list(Context) andalso is_list(Oids) ->
- snmpm_server:async_get_next(UserId, TargetName, Context, Oids);
+ SendOpts = [{context, Context}],
+ async_get_next2(UserId, TargetName, Oids, SendOpts).
-async_get_next(UserId, TargetName, Oids, Timeout)
- when is_list(Oids) andalso is_integer(Timeout) ->
- async_get_next(UserId, TargetName, ?DEFAULT_CONTEXT, Oids, Timeout).
+async_get_next(UserId, TargetName, Context, Oids, Expire) ->
+ SendOpts = [{timeout, Expire}, {context, Context}],
+ async_get_next2(UserId, TargetName, Oids, SendOpts).
-async_get_next(UserId, TargetName, Context, Oids, Timeout) ->
- snmpm_server:async_get_next(UserId, TargetName, Context, Oids, Timeout).
+async_get_next(UserId, TargetName, Context, Oids, Expire, ExtraInfo) ->
+ SendOpts = [{timeout, Expire}, {context, Context}, {extra, ExtraInfo}],
+ async_get_next2(UserId, TargetName, Oids, SendOpts).
+%% </BACKWARD-COMPAT>
-async_get_next(UserId, TargetName, Context, Oids, Timeout, ExtraInfo) ->
- snmpm_server:async_get_next(UserId, TargetName, Context, Oids, Timeout,
- ExtraInfo).
+%% <DEPRECATED>
agn(UserId, Addr, Oids) ->
agn(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids).
@@ -828,31 +844,44 @@ agn(UserId, Addr, Port, CtxName, Oids, Expire, ExtraInfo) ->
Error ->
Error
end.
+%% </DEPRECATED>
%% --- synchroneous set-request ---
%%
-sync_set(UserId, TargetName, VarsAndVals) ->
- sync_set(UserId, TargetName, ?DEFAULT_CONTEXT, VarsAndVals).
+sync_set2(UserId, TargetName, VarsAndVals) ->
+ sync_set2(UserId, TargetName, VarsAndVals, []).
-sync_set(UserId, TargetName, Context, VarsAndVals)
- when is_list(Context) andalso is_list(VarsAndVals) ->
- snmpm_server:sync_set(UserId, TargetName, Context, VarsAndVals);
+sync_set2(UserId, TargetName, VarsAndVals, SendOpts)
+ when is_list(VarsAndVals) andalso is_list(SendOpts) ->
+ snmpm_server:sync_set2(UserId, TargetName, VarsAndVals, SendOpts).
+
+%% <BACKWARD-COMPAT>
+sync_set(UserId, TargetName, VarsAndVals) ->
+ sync_set2(UserId, TargetName, VarsAndVals).
sync_set(UserId, TargetName, VarsAndVals, Timeout)
when is_list(VarsAndVals) andalso is_integer(Timeout) ->
- sync_set(UserId, TargetName, ?DEFAULT_CONTEXT, VarsAndVals, Timeout).
+ SendOpts = [{timeout, Timeout}],
+ sync_set2(UserId, TargetName, VarsAndVals, SendOpts);
+sync_set(UserId, TargetName, Context, VarsAndVals)
+ when is_list(Context) andalso is_list(VarsAndVals) ->
+ SendOpts = [{context, Context}],
+ sync_set2(UserId, TargetName, VarsAndVals, SendOpts).
sync_set(UserId, TargetName, Context, VarsAndVals, Timeout) ->
- snmpm_server:sync_set(UserId, TargetName, Context, VarsAndVals, Timeout).
+ SendOpts = [{timeout, Timeout}, {context, Context}],
+ sync_set2(UserId, TargetName, VarsAndVals, SendOpts).
sync_set(UserId, TargetName, Context, VarsAndVals, Timeout, ExtraInfo) ->
- snmpm_server:sync_set(UserId, TargetName, Context, VarsAndVals, Timeout,
- ExtraInfo).
+ SendOpts = [{timeout, Timeout}, {context, Context}, {extra, ExtraInfo}],
+ sync_set2(UserId, TargetName, VarsAndVals, SendOpts).
+%% </BACKWARD-COMPAT>
+%% <DEPRECATED>
s(UserId, Addr, VarsAndVals) ->
s(UserId, Addr, ?DEFAULT_AGENT_PORT, VarsAndVals).
@@ -906,31 +935,44 @@ s(UserId, Addr, Port, CtxName, VarsAndVals, Timeout, ExtraInfo) ->
Error ->
Error
end.
+%% </DEPRECATED>
%% --- asynchroneous set-request ---
%%
-async_set(UserId, TargetName, VarsAndVals) ->
- async_set(UserId, TargetName, ?DEFAULT_CONTEXT, VarsAndVals).
+async_set2(UserId, TargetName, VarsAndVals) ->
+ async_set2(UserId, TargetName, VarsAndVals, []).
-async_set(UserId, TargetName, Context, VarsAndVals)
- when is_list(Context) andalso is_list(VarsAndVals) ->
- snmpm_server:async_set(UserId, TargetName, Context, VarsAndVals);
+async_set2(UserId, TargetName, VarsAndVals, SendOpts)
+ when is_list(VarsAndVals) andalso is_list(SendOpts) ->
+ snmpm_server:async_set2(UserId, TargetName, VarsAndVals, SendOpts).
+
+%% <BACKWARD-COMPAT>
+async_set(UserId, TargetName, VarsAndVals) ->
+ async_set2(UserId, TargetName, VarsAndVals).
async_set(UserId, TargetName, VarsAndVals, Expire)
when is_list(VarsAndVals) andalso is_integer(Expire) ->
- async_set(UserId, TargetName, ?DEFAULT_CONTEXT, VarsAndVals, Expire).
+ SendOpts = [{timeout, Expire}],
+ async_set2(UserId, TargetName, VarsAndVals, SendOpts);
+async_set(UserId, TargetName, Context, VarsAndVals)
+ when is_list(Context) andalso is_list(VarsAndVals) ->
+ SendOpts = [{context, Context}],
+ async_set2(UserId, TargetName, VarsAndVals, SendOpts).
async_set(UserId, TargetName, Context, VarsAndVals, Expire) ->
- snmpm_server:async_set(UserId, TargetName, Context, VarsAndVals, Expire).
+ SendOpts = [{timeout, Expire}, {context, Context}],
+ async_set2(UserId, TargetName, VarsAndVals, SendOpts).
async_set(UserId, TargetName, Context, VarsAndVals, Expire, ExtraInfo) ->
- snmpm_server:async_set(UserId, TargetName, Context, VarsAndVals, Expire,
- ExtraInfo).
+ SendOpts = [{timeout, Expire}, {context, Context}, {extra, ExtraInfo}],
+ async_set2(UserId, TargetName, VarsAndVals, SendOpts).
+%% </BACKWARD-COMPAT>
+%% <DEPRECATED>
as(UserId, Addr, VarsAndVals) ->
as(UserId, Addr, ?DEFAULT_AGENT_PORT, VarsAndVals).
@@ -984,44 +1026,77 @@ as(UserId, Addr, Port, CtxName, VarsAndVals, Expire, ExtraInfo) ->
Error ->
Error
end.
-
-
+%% </DEPRECATED>
%% --- synchroneous get-bulk ---
%%
-sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids) ->
- sync_get_bulk(UserId, TargetName, NonRep, MaxRep, ?DEFAULT_CONTEXT, Oids).
+sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids) ->
+ sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, []).
-sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids)
+sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts)
when is_integer(NonRep) andalso
is_integer(MaxRep) andalso
- is_list(Context) andalso
- is_list(Oids) ->
- snmpm_server:sync_get_bulk(UserId, TargetName,
- NonRep, MaxRep,
- Context, Oids);
+ is_list(Oids) andalso
+ is_list(SendOpts) ->
+ %% p("sync_get_bulk -> entry with"
+ %% "~n UserId: ~p"
+ %% "~n TargetName: ~p"
+ %% "~n NonRep: ~p"
+ %% "~n MaxRep: ~p"
+ %% "~n Oids: ~p"
+ %% "~n SendOpts: ~p",
+ %% [UserId, TargetName, NonRep, MaxRep, Oids, SendOpts]),
+ snmpm_server:sync_get_bulk2(UserId, TargetName,
+ NonRep, MaxRep, Oids, SendOpts).
+
+%% <BACKWARD-COMPAT>
+sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids) ->
+ sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids).
sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids, Timeout)
when is_integer(NonRep) andalso
is_integer(MaxRep) andalso
is_list(Oids) andalso
is_integer(Timeout) ->
- sync_get_bulk(UserId, TargetName, NonRep, MaxRep,
- ?DEFAULT_CONTEXT, Oids, Timeout).
+ SendOpts = [{timeout, Timeout}],
+ sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts);
+sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids)
+ when is_integer(NonRep) andalso
+ is_integer(MaxRep) andalso
+ is_list(Context) andalso
+ is_list(Oids) ->
+ %% p("sync_get_bulk -> entry with"
+ %% "~n UserId: ~p"
+ %% "~n TargetName: ~p"
+ %% "~n NonRep: ~p"
+ %% "~n MaxRep: ~p"
+ %% "~n Context: ~p"
+ %% "~n Oids: ~p", [UserId, TargetName, NonRep, MaxRep, Context, Oids]),
+ SendOpts = [{context, Context}],
+ sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts).
sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids, Timeout) ->
- snmpm_server:sync_get_bulk(UserId, TargetName, NonRep, MaxRep,
- Context, Oids, Timeout).
+ SendOpts = [{timeout, Timeout}, {context, Context}],
+ sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts).
sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids, Timeout,
ExtraInfo) ->
- snmpm_server:sync_get_bulk(UserId, TargetName, NonRep, MaxRep,
- Context, Oids, Timeout, ExtraInfo).
+ SendOpts = [{timeout, Timeout}, {context, Context}, {extra, ExtraInfo}],
+ sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts).
+%% </BACKWARD-COMPAT>
+%% <DEPRECATED>
gb(UserId, Addr, NonRep, MaxRep, Oids) ->
+ %% p("gb -> entry with"
+ %% "~n UserId: ~p"
+ %% "~n Addr: ~p"
+ %% "~n NonRep: ~p"
+ %% "~n MaxRep: ~p"
+ %% "~n Oids: ~p",
+ %% [UserId, Addr, NonRep, MaxRep, Oids]),
gb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, Oids).
gb(UserId, Addr, Port, NonRep, MaxRep, Oids)
@@ -1029,6 +1104,14 @@ gb(UserId, Addr, Port, NonRep, MaxRep, Oids)
is_integer(NonRep) andalso
is_integer(MaxRep) andalso
is_list(Oids) ->
+ %% p("gb -> entry with"
+ %% "~n UserId: ~p"
+ %% "~n Addr: ~p"
+ %% "~n Port: ~p"
+ %% "~n NonRep: ~p"
+ %% "~n MaxRep: ~p"
+ %% "~n Oids: ~p",
+ %% [UserId, Addr, Port, NonRep, MaxRep, Oids]),
gb(UserId, Addr, Port, NonRep, MaxRep, ?DEFAULT_CONTEXT, Oids);
gb(UserId, Addr, NonRep, MaxRep, CtxName, Oids)
@@ -1036,6 +1119,14 @@ gb(UserId, Addr, NonRep, MaxRep, CtxName, Oids)
is_integer(MaxRep) andalso
is_list(CtxName) andalso
is_list(Oids) ->
+ %% p("gb -> entry with"
+ %% "~n UserId: ~p"
+ %% "~n Addr: ~p"
+ %% "~n NonRep: ~p"
+ %% "~n MaxRep: ~p"
+ %% "~n CtxName: ~p"
+ %% "~n Oids: ~p",
+ %% [UserId, Addr, NonRep, MaxRep, CtxName, Oids]),
gb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, CtxName, Oids);
gb(UserId, Addr, NonRep, MaxRep, Oids, Timeout)
@@ -1043,6 +1134,14 @@ gb(UserId, Addr, NonRep, MaxRep, Oids, Timeout)
is_integer(MaxRep) andalso
is_list(Oids) andalso
is_integer(Timeout) ->
+ %% p("gb -> entry with"
+ %% "~n UserId: ~p"
+ %% "~n Addr: ~p"
+ %% "~n NonRep: ~p"
+ %% "~n MaxRep: ~p"
+ %% "~n Oids: ~p"
+ %% "~n Timeout: ~p",
+ %% [UserId, Addr, NonRep, MaxRep, Oids, Timeout]),
gb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, Oids, Timeout).
gb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids)
@@ -1051,8 +1150,18 @@ gb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids)
is_integer(MaxRep) andalso
is_list(CtxName) andalso
is_list(Oids) ->
+ %% p("gb -> entry with"
+ %% "~n UserId: ~p"
+ %% "~n Addr: ~p"
+ %% "~n Port: ~p"
+ %% "~n NonRep: ~p"
+ %% "~n MaxRep: ~p"
+ %% "~n CtxName: ~p"
+ %% "~n Oids: ~p",
+ %% [UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids]),
case target_name(Addr, Port) of
{ok, TargetName} ->
+ %% p("gb -> TargetName: ~p", [TargetName]),
sync_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids);
Error ->
Error
@@ -1064,6 +1173,15 @@ gb(UserId, Addr, Port, NonRep, MaxRep, Oids, Timeout)
is_integer(MaxRep) andalso
is_list(Oids) andalso
is_integer(Timeout) ->
+ %% p("gb -> entry with"
+ %% "~n UserId: ~p"
+ %% "~n Addr: ~p"
+ %% "~n Port: ~p"
+ %% "~n NonRep: ~p"
+ %% "~n MaxRep: ~p"
+ %% "~n Oids: ~p"
+ %% "~n Timeout: ~p",
+ %% [UserId, Addr, Port, NonRep, MaxRep, Oids, Timeout]),
gb(UserId, Addr, Port, NonRep, MaxRep, ?DEFAULT_CONTEXT, Oids, Timeout);
gb(UserId, Addr, NonRep, MaxRep, CtxName, Oids, Timeout)
@@ -1072,10 +1190,29 @@ gb(UserId, Addr, NonRep, MaxRep, CtxName, Oids, Timeout)
is_list(CtxName) andalso
is_list(Oids) andalso
is_integer(Timeout) ->
+ %% p("gb -> entry with"
+ %% "~n UserId: ~p"
+ %% "~n Addr: ~p"
+ %% "~n NonRep: ~p"
+ %% "~n MaxRep: ~p"
+ %% "~n CtxName: ~p"
+ %% "~n Oids: ~p"
+ %% "~n Timeout: ~p",
+ %% [UserId, Addr, NonRep, MaxRep, CtxName, Oids, Timeout]),
gb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, CtxName, Oids,
Timeout).
gb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Timeout) ->
+ %% p("gb -> entry with"
+ %% "~n UserId: ~p"
+ %% "~n Addr: ~p"
+ %% "~n Port: ~p"
+ %% "~n NonRep: ~p"
+ %% "~n MaxRep: ~p"
+ %% "~n CtxName: ~p"
+ %% "~n Oids: ~p"
+ %% "~n Timeout: ~p",
+ %% [UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Timeout]),
case target_name(Addr, Port) of
{ok, TargetName} ->
sync_get_bulk(UserId, TargetName,
@@ -1085,6 +1222,17 @@ gb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Timeout) ->
end.
gb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Timeout, ExtraInfo) ->
+ %% p("gb -> entry with"
+ %% "~n UserId: ~p"
+ %% "~n Addr: ~p"
+ %% "~n Port: ~p"
+ %% "~n NonRep: ~p"
+ %% "~n MaxRep: ~p"
+ %% "~n CtxName: ~p"
+ %% "~n Oids: ~p"
+ %% "~n Timeout: ~p"
+ %% "~n ExtraInfo: ~p",
+ %% [UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Timeout, ExtraInfo]),
case target_name(Addr, Port) of
{ok, TargetName} ->
sync_get_bulk(UserId, TargetName,
@@ -1092,42 +1240,55 @@ gb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Timeout, ExtraInfo) ->
Error ->
Error
end.
+%% </DEPRECATED>
%% --- asynchroneous get-bulk ---
%%
-async_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids) ->
- async_get_bulk(UserId, TargetName, NonRep, MaxRep, ?DEFAULT_CONTEXT, Oids).
+async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids) ->
+ async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, []).
-async_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids)
+async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts)
when is_integer(NonRep) andalso
is_integer(MaxRep) andalso
- is_list(Context) andalso
- is_list(Oids) ->
- snmpm_server:async_get_bulk(UserId, TargetName,
- NonRep, MaxRep, Context, Oids);
+ is_list(Oids) andalso
+ is_list(SendOpts) ->
+ snmpm_server:async_get_bulk2(UserId, TargetName,
+ NonRep, MaxRep, Oids, SendOpts).
+
+%% <BACKWARD-COMPAT>
+async_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids) ->
+ async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids).
async_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids, Expire)
when is_integer(NonRep) andalso
is_integer(MaxRep) andalso
is_list(Oids) andalso
is_integer(Expire) ->
- async_get_bulk(UserId, TargetName,
- NonRep, MaxRep, ?DEFAULT_CONTEXT, Oids, Expire).
+ SendOpts = [{timeout, Expire}],
+ async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts);
+async_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids)
+ when is_integer(NonRep) andalso
+ is_integer(MaxRep) andalso
+ is_list(Context) andalso
+ is_list(Oids) ->
+ SendOpts = [{context, Context}],
+ async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts).
async_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids, Expire) ->
- snmpm_server:async_get_bulk(UserId, TargetName,
- NonRep, MaxRep, Context, Oids, Expire).
+ SendOpts = [{timeout, Expire}, {context, Context}],
+ async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts).
async_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids, Expire,
ExtraInfo) ->
- snmpm_server:async_get_bulk(UserId, TargetName,
- NonRep, MaxRep,
- Context, Oids, Expire, ExtraInfo).
+ SendOpts = [{timeout, Expire}, {context, Context}, {extra, ExtraInfo}],
+ async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts).
+%% </BACKWARD-COMPAT>
+%% <DEPRECATED>
agb(UserId, Addr, NonRep, MaxRep, Oids) ->
agb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, Oids).
@@ -1200,6 +1361,7 @@ agb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Expire, ExtraInfo) ->
Error ->
Error
end.
+%% </DEPRECATED>
cancel_async_request(UserId, ReqId) ->
@@ -1207,7 +1369,7 @@ cancel_async_request(UserId, ReqId) ->
%%%-----------------------------------------------------------------
-%%% Audit Trail Log functions (for backward compatibillity)
+%%% Audit Trail Log functions (for backward compatibility)
%%%-----------------------------------------------------------------
log_to_txt(LogDir, Mibs) ->
OutFile = "snmpm_log.txt",
diff --git a/lib/snmp/src/manager/snmpm_config.erl b/lib/snmp/src/manager/snmpm_config.erl
index fd6da3e71a..c2e57abddb 100644
--- a/lib/snmp/src/manager/snmpm_config.erl
+++ b/lib/snmp/src/manager/snmpm_config.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -36,7 +36,8 @@
user_info/0, user_info/1, user_info/2,
register_agent/3, unregister_agent/2,
- agent_info/0, agent_info/2, agent_info/3, update_agent_info/4,
+ agent_info/0, agent_info/2, agent_info/3,
+ update_agent_info/3, update_agent_info/4,
which_agents/0, which_agents/1,
is_known_engine_id/2,
@@ -84,7 +85,9 @@
backup/1,
- mk_target_name/3
+ mk_target_name/3,
+
+ default_transport_domain/0
]).
@@ -127,23 +130,24 @@
%% Macros and Constants:
--define(SERVER, ?MODULE).
--define(BACKUP_DB, snmpm_config_backup).
--define(CONFIG_DB, snmpm_config_db).
+-define(SERVER, ?MODULE).
+-define(BACKUP_DB, snmpm_config_backup).
+-define(CONFIG_DB, snmpm_config_db).
-define(DEFAULT_USER, default_user).
-define(DEFAULT_AGENT_PORT, 161).
--define(IRB_DEFAULT, auto).
-%% -define(IRB_DEFAULT, {user, timer:seconds(15)}).
+-define(IRB_DEFAULT, auto).
+%% -define(IRB_DEFAULT, {user, timer:seconds(15)}).
--define(USER_MOD_DEFAULT, snmpm_user_default).
--define(USER_DATA_DEFAULT, undefined).
+-define(USER_MOD_DEFAULT, snmpm_user_default).
+-define(USER_DATA_DEFAULT, undefined).
%% -define(DEF_ADDR_TAG, default_addr_tag).
-define(DEFAULT_TARGETNAME, default_agent).
--define(DEF_PORT_TAG, default_port_tag).
+-define(DEF_PORT_TAG, default_port_tag).
+-define(SUPPORTED_DOMAINS, [transportDomainUdpIpv4, transportDomainUdpIpv6]).
-ifdef(snmp_debug).
-define(GS_START_LINK(Opts),
@@ -159,6 +163,11 @@
%%%-------------------------------------------------------------------
%%% API
%%%-------------------------------------------------------------------
+
+default_transport_domain() ->
+ transportDomainUdpIpv4.
+
+
start_link(Opts) ->
?d("start_link -> entry with"
"~n Opts: ~p", [Opts]),
@@ -269,9 +278,10 @@ do_user_info(_UserId, BadItem) ->
error({not_found, BadItem}).
-%% A target-name constructed in this way is a string with the following
+%% A target-name constructed in this way is a string with the following:
%% <IP-address>:<Port>-<Version>
-%%
+%% This is intended for backward compatibility and therefor has
+%% only support for IPv4 addresses and *no* other transport domain.
mk_target_name(Addr0, Port, Config) when is_list(Config) ->
Version =
case lists:keysearch(version, 1, Config) of
@@ -280,7 +290,6 @@ mk_target_name(Addr0, Port, Config) when is_list(Config) ->
false ->
select_lowest_supported_version()
end,
-%% p("mk_target_name -> Version: ~p", [Version]),
case normalize_address(Addr0) of
{A, B, C, D} ->
lists:flatten(
@@ -308,57 +317,99 @@ select_lowest_supported_version([H|T], Versions) ->
end.
-register_agent(UserId, _TargetName, _Config) when (UserId =:= user_id) ->
+register_agent(UserId, _TargetName, _Config0) when (UserId =:= user_id) ->
{error, {bad_user_id, UserId}};
-register_agent(UserId, TargetName, Config)
+register_agent(UserId, TargetName, Config0)
when (is_list(TargetName) andalso
(length(TargetName) > 0) andalso
- is_list(Config)) ->
+ is_list(Config0)) ->
-%% p("register_agent -> entry with"
-%% "~n UserId: ~p"
-%% "~n TargetName: ~p"
-%% "~n Config: ~p", [UserId, TargetName, Config]),
+ ?vtrace("register_agent -> entry with"
+ "~n UserId: ~p"
+ "~n TargetName: ~p"
+ "~n Config0: ~p", [UserId, TargetName, Config0]),
%% Check:
%% 1) That the mandatory configs are present
- %% 2) That the illegal config user_id (used internally) is
- %% not present
+ %% 2) That no illegal config, e.g. user_id (used internally),
+ %% is not present
%% 3) Check that there are no invalid or erroneous configs
- %% 4) Chack that the manager is capable to use the selected version
- case verify_agent_config(Config) of
- ok ->
+ %% 4) Check that the manager is capable of using the selected version
+ case verify_agent_config(Config0) of
+ {ok, Config} ->
call({register_agent, UserId, TargetName, Config});
Error ->
Error
end.
-verify_agent_config(Conf) ->
- ok = verify_mandatory(Conf, [engine_id, address, reg_type]),
- case verify_invalid(Conf, [user_id]) of
- ok ->
- case verify_agent_config2(Conf) of
- ok ->
- {ok, Vsns} = system_info(versions),
- Vsn =
- case lists:keysearch(version, 1, Conf) of
- {value, {version, V}} ->
- V;
- false ->
- v1
- end,
- case lists:member(Vsn, Vsns) of
- true ->
- ok;
- false ->
- {error, {version_not_supported_by_manager, Vsn, Vsns}}
- end
- end;
- Error ->
+verify_agent_config(Conf0) ->
+ try
+ begin
+ verify_mandatory(Conf0, [engine_id, address, reg_type]),
+ verify_invalid(Conf0, [user_id]),
+ Conf = verify_agent_config3(Conf0),
+ Vsns = versions(),
+ Vsn = which_version(Conf),
+ verify_version(Vsn, Vsns),
+ {ok, Conf}
+ end
+ catch
+ throw:Error ->
Error
end.
+versions() ->
+ case system_info(versions) of
+ {ok, Vsns} ->
+ Vsns;
+ {error, _} = ERROR ->
+ throw(ERROR)
+ end.
+
+which_version(Conf) ->
+ case lists:keysearch(version, 1, Conf) of
+ {value, {version, V}} ->
+ V;
+ false ->
+ v1
+ end.
+
+verify_version(Vsn, Vsns) ->
+ case lists:member(Vsn, Vsns) of
+ true ->
+ ok;
+ false ->
+ Reason = {version_not_supported_by_manager, Vsn, Vsns},
+ throw({error, Reason})
+ end.
+
+verify_agent_config3(Conf0) ->
+ %% Fix (transport) address and domain
+ {TDomain, Conf1} =
+ case lists:keysearch(tdomain, 1, Conf0) of
+ {value, {tdomain, Dom}} ->
+ {Dom, Conf0};
+ false ->
+ Dom = default_transport_domain(),
+ {Dom, [{tdomain, Dom} | Conf0]}
+ end,
+ Conf2 = case lists:keysearch(address, 1, Conf1) of
+ {value, {address, Address}} ->
+ lists:keyreplace(address, 1, Conf1,
+ {address, {TDomain, Address}});
+ false ->
+ %% This is a mandatory config option,
+ %% a later test will detect this
+ Conf1
+ end,
+ case verify_agent2(Conf2) of
+ {ok, Conf} ->
+ Conf;
+ {error, _} = ERROR ->
+ throw(ERROR)
+ end.
+
verify_agent_config2(Conf) ->
verify_agent2(Conf).
@@ -366,6 +417,7 @@ verify_agent_config2(Conf) ->
unregister_agent(UserId, TargetName) ->
call({unregister_agent, UserId, TargetName}).
+%% This is the old style agent unregistration (using Addr and Port).
unregister_agent(UserId, Addr0, Port) ->
Addr = normalize_address(Addr0),
case do_agent_info(Addr, Port, target_name) of
@@ -421,17 +473,51 @@ which_agents(UserId) ->
Agents = ets:match(snmpm_agent_table, Pat),
[TargetName || [TargetName] <- Agents].
-
-update_agent_info(UserId, TargetName, Item, Val0)
- when (Item =/= user_id) ->
- case (catch verify_val(Item, Val0)) of
- {ok, Val} ->
- call({update_agent_info, UserId, TargetName, Item, Val});
- Error ->
+
+verify_agent_info(TargetName, Info0) ->
+ try
+ begin
+ verify_invalid(Info0, [user_id]),
+ %% Check if address is part of the list and
+ %% if so update it with the domain info.
+ Info =
+ case lists:keysearch(address, 1, Info0) of
+ {value, {address, Addr}} ->
+ %% If domain is part of the info, then use it.
+ %% If not, lookup what is already stored for
+ %% this agent and use that.
+ Domain =
+ case lists:keysearch(tdomain, 1, Info0) of
+ {value, {tdomain, Dom}} ->
+ Dom;
+ false ->
+ {ok, Dom} =
+ agent_info(TargetName, tdomain),
+ Dom
+ end,
+ Addr2 = {Domain, Addr},
+ lists:keyreplace(address, 1, Info0, {address, Addr2});
+ false ->
+ Info0
+ end,
+ verify_agent2(Info)
+ end
+ catch
+ throw:Error ->
Error
end.
-%% Backward compatibillity
+update_agent_info(UserId, TargetName, Info) ->
+ call({update_agent_info, UserId, TargetName, Info}).
+
+%% <BACKWARD-COMPAT-2>
+%% This is wrapped in the interface module, so this function is
+%% only here to catch code-upgrade problems.
+update_agent_info(UserId, TargetName, Item, Val) ->
+ update_agent_info(UserId, TargetName, [{Item, Val}]).
+%% </BACKWARD-COMPAT-2>
+
+%% <BACKWARD-COMPAT-1>
update_agent_info(UserId, Addr, Port, Item, Val) ->
case agent_info(Addr, Port, target_name) of
{ok, TargetName} ->
@@ -439,6 +525,7 @@ update_agent_info(UserId, Addr, Port, Item, Val) ->
Error ->
Error
end.
+%% </BACKWARD-COMPAT-1>
is_known_engine_id(EngineID, TargetName) ->
case agent_info(TargetName, engine_id) of
@@ -650,22 +737,14 @@ unregister_usm_user(EngineID, Name)
call({unregister_usm_user, EngineID, Name}).
verify_usm_user_config(EngineID, Name, Config) ->
- %% case verify_mandatory(Config, []) of
- %% ok ->
- %% case verify_invalid(Config, [engine_id, name]) of
- %% ok ->
- %% verify_usm_user_config2(EngineID, Name, Config);
- %% Error ->
- %% Error
- %% end;
- %% Error ->
- %% Error
- %% end.
- ok = verify_mandatory(Config, []),
- case verify_invalid(Config, [engine_id, name]) of
- ok ->
- verify_usm_user_config2(EngineID, Name, Config);
- Error ->
+ try
+ begin
+ verify_mandatory(Config, []),
+ verify_invalid(Config, [engine_id, name]),
+ verify_usm_user_config2(EngineID, Name, Config)
+ end
+ catch
+ throw:Error ->
Error
end.
@@ -1590,6 +1669,7 @@ check_agent_config2(Agent) ->
throw(Err)
end.
+%% For backward compatibility
check_agent_config({UserId,
TargetName,
Community,
@@ -1597,10 +1677,27 @@ check_agent_config({UserId,
EngineId,
Timeout, MaxMessageSize,
Version, SecModel, SecName, SecLevel}) ->
+ TDomain = default_transport_domain(),
+ check_agent_config({UserId,
+ TargetName,
+ Community,
+ TDomain, Ip, Port,
+ EngineId,
+ Timeout, MaxMessageSize,
+ Version, SecModel, SecName, SecLevel});
+
+check_agent_config({UserId,
+ TargetName,
+ Community,
+ TDomain, Ip, Port,
+ EngineId,
+ Timeout, MaxMessageSize,
+ Version, SecModel, SecName, SecLevel}) ->
?vtrace("check_agent_config -> entry with"
"~n UserId: ~p"
"~n TargetName: ~p"
"~n Community: ~p"
+ "~n TDomain: ~p"
"~n Ip: ~p"
"~n Port: ~p"
"~n EngineId: ~p"
@@ -1610,15 +1707,16 @@ check_agent_config({UserId,
"~n SecModel: ~p"
"~n SecName: ~p"
"~n SecLevel: ~p",
- [UserId, TargetName, Community, Ip, Port,
+ [UserId, TargetName, Community,
+ TDomain, Ip, Port,
EngineId, Timeout, MaxMessageSize,
Version, SecModel, SecName, SecLevel]),
- Addr = normalize_address(Ip),
+ Addr = normalize_address(TDomain, Ip),
?vtrace("check_agent_config -> Addr: ~p", [Addr]),
Agent = {UserId,
TargetName,
Community,
- Addr, Port,
+ TDomain, Addr, Port,
EngineId,
Timeout, MaxMessageSize,
Version, SecModel, SecName, SecLevel},
@@ -1644,6 +1742,7 @@ init_agent_config({UserId, TargetName, Config}) ->
end.
+%% For backward compatibility
verify_agent({UserId,
TargetName,
Comm,
@@ -1651,48 +1750,68 @@ verify_agent({UserId,
EngineId,
Timeout, MMS,
Version, SecModel, SecName, SecLevel}) ->
- ?vtrace("verify_agent -> entry with"
+ TDomain = default_transport_domain(),
+ verify_agent({UserId,
+ TargetName,
+ Comm,
+ TDomain, Ip, Port,
+ EngineId,
+ Timeout, MMS,
+ Version, SecModel, SecName, SecLevel});
+
+verify_agent({UserId,
+ TargetName,
+ Comm,
+ TDomain, Ip, Port,
+ EngineId,
+ Timeout, MMS,
+ Version, SecModel, SecName, SecLevel}) ->
+ ?vdebug("verify_agent -> entry with"
"~n UserId: ~p"
"~n TargetName: ~p", [UserId, TargetName]),
snmp_conf:check_string(TargetName, {gt, 0}),
- case verify_val(address, Ip) of
- {ok, Addr} ->
- snmp_conf:check_integer(Port, {gt, 0}),
- Conf =
- [{reg_type, target_name},
- {address, Addr},
- {port, Port},
- {community, Comm},
- {engine_id, EngineId},
- {timeout, Timeout},
- {max_message_size, MMS},
- {version, Version},
- {sec_model, SecModel},
- {sec_name, SecName},
- {sec_level, SecLevel}
- ],
- case verify_agent2(Conf) of
- ok ->
- {UserId, TargetName, Conf, Version};
- Err ->
- throw(Err)
- end;
-
- Error ->
- ?vlog("verify_agent -> failed: ~n ~p", [Error]),
- throw(Error)
+ snmp_conf:check_integer(Port, {gt, 0}),
+ %% Note that the order of Conf *is* important.
+ %% Some properties may depend on others, so that
+ %% in order to verify one property, another must
+ %% be already verified (and present). An example
+ %% of this is the property 'address', for which
+ %% the property tdomain is needed.
+ Conf0 =
+ [{reg_type, target_name},
+ {tdomain, TDomain},
+ %% This should be taddress, but what the*...
+ {address, {TDomain, Ip}},
+ {port, Port},
+ {community, Comm},
+ {engine_id, EngineId},
+ {timeout, Timeout},
+ {max_message_size, MMS},
+ {version, Version},
+ {sec_model, SecModel},
+ {sec_name, SecName},
+ {sec_level, SecLevel}
+ ],
+ case verify_agent2(Conf0) of
+ {ok, Conf} ->
+ {UserId, TargetName, Conf, Version};
+ Err ->
+ throw(Err)
end.
-verify_agent2([]) ->
- ok;
-verify_agent2([{Item, Val}|Items]) ->
- case verify_val(Item, Val) of
- {ok, _Val} ->
- verify_agent2(Items);
+verify_agent2(Conf) ->
+ verify_agent2(Conf, []).
+
+verify_agent2([], VerifiedConf) ->
+ {ok, VerifiedConf};
+verify_agent2([{Item, Val0}|Items], VerifiedConf) ->
+ case verify_val(Item, Val0) of
+ {ok, Val} ->
+ verify_agent2(Items, [{Item, Val} | VerifiedConf]);
Err ->
Err
end;
-verify_agent2([Bad|_]) ->
+verify_agent2([Bad|_], _VerifiedConf) ->
{error, {bad_agent_config, Bad}}.
@@ -1708,14 +1827,28 @@ read_users_config_file(Dir) ->
check_user_config({Id, Mod, Data}) ->
+ ?vtrace("check_user_config -> entry with"
+ "~n Id: ~p"
+ "~n Mod: ~p"
+ "~n Data: ~p", [Id, Mod, Data]),
check_user_config({Id, Mod, Data, []});
-check_user_config({Id, Mod, _Data, DefaultAgentConfig} = User)
+check_user_config({Id, Mod, Data, DefaultAgentConfig} = _User)
when (Id =/= ?DEFAULT_USER) andalso is_list(DefaultAgentConfig) ->
+ ?vtrace("check_user_config -> entry with"
+ "~n Id: ~p"
+ "~n Mod: ~p"
+ "~n Data: ~p"
+ "~n DefaultAgentConfig: ~p",
+ [Id, Mod, Data, DefaultAgentConfig]),
case (catch verify_user_behaviour(Mod)) of
ok ->
+ ?vtrace("check_user_config -> user behaviour verified", []),
case verify_user_agent_config(DefaultAgentConfig) of
- ok ->
- {ok, User};
+ {ok, DefAgentConf} ->
+ ?vtrace("check_user_config -> "
+ "user agent (default) config verified", []),
+ User2 = {Id, Mod, Data, DefAgentConf},
+ {ok, User2};
{error, Reason} ->
error({bad_default_agent_config, Reason})
end;
@@ -1756,16 +1889,16 @@ verify_user({Id, UserMod, UserData}) ->
verify_user({Id, UserMod, UserData, DefaultAgentConfig})
when (Id =/= ?DEFAULT_USER) andalso is_list(DefaultAgentConfig) ->
?d("verify_user -> entry with"
- "~n Id: ~p"
- "~n UserMod: ~p"
- "~n UserData: ~p"
+ "~n Id: ~p"
+ "~n UserMod: ~p"
+ "~n UserData: ~p"
"~n DefaultAgentConfig: ~p",
[Id, UserMod, UserData, DefaultAgentConfig]),
case (catch verify_user_behaviour(UserMod)) of
ok ->
case verify_user_agent_config(DefaultAgentConfig) of
- ok ->
- Config = default_agent_config(DefaultAgentConfig),
+ {ok, DefAgentConf} ->
+ Config = default_agent_config(DefAgentConf),
{ok, #user{id = Id,
mod = UserMod,
data = UserData,
@@ -1783,10 +1916,15 @@ verify_user({Id, _, _, _}) ->
{error, {bad_user_id, Id}}.
verify_user_agent_config(Conf) ->
- case verify_invalid(Conf, [user_id, engine_id, address]) of
- ok ->
- verify_agent_config2(Conf);
- Error ->
+ try
+ begin
+ verify_invalid(Conf, [user_id, engine_id, address]),
+ verify_agent_config2(Conf)
+ end
+ catch
+ throw:Error ->
+ ?vdebug("verify_user_agent_config -> throw"
+ "~n Error: ~p", [Error]),
Error
end.
@@ -2147,6 +2285,16 @@ handle_call({unregister_agent, UserId, TargetName}, _From, State) ->
Reply = handle_unregister_agent(UserId, TargetName),
{reply, Reply, State};
+handle_call({update_agent_info, UserId, TargetName, Info},
+ _From, State) ->
+ ?vlog("received update_agent_info request: "
+ "~n UserId: ~p"
+ "~n TargetName: ~p"
+ "~n Info: ~p", [UserId, TargetName, Info]),
+ Reply = handle_update_agent_info(UserId, TargetName, Info),
+ {reply, Reply, State};
+
+%% <BACKWARD-COMPAT>
handle_call({update_agent_info, UserId, TargetName, Item, Val},
_From, State) ->
?vlog("received update_agent_info request: "
@@ -2156,6 +2304,7 @@ handle_call({update_agent_info, UserId, TargetName, Item, Val},
"~n Val: ~p", [UserId, TargetName, Item, Val]),
Reply = handle_update_agent_info(UserId, TargetName, Item, Val),
{reply, Reply, State};
+%% </BACKWARD-COMPAT>
handle_call({register_usm_user, User}, _From, State) ->
?vlog("received register_usm_user request: "
@@ -2517,16 +2666,27 @@ handle_register_agent(UserId, TargetName, Config) ->
"~n Config: ~p", [UserId, TargetName, Config]),
case (catch agent_info(TargetName, user_id)) of
{error, _} ->
+ ?vtrace("handle_register_agent -> user_id not found in config", []),
case ets:lookup(snmpm_user_table, UserId) of
[#user{default_agent_config = DefConfig}] ->
+ ?vtrace("handle_register_agent -> "
+ "~n DefConfig: ~p", [DefConfig]),
+ %% First, insert this users default config
+ ?vtrace("handle_register_agent -> store default config", []),
do_handle_register_agent(TargetName, DefConfig),
+ %% Second, insert the config for this agent
+ ?vtrace("handle_register_agent -> store config", []),
do_handle_register_agent(TargetName,
[{user_id, UserId}|Config]),
%% <DIRTY-BACKWARD-COMPATIBILLITY>
%% And now for some (backward compatibillity)
%% dirty crossref stuff
+ ?vtrace("handle_register_agent -> lookup address", []),
{ok, Addr} = agent_info(TargetName, address),
+ ?vtrace("handle_register_agent -> Addr: ~p, lookup Port",
+ [Addr]),
{ok, Port} = agent_info(TargetName, port),
+ ?vtrace("handle_register_agent -> register cross-ref fix", []),
ets:insert(snmpm_agent_table,
{{Addr, Port, target_name}, TargetName}),
%% </DIRTY-BACKWARD-COMPATIBILLITY>
@@ -2551,10 +2711,18 @@ handle_register_agent(UserId, TargetName, Config) ->
do_handle_register_agent(_TargetName, []) ->
ok;
do_handle_register_agent(TargetName, [{Item, Val}|Rest]) ->
+ ?vtrace("handle_register_agent -> entry with"
+ "~n TargetName: ~p"
+ "~n Item: ~p"
+ "~n Val: ~p"
+ "~n Rest: ~p", [TargetName, Item, Val, Rest]),
case (catch do_update_agent_info(TargetName, Item, Val)) of
ok ->
do_handle_register_agent(TargetName, Rest);
{error, Reason} ->
+ ?vtrace("handle_register_agent -> failed updating ~p"
+ "~n Item: ~p"
+ "~n Reason: ~p", [Item, Reason]),
ets:match_delete(snmpm_agent_table, {TargetName, '_'}),
{error, Reason}
end;
@@ -2589,41 +2757,61 @@ handle_unregister_agent(UserId, TargetName) ->
end.
-handle_update_agent_info(UserId, TargetName, Item, Val) ->
+handle_update_agent_info(UserId, TargetName, Info) ->
?vdebug("handle_update_agent_info -> entry with"
"~n UserId: ~p"
"~n TargetName: ~p"
- "~n Item: ~p"
- "~n Val: ~p", [UserId, TargetName, Item, Val]),
+ "~n Info: ~p", [UserId, TargetName, Info]),
+ %% Verify ownership
case (catch agent_info(TargetName, user_id)) of
- {ok, UserId} ->
- do_update_agent_info(TargetName, Item, Val);
+ {ok, UserId} ->
+ handle_update_agent_info(TargetName, Info);
{ok, OtherUserId} ->
{error, {not_owner, OtherUserId}};
Error ->
Error
end.
-do_update_agent_info(TargetName, Item, Val0) ->
-%% p("do_update_agent_info -> entry with"
-%% "~n TargetName: ~p"
-%% "~n Item: ~p"
-%% "~n Val0: ~p", [TargetName, Item, Val0]),
- case verify_val(Item, Val0) of
- {ok, Val} ->
-%% p("do_update_agent_info -> verified value"
-%% "~n Val: ~p", [Val]),
- ets:insert(snmpm_agent_table, {{TargetName, Item}, Val}),
- ok;
+handle_update_agent_info(TargetName, Info0) ->
+ ?vtrace("handle_update_agent_info -> entry with"
+ "~n TargetName: ~p"
+ "~n Info0: ~p", [TargetName, Info0]),
+ %% Verify info
+ try verify_agent_info(TargetName, Info0) of
+ {ok, Info} ->
+ do_update_agent_info(TargetName, Info);
Error ->
- ?vlog("do_update_agent_info -> verify value failed: "
- "~n TargetName: ~p"
- "~n Item: ~p"
- "~n Val0: ~p"
- "~n Error: ~p", [TargetName, Item, Val0, Error]),
- {error, {bad_agent_val, TargetName, Item, Val0}}
+ Error
+ catch
+ throw:Error ->
+ Error;
+ T:E ->
+ {error, {failed_info_verification, Info0, T, E}}
end.
+handle_update_agent_info(UserId, TargetName, Item, Val) ->
+ ?vdebug("handle_update_agent_info -> entry with"
+ "~n UserId: ~p"
+ "~n TargetName: ~p"
+ "~n Item: ~p"
+ "~n Val: ~p", [UserId, TargetName, Item, Val]),
+ handle_update_agent_info(TargetName, [{Item, Val}]).
+
+do_update_agent_info(TargetName, Info) ->
+ InsertItem =
+ fun({Item, Val}) ->
+ ets:insert(snmpm_agent_table, {{TargetName, Item}, Val})
+ end,
+ lists:foreach(InsertItem, Info).
+
+do_update_agent_info(TargetName, Item, Val) ->
+ ?vtrace("do_update_agent_info -> entry with"
+ "~n TargetName: ~p"
+ "~n Item: ~p"
+ "~n Val: ~p", [TargetName, Item, Val]),
+ ets:insert(snmpm_agent_table, {{TargetName, Item}, Val}),
+ ok.
+
handle_register_usm_user(#usm_user{engine_id = EngineID,
name = Name} = User) ->
@@ -2791,7 +2979,7 @@ verify_mandatory(Conf, [Mand|Mands]) ->
true ->
verify_mandatory(Conf, Mands);
false ->
- {error, {missing_mandatory_config, Mand}}
+ throw({error, {missing_mandatory_config, Mand}})
end.
verify_invalid(_, []) ->
@@ -2801,7 +2989,7 @@ verify_invalid(Conf, [Inv|Invs]) ->
false ->
verify_invalid(Conf, Invs);
true ->
- {error, {illegal_config, Inv}}
+ throw({error, {illegal_config, Inv}})
end.
@@ -2810,10 +2998,26 @@ verify_val(user_id, UserId) ->
verify_val(reg_type, RegType)
when (RegType =:= addr_port) orelse (RegType =:= target_name) ->
{ok, RegType};
-verify_val(address, Addr0) ->
- case normalize_address(Addr0) of
+verify_val(tdomain = Item, snmpUDPDomain = _Domain) ->
+ verify_val(Item, transportDomainUdpIpv4);
+verify_val(tdomain, Domain) ->
+ case lists:member(Domain, ?SUPPORTED_DOMAINS) of
+ true ->
+ {ok, Domain};
+ false ->
+ case lists:member(Domain, snmp_conf:all_domains()) of
+ true ->
+ error({unsupported_domain, Domain});
+ false ->
+ error({unknown_domain, Domain})
+ end
+ end;
+verify_val(address, {Domain, Addr0}) ->
+ case normalize_address(Domain, Addr0) of
{_A1, _A2, _A3, _A4} = Addr ->
{ok, Addr};
+ {_A1, _A2, _A3, _A4, _A5, _A6, _A7, _A8} = Addr ->
+ {ok, Addr};
_ when is_list(Addr0) ->
case (catch snmp_conf:check_ip(Addr0)) of
ok ->
@@ -2824,6 +3028,8 @@ verify_val(address, Addr0) ->
_ ->
error({bad_address, Addr0})
end;
+verify_val(address, BadAddress) ->
+ error({bad_address, BadAddress});
verify_val(port, Port) ->
case (catch snmp_conf:check_integer(Port, {gt, 0})) of
ok ->
@@ -2875,7 +3081,7 @@ verify_val(sec_name, BadName) ->
verify_val(sec_level, Level) ->
(catch snmp_conf:check_sec_level(Level));
verify_val(Item, _) ->
- {error, {no_such_item, Item}}.
+ {error, {unknown_item, Item}}.
%%%-------------------------------------------------------------------
@@ -3034,11 +3240,17 @@ init_mini_mib_elems(MibName, [_|T], Res) ->
%%----------------------------------------------------------------------
normalize_address(Addr) ->
- case inet:getaddr(Addr, inet) of
+ normalize_address(snmpUDPDomain, Addr).
+
+normalize_address(snmpUDPDomain, Addr) ->
+ normalize_address(transportDomainUdpIpv4, Addr);
+
+normalize_address(Domain, Addr) ->
+ case inet:getaddr(Addr, td2fam(Domain)) of
{ok, Addr2} ->
Addr2;
_ when is_list(Addr) ->
- case (catch snmp_conf:check_ip(Addr)) of
+ case (catch snmp_conf:check_ip(Domain, Addr)) of
ok ->
list_to_tuple(Addr);
_ ->
@@ -3048,6 +3260,9 @@ normalize_address(Addr) ->
Addr
end.
+td2fam(transportDomainUdpIpv4) -> inet;
+td2fam(transportDomainUdpIpv6) -> inet6.
+
%%----------------------------------------------------------------------
diff --git a/lib/snmp/src/manager/snmpm_internal.hrl b/lib/snmp/src/manager/snmpm_internal.hrl
index 5d9b32e3f6..53ad41c6b0 100644
--- a/lib/snmp/src/manager/snmpm_internal.hrl
+++ b/lib/snmp/src/manager/snmpm_internal.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2006-2009. All Rights Reserved.
+%% Copyright Ericsson AB 2006-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -20,6 +20,11 @@
-ifndef(snmpm_internal).
-define(snmpm_internal, true).
+-define(DEFAULT_CONTEXT, "").
+-define(SNMPM_EXTRA_INFO_TAG, snmpm_extra_info_tag).
+-define(DEFAULT_EXTRA_INFO, {?SNMPM_EXTRA_INFO_TAG}).
+
+
-include_lib("snmp/src/app/snmp_internal.hrl").
-define(snmpm_info(F, A), ?snmp_info("manager", F, A)).
diff --git a/lib/snmp/src/manager/snmpm_mpd.erl b/lib/snmp/src/manager/snmpm_mpd.erl
index 7712370d28..103c87d32b 100644
--- a/lib/snmp/src/manager/snmpm_mpd.erl
+++ b/lib/snmp/src/manager/snmpm_mpd.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -92,7 +92,7 @@ reset(#state{v3 = V3}) ->
%% Purpose: This is the main Message Dispatching function. (see
%% section 4.2.1 in rfc2272)
%%-----------------------------------------------------------------
-process_msg(Msg, TDomain, Addr, Port, State, NoteStore, Logger) ->
+process_msg(Msg, Domain, Addr, Port, State, NoteStore, Logger) ->
inc(snmpInPkts),
@@ -102,18 +102,18 @@ process_msg(Msg, TDomain, Addr, Port, State, NoteStore, Logger) ->
#message{version = 'version-1', vsn_hdr = Community, data = Data}
when State#state.v1 =:= true ->
HS = ?empty_msg_size + length(Community),
- process_v1_v2c_msg('version-1', NoteStore, Msg, TDomain,
- Addr, Port,
+ process_v1_v2c_msg('version-1', NoteStore, Msg,
+ Domain, Addr, Port,
Community, Data, HS, Logger);
%% Version 2
#message{version = 'version-2', vsn_hdr = Community, data = Data}
when State#state.v2c =:= true ->
HS = ?empty_msg_size + length(Community),
- process_v1_v2c_msg('version-2', NoteStore, Msg, TDomain,
- Addr, Port,
- Community, Data, HS, Logger);
-
+ (catch process_v1_v2c_msg('version-2', NoteStore, Msg,
+ Domain, Addr, Port,
+ Community, Data, HS, Logger));
+
%% Version 3
#message{version = 'version-3', vsn_hdr = H, data = Data}
when State#state.v3 =:= true ->
@@ -148,17 +148,30 @@ process_msg(Msg, TDomain, Addr, Port, State, NoteStore, Logger) ->
%%-----------------------------------------------------------------
%% Handles a Community based message (v1 or v2c).
%%-----------------------------------------------------------------
-process_v1_v2c_msg(Vsn, _NoteStore, Msg, snmpUDPDomain,
+process_v1_v2c_msg(Vsn, _NoteStore, Msg, Domain,
Addr, Port,
Community, Data, HS, Log) ->
?vdebug("process_v1_v2c_msg -> entry with"
"~n Vsn: ~p"
+ "~n Domain: ~p"
"~n Addr: ~p"
"~n Port: ~p"
"~n Community: ~p"
- "~n HS: ~p", [Vsn, Addr, Port, Community, HS]),
+ "~n HS: ~p", [Vsn, Domain, Addr, Port, Community, HS]),
+ {TDomain, TAddress} =
+ try
+ begin
+ TD = snmp_conf:mk_tdomain(Domain),
+ TA = snmp_conf:mk_taddress(Domain, Addr, Port),
+ {TD, TA}
+ end
+ catch
+ throw:{error, TReason} ->
+ throw({discarded, {badarg, Domain, TReason}})
+ end,
+
Max = get_max_message_size(),
AgentMax = get_agent_max_message_size(Addr, Port),
PduMS = pdu_ms(Max, AgentMax, HS),
@@ -170,14 +183,14 @@ process_v1_v2c_msg(Vsn, _NoteStore, Msg, snmpUDPDomain,
?vtrace("process_v1_v2c_msg -> was a pdu", []),
Log(Msg),
inc_snmp_in(Pdu),
- MsgData = {Community, sec_model(Vsn)},
+ MsgData = {Community, sec_model(Vsn), TDomain, TAddress},
{ok, Vsn, Pdu, PduMS, MsgData};
Trap when is_record(Trap, trappdu) ->
?vtrace("process_v1_v2c_msg -> was a trap", []),
Log(Msg),
inc_snmp_in(Trap),
- MsgData = {Community, sec_model(Vsn)},
+ MsgData = {Community, sec_model(Vsn), TDomain, TAddress},
{ok, Vsn, Trap, PduMS, MsgData};
{'EXIT', Reason} ->
@@ -185,11 +198,7 @@ process_v1_v2c_msg(Vsn, _NoteStore, Msg, snmpUDPDomain,
"~n Reason: ~p", [Reason]),
inc(snmpInASNParseErrs),
{discarded, Reason}
- end;
-process_v1_v2c_msg(_Vsn, _NoteStore, _Msg, TDomain,
- _Addr, _Port,
- _Comm, _HS, _Data, _Log) ->
- {discarded, {badarg, TDomain}}.
+ end.
pdu_ms(MgrMMS, AgentMMS, HS) when AgentMMS < MgrMMS ->
AgentMMS - HS;
@@ -482,8 +491,8 @@ generate_msg('version-3', NoteStore, Pdu,
generate_v3_msg(NoteStore, Pdu,
SecModel, SecName, SecLevel, CtxEngineID, CtxName,
TargetName, Log);
-generate_msg(Vsn, _NoteStore, Pdu, {Community, _SecModel}, Log) ->
- generate_v1_v2c_msg(Vsn, Pdu, Community, Log).
+generate_msg(Vsn, _NoteStore, Pdu, {Comm, _SecModel}, Log) ->
+ generate_v1_v2c_msg(Vsn, Pdu, Comm, Log).
generate_v3_msg(NoteStore, Pdu,
@@ -627,6 +636,8 @@ generate_response_msg('version-3', Pdu,
generate_v3_response_msg(Pdu, MsgID, SecModel, SecName, SecLevel,
CtxEngineID, CtxName, SecData, Log);
generate_response_msg(Vsn, Pdu, {Comm, _SecModel}, Log) ->
+ generate_v1_v2c_response_msg(Vsn, Pdu, Comm, Log);
+generate_response_msg(Vsn, Pdu, {Comm, _SecModel, _TDomain, _TAddress}, Log) ->
generate_v1_v2c_response_msg(Vsn, Pdu, Comm, Log).
diff --git a/lib/snmp/src/manager/snmpm_net_if.erl b/lib/snmp/src/manager/snmpm_net_if.erl
index 07156dacd9..4d6bd9aa33 100644
--- a/lib/snmp/src/manager/snmpm_net_if.erl
+++ b/lib/snmp/src/manager/snmpm_net_if.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -28,7 +28,8 @@
start_link/2,
stop/1,
send_pdu/6, % Backward compatibillity
- send_pdu/7,
+ send_pdu/7, % Backward compatibillity
+ send_pdu/8,
inform_response/4,
@@ -99,18 +100,23 @@ stop(Pid) ->
call(Pid, stop).
send_pdu(Pid, Pdu, Vsn, MsgData, Addr, Port) ->
- send_pdu(Pid, Pdu, Vsn, MsgData, Addr, Port, undefined).
+ send_pdu(Pid, Pdu, Vsn, MsgData, Addr, Port, ?DEFAULT_EXTRA_INFO).
-send_pdu(Pid, Pdu, Vsn, MsgData, Addr, Port, ExtraInfo)
+send_pdu(Pid, Pdu, Vsn, MsgData, Addr, Port, ExtraInfo) ->
+ Domain = snmpm_config:default_transport_domain(),
+ send_pdu(Pid, Pdu, Vsn, MsgData, Domain, Addr, Port, ExtraInfo).
+
+send_pdu(Pid, Pdu, Vsn, MsgData, Domain, Addr, Port, ExtraInfo)
when is_record(Pdu, pdu) ->
?d("send_pdu -> entry with"
"~n Pid: ~p"
"~n Pdu: ~p"
"~n Vsn: ~p"
"~n MsgData: ~p"
+ "~n Domain: ~p"
"~n Addr: ~p"
- "~n Port: ~p", [Pid, Pdu, Vsn, MsgData, Addr, Port]),
- cast(Pid, {send_pdu, Pdu, Vsn, MsgData, Addr, Port, ExtraInfo}).
+ "~n Port: ~p", [Pid, Pdu, Vsn, MsgData, Domain, Addr, Port]),
+ cast(Pid, {send_pdu, Pdu, Vsn, MsgData, Domain, Addr, Port, ExtraInfo}).
note_store(Pid, NoteStore) ->
call(Pid, {note_store, NoteStore}).
@@ -380,14 +386,17 @@ handle_call(Req, From, State) ->
%% {noreply, State, Timeout} |
%% {stop, Reason, State} (terminate/2 is called)
%%--------------------------------------------------------------------
-handle_cast({send_pdu, Pdu, Vsn, MsgData, Addr, Port, _ExtraInfo}, State) ->
+handle_cast({send_pdu, Pdu, Vsn, MsgData, Domain, Addr, Port, ExtraInfo},
+ State) ->
?vlog("received send_pdu message with"
"~n Pdu: ~p"
"~n Vsn: ~p"
"~n MsgData: ~p"
+ "~n Domain: ~p"
"~n Addr: ~p"
- "~n Port: ~p", [Pdu, Vsn, MsgData, Addr, Port]),
- maybe_handle_send_pdu(Pdu, Vsn, MsgData, Addr, Port, State),
+ "~n Port: ~p", [Pdu, Vsn, MsgData, Domain, Addr, Port]),
+ maybe_process_extra_info(ExtraInfo),
+ maybe_handle_send_pdu(Pdu, Vsn, MsgData, Domain, Addr, Port, State),
{noreply, State};
handle_cast({inform_response, Ref, Addr, Port}, State) ->
@@ -544,8 +553,9 @@ handle_recv_msg(Addr, Port, Bytes,
mpd_state = MpdState,
sock = Sock,
log = Log} = State) ->
+ Domain = snmp_conf:which_domain(Addr), % What the ****...
Logger = logger(Log, read, Addr, Port),
- case (catch snmpm_mpd:process_msg(Bytes, snmpUDPDomain, Addr, Port,
+ case (catch snmpm_mpd:process_msg(Bytes, Domain, Addr, Port,
MpdState, NoteStore, Logger)) of
{ok, Vsn, Pdu, MS, ACM} ->
@@ -733,17 +743,17 @@ irgc_stop(Ref) ->
(catch erlang:cancel_timer(Ref)).
-maybe_handle_send_pdu(Pdu, Vsn, MsgData, Addr, Port,
+maybe_handle_send_pdu(Pdu, Vsn, MsgData, Domain, Addr, Port,
#state{filter = FilterMod} = State) ->
case (catch FilterMod:accept_send_pdu(Addr, Port, pdu_type_of(Pdu))) of
false ->
inc(netIfPduOutDrops),
ok;
_ ->
- handle_send_pdu(Pdu, Vsn, MsgData, Addr, Port, State)
+ handle_send_pdu(Pdu, Vsn, MsgData, Domain, Addr, Port, State)
end.
-handle_send_pdu(Pdu, Vsn, MsgData, Addr, Port,
+handle_send_pdu(Pdu, Vsn, MsgData, _Domain, Addr, Port,
#state{server = Pid,
note_store = NoteStore,
sock = Sock,
@@ -999,6 +1009,19 @@ pdu_type_of(TrapPdu) when is_record(TrapPdu, trappdu) ->
%% -------------------------------------------------------------------
+%% At this point this function is used during testing
+maybe_process_extra_info(?DEFAULT_EXTRA_INFO) ->
+ ok;
+maybe_process_extra_info({?SNMPM_EXTRA_INFO_TAG, Fun})
+ when is_function(Fun, 0) ->
+ (catch Fun()),
+ ok;
+maybe_process_extra_info(_ExtraInfo) ->
+ ok.
+
+
+%% -------------------------------------------------------------------
+
t() ->
{A,B,C} = erlang:now(),
A*1000000000+B*1000+(C div 1000).
diff --git a/lib/snmp/src/manager/snmpm_server.erl b/lib/snmp/src/manager/snmpm_server.erl
index d64b5b1d53..484954addb 100644
--- a/lib/snmp/src/manager/snmpm_server.erl
+++ b/lib/snmp/src/manager/snmpm_server.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -32,14 +32,14 @@
register_user/4, register_user_monitor/4, unregister_user/1,
- sync_get/4, sync_get/5, sync_get/6,
- async_get/4, async_get/5, async_get/6,
- sync_get_next/4, sync_get_next/5, sync_get_next/6,
- async_get_next/4, async_get_next/5, async_get_next/6,
- sync_get_bulk/6, sync_get_bulk/7, sync_get_bulk/8,
- async_get_bulk/6, async_get_bulk/7, async_get_bulk/8,
- sync_set/4, sync_set/5, sync_set/6,
- async_set/4, async_set/5, async_set/6,
+ sync_get2/4,
+ async_get2/4,
+ sync_get_next2/4,
+ async_get_next2/4,
+ sync_get_bulk2/6,
+ async_get_bulk2/6,
+ sync_set2/4,
+ async_set2/4,
cancel_async_request/2,
%% discovery/2, discovery/3, discovery/4, discovery/5, discovery/6,
@@ -55,6 +55,20 @@
]).
+%% <BACKWARD-COMPAT>
+-export([sync_get/4, sync_get/5, sync_get/6,
+ async_get/4, async_get/5, async_get/6,
+ sync_get_next/4, sync_get_next/5, sync_get_next/6,
+ async_get_next/4, async_get_next/5, async_get_next/6,
+ sync_get_bulk/6, sync_get_bulk/7, sync_get_bulk/8,
+ async_get_bulk/6, async_get_bulk/7, async_get_bulk/8,
+ sync_set/4, sync_set/5, sync_set/6,
+ async_set/4, async_set/5, async_set/6
+ ]).
+%% </BACKWARD-COMPAT>
+
+
+
%% Internal exports
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
code_change/3, terminate/2]).
@@ -75,13 +89,39 @@
-define(SERVER, ?MODULE).
--define(SYNC_GET_TIMEOUT, 5000).
--define(SYNC_SET_TIMEOUT, 5000).
--define(DEFAULT_ASYNC_EXPIRE, 5000).
--define(EXTRA_INFO, undefined).
-
--define(SNMP_AGENT_PORT, 161).
-
+-define(DEFAULT_SYNC_TIMEOUT, timer:seconds(5)).
+-define(DEFAULT_SYNC_GET_TIMEOUT, ?DEFAULT_SYNC_TIMEOUT).
+-define(DEFAULT_SYNC_GET_NEXT_TIMEOUT, ?DEFAULT_SYNC_TIMEOUT).
+-define(DEFAULT_SYNC_GET_BULK_TIMEOUT, ?DEFAULT_SYNC_TIMEOUT).
+-define(DEFAULT_SYNC_SET_TIMEOUT, ?DEFAULT_SYNC_TIMEOUT).
+
+-define(DEFAULT_ASYNC_TIMEOUT, timer:seconds(5)).
+-define(DEFAULT_ASYNC_GET_TIMEOUT, ?DEFAULT_ASYNC_TIMEOUT).
+-define(DEFAULT_ASYNC_GET_NEXT_TIMEOUT, ?DEFAULT_ASYNC_TIMEOUT).
+-define(DEFAULT_ASYNC_GET_BULK_TIMEOUT, ?DEFAULT_ASYNC_TIMEOUT).
+-define(DEFAULT_ASYNC_SET_TIMEOUT, ?DEFAULT_ASYNC_TIMEOUT).
+
+-define(SNMP_AGENT_PORT, 161).
+
+-define(SYNC_GET_TIMEOUT(SendOpts),
+ get_opt(timeout, ?DEFAULT_SYNC_GET_TIMEOUT, SendOpts)).
+-define(SYNC_GET_NEXT_TIMEOUT(SendOpts),
+ get_opt(timeout, ?DEFAULT_SYNC_GET_NEXT_TIMEOUT, SendOpts)).
+-define(SYNC_GET_BULK_TIMEOUT(SendOpts),
+ get_opt(timeout, ?DEFAULT_SYNC_GET_BULK_TIMEOUT, SendOpts)).
+-define(SYNC_SET_TIMEOUT(SendOpts),
+ get_opt(timeout, ?DEFAULT_SYNC_SET_TIMEOUT, SendOpts)).
+
+-define(ASYNC_GET_TIMEOUT(SendOpts),
+ get_opt(timeout, ?DEFAULT_ASYNC_GET_TIMEOUT, SendOpts)).
+-define(ASYNC_GET_NEXT_TIMEOUT(SendOpts),
+ get_opt(timeout, ?DEFAULT_ASYNC_GET_NEXT_TIMEOUT, SendOpts)).
+-define(ASYNC_GET_BULK_TIMEOUT(SendOpts),
+ get_opt(timeout, ?DEFAULT_ASYNC_GET_BULK_TIMEOUT, SendOpts)).
+-define(ASYNC_SET_TIMEOUT(SendOpts),
+ get_opt(timeout, ?DEFAULT_ASYNC_SET_TIMEOUT, SendOpts)).
+
+-define(GET_EXTRA(SendOpts), get_opt(extra, ?DEFAULT_EXTRA_INFO, SendOpts)).
-ifdef(snmp_debug).
-define(GS_START_LINK(Args),
@@ -121,7 +161,8 @@
{id,
user_id,
reg_type,
- target,
+ target,
+ domain,
addr,
port,
type,
@@ -192,82 +233,140 @@ unregister_user(UserId) ->
%% -- [sync] get --
+%% The reason why we have a sync_get2 is to simplify backward
+%% compatibillity.
+
+%% sync_get2(UserId, TargetName, Oids) ->
+%% sync_get2(UserId, TargetName, Oids, []).
+sync_get2(UserId, TargetName, Oids, Opts) ->
+ call({sync_get, self(), UserId, TargetName, Oids, Opts}).
+
+
+%% <BACKWARD-COMPAT>
sync_get(UserId, TargetName, CtxName, Oids) ->
sync_get(UserId, TargetName, CtxName, Oids,
- ?SYNC_GET_TIMEOUT).
+ ?DEFAULT_SYNC_GET_TIMEOUT).
sync_get(UserId, TargetName, CtxName, Oids, Timeout) ->
- sync_get(UserId, TargetName, CtxName, Oids, Timeout, ?EXTRA_INFO).
+ sync_get(UserId, TargetName, CtxName, Oids, Timeout, ?DEFAULT_EXTRA_INFO).
sync_get(UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo)
when is_list(TargetName) andalso
is_list(CtxName) andalso
is_list(Oids) andalso
is_integer(Timeout) ->
- call({sync_get, self(), UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo}).
+ Opts = [{context, CtxName}, {timeout, Timeout}, {extra, ExtraInfo}],
+ sync_get2(UserId, TargetName, Oids, Opts).
+%% </BACKWARD-COMPAT>
+
+
%% -- [async] get --
+%% async_get2(UserId, TargetName, Oids) ->
+%% async_get2(UserId, TargetName, Oids, []).
+async_get2(UserId, TargetName, Oids, SendOpts) ->
+ call({async_get, self(), UserId, TargetName, Oids, SendOpts}).
+
+
+%% <BACKWARD-COMPAT>
async_get(UserId, TargetName, CtxName, Oids) ->
async_get(UserId, TargetName, CtxName, Oids,
- ?DEFAULT_ASYNC_EXPIRE, ?EXTRA_INFO).
+ ?DEFAULT_ASYNC_GET_TIMEOUT, ?DEFAULT_EXTRA_INFO).
async_get(UserId, TargetName, CtxName, Oids, Expire) ->
- async_get(UserId, TargetName, CtxName, Oids, Expire, ?EXTRA_INFO).
+ async_get(UserId, TargetName, CtxName, Oids, Expire, ?DEFAULT_EXTRA_INFO).
async_get(UserId, TargetName, CtxName, Oids, Expire, ExtraInfo)
when (is_list(TargetName) andalso
is_list(CtxName) andalso
is_list(Oids) andalso
is_integer(Expire) andalso (Expire >= 0)) ->
- call({async_get, self(), UserId, TargetName, CtxName, Oids, Expire,
- ExtraInfo}).
+ SendOpts = [{context, CtxName}, {expire, Expire}, {extra, ExtraInfo}],
+ async_get2(UserId, TargetName, Oids, SendOpts).
+%% </BACKWARD-COMPAT>
+
+
%% -- [sync] get-next --
+%% sync_get_next2(UserId, TargetName, Oids) ->
+%% sync_get_next2(UserId, TargetName, Oids, []).
+sync_get_next2(UserId, TargetName, Oids, SendOpts) ->
+ call({sync_get_next, self(), UserId, TargetName, Oids, SendOpts}).
+
+
+%% <BACKWARD-COMPAT>
sync_get_next(UserId, TargetName, CtxName, Oids) ->
- sync_get_next(UserId, TargetName, CtxName, Oids, ?SYNC_GET_TIMEOUT,
- ?EXTRA_INFO).
+ sync_get_next(UserId, TargetName, CtxName, Oids,
+ ?DEFAULT_SYNC_GET_TIMEOUT, ?DEFAULT_EXTRA_INFO).
sync_get_next(UserId, TargetName, CtxName, Oids, Timeout) ->
- sync_get_next(UserId, TargetName, CtxName, Oids, Timeout, ?EXTRA_INFO).
+ sync_get_next(UserId, TargetName, CtxName, Oids, Timeout,
+ ?DEFAULT_EXTRA_INFO).
sync_get_next(UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo)
when is_list(TargetName) andalso
is_list(CtxName) andalso
is_list(Oids) andalso
is_integer(Timeout) ->
- call({sync_get_next, self(), UserId, TargetName, CtxName, Oids, Timeout,
- ExtraInfo}).
+ SendOpts = [{context, CtxName}, {timeout, Timeout}, {extra, ExtraInfo}],
+ sync_get_next2(UserId, TargetName, Oids, SendOpts).
+%% <BACKWARD-COMPAT>
+
+
%% -- [async] get-next --
+%% async_get_next2(UserId, TargetName, Oids) ->
+%% async_get_next2(UserId, TargetName, Oids, []).
+async_get_next2(UserId, TargetName, Oids, SendOpts) ->
+ call({async_get_next, self(), UserId, TargetName, Oids, SendOpts}).
+
+
async_get_next(UserId, TargetName, CtxName, Oids) ->
async_get_next(UserId, TargetName, CtxName, Oids,
- ?DEFAULT_ASYNC_EXPIRE, ?EXTRA_INFO).
+ ?DEFAULT_ASYNC_GET_NEXT_TIMEOUT, ?DEFAULT_EXTRA_INFO).
async_get_next(UserId, TargetName, CtxName, Oids, Expire) ->
- async_get_next(UserId, TargetName, CtxName, Oids, Expire, ?EXTRA_INFO).
+ async_get_next(UserId, TargetName, CtxName, Oids, Expire,
+ ?DEFAULT_EXTRA_INFO).
async_get_next(UserId, TargetName, CtxName, Oids, Expire, ExtraInfo)
when (is_list(TargetName) andalso
is_list(CtxName) andalso
is_list(Oids) andalso
is_integer(Expire) andalso (Expire >= 0)) ->
- call({async_get_next, self(), UserId, TargetName, CtxName, Oids,
- Expire, ExtraInfo}).
+ SendOpts = [{context, CtxName}, {expire, Expire}, {extra, ExtraInfo}],
+ async_get_next2(UserId, TargetName, Oids, SendOpts).
+
+
%% -- [sync] get-bulk --
+%% sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids) ->
+%% sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, []).
+sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts) ->
+ %% p("sync_get_bulk2 -> entry with"
+ %% "~n UserId: ~p"
+ %% "~n TargetName: ~p"
+ %% "~n NonRep: ~p"
+ %% "~n MaxRep: ~p"
+ %% "~n Oids: ~p"
+ %% "~n SendOpts: ~p",
+ %% [UserId, TargetName, NonRep, MaxRep, Oids, SendOpts]),
+ call({sync_get_bulk, self(), UserId, TargetName,
+ NonRep, MaxRep, Oids, SendOpts}).
+
sync_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids) ->
sync_get_bulk(UserId, TargetName,
NonRep, MaxRep, CtxName, Oids,
- ?SYNC_GET_TIMEOUT, ?EXTRA_INFO).
+ ?DEFAULT_SYNC_GET_TIMEOUT, ?DEFAULT_EXTRA_INFO).
sync_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids, Timeout) ->
sync_get_bulk(UserId, TargetName,
NonRep, MaxRep, CtxName, Oids,
- Timeout, ?EXTRA_INFO).
+ Timeout, ?DEFAULT_EXTRA_INFO).
sync_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids, Timeout,
ExtraInfo)
@@ -277,20 +376,28 @@ sync_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids, Timeout,
is_list(CtxName) andalso
is_list(Oids) andalso
is_integer(Timeout) ->
- call({sync_get_bulk, self(), UserId, TargetName,
- NonRep, MaxRep, CtxName, Oids, Timeout, ExtraInfo}).
+ SendOpts = [{context, CtxName}, {timeout, Timeout}, {extra, ExtraInfo}],
+ sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts).
+
%% -- [async] get-bulk --
+%% async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids) ->
+%% async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, []).
+async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts) ->
+ call({async_get_bulk, self(), UserId, TargetName, NonRep, MaxRep,
+ Oids, SendOpts}).
+
+
async_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids) ->
async_get_bulk(UserId, TargetName,
NonRep, MaxRep, CtxName, Oids,
- ?DEFAULT_ASYNC_EXPIRE, ?EXTRA_INFO).
+ ?DEFAULT_ASYNC_GET_BULK_TIMEOUT, ?DEFAULT_EXTRA_INFO).
async_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids, Expire) ->
async_get_bulk(UserId, TargetName,
NonRep, MaxRep, CtxName, Oids,
- Expire, ?EXTRA_INFO).
+ Expire, ?DEFAULT_EXTRA_INFO).
async_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids, Expire,
ExtraInfo)
@@ -300,45 +407,61 @@ async_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids, Expire,
is_list(CtxName) andalso
is_list(Oids) andalso
is_integer(Expire) ->
- call({async_get_bulk, self(), UserId, TargetName,
- NonRep, MaxRep, CtxName, Oids, Expire, ExtraInfo}).
+ SendOpts = [{context, CtxName}, {expire, Expire}, {extra, ExtraInfo}],
+ async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts).
+
+
%% -- [sync] set --
%% VarsAndValues is: {PlainOid, o|s|i, Value} (unknown mibs) | {Oid, Value}
+%% sync_set2(UserId, TargetName, VarsAndVals) ->
+%% sync_set2(UserId, TargetName, VarsAndVals, []).
+sync_set2(UserId, TargetName, VarsAndVals, SendOpts) ->
+ call({sync_set, self(), UserId, TargetName, VarsAndVals, SendOpts}).
+
+
sync_set(UserId, TargetName, CtxName, VarsAndVals) ->
sync_set(UserId, TargetName, CtxName, VarsAndVals,
- ?SYNC_SET_TIMEOUT, ?EXTRA_INFO).
+ ?DEFAULT_SYNC_SET_TIMEOUT, ?DEFAULT_EXTRA_INFO).
sync_set(UserId, TargetName, CtxName, VarsAndVals, Timeout) ->
sync_set(UserId, TargetName, CtxName, VarsAndVals,
- Timeout, ?EXTRA_INFO).
+ Timeout, ?DEFAULT_EXTRA_INFO).
sync_set(UserId, TargetName, CtxName, VarsAndVals, Timeout, ExtraInfo)
when is_list(TargetName) andalso
is_list(CtxName) andalso
is_list(VarsAndVals) andalso
is_integer(Timeout) ->
- call({sync_set, self(), UserId, TargetName,
- CtxName, VarsAndVals, Timeout, ExtraInfo}).
+ SendOpts = [{context, CtxName}, {timeout, Timeout}, {extra, ExtraInfo}],
+ sync_set2(UserId, TargetName, VarsAndVals, SendOpts).
+
+
%% -- [async] set --
+%% async_set2(UserId, TargetName, VarsAndVals) ->
+%% async_set2(UserId, TargetName, VarsAndVals, []).
+async_set2(UserId, TargetName, VarsAndVals, SendOpts) ->
+ call({async_set, self(), UserId, TargetName, VarsAndVals, SendOpts}).
+
+
async_set(UserId, TargetName, CtxName, VarsAndVals) ->
async_set(UserId, TargetName, CtxName, VarsAndVals,
- ?DEFAULT_ASYNC_EXPIRE, ?EXTRA_INFO).
+ ?DEFAULT_ASYNC_SET_TIMEOUT, ?DEFAULT_EXTRA_INFO).
async_set(UserId, TargetName, CtxName, VarsAndVals, Expire) ->
async_set(UserId, TargetName, CtxName, VarsAndVals,
- Expire, ?EXTRA_INFO).
+ Expire, ?DEFAULT_EXTRA_INFO).
async_set(UserId, TargetName, CtxName, VarsAndVals, Expire, ExtraInfo)
when (is_list(TargetName) andalso
is_list(CtxName) andalso
is_list(VarsAndVals) andalso
is_integer(Expire) andalso (Expire >= 0)) ->
- call({async_set, self(), UserId, TargetName,
- CtxName, VarsAndVals, Expire, ExtraInfo}).
+ SendOpts = [{context, CtxName}, {expire, Expire}, {extra, ExtraInfo}],
+ async_set2(UserId, TargetName, VarsAndVals, SendOpts).
cancel_async_request(UserId, ReqId) ->
@@ -571,9 +694,26 @@ handle_call({unregister_user, UserId}, _From, State) ->
%% We will reply to this request later, when the reply comes in from the
%% agent, or when the timeout hits (unless we get an error now).
-handle_call({sync_get, Pid, UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo},
+handle_call({sync_get, Pid, UserId, TargetName, Oids, SendOpts},
From, State) ->
- ?vlog("received sync_get [~p] request", [CtxName]),
+ ?vlog("[~p,~p] received sync_get request for: "
+ "~n ~p", [UserId, TargetName, Oids]),
+ case (catch handle_sync_get(Pid,
+ UserId, TargetName, Oids, SendOpts,
+ From, State)) of
+ ok ->
+ {noreply, State};
+ Error ->
+ {reply, Error, State}
+ end;
+
+%% <BACKWARD-COMPAT>
+%% The only case where this would be called is during code upgrade
+handle_call({sync_get,
+ Pid, UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo},
+ From, State) ->
+ ?vlog("[~p,~p,~p] received sync_get request for: "
+ "~n ~p", [UserId, TargetName, CtxName, Oids]),
case (catch handle_sync_get(Pid,
UserId, TargetName, CtxName, Oids,
Timeout, ExtraInfo, From, State)) of
@@ -582,10 +722,30 @@ handle_call({sync_get, Pid, UserId, TargetName, CtxName, Oids, Timeout, ExtraInf
Error ->
{reply, Error, State}
end;
+%% </BACKWARD-COMPAT>
-handle_call({sync_get_next, Pid, UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo}, From, State) ->
- ?vlog("received sync_get_next [~p] request", [CtxName]),
+handle_call({sync_get_next, Pid, UserId, TargetName, Oids, SendOpts},
+ From, State) ->
+ ?vlog("[~p,~p] received sync_get_next request for: "
+ "~n ~p", [UserId, TargetName, SendOpts]),
+ case (catch handle_sync_get_next(Pid,
+ UserId, TargetName, Oids, SendOpts,
+ From, State)) of
+ ok ->
+ {noreply, State};
+ Error ->
+ {reply, Error, State}
+ end;
+
+
+%% <BACKWARD-COMPAT>
+%% The only case where this would be called is during code upgrade
+handle_call({sync_get_next,
+ Pid, UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo},
+ From, State) ->
+ ?vlog("[~p,~p,~p] received sync_get_next request for"
+ "~n ~p", [UserId, TargetName, CtxName, Oids]),
case (catch handle_sync_get_next(Pid,
UserId, TargetName, CtxName, Oids,
Timeout, ExtraInfo, From, State)) of
@@ -594,13 +754,31 @@ handle_call({sync_get_next, Pid, UserId, TargetName, CtxName, Oids, Timeout, Ext
Error ->
{reply, Error, State}
end;
+%% </BACKWARD-COMPAT>
%% Check agent version? This op not in v1
+handle_call({sync_get_bulk,
+ Pid, UserId, TargetName, NonRep, MaxRep, Oids, SendOpts},
+ From, State) ->
+ ?vlog("[~p,~p] received sync_get_bulk request for: "
+ "~n ~p", [UserId, TargetName, Oids]),
+ case (catch handle_sync_get_bulk(Pid,
+ UserId, TargetName, NonRep, MaxRep, Oids,
+ SendOpts, From, State)) of
+ ok ->
+ {noreply, State};
+ Error ->
+ {reply, Error, State}
+ end;
+
+%% <BACKWARD-COMPAT>
+%% The only case where this would be called is during code upgrade
handle_call({sync_get_bulk, Pid, UserId, TargetName,
NonRep, MaxRep, CtxName, Oids, Timeout, ExtraInfo},
From, State) ->
- ?vlog("received sync_get_bulk [~p] request", [CtxName]),
+ ?vlog("[~p,~p] received sync_get_bulk request for: ~p"
+ "~n ~p", [UserId, TargetName, CtxName, Oids]),
case (catch handle_sync_get_bulk(Pid,
UserId, TargetName, CtxName,
NonRep, MaxRep, Oids,
@@ -610,12 +788,31 @@ handle_call({sync_get_bulk, Pid, UserId, TargetName,
Error ->
{reply, Error, State}
end;
+%% </BACKWARD-COMPAT>
+
+
+handle_call({sync_set,
+ Pid, UserId, TargetName, VarsAndVals, SendOpts},
+ From, State) ->
+ ?vlog("[~p,~p] received sync_set request for: "
+ "~n ~p", [UserId, TargetName, VarsAndVals]),
+ case (catch handle_sync_set(Pid,
+ UserId, TargetName, VarsAndVals, SendOpts,
+ From, State)) of
+ ok ->
+ {noreply, State};
+ Error ->
+ {reply, Error, State}
+ end;
+%% <BACKWARD-COMPAT>
+%% The only case where this would be called is during code upgrade
handle_call({sync_set, Pid, UserId, TargetName,
CtxName, VarsAndVals, Timeout, ExtraInfo},
From, State) ->
- ?vlog("received sync_set [~p] request", [CtxName]),
+ ?vlog("[~p,~p,~p] received sync_set request for: "
+ "~n ~p", [UserId, TargetName, CtxName, VarsAndVals]),
case (catch handle_sync_set(Pid,
UserId, TargetName, CtxName, VarsAndVals,
Timeout, ExtraInfo, From, State)) of
@@ -624,45 +821,105 @@ handle_call({sync_set, Pid, UserId, TargetName,
Error ->
{reply, Error, State}
end;
+%% </BACKWARD-COMPAT>
+handle_call({async_get, Pid, UserId, TargetName, Oids, SendOpts},
+ _From, State) ->
+ ?vlog("[~p,~p] received async_get request for: "
+ "~n ~p", [UserId, TargetName, Oids]),
+ Reply = (catch handle_async_get(Pid,
+ UserId, TargetName, Oids, SendOpts,
+ State)),
+ {reply, Reply, State};
+
+
+%% <BACKWARD-COMPAT>
+%% The only case where this would be called is during code upgrade
handle_call({async_get, Pid, UserId, TargetName,
CtxName, Oids, Expire, ExtraInfo},
_From, State) ->
- ?vlog("received async_get [~p] request", [CtxName]),
+ ?vlog("[~p,~p,~p] received async_get request for: "
+ "~n ~p", [UserId, TargetName, CtxName, Oids]),
Reply = (catch handle_async_get(Pid, UserId, TargetName, CtxName, Oids,
Expire, ExtraInfo, State)),
{reply, Reply, State};
+%% </BACKWARD-COMPAT>
+handle_call({async_get_next, Pid, UserId, TargetName, Oids, SendOpts},
+ _From, State) ->
+ ?vlog("[~p,~p] received async_get_next request for: "
+ "~n ~p", [UserId, TargetName, Oids]),
+ Reply = (catch handle_async_get_next(Pid,
+ UserId, TargetName, Oids, SendOpts,
+ State)),
+ {reply, Reply, State};
+
+
+%% <BACKWARD-COMPAT>
+%% The only case where this would be called is during code upgrade
handle_call({async_get_next, Pid, UserId, TargetName,
CtxName, Oids, Expire, ExtraInfo},
_From, State) ->
- ?vlog("received async_get_next [~p] request", [CtxName]),
+ ?vlog("[~p,~p,~p] received async_get_next request for: ",
+ [UserId, TargetName, CtxName, Oids]),
Reply = (catch handle_async_get_next(Pid, UserId, TargetName, CtxName,
Oids, Expire, ExtraInfo, State)),
{reply, Reply, State};
+%% </BACKWARD-COMPAT>
%% Check agent version? This op not in v1
+handle_call({async_get_bulk,
+ Pid, UserId, TargetName, NonRep, MaxRep, Oids, SendOpts},
+ _From, State) ->
+ ?vlog("[~p,~p] received async_get_bulk request for: "
+ "~n ~p", [UserId, TargetName, Oids]),
+ Reply = (catch handle_async_get_bulk(Pid,
+ UserId, TargetName,
+ NonRep, MaxRep, Oids, SendOpts,
+ State)),
+ {reply, Reply, State};
+
+
+%% <BACKWARD-COMPAT>
+%% The only case where this would be called is during code upgrade
handle_call({async_get_bulk, Pid, UserId, TargetName,
NonRep, MaxRep, CtxName, Oids, Expire, ExtraInfo},
_From, State) ->
- ?vlog("received async_get_bulk [~p] request", [CtxName]),
+ ?vlog("[~p,~p,~p] received async_get_bulk request for: "
+ "~n ~p", [UserId, TargetName, CtxName, Oids]),
Reply = (catch handle_async_get_bulk(Pid,
UserId, TargetName, CtxName,
NonRep, MaxRep, Oids,
Expire, ExtraInfo, State)),
{reply, Reply, State};
+%% </BACKWARD-COMPAT>
+handle_call({async_set,
+ Pid, UserId, TargetName, VarsAndVals, SendOpts},
+ _From, State) ->
+ ?vlog("[~p,~p] received async_set request for: "
+ "~n ~p", [UserId, TargetName, VarsAndVals]),
+ Reply = (catch handle_async_set(Pid,
+ UserId, TargetName, VarsAndVals, SendOpts,
+ State)),
+ {reply, Reply, State};
+
+
+%% <BACKWARD-COMPAT>
+%% The only case where this would be called is during code upgrade
handle_call({async_set, Pid, UserId, TargetName,
CtxName, VarsAndVals, Expire, ExtraInfo},
_From, State) ->
- ?vlog("received async_set [~p] request", [CtxName]),
+ ?vlog("[~p,~p,~p] received async_set request for: "
+ "~n ~p", [UserId, TargetName, CtxName, VarsAndVals]),
Reply = (catch handle_async_set(Pid, UserId, TargetName, CtxName,
VarsAndVals, Expire, ExtraInfo, State)),
{reply, Reply, State};
+%% </BACKWARD-COMPAT>
handle_call({cancel_async_request, UserId, ReqId}, _From, State) ->
@@ -901,36 +1158,48 @@ terminate(Reason, #state{gct = GCT}) ->
handle_sync_get(Pid, UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo,
From, State) ->
+ SendOpts =
+ [
+ {context, CtxName},
+ {timeout, Timeout},
+ {extra, ExtraInfo}
+ ],
+ handle_sync_get(Pid, UserId, TargetName, Oids, SendOpts, From, State).
+
+handle_sync_get(Pid, UserId, TargetName, Oids, SendOpts, From, State) ->
?vtrace("handle_sync_get -> entry with"
"~n Pid: ~p"
"~n UserId: ~p"
"~n TargetName: ~p"
- "~n CtxName: ~p"
"~n Oids: ~p"
- "~n Timeout: ~p"
+ "~n SendOpts: ~p"
"~n From: ~p",
- [Pid, UserId, TargetName, CtxName, Oids, Timeout, From]),
- case agent_data(TargetName, CtxName) of
- {ok, RegType, Addr, Port, Vsn, MsgData} ->
+ [Pid, UserId, TargetName, Oids, SendOpts, From]),
+ case agent_data(TargetName, SendOpts) of
+ {ok, RegType, Domain, Addr, Port, Vsn, MsgData} ->
?vtrace("handle_sync_get -> send a ~p message", [Vsn]),
- ReqId = send_get_request(Oids, Vsn, MsgData, Addr, Port,
- ExtraInfo, State),
+ Extra = ?GET_EXTRA(SendOpts),
+ ReqId = send_get_request(Oids, Vsn, MsgData,
+ Domain, Addr, Port,
+ Extra, State),
?vdebug("handle_sync_get -> ReqId: ~p", [ReqId]),
- Msg = {sync_timeout, ReqId, From},
- Ref = erlang:send_after(Timeout, self(), Msg),
- MonRef = erlang:monitor(process, Pid),
+ Msg = {sync_timeout, ReqId, From},
+ Timeout = ?SYNC_GET_TIMEOUT(SendOpts),
+ Ref = erlang:send_after(Timeout, self(), Msg),
+ MonRef = erlang:monitor(process, Pid),
?vtrace("handle_sync_get -> MonRef: ~p", [MonRef]),
- Req = #request{id = ReqId,
- user_id = UserId,
- reg_type = RegType,
- target = TargetName,
- addr = Addr,
- port = Port,
- type = get,
- data = MsgData,
- ref = Ref,
- mon = MonRef,
- from = From},
+ Req = #request{id = ReqId,
+ user_id = UserId,
+ reg_type = RegType,
+ target = TargetName,
+ domain = Domain,
+ addr = Addr,
+ port = Port,
+ type = get,
+ data = MsgData,
+ ref = Ref,
+ mon = MonRef,
+ from = From},
ets:insert(snmpm_request_table, Req),
ok;
Error ->
@@ -940,39 +1209,51 @@ handle_sync_get(Pid, UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo,
Error
end.
-
handle_sync_get_next(Pid, UserId, TargetName, CtxName, Oids, Timeout,
ExtraInfo, From, State) ->
+ SendOpts =
+ [
+ {context, CtxName},
+ {timeout, Timeout},
+ {extra, ExtraInfo}
+ ],
+ handle_sync_get_next(Pid, UserId, TargetName, Oids, SendOpts, From, State).
+
+handle_sync_get_next(Pid, UserId, TargetName, Oids, SendOpts,
+ From, State) ->
?vtrace("handle_sync_get_next -> entry with"
"~n Pid: ~p"
"~n UserId: ~p"
"~n TargetName: ~p"
- "~n CtxName: ~p"
"~n Oids: ~p"
- "~n Timeout: ~p"
+ "~n SendOpts: ~p"
"~n From: ~p",
- [Pid, UserId, TargetName, CtxName, Oids, Timeout, From]),
- case agent_data(TargetName, CtxName) of
- {ok, RegType, Addr, Port, Vsn, MsgData} ->
+ [Pid, UserId, TargetName, Oids, SendOpts, From]),
+ case agent_data(TargetName, SendOpts) of
+ {ok, RegType, Domain, Addr, Port, Vsn, MsgData} ->
?vtrace("handle_sync_get_next -> send a ~p message", [Vsn]),
- ReqId = send_get_next_request(Oids, Vsn, MsgData,
- Addr, Port, ExtraInfo, State),
+ Extra = ?GET_EXTRA(SendOpts),
+ ReqId = send_get_next_request(Oids, Vsn, MsgData,
+ Domain, Addr, Port,
+ Extra, State),
?vdebug("handle_sync_get_next -> ReqId: ~p", [ReqId]),
- Msg = {sync_timeout, ReqId, From},
- Ref = erlang:send_after(Timeout, self(), Msg),
- MonRef = erlang:monitor(process, Pid),
+ Msg = {sync_timeout, ReqId, From},
+ Timeout = ?SYNC_GET_NEXT_TIMEOUT(SendOpts),
+ Ref = erlang:send_after(Timeout, self(), Msg),
+ MonRef = erlang:monitor(process, Pid),
?vtrace("handle_sync_get_next -> MonRef: ~p", [MonRef]),
- Req = #request{id = ReqId,
- user_id = UserId,
- reg_type = RegType,
- target = TargetName,
- addr = Addr,
- port = Port,
- type = get_next,
- data = MsgData,
- ref = Ref,
- mon = MonRef,
- from = From},
+ Req = #request{id = ReqId,
+ user_id = UserId,
+ reg_type = RegType,
+ target = TargetName,
+ domain = Domain,
+ addr = Addr,
+ port = Port,
+ type = get_next,
+ data = MsgData,
+ ref = Ref,
+ mon = MonRef,
+ from = From},
ets:insert(snmpm_request_table, Req),
ok;
@@ -987,39 +1268,52 @@ handle_sync_get_next(Pid, UserId, TargetName, CtxName, Oids, Timeout,
handle_sync_get_bulk(Pid, UserId, TargetName, CtxName,
NonRep, MaxRep, Oids, Timeout,
ExtraInfo, From, State) ->
+ SendOpts =
+ [
+ {context, CtxName},
+ {timeout, Timeout},
+ {extra, ExtraInfo}
+ ],
+ handle_sync_get_bulk(Pid, UserId, TargetName, NonRep, MaxRep, Oids,
+ SendOpts, From, State).
+
+handle_sync_get_bulk(Pid, UserId, TargetName, NonRep, MaxRep, Oids, SendOpts,
+ From, State) ->
?vtrace("handle_sync_get_bulk -> entry with"
"~n Pid: ~p"
"~n UserId: ~p"
"~n TargetName: ~p"
- "~n CtxName: ~p"
"~n NonRep: ~p"
"~n MaxRep: ~p"
"~n Oids: ~p"
- "~n Timeout: ~p"
+ "~n SendOpts: ~p"
"~n From: ~p",
- [Pid, UserId, TargetName, CtxName, NonRep, MaxRep, Oids,
- Timeout, From]),
- case agent_data(TargetName, CtxName) of
- {ok, RegType, Addr, Port, Vsn, MsgData} ->
+ [Pid, UserId, TargetName, NonRep, MaxRep, Oids, SendOpts, From]),
+ case agent_data(TargetName, SendOpts) of
+ {ok, RegType, Domain, Addr, Port, Vsn, MsgData} ->
?vtrace("handle_sync_get_bulk -> send a ~p message", [Vsn]),
- ReqId = send_get_bulk_request(Oids, Vsn, MsgData, Addr, Port,
- NonRep, MaxRep, ExtraInfo, State),
+ Extra = ?GET_EXTRA(SendOpts),
+ ReqId = send_get_bulk_request(Oids, Vsn, MsgData,
+ Domain, Addr, Port,
+ NonRep, MaxRep, Extra, State),
?vdebug("handle_sync_get_bulk -> ReqId: ~p", [ReqId]),
- Msg = {sync_timeout, ReqId, From},
- Ref = erlang:send_after(Timeout, self(), Msg),
- MonRef = erlang:monitor(process, Pid),
+ Msg = {sync_timeout, ReqId, From},
+ Timeout = ?SYNC_GET_BULK_TIMEOUT(SendOpts),
+ Ref = erlang:send_after(Timeout, self(), Msg),
+ MonRef = erlang:monitor(process, Pid),
?vtrace("handle_sync_get_bulk -> MonRef: ~p", [MonRef]),
- Req = #request{id = ReqId,
- user_id = UserId,
- reg_type = RegType,
- target = TargetName,
- addr = Addr,
- port = Port,
- type = get_bulk,
- data = MsgData,
- ref = Ref,
- mon = MonRef,
- from = From},
+ Req = #request{id = ReqId,
+ user_id = UserId,
+ reg_type = RegType,
+ target = TargetName,
+ domain = Domain,
+ addr = Addr,
+ port = Port,
+ type = get_bulk,
+ data = MsgData,
+ ref = Ref,
+ mon = MonRef,
+ from = From},
ets:insert(snmpm_request_table, Req),
ok;
@@ -1033,36 +1327,49 @@ handle_sync_get_bulk(Pid, UserId, TargetName, CtxName,
handle_sync_set(Pid, UserId, TargetName, CtxName, VarsAndVals, Timeout,
ExtraInfo, From, State) ->
+ SendOpts =
+ [
+ {context, CtxName},
+ {timeout, Timeout},
+ {extra, ExtraInfo}
+ ],
+ handle_sync_set(Pid, UserId, TargetName, VarsAndVals, SendOpts,
+ From, State).
+
+handle_sync_set(Pid, UserId, TargetName, VarsAndVals, SendOpts, From, State) ->
?vtrace("handle_sync_set -> entry with"
"~n Pid: ~p"
"~n UserId: ~p"
"~n TargetName: ~p"
- "~n CtxName: ~p"
"~n VarsAndVals: ~p"
- "~n Timeout: ~p"
+ "~n SendOpts: ~p"
"~n From: ~p",
- [Pid, UserId, TargetName, CtxName, VarsAndVals, Timeout, From]),
- case agent_data(TargetName, CtxName) of
- {ok, RegType, Addr, Port, Vsn, MsgData} ->
+ [Pid, UserId, TargetName, VarsAndVals, From]),
+ case agent_data(TargetName, SendOpts) of
+ {ok, RegType, Domain, Addr, Port, Vsn, MsgData} ->
?vtrace("handle_sync_set -> send a ~p message", [Vsn]),
- ReqId = send_set_request(VarsAndVals, Vsn, MsgData,
- Addr, Port, ExtraInfo, State),
+ Extra = ?GET_EXTRA(SendOpts),
+ ReqId = send_set_request(VarsAndVals, Vsn, MsgData,
+ Domain, Addr, Port,
+ Extra, State),
?vdebug("handle_sync_set -> ReqId: ~p", [ReqId]),
- Msg = {sync_timeout, ReqId, From},
- Ref = erlang:send_after(Timeout, self(), Msg),
- MonRef = erlang:monitor(process, Pid),
+ Msg = {sync_timeout, ReqId, From},
+ Timeout = ?SYNC_SET_TIMEOUT(SendOpts),
+ Ref = erlang:send_after(Timeout, self(), Msg),
+ MonRef = erlang:monitor(process, Pid),
?vtrace("handle_sync_set -> MonRef: ~p", [MonRef]),
- Req = #request{id = ReqId,
- user_id = UserId,
- reg_type = RegType,
- target = TargetName,
- addr = Addr,
- port = Port,
- type = set,
- data = MsgData,
- ref = Ref,
- mon = MonRef,
- from = From},
+ Req = #request{id = ReqId,
+ user_id = UserId,
+ reg_type = RegType,
+ target = TargetName,
+ domain = Domain,
+ addr = Addr,
+ port = Port,
+ type = set,
+ data = MsgData,
+ ref = Ref,
+ mon = MonRef,
+ from = From},
ets:insert(snmpm_request_table, Req),
ok;
@@ -1076,24 +1383,36 @@ handle_sync_set(Pid, UserId, TargetName, CtxName, VarsAndVals, Timeout,
handle_async_get(Pid, UserId, TargetName, CtxName, Oids, Expire, ExtraInfo,
State) ->
+ SendOpts =
+ [
+ {context, CtxName},
+ {timeout, Expire},
+ {extra, ExtraInfo}
+ ],
+ handle_async_get(Pid, UserId, TargetName, Oids, SendOpts, State).
+
+handle_async_get(Pid, UserId, TargetName, Oids, SendOpts, State) ->
?vtrace("handle_async_get -> entry with"
"~n Pid: ~p"
"~n UserId: ~p"
"~n TargetName: ~p"
- "~n CtxName: ~p"
"~n Oids: ~p"
- "~n Expire: ~p",
- [Pid, UserId, TargetName, CtxName, Oids, Expire]),
- case agent_data(TargetName, CtxName) of
- {ok, RegType, Addr, Port, Vsn, MsgData} ->
+ "~n SendOpts: ~p",
+ [Pid, UserId, TargetName, Oids, SendOpts]),
+ case agent_data(TargetName, SendOpts) of
+ {ok, RegType, Domain, Addr, Port, Vsn, MsgData} ->
?vtrace("handle_async_get -> send a ~p message", [Vsn]),
- ReqId = send_get_request(Oids, Vsn, MsgData, Addr, Port,
- ExtraInfo, State),
+ Extra = ?GET_EXTRA(SendOpts),
+ ReqId = send_get_request(Oids, Vsn, MsgData,
+ Domain, Addr, Port,
+ Extra, State),
?vdebug("handle_async_get -> ReqId: ~p", [ReqId]),
+ Expire = ?ASYNC_GET_TIMEOUT(SendOpts),
Req = #request{id = ReqId,
user_id = UserId,
reg_type = RegType,
target = TargetName,
+ domain = Domain,
addr = Addr,
port = Port,
type = get,
@@ -1114,24 +1433,36 @@ handle_async_get(Pid, UserId, TargetName, CtxName, Oids, Expire, ExtraInfo,
handle_async_get_next(Pid, UserId, TargetName, CtxName, Oids, Expire,
ExtraInfo, State) ->
+ SendOpts =
+ [
+ {context, CtxName},
+ {timeout, Expire},
+ {extra, ExtraInfo}
+ ],
+ handle_async_get_next(Pid, UserId, TargetName, Oids, SendOpts, State).
+
+handle_async_get_next(Pid, UserId, TargetName, Oids, SendOpts, State) ->
?vtrace("handle_async_get_next -> entry with"
"~n Pid: ~p"
"~n UserId: ~p"
"~n TargetName: ~p"
- "~n CtxName: ~p"
"~n Oids: ~p"
- "~n Expire: ~p",
- [Pid, UserId, TargetName, CtxName, Oids, Expire]),
- case agent_data(TargetName, CtxName) of
- {ok, RegType, Addr, Port, Vsn, MsgData} ->
+ "~n SendOpts: ~p",
+ [Pid, UserId, TargetName, Oids, SendOpts]),
+ case agent_data(TargetName, SendOpts) of
+ {ok, RegType, Domain, Addr, Port, Vsn, MsgData} ->
?vtrace("handle_async_get_next -> send a ~p message", [Vsn]),
+ Extra = ?GET_EXTRA(SendOpts),
ReqId = send_get_next_request(Oids, Vsn, MsgData,
- Addr, Port, ExtraInfo, State),
+ Domain, Addr, Port,
+ Extra, State),
?vdebug("handle_async_get_next -> ReqId: ~p", [ReqId]),
+ Expire = ?ASYNC_GET_NEXT_TIMEOUT(SendOpts),
Req = #request{id = ReqId,
user_id = UserId,
reg_type = RegType,
target = TargetName,
+ domain = Domain,
addr = Addr,
port = Port,
type = get_next,
@@ -1153,26 +1484,42 @@ handle_async_get_next(Pid, UserId, TargetName, CtxName, Oids, Expire,
handle_async_get_bulk(Pid, UserId, TargetName, CtxName,
NonRep, MaxRep, Oids, Expire,
ExtraInfo, State) ->
+ SendOpts =
+ [
+ {context, CtxName},
+ {timeout, Expire},
+ {extra, ExtraInfo}
+ ],
+ handle_async_get_bulk(Pid,
+ UserId, TargetName, NonRep, MaxRep, Oids, SendOpts,
+ State).
+
+handle_async_get_bulk(Pid,
+ UserId, TargetName, NonRep, MaxRep, Oids, SendOpts,
+ State) ->
?vtrace("handle_async_get_bulk -> entry with"
"~n Pid: ~p"
"~n UserId: ~p"
"~n TargetName: ~p"
- "~n CtxName: ~p"
"~n NonRep: ~p"
"~n MaxRep: ~p"
"~n Oids: ~p"
- "~n Expire: ~p",
- [Pid, UserId, TargetName, CtxName, NonRep, MaxRep, Oids, Expire]),
- case agent_data(TargetName, CtxName) of
- {ok, RegType, Addr, Port, Vsn, MsgData} ->
+ "~n SendOpts: ~p",
+ [Pid, UserId, TargetName, NonRep, MaxRep, Oids, SendOpts]),
+ case agent_data(TargetName, SendOpts) of
+ {ok, RegType, Domain, Addr, Port, Vsn, MsgData} ->
?vtrace("handle_async_get_bulk -> send a ~p message", [Vsn]),
- ReqId = send_get_bulk_request(Oids, Vsn, MsgData, Addr, Port,
- NonRep, MaxRep, ExtraInfo, State),
+ Extra = ?GET_EXTRA(SendOpts),
+ ReqId = send_get_bulk_request(Oids, Vsn, MsgData,
+ Domain, Addr, Port,
+ NonRep, MaxRep, Extra, State),
?vdebug("handle_async_get_bulk -> ReqId: ~p", [ReqId]),
+ Expire = ?ASYNC_GET_BULK_TIMEOUT(SendOpts),
Req = #request{id = ReqId,
user_id = UserId,
reg_type = RegType,
target = TargetName,
+ domain = Domain,
addr = Addr,
port = Port,
type = get_bulk,
@@ -1192,24 +1539,36 @@ handle_async_get_bulk(Pid, UserId, TargetName, CtxName,
handle_async_set(Pid, UserId, TargetName, CtxName, VarsAndVals, Expire,
ExtraInfo, State) ->
+ SendOpts =
+ [
+ {context, CtxName},
+ {timeout, Expire},
+ {extra, ExtraInfo}
+ ],
+ handle_async_set(Pid, UserId, TargetName, VarsAndVals, SendOpts, State).
+
+handle_async_set(Pid, UserId, TargetName, VarsAndVals, SendOpts, State) ->
?vtrace("handle_async_set -> entry with"
"~n Pid: ~p"
"~n UserId: ~p"
"~n TargetName: ~p"
- "~n CtxName: ~p"
"~n VarsAndVals: ~p"
- "~n Expire: ~p",
- [Pid, UserId, TargetName, CtxName, VarsAndVals, Expire]),
- case agent_data(TargetName, CtxName) of
- {ok, RegType, Addr, Port, Vsn, MsgData} ->
+ "~n SendOpts: ~p",
+ [Pid, UserId, TargetName, VarsAndVals, SendOpts]),
+ case agent_data(TargetName, SendOpts) of
+ {ok, RegType, Domain, Addr, Port, Vsn, MsgData} ->
?vtrace("handle_async_set -> send a ~p message", [Vsn]),
+ Extra = ?GET_EXTRA(SendOpts),
ReqId = send_set_request(VarsAndVals, Vsn, MsgData,
- Addr, Port, ExtraInfo, State),
+ Domain, Addr, Port,
+ Extra, State),
?vdebug("handle_async_set -> ReqId: ~p", [ReqId]),
+ Expire = ?ASYNC_SET_TIMEOUT(SendOpts),
Req = #request{id = ReqId,
user_id = UserId,
reg_type = RegType,
target = TargetName,
+ domain = Domain,
addr = Addr,
port = Port,
type = set,
@@ -2565,7 +2924,7 @@ do_gc(Key, Now) ->
%%
%%----------------------------------------------------------------------
-send_get_request(Oids, Vsn, MsgData, Addr, Port, ExtraInfo,
+send_get_request(Oids, Vsn, MsgData, Domain, Addr, Port, ExtraInfo,
#state{net_if = NetIf,
net_if_mod = Mod,
mini_mib = MiniMIB}) ->
@@ -2576,34 +2935,39 @@ send_get_request(Oids, Vsn, MsgData, Addr, Port, ExtraInfo,
"~n Pdu: ~p"
"~n Vsn: ~p"
"~n MsgData: ~p"
+ "~n Domain: ~p"
"~n Addr: ~p"
- "~n Port: ~p", [Mod, NetIf, Pdu, Vsn, MsgData, Addr, Port]),
- (catch Mod:send_pdu(NetIf, Pdu, Vsn, MsgData, Addr, Port, ExtraInfo)),
+ "~n Port: ~p",
+ [Mod, NetIf, Pdu, Vsn, MsgData, Domain, Addr, Port]),
+ Res = (catch Mod:send_pdu(NetIf, Pdu, Vsn, MsgData,
+ Domain, Addr, Port, ExtraInfo)),
+ ?vtrace("send_get_request -> send result:"
+ "~n ~p", [Res]),
Pdu#pdu.request_id.
-send_get_next_request(Oids, Vsn, MsgData, Addr, Port, ExtraInfo,
+send_get_next_request(Oids, Vsn, MsgData, Domain, Addr, Port, ExtraInfo,
#state{mini_mib = MiniMIB,
net_if = NetIf,
net_if_mod = Mod}) ->
Pdu = make_pdu(get_next, Oids, MiniMIB),
- Mod:send_pdu(NetIf, Pdu, Vsn, MsgData, Addr, Port, ExtraInfo),
+ Mod:send_pdu(NetIf, Pdu, Vsn, MsgData, Domain, Addr, Port, ExtraInfo),
Pdu#pdu.request_id.
-send_get_bulk_request(Oids, Vsn, MsgData, Addr, Port,
+send_get_bulk_request(Oids, Vsn, MsgData, Domain, Addr, Port,
NonRep, MaxRep, ExtraInfo,
#state{mini_mib = MiniMIB,
net_if = NetIf,
net_if_mod = Mod}) ->
Pdu = make_pdu(bulk, {NonRep, MaxRep, Oids}, MiniMIB),
- Mod:send_pdu(NetIf, Pdu, Vsn, MsgData, Addr, Port, ExtraInfo),
+ Mod:send_pdu(NetIf, Pdu, Vsn, MsgData, Domain, Addr, Port, ExtraInfo),
Pdu#pdu.request_id.
-send_set_request(VarsAndVals, Vsn, MsgData, Addr, Port, ExtraInfo,
+send_set_request(VarsAndVals, Vsn, MsgData, Domain, Addr, Port, ExtraInfo,
#state{mini_mib = MiniMIB,
net_if = NetIf,
net_if_mod = Mod}) ->
Pdu = make_pdu(set, VarsAndVals, MiniMIB),
- Mod:send_pdu(NetIf, Pdu, Vsn, MsgData, Addr, Port, ExtraInfo),
+ Mod:send_pdu(NetIf, Pdu, Vsn, MsgData, Domain, Addr, Port, ExtraInfo),
Pdu#pdu.request_id.
%% send_discovery(Vsn, MsgData, Addr, Port, ExtraInfo,
@@ -2798,10 +3162,7 @@ request_id() ->
%%----------------------------------------------------------------------
-agent_data(TargetName, CtxName) ->
- agent_data(TargetName, CtxName, []).
-
-agent_data(TargetName, CtxName, Config) ->
+agent_data(TargetName, SendOpts) ->
case snmpm_config:agent_info(TargetName, all) of
{ok, Info} ->
Version = agent_data_item(version, Info),
@@ -2813,15 +3174,18 @@ agent_data(TargetName, CtxName, Config) ->
DefSecLevel = agent_data_item(sec_level, Info),
EngineId = agent_data_item(engine_id, Info),
+ CtxName = agent_data_item(context,
+ SendOpts,
+ ?DEFAULT_CONTEXT),
SecModel = agent_data_item(sec_model,
- Config,
+ SendOpts,
DefSecModel),
SecName = agent_data_item(sec_name,
- Config,
+ SendOpts,
DefSecName),
SecLevel = agent_data_item(sec_level,
- Config,
+ SendOpts,
DefSecLevel),
{SecModel, SecName, mk_sec_level_flag(SecLevel),
@@ -2831,18 +3195,19 @@ agent_data(TargetName, CtxName, Config) ->
DefSecModel = agent_data_item(sec_model, Info),
Comm = agent_data_item(community,
- Config,
+ SendOpts,
DefComm),
SecModel = agent_data_item(sec_model,
- Config,
+ SendOpts,
DefSecModel),
{Comm, SecModel}
end,
+ Domain = agent_data_item(tdomain, Info),
Addr = agent_data_item(address, Info),
Port = agent_data_item(port, Info),
RegType = agent_data_item(reg_type, Info),
- {ok, RegType, Addr, Port, version(Version), MsgData};
+ {ok, RegType, Domain, Addr, Port, version(Version), MsgData};
Error ->
Error
end.
@@ -3003,6 +3368,12 @@ default_agent_config() ->
%%----------------------------------------------------------------------
+get_opt(Key, Default, Opts) ->
+ proplists:get_value(Key, Opts, Default).
+
+
+%%----------------------------------------------------------------------
+
is_started(#state{net_if = _Pid, net_if_mod = _Mod}) ->
%% Mod:is_started(Pid) and snmpm_config:is_started().
case snmpm_config:is_started() of
diff --git a/lib/snmp/src/manager/snmpm_usm.erl b/lib/snmp/src/manager/snmpm_usm.erl
index 449127844a..497d6d6102 100644
--- a/lib/snmp/src/manager/snmpm_usm.erl
+++ b/lib/snmp/src/manager/snmpm_usm.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -476,14 +476,19 @@ set_engine_latest_time(SnmpEngineID, EngineTime) ->
%%-----------------------------------------------------------------
%% Utility functions
%%-----------------------------------------------------------------
+-spec error(term()) -> no_return().
error(Reason) ->
throw({error, Reason}).
+-spec error(term(), term()) -> no_return().
error(Reason, ErrorInfo) ->
throw({error, Reason, ErrorInfo}).
+-spec error(term(), term(), term()) -> no_return().
error(Variable, Oid, SecName) ->
error(Variable, Oid, SecName, []).
+
+-spec error(term(), term(), term(), [term()]) -> no_return().
error(Variable, Oid, SecName, Opts) ->
Val = inc(Variable),
ErrorInfo = {#varbind{oid = Oid,
diff --git a/lib/snmp/src/misc/snmp_conf.erl b/lib/snmp/src/misc/snmp_conf.erl
index 4d2f5d8f92..7249def24e 100644
--- a/lib/snmp/src/misc/snmp_conf.erl
+++ b/lib/snmp/src/misc/snmp_conf.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -37,7 +37,15 @@
check_timer/1,
- check_ip/1, check_taddress/1,
+ all_domains/0,
+ check_domain/1,
+ all_tdomains/0,
+ check_tdomain/1,
+ mk_tdomain/1,
+ which_domain/1,
+ check_ip/1, check_ip/2,
+ check_taddress/1, check_taddress/2,
+ mk_taddress/3,
check_packet_size/1,
@@ -52,8 +60,10 @@
-define(SNMP_USE_V3, true).
--include("snmp_types.hrl").
--include("SNMP-FRAMEWORK-MIB.hrl").
+-include_lib("snmp/include/snmp_types.hrl").
+-include_lib("snmp/include/SNMP-FRAMEWORK-MIB.hrl").
+-include_lib("snmp/include/TRANSPORT-ADDRESS-MIB.hrl").
+-include_lib("snmp/include/SNMPv2-TM.hrl").
-define(VMODULE,"CONF").
-include("snmp_verbosity.hrl").
@@ -337,16 +347,98 @@ check_sec_level(BadSecLevel) ->
%% ---------
+all_tdomains() ->
+ [
+ ?transportDomainUdpIpv4,
+ ?transportDomainUdpIpv6,
+ ?transportDomainUdpIpv4z,
+ ?transportDomainUdpIpv6z,
+ ?transportDomainTcpIpv4,
+ ?transportDomainTcpIpv6,
+ ?transportDomainTcpIpv4z,
+ ?transportDomainTcpIpv6z,
+ ?transportDomainSctpIpv4,
+ ?transportDomainSctpIpv6,
+ ?transportDomainSctpIpv4z,
+ ?transportDomainSctpIpv6z,
+ ?transportDomainLocal,
+ ?transportDomainUdpDns,
+ ?transportDomainTcpDns,
+ ?transportDomainSctpDns
+ ].
+
+check_tdomain(TDomain) ->
+ SupportedTDomains =
+ [
+ ?snmpUDPDomain,
+ ?transportDomainUdpIpv4,
+ ?transportDomainUdpIpv6
+ ],
+ AllTDomains = all_tdomains(),
+ case lists:member(TDomain, SupportedTDomains) of
+ true ->
+ ok;
+ false ->
+ case lists:member(TDomain, AllTDomains) of
+ true ->
+ error({unsupported_tdomain, TDomain});
+ false ->
+ error({unknown_tdomain, TDomain})
+ end
+ end.
+
+
+%% ---------
+
+mk_tdomain(snmpUDPDomain) ->
+ mk_tdomain(transportDomainUdpIpv4);
+mk_tdomain(transportDomainUdpIpv4) ->
+ ?transportDomainUdpIpv4;
+mk_tdomain(transportDomainUdpIpv6) ->
+ ?transportDomainUdpIpv6;
+mk_tdomain(BadDomain) ->
+ error({bad_domain, BadDomain}).
+
+
+%% ---------
+
+check_taddress(X) ->
+ check_taddress(snmpUDPDomain, X).
+
+check_taddress(?snmpUDPDomain, X) ->
+ check_taddress(transportDomainUdpIpv4, X);
+check_taddress(snmpUDPDomain, X) ->
+ check_taddress(transportDomainUdpIpv4, X);
-check_taddress(X) when is_list(X) andalso (length(X) =:= 6) ->
+check_taddress(?transportDomainUdpIpv4, X) ->
+ check_taddress(transportDomainUdpIpv4, X);
+check_taddress(transportDomainUdpIpv4, X)
+ when is_list(X) andalso (length(X) =:= 6) ->
case (catch all_integer(X)) of
true ->
ok;
false ->
error({invalid_taddress, X})
end;
-check_taddress(X) ->
- error({invalid_taddress, X}).
+check_taddress(transportDomainUdpIpv4, X) ->
+ error({invalid_taddress, X});
+
+check_taddress(?transportDomainUdpIpv6, X) ->
+ check_taddress(transportDomainUdpIpv6, X);
+check_taddress(transportDomainUdpIpv6, X)
+ when is_list(X) andalso (length(X) =:= 10) ->
+ case (catch all_integer(X)) of
+ true ->
+ ok;
+ false ->
+ error({invalid_taddress, X})
+ end;
+check_taddress(transportDomainUdpIpv6, X) ->
+ error({invalid_taddress, X});
+
+check_taddress(BadDomain, _X) ->
+ error({invalid_tdomain, BadDomain}).
+
%% ---------
@@ -385,15 +477,117 @@ do_check_timer(WaitFor, Factor, Incr, Retry) ->
%% ---------
-check_ip(X) when is_list(X) andalso (length(X) =:= 4) ->
+all_domains() ->
+ [
+ transportDomainUdpIpv4,
+ transportDomainUdpIpv6,
+ transportDomainUdpIpv4z,
+ transportDomainUdpIpv6z,
+ transportDomainTcpIpv4,
+ transportDomainTcpIpv6,
+ transportDomainTcpIpv4z,
+ transportDomainTcpIpv6z,
+ transportDomainSctpIpv4,
+ transportDomainSctpIpv6,
+ transportDomainSctpIpv4z,
+ transportDomainSctpIpv6z,
+ transportDomainLocal,
+ transportDomainUdpDns,
+ transportDomainTcpDns,
+ transportDomainSctpDns
+ ].
+
+check_domain(Domain) ->
+ SupportedDomains =
+ [
+ snmpUDPDomain,
+ transportDomainUdpIpv4,
+ transportDomainUdpIpv6
+ ],
+ AllDomains = all_domains(),
+ case lists:member(Domain, SupportedDomains) of
+ true ->
+ ok;
+ false ->
+ case lists:member(Domain, AllDomains) of
+ true ->
+ error({unsupported_domain, Domain});
+ false ->
+ error({unknown_domain, Domain})
+ end
+ end.
+
+
+%% ---------
+
+%% The values of Ip and Port has both been checked at this
+%% point, so we dont need to do that again.
+mk_taddress(snmpUDPDomain, Ip, Port) ->
+ mk_taddress(transportDomainUdpIpv4, Ip, Port);
+mk_taddress(transportDomainUdpIpv4, Ip, Port) when is_list(Ip) ->
+ Ip ++ [Port div 256, Port rem 256];
+mk_taddress(transportDomainUdpIpv4 = Domain, Ip, Port) when is_tuple(Ip) ->
+ mk_taddress(Domain, tuple_to_list(Ip), Port);
+mk_taddress(transportDomainUdpIpv6, Ip, Port) when is_list(Ip) ->
+ Ip ++ [Port div 256, Port rem 256];
+mk_taddress(transportDomainUdpIpv6 = Domain, Ip, Port) when is_tuple(Ip) ->
+ mk_taddress(Domain, tuple_to_list(Ip), Port);
+
+%% These are just for convenience
+mk_taddress(?snmpUDPDomain, Ip, Port) ->
+ mk_taddress(snmpUDPDomain, Ip, Port);
+mk_taddress(?transportDomainUdpIpv4, Ip, Port) ->
+ mk_taddress(transportDomainUdpIpv4, Ip, Port);
+mk_taddress(?transportDomainUdpIpv6, Ip, Port) ->
+ mk_taddress(transportDomainUdpIpv6, Ip, Port);
+
+%% Bad domain
+mk_taddress(BadDomain, _Ip, _Port) ->
+ error({bad_domain, BadDomain}).
+
+
+%% ---------
+
+which_domain(Ip) when is_list(Ip) andalso (length(Ip) =:= 4) ->
+ transportDomainUdpIpv4;
+which_domain(Ip) when is_tuple(Ip) andalso (size(Ip) =:= 4) ->
+ transportDomainUdpIpv4;
+which_domain(Ip) when is_list(Ip) andalso (length(Ip) =:= 8) ->
+ transportDomainUdpIpv6;
+which_domain(Ip) when is_tuple(Ip) andalso (size(Ip) =:= 8) ->
+ transportDomainUdpIpv6.
+
+
+%% ---------
+
+check_ip(X) ->
+ check_ip(snmpUDPDomain, X).
+
+check_ip(snmpUDPDomain, X) ->
+ check_ip(transportDomainUdpIpv4, X);
+check_ip(transportDomainUdpIpv4, X) when is_list(X) andalso (length(X) =:= 4) ->
case (catch all_integer(X)) of
true ->
ok;
false ->
error({invalid_ip_address, X})
end;
-check_ip(X) ->
- error({invalid_ip_address, X}).
+check_ip(transportDomainUdpIpv4, X) ->
+ error({invalid_ip_address, X});
+
+check_ip(transportDomainUdpIpv6, X) when is_list(X) andalso (length(X) =:= 8) ->
+ case (catch all_integer(X)) of
+ true ->
+ ok;
+ false ->
+ error({invalid_ip_address, X})
+ end;
+check_ip(transportDomainUdpIpv6, X) ->
+ error({invalid_ip_address, X});
+
+check_ip(BadDomain, _X) ->
+ error({invalid_domain, BadDomain}).
+
%% ---------
diff --git a/lib/snmp/src/misc/snmp_config.erl b/lib/snmp/src/misc/snmp_config.erl
index 25350e08cb..6ab20e3e48 100644
--- a/lib/snmp/src/misc/snmp_config.erl
+++ b/lib/snmp/src/misc/snmp_config.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -337,7 +337,7 @@ config_agent_sys() ->
{dir, ATLDir},
{size, ATLSize},
{repair, ATLRepair},
- {seqno, ATLSeqNo}]}];
+ {seqno, ATLSeqNo}]}];
no ->
[]
end,
@@ -491,6 +491,9 @@ config_agent_snmp(Dir, Vsns) ->
Host = host(),
AgentIP = ask("5. IP address for the agent (only used as id ~n"
" when sending traps)", Host, fun verify_address/1),
+ %% We intentionally skip TDomain...
+ %% If the user wish to use IPv6, the user must create an dummy entry here
+ %% and then manually edit these entries later.
ManagerIP = ask("6. IP address for the manager (only this manager ~n"
" will have access to the agent, traps are sent ~n"
" to this one)", Host, fun verify_address/1),
@@ -565,7 +568,7 @@ config_agent_snmp(Dir, Vsns) ->
false ->
ok
end,
- i("The following agent files were written: agent.conf, "
+ i("The following agent files where written: agent.conf, "
"community.conf,~n"
"standard.conf, target_addr.conf, "
"target_params.conf, ~n"
@@ -773,7 +776,7 @@ config_manager_snmp(Dir, Vsns) ->
Users, Agents, Usms)) of
ok ->
i("~n- - - - - - - - - - - - -"),
- i("The following manager files were written: "
+ i("The following manager files where written: "
"manager.conf, agents.conf " ++
case lists:member(v3, Vsns) of
true ->
@@ -1062,9 +1065,19 @@ verify_sec_type(ST) -> {error, "invalid security type: " ++ ST}.
verify_address(A) ->
- case (catch snmp_misc:ip(A)) of
+ verify_address(A, snmpUDPDomain).
+
+verify_address(A, snmpUDPDomain = _Domain) ->
+ do_verify_address(A, inet);
+verify_address(A, transportDomainUdpIpv4 = _Domain) ->
+ do_verify_address(A, inet);
+verify_address(A, transportDomainUdpIpv6 = _Domain) ->
+ do_verify_address(A, inet6).
+
+do_verify_address(A, Family) ->
+ case (catch snmp_misc:ip(A, Family)) of
{ok, IP} ->
- {ok, tuple_to_list(IP)};
+ {ok, tuple_to_list(IP)};
{error, _} ->
{error, "invalid address: " ++ A};
_E ->
@@ -1721,10 +1734,12 @@ write_agent_snmp_target_addr_conf(Dir, ManagerIp, UDP,
Hdr = header() ++ Comment,
F = fun(v1 = Vsn, Acc) ->
[{mk_ip(ManagerIp, Vsn),
+ snmp_target_mib:default_domain(),
ManagerIp, UDP, Timeout, RetryCount,
"std_trap", mk_param(Vsn), "", [], 2048}| Acc];
(v2 = Vsn, Acc) ->
[{mk_ip(ManagerIp, Vsn),
+ snmp_target_mib:default_domain(),
ManagerIp, UDP, Timeout, RetryCount,
"std_trap", mk_param(Vsn), "", [], 2048},
{lists:flatten(io_lib:format("~s.2",[mk_ip(ManagerIp, Vsn)])),
@@ -1732,6 +1747,7 @@ write_agent_snmp_target_addr_conf(Dir, ManagerIp, UDP,
"std_inform", mk_param(Vsn), "", [], 2048}| Acc];
(v3 = Vsn, Acc) ->
[{mk_ip(ManagerIp, Vsn),
+ snmp_target_mib:default_domain(),
ManagerIp, UDP, Timeout, RetryCount,
"std_trap", mk_param(Vsn), "", [], 2048},
{lists:flatten(io_lib:format("~s.3",[mk_ip(ManagerIp, Vsn)])),
@@ -2334,7 +2350,9 @@ write_sys_config_file_manager_atl_opt(Fid, {type, Type}) ->
write_sys_config_file_manager_atl_opt(Fid, {size, Size}) ->
ok = io:format(Fid, "{size, ~w}", [Size]);
write_sys_config_file_manager_atl_opt(Fid, {repair, Rep}) ->
- ok = io:format(Fid, "{repair, ~w}", [Rep]).
+ ok = io:format(Fid, "{repair, ~w}", [Rep]);
+write_sys_config_file_manager_atl_opt(Fid, {seqno, SeqNo}) ->
+ ok = io:format(Fid, "{seqno, ~w}", [SeqNo]).
header() ->
diff --git a/lib/snmp/src/misc/snmp_log.erl b/lib/snmp/src/misc/snmp_log.erl
index f9aa911817..2c781810ef 100644
--- a/lib/snmp/src/misc/snmp_log.erl
+++ b/lib/snmp/src/misc/snmp_log.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -266,9 +266,6 @@ validate_loop(eof, _Log, _Validatior, _PrevTS, _PrevSN) ->
ok;
validate_loop({error, _} = Error, _Log, _Validator, _PrevTS, _PrevSN) ->
Error;
-validate_loop({corrupt_log_file, _} = Reason,
- _Log, _Validator, _PrevTS, _PrevSN) ->
- {error, Reason};
validate_loop({Cont, Terms}, Log, Validator, PrevTS, PrevSN) ->
?vtrace("validate_loop -> entry with"
"~n Terms: ~p"
@@ -508,8 +505,6 @@ loop(eof, _Log, _Write) ->
ok;
loop({error, _} = Error, _Log, _Write) ->
Error;
-loop({corrupt_log_file, _} = Reason, _Log, _Write) ->
- {error, Reason};
loop({Cont, Terms}, Log, Write) ->
case (catch lists:foreach(Write, Terms)) of
{'EXIT', Reason} ->
diff --git a/lib/snmp/src/misc/snmp_misc.erl b/lib/snmp/src/misc/snmp_misc.erl
index 1b535743a4..a061dcd97c 100644
--- a/lib/snmp/src/misc/snmp_misc.erl
+++ b/lib/snmp/src/misc/snmp_misc.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -40,7 +40,7 @@
get_option/2,
get_option/3,
get_sec_level/1,
- ip/1,
+ ip/1, ip/2,
is_auth/1,
is_BitString/1,
is_oid/1,
@@ -347,10 +347,15 @@ bits_to_int([Kibble|Ks],Kibbles,Res) ->
%%----------------------------------------------------------------------
-%% Returns: {ok, {int(),int(),int(),int()}} | {error, Reason}
+%% Returns: {ok, {int(),int(),int(),int()}} |
+%% {ok, {int(),int(),int(),int()},int(),int(),int(),int()} |
+%% {error, Reason}
%%----------------------------------------------------------------------
ip(Host) ->
- inet:getaddr(Host, inet).
+ ip(Host, inet).
+
+ip(Host, Family) ->
+ inet:getaddr(Host, Family).
ensure_trailing_dir_delimiter([]) -> "/";
ensure_trailing_dir_delimiter(DirSuggestion) ->
diff --git a/lib/snmp/src/misc/snmp_note_store.erl b/lib/snmp/src/misc/snmp_note_store.erl
index a21a6209f1..23fccf8a5f 100644
--- a/lib/snmp/src/misc/snmp_note_store.erl
+++ b/lib/snmp/src/misc/snmp_note_store.erl
@@ -258,10 +258,17 @@ code_change({down, _Vsn}, State, _Extra) ->
{ok, NState};
% upgrade
-code_change(_Vsn, State, _Extra) ->
+code_change(_Vsn, State0, _Extra) ->
process_flag(trap_exit, true),
- NState = restart_timer(State),
- {ok, NState}.
+ State1 =
+ case State0 of
+ #state{timeout = false} ->
+ State0#state{timeout = ?timeout};
+ _ ->
+ State0
+ end,
+ State2 = restart_timer(State1),
+ {ok, State2}.
%%----------------------------------------------------------
@@ -282,7 +289,7 @@ deactivate_timer(#state{timer = Pid, active = true} = State) ->
receive
deactivated -> ok
end,
- State#state{timeout = false};
+ State#state{active = false};
deactivate_timer(State) ->
State.
diff --git a/lib/snmp/src/misc/snmp_pdus.erl b/lib/snmp/src/misc/snmp_pdus.erl
index dc8900c8cd..0788d86b2d 100644
--- a/lib/snmp/src/misc/snmp_pdus.erl
+++ b/lib/snmp/src/misc/snmp_pdus.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -269,24 +269,35 @@ dec_value([64 | Bytes]) ->
{Value, Rest} = dec_oct_str_notag(Bytes),
{{'IpAddress', Value}, Rest};
dec_value([65 | Bytes]) ->
+ %% Counter32 is an unsigned 32 but is actually encoded as
+ %% a signed integer 32 (INTEGER).
{Value, Rest} = dec_integer_notag(Bytes),
- if Value >= 0, Value =< 4294967295 ->
- {{'Counter32', Value}, Rest};
- true ->
- exit({error, {bad_counter32, Value}})
- end;
+ Value2 =
+ if
+ (Value >= 0) andalso (Value =< 16#ffffffff) ->
+ %% We accept value above 16#7fffffff
+ %% in order to be backward bug-compatible
+ Value;
+ (Value < 0) ->
+ 16#ffffffff + Value + 1;
+ true ->
+ exit({error, {bad_counter32, Value}})
+ end,
+ {{'Counter32', Value2}, Rest};
dec_value([66 | Bytes]) ->
{Value, Rest} = dec_integer_notag(Bytes),
- if Value >= 0, Value =< 4294967295 ->
+ if
+ (Value >= 0) andalso (Value =< 4294967295) ->
{{'Unsigned32', Value}, Rest};
- true ->
+ true ->
exit({error, {bad_unsigned32, Value}})
end;
dec_value([67 | Bytes]) ->
{Value, Rest} = dec_integer_notag(Bytes),
- if Value >= 0, Value =< 4294967295 ->
+ if
+ (Value >= 0) andalso (Value =< 4294967295) ->
{{'TimeTicks', Value}, Rest};
- true ->
+ true ->
exit({error, {bad_timeticks, Value}})
end;
dec_value([68 | Bytes]) ->
@@ -642,6 +653,21 @@ enc_value(_Type, endOfMibView) ->
[130,0];
enc_value('NULL', _Val) ->
[5,0];
+enc_value('Counter32', Val) ->
+ Val2 =
+ if
+ Val > 16#ffffffff ->
+ exit({error, {bad_counter32, Val}});
+ Val >= 16#80000000 ->
+ (Val band 16#7fffffff) - 16#80000000;
+ Val >= 0 ->
+ Val;
+ true ->
+ exit({error, {bad_counter32, Val}})
+ end,
+ Bytes2 = enc_integer_notag(Val2),
+ Len2 = elength(length(Bytes2)),
+ lists:append([65 | Len2],Bytes2);
enc_value('Counter64', Val) ->
Val2 =
if
diff --git a/lib/snmp/test/Makefile b/lib/snmp/test/Makefile
index b7975024b4..78ffb1c255 100644
--- a/lib/snmp/test/Makefile
+++ b/lib/snmp/test/Makefile
@@ -2,7 +2,7 @@
# %CopyrightBegin%
#
-# Copyright Ericsson AB 1997-2009. All Rights Reserved.
+# Copyright Ericsson AB 1997-2011. All Rights Reserved.
#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
@@ -145,9 +145,12 @@ endif
# ----------------------------------------------------
EBIN = .
-ERL_COMPILE_FLAGS += -I../src \
+ERL_COMPILE_FLAGS += -I../../snmp/src/app \
+ -I../../snmp/src/misc \
+ -I../../snmp/src/agent \
+ -I../../snmp/src/manager \
-I$(ERL_TOP)/lib/test_server/include \
- -I../include \
+ -I../../snmp/include \
-Dsnmp_test_data=snmp_test_data \
-Dversion=\"$(VSN)$(PRE_VSN)\" \
+'{parse_transform,sys_pre_attributes}' \
@@ -217,6 +220,10 @@ appup: make
$(MAYBE_ESTOP)
+$(SNMP_BIN_TARGET_DIR)/Klas4.bin: $(SNMP_BIN_TARGET_DIR)/Klas3.bin
+
+$(SNMP_BIN_TARGET_DIR)/SA-MIB.bin: $(SNMP_BIN_TARGET_DIR)/OLD-SNMPEA-MIB.bin
+
# ----------------------------------------------------
# Release Target
# ----------------------------------------------------
diff --git a/lib/snmp/test/snmp_agent_test.erl b/lib/snmp/test/snmp_agent_test.erl
index 692d29fda0..468280db02 100644
--- a/lib/snmp/test/snmp_agent_test.erl
+++ b/lib/snmp/test/snmp_agent_test.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2003-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2003-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -81,13 +81,12 @@
case get(vsn) of
v1 -> V1;
v2 -> V2;
- _ -> V3
+ _ -> V3
end).
all() ->
- Reqs = [mnesia, distribution, {local_slave_nodes, 2},
- {time, 360}],
+ %% Reqs = [mnesia, distribution, {local_slave_nodes, 2}, {time, 360}],
Conf1 = [{group, all_tcs}],
Conf2 = [{group, tickets2}],
Conf1 ++ Conf2.
@@ -95,67 +94,138 @@ all() ->
groups() ->
[{all_tcs, [], cases()},
{mib_storage, [],
- [{group, mib_storage_ets}, {group, mib_storage_dets},
+ [
+ {group, mib_storage_ets},
+ {group, mib_storage_dets},
{group, mib_storage_mnesia},
{group, mib_storage_size_check_ets},
{group, mib_storage_size_check_dets},
{group, mib_storage_size_check_mnesia},
{group, mib_storage_varm_dets},
- {group, mib_storage_varm_mnesia}]},
- {mib_storage_ets, [], mib_storage_ets_cases()},
- {mib_storage_dets, [], mib_storage_dets_cases()},
- {mib_storage_mnesia, [], mib_storage_mnesia_cases()},
- {mib_storage_size_check_ets, [],
- mse_size_check_cases()},
- {mib_storage_size_check_dets, [],
- msd_size_check_cases()},
- {mib_storage_size_check_mnesia, [],
- msm_size_check_cases()},
- {mib_storage_varm_dets, [],
- varm_mib_storage_dets_cases()},
- {mib_storage_varm_mnesia, [],
- varm_mib_storage_mnesia_cases()},
- {misc, [], misc_cases()}, {test_v1, [], v1_cases()},
- {test_v2, [], v2_cases()},
- {test_v1_v2, [], v1_v2_cases()},
- {test_v3, [], v3_cases()},
- {test_multi_threaded, [], mt_cases()},
- {multiple_reqs, [], mul_cases()},
- {multiple_reqs_2, [], mul_cases_2()},
- {v2_inform, [], [v2_inform_i]},
+ {group, mib_storage_varm_mnesia}
+ ]
+ },
+ {mib_storage_ets, [], mib_storage_ets_cases()},
+ {mib_storage_dets, [], mib_storage_dets_cases()},
+ {mib_storage_mnesia, [], mib_storage_mnesia_cases()},
+ {mib_storage_size_check_ets, [], mse_size_check_cases()},
+ {mib_storage_size_check_dets, [], msd_size_check_cases()},
+ {mib_storage_size_check_mnesia, [], msm_size_check_cases()},
+ {mib_storage_varm_dets, [], varm_mib_storage_dets_cases()},
+ {mib_storage_varm_mnesia, [], varm_mib_storage_mnesia_cases()},
+ {misc, [], misc_cases()},
+ {test_v1, [], v1_cases()},
+ {test_v2, [], v2_cases()},
+ {test_v1_v2, [], v1_v2_cases()},
+ {test_v3, [], v3_cases()},
+ {test_multi_threaded, [], mt_cases()},
+ {multiple_reqs, [], mul_cases()},
+ {multiple_reqs_2, [], mul_cases_2()},
+ {v2_inform, [],
+ [
+ v2_inform_i
+ ]
+ },
{v3_security, [],
- [v3_crypto_basic, v3_md5_auth, v3_sha_auth,
- v3_des_priv]},
+ [
+ v3_crypto_basic,
+ v3_md5_auth,
+ v3_sha_auth,
+ v3_des_priv
+ ]
+ },
{standard_mibs, [],
- [snmp_standard_mib, snmp_community_mib,
- snmp_framework_mib, snmp_target_mib,
- snmp_notification_mib, snmp_view_based_acm_mib]},
+ [
+ snmp_standard_mib,
+ snmp_community_mib,
+ snmp_framework_mib,
+ snmp_target_mib,
+ snmp_notification_mib,
+ snmp_view_based_acm_mib
+ ]
+ },
{standard_mibs_2, [],
- [snmpv2_mib_2, snmp_community_mib_2,
- snmp_framework_mib_2, snmp_target_mib_2,
- snmp_notification_mib_2, snmp_view_based_acm_mib_2]},
+ [
+ snmpv2_mib_2,
+ snmp_community_mib_2,
+ snmp_framework_mib_2,
+ snmp_target_mib_2,
+ snmp_notification_mib_2,
+ snmp_view_based_acm_mib_2
+ ]
+ },
{standard_mibs_3, [],
- [snmpv2_mib_3, snmp_framework_mib_3, snmp_mpd_mib_3,
- snmp_target_mib_3, snmp_notification_mib_3,
- snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]},
+ [
+ snmpv2_mib_3,
+ snmp_framework_mib_3,
+ snmp_mpd_mib_3,
+ snmp_target_mib_3,
+ snmp_notification_mib_3,
+ snmp_view_based_acm_mib_3,
+ snmp_user_based_sm_mib_3
+ ]
+ },
{reported_bugs, [],
- [otp_1128, otp_1129, otp_1131, otp_1162, otp_1222,
- otp_1298, otp_1331, otp_1338, otp_1342, otp_2776,
- otp_2979, otp_3187, otp_3725]},
+ [
+ otp_1128,
+ otp_1129,
+ otp_1131,
+ otp_1162,
+ otp_1222,
+ otp_1298,
+ otp_1331,
+ otp_1338,
+ otp_1342,
+ otp_2776,
+ otp_2979,
+ otp_3187,
+ otp_3725
+ ]
+ },
{reported_bugs_2, [],
- [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2,
- otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2,
- otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]},
+ [
+ otp_1128_2,
+ otp_1129_2,
+ otp_1131_2,
+ otp_1162_2,
+ otp_1222_2,
+ otp_1298_2,
+ otp_1331_2,
+ otp_1338_2,
+ otp_1342_2,
+ otp_2776_2,
+ otp_2979_2,
+ otp_3187_2
+ ]
+ },
{reported_bugs_3, [],
- [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3,
- otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3,
- otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3,
- otp_3542]},
- {tickets1, [], [{group, otp_4394}, {group, otp_7157}]},
+ [
+ otp_1128_3,
+ otp_1129_3,
+ otp_1131_3,
+ otp_1162_3,
+ otp_1222_3,
+ otp_1298_3,
+ otp_1331_3,
+ otp_1338_3,
+ otp_1342_3,
+ otp_2776_3,
+ otp_2979_3,
+ otp_3187_3,
+ otp_3542
+ ]
+ },
+ {tickets1, [],
+ [
+ {group, otp_4394},
+ {group, otp_7157}
+ ]
+ },
{tickets2, [], [otp8395]},
{otp_4394, [], [otp_4394_test]},
- {otp_7157, [],
- begin Reqs = [], Conf = [otp_7157_test], Conf end}].
+ {otp_7157, [], [otp_7157_test]
+ }
+ ].
init_per_group(all_tcs, Config) ->
init_all(Config);
@@ -378,17 +448,29 @@ end_per_testcase2(_Case, Config) ->
cases() ->
-case ?OSTYPE() of
- vxworks ->
- [{group, misc}, {group, test_v1}, {group, test_v2},
- {group, test_v1_v2}, {group, test_multi_threaded},
- {group, mib_storage}, {group, tickets1}];
- _Else ->
- [{group, misc}, {group, test_v1}, {group, test_v2},
- {group, test_v1_v2}, {group, test_v3},
- {group, test_multi_threaded}, {group, mib_storage},
- {group, tickets1}]
-end.
+ case ?OSTYPE() of
+ vxworks ->
+ [
+ {group, misc},
+ {group, test_v1},
+ {group, test_v2},
+ {group, test_v1_v2},
+ {group, test_multi_threaded},
+ {group, mib_storage},
+ {group, tickets1}
+ ];
+ _Else ->
+ [
+ {group, misc},
+ {group, test_v1},
+ {group, test_v2},
+ {group, test_v1_v2},
+ {group, test_v3},
+ {group, test_multi_threaded},
+ {group, mib_storage},
+ {group, tickets1}
+ ]
+ end.
%%%-----------------------------------------------------------------
@@ -1071,11 +1153,29 @@ app_dir(App) ->
%v1_cases() -> [loop_mib];
v1_cases() ->
-[simple, db_notify_client, v1_processing, big, big2,
- loop_mib, api, subagent, mnesia, {group, multiple_reqs},
- sa_register, v1_trap, sa_error, next_across_sa, undo,
- {group, reported_bugs}, {group, standard_mibs},
- sparse_table, cnt_64, opaque, change_target_addr_config].
+ [
+ simple,
+ db_notify_client,
+ v1_processing,
+ big,
+ big2,
+ loop_mib,
+ api,
+ subagent,
+ mnesia,
+ {group, multiple_reqs},
+ sa_register,
+ v1_trap,
+ sa_error,
+ next_across_sa,
+ undo,
+ {group, reported_bugs},
+ {group, standard_mibs},
+ sparse_table,
+ cnt_64,
+ opaque,
+ change_target_addr_config
+ ].
init_v1(Config) when is_list(Config) ->
?line SaNode = ?config(snmp_sa, Config),
@@ -1094,12 +1194,31 @@ finish_v1(Config) when is_list(Config) ->
v2_cases() ->
-[simple_2, v2_processing, big_2, big2_2, loop_mib_2,
- api_2, subagent_2, mnesia_2, {group, multiple_reqs_2},
- sa_register_2, v2_trap, {group, v2_inform}, sa_error_2,
- next_across_sa_2, undo_2, {group, reported_bugs_2},
- {group, standard_mibs_2}, v2_types, implied,
- sparse_table_2, cnt_64_2, opaque_2, v2_caps].
+ [
+ simple_2,
+ v2_processing,
+ big_2,
+ big2_2,
+ loop_mib_2,
+ api_2,
+ subagent_2,
+ mnesia_2,
+ {group, multiple_reqs_2},
+ sa_register_2,
+ v2_trap,
+ {group, v2_inform},
+ sa_error_2,
+ next_across_sa_2,
+ undo_2,
+ {group, reported_bugs_2},
+ {group, standard_mibs_2},
+ v2_types,
+ implied,
+ sparse_table_2,
+ cnt_64_2,
+ opaque_2,
+ v2_caps
+ ].
init_v2(Config) when is_list(Config) ->
SaNode = ?config(snmp_sa, Config),
@@ -1118,7 +1237,7 @@ finish_v2(Config) when is_list(Config) ->
v1_v2_cases() ->
-[simple_bi].
+ [simple_bi].
init_v1_v2(Config) when is_list(Config) ->
SaNode = ?config(snmp_sa, Config),
@@ -1137,13 +1256,32 @@ finish_v1_v2(Config) when is_list(Config) ->
v3_cases() ->
-[simple_3, v3_processing, big_3, big2_3, api_3,
- subagent_3, mnesia_3, loop_mib_3, multiple_reqs_3,
- sa_register_3, v3_trap, v3_inform, sa_error_3,
- next_across_sa_3, undo_3, {group, reported_bugs_3},
- {group, standard_mibs_3}, {group, v3_security},
- v2_types_3, implied_3, sparse_table_3, cnt_64_3,
- opaque_3, v2_caps_3].
+ [
+ simple_3,
+ v3_processing,
+ big_3,
+ big2_3,
+ api_3,
+ subagent_3,
+ mnesia_3,
+ loop_mib_3,
+ multiple_reqs_3,
+ sa_register_3,
+ v3_trap,
+ v3_inform,
+ sa_error_3,
+ next_across_sa_3,
+ undo_3,
+ {group, reported_bugs_3},
+ {group, standard_mibs_3},
+ {group, v3_security},
+ v2_types_3,
+ implied_3,
+ sparse_table_3,
+ cnt_64_3,
+ opaque_3,
+ v2_caps_3
+ ].
init_v3(Config) when is_list(Config) ->
%% Make sure crypto works, otherwise start_agent will fail
diff --git a/lib/snmp/test/snmp_agent_test_lib.erl b/lib/snmp/test/snmp_agent_test_lib.erl
index 9e89aa889c..a18d9f3201 100644
--- a/lib/snmp/test/snmp_agent_test_lib.erl
+++ b/lib/snmp/test/snmp_agent_test_lib.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2005-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -1311,10 +1311,12 @@ rewrite_target_addr_conf(Dir, NewPort) ->
"~n NewPort: ~p", [NewPort]),
TAFile = filename:join(Dir, "target_addr.conf"),
case file:read_file_info(TAFile) of
- {ok, _} -> ok;
- {error, R} -> ?ERR("failure reading file info of "
- "target address config file: ~p",[R]),
- ok
+ {ok, _} ->
+ ok;
+ {error, R} ->
+ ?ERR("failure reading file info of "
+ "target address config file: ~p",[R]),
+ ok
end,
?line [TrapAddr|Addrs] =
@@ -1335,8 +1337,9 @@ rewrite_target_addr_conf(Dir, NewPort) ->
rewrite_target_addr_conf_check(O) ->
{ok,O}.
-rewrite_target_addr_conf2(NewPort,{Name,Ip,_Port,Timeout,Retry,
- "std_trap",EngineId}) ->
+rewrite_target_addr_conf2(NewPort,
+ {Name, Ip, _Port, Timeout, Retry,
+ "std_trap", EngineId}) ->
?LOG("rewrite_target_addr_conf2 -> entry with std_trap",[]),
{Name,Ip,NewPort,Timeout,Retry,"std_trap",EngineId};
rewrite_target_addr_conf2(_NewPort,O) ->
diff --git a/lib/snmp/test/snmp_compiler_test.erl b/lib/snmp/test/snmp_compiler_test.erl
index 2e6020ae7a..c964b08168 100644
--- a/lib/snmp/test/snmp_compiler_test.erl
+++ b/lib/snmp/test/snmp_compiler_test.erl
@@ -47,6 +47,7 @@
module_identity/1,
agent_capabilities/1,
module_compliance/1,
+ warnings_as_errors/1,
otp_6150/1,
otp_8574/1,
@@ -97,9 +98,10 @@ all() ->
description,
oid_conflicts,
imports,
- module_identity,
- agent_capabilities,
- module_compliance,
+ module_identity,
+ agent_capabilities,
+ module_compliance,
+ warnings_as_errors,
{group, tickets}
].
@@ -152,6 +154,8 @@ description(Config) when is_list(Config) ->
ok.
+%%======================================================================
+
oid_conflicts(suite) -> [];
oid_conflicts(Config) when is_list(Config) ->
put(tname,oid_conflicts),
@@ -165,18 +169,24 @@ oid_conflicts(Config) when is_list(Config) ->
ok.
+%%======================================================================
+
imports(suite) ->
[];
imports(Config) when is_list(Config) ->
?SKIP(not_yet_implemented).
+%%======================================================================
+
module_identity(suite) ->
[];
module_identity(Config) when is_list(Config) ->
?SKIP(not_yet_implemented).
+%%======================================================================
+
agent_capabilities(suite) ->
[];
agent_capabilities(Config) when is_list(Config) ->
@@ -218,6 +228,8 @@ agent_capabilities(Config) when is_list(Config) ->
ok.
+%%======================================================================
+
module_compliance(suite) ->
[];
module_compliance(Config) when is_list(Config) ->
@@ -259,6 +271,32 @@ module_compliance(Config) when is_list(Config) ->
ok.
+%%======================================================================
+
+warnings_as_errors(suite) ->
+ ["OTP-9437"];
+warnings_as_errors(Config) when is_list(Config) ->
+ put(tname,warnings_as_errors),
+ p("starting with Config: ~p~n", [Config]),
+ Dir = ?config(comp_dir, Config),
+ MibDir = ?config(mib_dir, Config),
+ MibFile = join(MibDir, "OTP8574-MIB.mib"),
+ OutFile = join(Dir, "OTP8574-MIB.bin"),
+ Opts = [{group_check, false},
+ {outdir, Dir},
+ {verbosity, trace},
+ relaxed_row_name_assign_check],
+ {error, compilation_failed} =
+ snmpc:compile(MibFile, [warnings_as_errors|Opts]),
+ false = filelib:is_regular(OutFile),
+ {ok, _} = snmpc:compile(MibFile, Opts),
+ true = filelib:is_regular(OutFile),
+ ok = file:delete(OutFile),
+ ok.
+
+
+%%======================================================================
+
otp_6150(suite) ->
[];
otp_6150(Config) when is_list(Config) ->
@@ -273,6 +311,8 @@ otp_6150(Config) when is_list(Config) ->
ok.
+%%======================================================================
+
otp_8574(suite) ->
[];
otp_8574(Config) when is_list(Config) ->
@@ -304,6 +344,8 @@ otp_8574(Config) when is_list(Config) ->
end.
+%%======================================================================
+
otp_8595(suite) ->
[];
otp_8595(Config) when is_list(Config) ->
diff --git a/lib/snmp/test/snmp_manager_test.erl b/lib/snmp/test/snmp_manager_test.erl
index 50836db731..d18f20d359 100644
--- a/lib/snmp/test/snmp_manager_test.erl
+++ b/lib/snmp/test/snmp_manager_test.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2003-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2003-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -37,13 +37,16 @@
-include_lib("snmp/include/snmp_types.hrl").
-include_lib("snmp/include/STANDARD-MIB.hrl").
+-include_lib("snmp/src/manager/snmpm_internal.hrl").
%%----------------------------------------------------------------------
%% External exports
%%----------------------------------------------------------------------
-export([
- all/0,groups/0,init_per_group/2,end_per_group/2,
+ all/0,
+ groups/0,
+ init_per_group/2, end_per_group/2,
init_per_testcase/2, end_per_testcase/2,
@@ -54,49 +57,46 @@
notify_started01/1,
notify_started02/1,
-
register_user1/1,
-
register_agent1/1,
register_agent2/1,
+ register_agent3/1,
-
info/1,
-
-
-
simple_sync_get1/1,
simple_sync_get2/1,
+ simple_sync_get3/1,
simple_async_get1/1,
simple_async_get2/1,
-
+ simple_async_get3/1,
simple_sync_get_next1/1,
simple_sync_get_next2/1,
+ simple_sync_get_next3/1,
simple_async_get_next1/1,
simple_async_get_next2/1,
-
+ simple_async_get_next3/1,
simple_sync_set1/1,
simple_sync_set2/1,
+ simple_sync_set3/1,
simple_async_set1/1,
simple_async_set2/1,
-
+ simple_async_set3/1,
simple_sync_get_bulk1/1,
simple_sync_get_bulk2/1,
+ simple_sync_get_bulk3/1,
simple_async_get_bulk1/1,
simple_async_get_bulk2/1,
-
+ simple_async_get_bulk3/1,
misc_async1/1,
misc_async2/1,
discovery/1,
-
-
trap1/1,
trap2/1,
@@ -109,8 +109,6 @@
report/1,
-
-
otp8015_1/1,
otp8395_1/1
@@ -220,7 +218,7 @@ init_per_testcase2(Case, Config) ->
Conf2.
init_per_testcase3(Case, Config) ->
- OldApiCases =
+ ApiCases01 =
[
simple_sync_get1,
simple_async_get1,
@@ -232,7 +230,7 @@ init_per_testcase3(Case, Config) ->
simple_async_get_bulk1,
misc_async1
],
- NewApiCases =
+ ApiCases02 =
[
simple_sync_get2,
simple_async_get2,
@@ -245,6 +243,17 @@ init_per_testcase3(Case, Config) ->
misc_async2,
otp8395_1
],
+ ApiCases03 =
+ [
+ simple_sync_get3,
+ simple_async_get3,
+ simple_sync_get_next3,
+ simple_async_get_next3,
+ simple_sync_set3,
+ simple_async_set3,
+ simple_sync_get_bulk3,
+ simple_async_get_bulk3
+ ],
Cases =
[
trap1,
@@ -256,8 +265,9 @@ init_per_testcase3(Case, Config) ->
inform_swarm,
report
] ++
- OldApiCases ++
- NewApiCases,
+ ApiCases01 ++
+ ApiCases02 ++
+ ApiCases03,
case lists:member(Case, Cases) of
true ->
NoAutoInformCases = [inform1, inform2, inform3, inform_swarm],
@@ -279,7 +289,7 @@ init_per_testcase3(Case, Config) ->
Conf2 = init_agent(Conf1),
Conf3 = init_manager(AutoInform, Conf2),
Conf4 = init_mgr_user(Conf3),
- case lists:member(Case, NewApiCases) of
+ case lists:member(Case, ApiCases02 ++ ApiCases03) of
true ->
init_mgr_user_data2(Conf4);
false ->
@@ -301,7 +311,7 @@ end_per_testcase(Case, Config) when is_list(Config) ->
Conf2.
end_per_testcase2(Case, Config) ->
- OldApiCases =
+ ApiCases01 =
[
simple_sync_get1,
simple_async_get1,
@@ -313,7 +323,7 @@ end_per_testcase2(Case, Config) ->
simple_async_get_bulk1,
misc_async1
],
- NewApiCases =
+ ApiCases02 =
[
simple_sync_get2,
simple_async_get2,
@@ -326,6 +336,17 @@ end_per_testcase2(Case, Config) ->
misc_async2,
otp8395_1
],
+ ApiCases03 =
+ [
+ simple_sync_get3,
+ simple_async_get3,
+ simple_sync_get_next3,
+ simple_async_get_next3,
+ simple_sync_set3,
+ simple_async_set3,
+ simple_sync_get_bulk3,
+ simple_async_get_bulk3
+ ],
Cases =
[
trap1,
@@ -337,11 +358,12 @@ end_per_testcase2(Case, Config) ->
inform_swarm,
report
] ++
- OldApiCases ++
- NewApiCases,
+ ApiCases01 ++
+ ApiCases02 ++
+ ApiCases03,
case lists:member(Case, Cases) of
true ->
- Conf1 = case lists:member(Case, NewApiCases) of
+ Conf1 = case lists:member(Case, ApiCases02 ++ ApiCases03) of
true ->
fin_mgr_user_data2(Config);
false ->
@@ -360,42 +382,130 @@ end_per_testcase2(Case, Config) ->
%%======================================================================
all() ->
-[{group, start_and_stop_tests}, {group, misc_tests},
- {group, user_tests}, {group, agent_tests},
- {group, request_tests}, {group, event_tests}, discovery,
- {group, tickets}].
+ [
+ {group, start_and_stop_tests},
+ {group, misc_tests},
+ {group, user_tests},
+ {group, agent_tests},
+ {group, request_tests},
+ {group, event_tests},
+ discovery,
+ {group, tickets}
+ ].
groups() ->
- [{start_and_stop_tests, [],
- [simple_start_and_stop1, simple_start_and_stop2,
- simple_start_and_monitor_crash1,
- simple_start_and_monitor_crash2, notify_started01,
- notify_started02]},
- {misc_tests, [], [info]},
- {user_tests, [], [register_user1]},
- {agent_tests, [], [register_agent1, register_agent2]},
- {request_tests, [],
- [{group, get_tests}, {group, get_next_tests},
- {group, set_tests}, {group, bulk_tests},
- {group, misc_request_tests}]},
- {get_tests, [],
- [simple_sync_get1, simple_sync_get2, simple_async_get1,
- simple_async_get2]},
- {get_next_tests, [],
- [simple_sync_get_next1, simple_sync_get_next2,
- simple_async_get_next1, simple_async_get_next2]},
- {set_tests, [],
- [simple_sync_set1, simple_sync_set2, simple_async_set1,
- simple_async_set2]},
- {bulk_tests, [],
- [simple_sync_get_bulk1, simple_sync_get_bulk2,
- simple_async_get_bulk1, simple_async_get_bulk2]},
- {misc_request_tests, [], [misc_async1, misc_async2]},
- {event_tests, [],
- [trap1, trap2, inform1, inform2, inform3, inform4,
- inform_swarm, report]},
- {tickets, [], [{group, otp8015}, {group, otp8395}]},
- {otp8015, [], [otp8015_1]}, {otp8395, [], [otp8395_1]}].
+ [
+ {start_and_stop_tests, [],
+ [
+ simple_start_and_stop1,
+ simple_start_and_stop2,
+ simple_start_and_monitor_crash1,
+ simple_start_and_monitor_crash2,
+ notify_started01,
+ notify_started02
+ ]
+ },
+ {misc_tests, [],
+ [
+ info
+ ]
+ },
+ {user_tests, [],
+ [
+ register_user1
+ ]
+ },
+ {agent_tests, [],
+ [
+ register_agent1,
+ register_agent2,
+ register_agent3
+ ]
+ },
+ {request_tests, [],
+ [
+ {group, get_tests},
+ {group, get_next_tests},
+ {group, set_tests},
+ {group, bulk_tests},
+ {group, misc_request_tests}
+ ]
+ },
+ {get_tests, [],
+ [
+ simple_sync_get1,
+ simple_sync_get2,
+ simple_sync_get3,
+ simple_async_get1,
+ simple_async_get2,
+ simple_async_get3
+ ]
+ },
+ {get_next_tests, [],
+ [
+ simple_sync_get_next1,
+ simple_sync_get_next2,
+ simple_sync_get_next3,
+ simple_async_get_next1,
+ simple_async_get_next2,
+ simple_async_get_next3
+ ]
+ },
+ {set_tests, [],
+ [
+ simple_sync_set1,
+ simple_sync_set2,
+ simple_sync_set3,
+ simple_async_set1,
+ simple_async_set2,
+ simple_async_set3
+ ]
+ },
+ {bulk_tests, [],
+ [
+ simple_sync_get_bulk1,
+ simple_sync_get_bulk2,
+ simple_sync_get_bulk3,
+ simple_async_get_bulk1,
+ simple_async_get_bulk2,
+ simple_async_get_bulk3
+ ]
+ },
+ {misc_request_tests, [],
+ [
+ misc_async1,
+ misc_async2
+ ]
+ },
+ {event_tests, [],
+ [
+ trap1%% ,
+ %% trap2,
+ %% inform1,
+ %% inform2,
+ %% inform3,
+ %% inform4,
+ %% inform_swarm,
+ %% report
+ ]
+ },
+ {tickets, [],
+ [
+ {group, otp8015},
+ {group, otp8395}
+ ]
+ },
+ {otp8015, [],
+ [
+ otp8015_1
+ ]
+ },
+ {otp8395, [],
+ [
+ otp8395_1
+ ]
+ }
+ ].
init_per_group(_GroupName, Config) ->
Config.
@@ -404,21 +514,6 @@ end_per_group(_GroupName, Config) ->
Config.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%%======================================================================
%% Test functions
%%======================================================================
@@ -1041,6 +1136,7 @@ register_agent1(suite) ->
register_agent1(Config) when is_list(Config) ->
process_flag(trap_exit, true),
put(tname,ra1),
+
p("starting with Config: ~p~n", [Config]),
ManagerNode = start_manager_node(),
@@ -1071,7 +1167,7 @@ register_agent1(Config) when is_list(Config) ->
p("manager info: ~p~n", [mgr_info(ManagerNode)]),
- p("register user(s) calvin & hobbe"),
+ p("register user(s) user_alfa & user_beta"),
?line ok = mgr_register_user(ManagerNode, user_alfa, snmpm_user_default, []),
?line ok = mgr_register_user(ManagerNode, user_beta, snmpm_user_default, []),
p("manager info: ~p~n", [mgr_info(ManagerNode)]),
@@ -1200,7 +1296,7 @@ register_agent2(Config) when is_list(Config) ->
p("manager info: ~p~n", [mgr_info(ManagerNode)]),
- p("register user(s) calvin & hobbe"),
+ p("register user(s) user_alfa & user_beta"),
?line ok = mgr_register_user(ManagerNode, user_alfa, snmpm_user_default, []),
?line ok = mgr_register_user(ManagerNode, user_beta, snmpm_user_default, []),
p("manager info: ~p~n", [mgr_info(ManagerNode)]),
@@ -1255,7 +1351,7 @@ register_agent2(Config) when is_list(Config) ->
end,
p("manager info: ~p~n", [mgr_info(ManagerNode)]),
-
+
p("unregister user user_alfa"),
?line ok = mgr_unregister_user(ManagerNode, user_alfa),
@@ -1284,7 +1380,157 @@ register_agent2(Config) when is_list(Config) ->
p("manager info: ~p~n", [mgr_info(ManagerNode)]),
- p("unregister user hobbe"),
+ p("unregister user user_beta"),
+ ?line ok = mgr_unregister_user(ManagerNode, user_beta),
+
+ p("manager info: ~p~n", [mgr_info(ManagerNode)]),
+
+ ?SLEEP(1000),
+
+ p("stop snmp application (with only manager)"),
+ ?line ok = stop_snmp(ManagerNode),
+
+ ?SLEEP(1000),
+
+ stop_node(ManagerNode),
+
+ ?SLEEP(1000),
+
+ p("end"),
+ ok.
+
+
+%%======================================================================
+
+register_agent3(doc) ->
+ ["Test registration of agents with the NEW interface functions "
+ "and specifying transport domain"];
+register_agent3(suite) ->
+ [];
+register_agent3(Config) when is_list(Config) ->
+ process_flag(trap_exit, true),
+ put(tname, ra3),
+ p("starting with Config: ~p~n", [Config]),
+
+ ManagerNode = start_manager_node(),
+
+ ConfDir = ?config(manager_conf_dir, Config),
+ DbDir = ?config(manager_db_dir, Config),
+ LocalHost = snmp_test_lib:localhost(),
+
+
+ write_manager_conf(ConfDir),
+
+ Opts = [{server, [{verbosity, trace}]},
+ {net_if, [{verbosity, trace}]},
+ {note_store, [{verbosity, trace}]},
+ {config, [{verbosity, trace}, {dir, ConfDir}, {db_dir, DbDir}]}],
+
+
+ p("load snmp application"),
+ ?line ok = load_snmp(ManagerNode),
+
+ p("set manager env for the snmp application"),
+ ?line ok = set_mgr_env(ManagerNode, Opts),
+
+ p("starting snmp application (with only manager)"),
+ ?line ok = start_snmp(ManagerNode),
+
+ p("started"),
+
+ ?SLEEP(1000),
+
+ p("manager info: ~p~n", [mgr_info(ManagerNode)]),
+
+ p("register user(s) user_alfa & user_beta"),
+ ?line ok = mgr_register_user(ManagerNode, user_alfa, snmpm_user_default, []),
+ ?line ok = mgr_register_user(ManagerNode, user_beta, snmpm_user_default, []),
+ p("manager info: ~p~n", [mgr_info(ManagerNode)]),
+
+ p("register agent(s)"),
+ TargetName1 = "agent2",
+ ?line ok = mgr_register_agent(ManagerNode, user_alfa, TargetName1,
+ [{tdomain, transportDomainUdpIpv4},
+ {address, LocalHost},
+ {port, 5001},
+ {engine_id, "agentEngineId-1"}]),
+ TargetName2 = "agent3",
+ ?line ok = mgr_register_agent(ManagerNode, user_alfa, TargetName2,
+ [{tdomain, transportDomainUdpIpv6},
+ {address, LocalHost},
+ {port, 5002},
+ {engine_id, "agentEngineId-2"}]),
+ TargetName3 = "agent4",
+ ?line {error, {unsupported_domain, _} = Reason4} =
+ mgr_register_agent(ManagerNode, user_beta, TargetName3,
+ [{tdomain, transportDomainTcpIpv4},
+ {address, LocalHost},
+ {port, 5003},
+ {engine_id, "agentEngineId-3"}]),
+ p("Expected registration failure: ~p", [Reason4]),
+ TargetName4 = "agent5",
+ ?line {error, {unknown_domain, _} = Reason5} =
+ mgr_register_agent(ManagerNode, user_beta, TargetName4,
+ [{tdomain, transportDomainUdpIpv4_bad},
+ {address, LocalHost},
+ {port, 5004},
+ {engine_id, "agentEngineId-4"}]),
+ p("Expected registration failure: ~p", [Reason5]),
+
+ p("verify all agent(s): expect 2"),
+ case mgr_which_agents(ManagerNode) of
+ Agents1 when length(Agents1) =:= 2 ->
+ p("all agents: ~p~n", [Agents1]),
+ ok;
+ Agents1 ->
+ ?FAIL({agent_registration_failure, Agents1})
+ end,
+
+ p("verify user_alfa agent(s)"),
+ case mgr_which_agents(ManagerNode, user_alfa) of
+ Agents2 when length(Agents2) =:= 2 ->
+ p("calvin agents: ~p~n", [Agents2]),
+ ok;
+ Agents2 ->
+ ?FAIL({agent_registration_failure, Agents2})
+ end,
+
+ p("verify user_beta agent(s)"),
+ case mgr_which_agents(ManagerNode, user_beta) of
+ Agents3 when length(Agents3) =:= 0 ->
+ p("hobbe agents: ~p~n", [Agents3]),
+ ok;
+ Agents3 ->
+ ?FAIL({agent_registration_failure, Agents3})
+ end,
+
+ p("manager info: ~p~n", [mgr_info(ManagerNode)]),
+
+ p("unregister user user_alfa"),
+ ?line ok = mgr_unregister_user(ManagerNode, user_alfa),
+
+ p("verify all agent(s): expect 0"),
+ case mgr_which_agents(ManagerNode) of
+ Agents4 when length(Agents4) =:= 0 ->
+ p("all agents: ~p~n", [Agents4]),
+ ok;
+ Agents4 ->
+ ?FAIL({agent_unregistration_failure, Agents4})
+ end,
+ p("manager info: ~p~n", [mgr_info(ManagerNode)]),
+
+ p("verify all agent(s): expect 0"),
+ case mgr_which_agents(ManagerNode) of
+ [] ->
+ ok;
+ Agents5 ->
+ p("all agents: ~p~n", [Agents5]),
+ ?FAIL({agent_unregistration_failure, Agents5})
+ end,
+
+ p("manager info: ~p~n", [mgr_info(ManagerNode)]),
+
+ p("unregister user user_beta"),
?line ok = mgr_unregister_user(ManagerNode, user_beta),
p("manager info: ~p~n", [mgr_info(ManagerNode)]),
@@ -1319,15 +1565,15 @@ simple_sync_get1(Config) when is_list(Config) ->
p("issue get-request without loading the mib"),
Oids1 = [?sysObjectID_instance, ?sysDescr_instance, ?sysUpTime_instance],
- ?line ok = do_simple_get(Node, Addr, Port, Oids1),
+ ?line ok = do_simple_sync_get(Node, Addr, Port, Oids1),
p("issue get-request after first loading the mibs"),
?line ok = mgr_user_load_mib(Node, std_mib()),
Oids2 = [[sysObjectID, 0], [sysDescr, 0], [sysUpTime, 0]],
- ?line ok = do_simple_get(Node, Addr, Port, Oids2),
+ ?line ok = do_simple_sync_get(Node, Addr, Port, Oids2),
ok.
-do_simple_get(Node, Addr, Port, Oids) ->
+do_simple_sync_get(Node, Addr, Port, Oids) ->
?line {ok, Reply, Rem} = mgr_user_sync_get(Node, Addr, Port, Oids),
?DBG("~n Reply: ~p"
@@ -1360,14 +1606,22 @@ do_simple_get(Node, Addr, Port, Oids) ->
%%======================================================================
-simple_sync_get2(doc) -> ["Simple sync get-request - New style (TargetName)"];
+simple_sync_get2(doc) ->
+ ["Simple sync get-request - Version 2 API (TargetName)"];
simple_sync_get2(suite) -> [];
simple_sync_get2(Config) when is_list(Config) ->
process_flag(trap_exit, true),
put(tname, ssg2),
- do_simple_get(Config).
+ do_simple_sync_get2(Config).
-do_simple_get(Config) ->
+do_simple_sync_get2(Config) ->
+ Get = fun(Node, TargetName, Oids) ->
+ mgr_user_sync_get(Node, TargetName, Oids)
+ end,
+ PostVerify = fun() -> ok end,
+ do_simple_sync_get2(Config, Get, PostVerify).
+
+do_simple_sync_get2(Config, Get, PostVerify) ->
p("starting with Config: ~p~n", [Config]),
Node = ?config(manager_node, Config),
@@ -1375,20 +1629,21 @@ do_simple_get(Config) ->
p("issue get-request without loading the mib"),
Oids1 = [?sysObjectID_instance, ?sysDescr_instance, ?sysUpTime_instance],
- ?line ok = do_simple_get(Node, TargetName, Oids1),
+ ?line ok = do_simple_sync_get2(Node, TargetName, Oids1, Get, PostVerify),
p("issue get-request after first loading the mibs"),
?line ok = mgr_user_load_mib(Node, std_mib()),
Oids2 = [[sysObjectID, 0], [sysDescr, 0], [sysUpTime, 0]],
- ?line ok = do_simple_get(Node, TargetName, Oids2),
+ ?line ok = do_simple_sync_get2(Node, TargetName, Oids2, Get, PostVerify),
ok.
-
-do_simple_get(Node, TargetName, Oids) ->
- ?line {ok, Reply, Rem} = mgr_user_sync_get(Node, TargetName, Oids),
+
+do_simple_sync_get2(Node, TargetName, Oids, Get, PostVerify)
+ when is_function(Get, 3) andalso is_function(PostVerify, 0) ->
+ ?line {ok, Reply, Rem} = Get(Node, TargetName, Oids),
?DBG("~n Reply: ~p"
"~n Rem: ~w", [Reply, Rem]),
-
+
%% verify that the operation actually worked:
%% The order should be the same, so no need to seach
?line ok = case Reply of
@@ -1403,7 +1658,7 @@ do_simple_get(Node, TargetName, Oids) ->
"~n SysDescr: ~s"
"~n SysUpTime: ~w",
[SysObjectID, SysDescr, SysUpTime]),
- ok;
+ PostVerify();
{noError, 0, Vbs} ->
p("unexpected varbinds: ~n~p", [Vbs]),
{error, {unexpected_vbs, Vbs}};
@@ -1416,6 +1671,38 @@ do_simple_get(Node, TargetName, Oids) ->
%%======================================================================
+simple_sync_get3(doc) ->
+ ["Simple sync get-request - Version 3 API (TargetName and send-opts)"];
+simple_sync_get3(suite) -> [];
+simple_sync_get3(Config) when is_list(Config) ->
+ process_flag(trap_exit, true),
+ put(tname, ssg3),
+ do_simple_sync_get3(Config).
+
+do_simple_sync_get3(Config) ->
+ Self = self(),
+ Msg = simple_sync_get3,
+ Fun = fun() -> Self ! Msg end,
+ Extra = {?SNMPM_EXTRA_INFO_TAG, Fun},
+ SendOpts =
+ [
+ {extra, Extra}
+ ],
+ Get = fun(Node, TargetName, Oids) ->
+ mgr_user_sync_get2(Node, TargetName, Oids, SendOpts)
+ end,
+ PostVerify =
+ fun() ->
+ receive
+ Msg ->
+ ok
+ end
+ end,
+ do_simple_sync_get2(Config, Get, PostVerify).
+
+
+%%======================================================================
+
simple_async_get1(doc) -> ["Simple (async) get-request - "
"Old style (Addr & Port)"];
simple_async_get1(suite) -> [];
@@ -1435,40 +1722,41 @@ simple_async_get1(Config) when is_list(Config) ->
?line ok = agent_load_mib(AgentNode, Test2Mib),
Exec = fun(Data) ->
- async_g_exec1(MgrNode, Addr, Port, Data)
+ async_g_exec1(MgrNode, Addr, Port, Data)
end,
- Requests = [
- { 1,
- [?sysObjectID_instance],
- Exec,
- fun(X) -> sag_verify(X, [?sysObjectID_instance]) end},
- { 2,
- [?sysDescr_instance, ?sysUpTime_instance],
- Exec,
- fun(X) ->
- sag_verify(X, [?sysObjectID_instance,
- ?sysUpTime_instance])
- end},
- { 3,
- [[sysObjectID, 0], [sysDescr, 0], [sysUpTime, 0]],
- Exec,
- fun(X) ->
- sag_verify(X, [?sysObjectID_instance,
- ?sysDescr_instance,
- ?sysUpTime_instance])
- end},
- { 4,
- [?sysObjectID_instance,
- ?sysDescr_instance,
- ?sysUpTime_instance],
- Exec,
- fun(X) ->
- sag_verify(X, [?sysObjectID_instance,
- ?sysDescr_instance,
- ?sysUpTime_instance])
- end}
- ],
+ Requests =
+ [
+ { 1,
+ [?sysObjectID_instance],
+ Exec,
+ fun(X) -> sag_verify(X, [?sysObjectID_instance]) end },
+ { 2,
+ [?sysDescr_instance, ?sysUpTime_instance],
+ Exec,
+ fun(X) ->
+ sag_verify(X, [?sysObjectID_instance,
+ ?sysUpTime_instance])
+ end },
+ { 3,
+ [[sysObjectID, 0], [sysDescr, 0], [sysUpTime, 0]],
+ Exec,
+ fun(X) ->
+ sag_verify(X, [?sysObjectID_instance,
+ ?sysDescr_instance,
+ ?sysUpTime_instance])
+ end },
+ { 4,
+ [?sysObjectID_instance,
+ ?sysDescr_instance,
+ ?sysUpTime_instance],
+ Exec,
+ fun(X) ->
+ sag_verify(X, [?sysObjectID_instance,
+ ?sysDescr_instance,
+ ?sysUpTime_instance])
+ end }
+ ],
p("manager info when starting test: ~n~p", [mgr_info(MgrNode)]),
p("agent info when starting test: ~n~p", [agent_info(AgentNode)]),
@@ -1516,66 +1804,76 @@ sag_verify_vbs([Vb|_], [E|_]) ->
%%======================================================================
-simple_async_get2(doc) -> ["Simple (async) get-request - "
- "New style (TargetName)"];
+simple_async_get2(doc) ->
+ ["Simple (async) get-request - Version 2 API (TargetName)"];
simple_async_get2(suite) -> [];
simple_async_get2(Config) when is_list(Config) ->
process_flag(trap_exit, true),
put(tname, sag2),
p("starting with Config: ~p~n", [Config]),
-
MgrNode = ?config(manager_node, Config),
AgentNode = ?config(agent_node, Config),
TargetName = ?config(manager_agent_target_name, Config),
+ Get = fun(Oids) -> async_g_exec2(MgrNode, TargetName, Oids) end,
+ PostVerify = fun(Res) -> Res end,
+ do_simple_async_sync_get2(Config, MgrNode, AgentNode, Get, PostVerify).
+do_simple_async_sync_get2(Config, MgrNode, AgentNode, Get, PostVerify) ->
?line ok = mgr_user_load_mib(MgrNode, std_mib()),
Test2Mib = test2_mib(Config),
?line ok = mgr_user_load_mib(MgrNode, Test2Mib),
?line ok = agent_load_mib(AgentNode, Test2Mib),
-
- Exec = fun(Data) ->
- async_g_exec2(MgrNode, TargetName, Data)
- end,
-
- Requests = [
- { 1,
- [?sysObjectID_instance],
- Exec,
- fun(X) -> sag_verify(X, [?sysObjectID_instance]) end},
- { 2,
- [?sysDescr_instance, ?sysUpTime_instance],
- Exec,
- fun(X) ->
- sag_verify(X, [?sysObjectID_instance,
- ?sysUpTime_instance])
- end},
- { 3,
- [[sysObjectID, 0], [sysDescr, 0], [sysUpTime, 0]],
- Exec,
- fun(X) ->
- sag_verify(X, [?sysObjectID_instance,
- ?sysDescr_instance,
- ?sysUpTime_instance])
- end},
- { 4,
- [?sysObjectID_instance,
- ?sysDescr_instance,
- ?sysUpTime_instance],
- Exec,
- fun(X) ->
- sag_verify(X, [?sysObjectID_instance,
- ?sysDescr_instance,
- ?sysUpTime_instance])
- end}
- ],
+ do_simple_async_sync_get2(fun() -> mgr_info(MgrNode) end,
+ fun() -> agent_info(AgentNode) end,
+ Get, PostVerify).
+
+do_simple_async_sync_get2(MgrInfo, AgentInfo, Get, PostVerify)
+ when is_function(MgrInfo, 0) andalso
+ is_function(AgentInfo, 0) andalso
+ is_function(Get, 1) andalso
+ is_function(PostVerify, 1) ->
+ Requests =
+ [
+ { 1,
+ [?sysObjectID_instance],
+ Get,
+ fun(X) ->
+ PostVerify(sag_verify(X, [?sysObjectID_instance])) end},
+ { 2,
+ [?sysDescr_instance, ?sysUpTime_instance],
+ Get,
+ fun(X) ->
+ PostVerify(sag_verify(X, [?sysObjectID_instance,
+ ?sysUpTime_instance]))
+ end},
+ { 3,
+ [[sysObjectID, 0], [sysDescr, 0], [sysUpTime, 0]],
+ Get,
+ fun(X) ->
+ PostVerify(sag_verify(X, [?sysObjectID_instance,
+ ?sysDescr_instance,
+ ?sysUpTime_instance]))
+
+ end},
+ { 4,
+ [?sysObjectID_instance,
+ ?sysDescr_instance,
+ ?sysUpTime_instance],
+ Get,
+ fun(X) ->
+ PostVerify(sag_verify(X, [?sysObjectID_instance,
+ ?sysDescr_instance,
+ ?sysUpTime_instance]))
+ end}
+ ],
- p("manager info when starting test: ~n~p", [mgr_info(MgrNode)]),
- p("agent info when starting test: ~n~p", [agent_info(AgentNode)]),
+ p("manager info when starting test: ~n~p", [MgrInfo()]),
+ p("agent info when starting test: ~n~p", [AgentInfo()]),
?line ok = async_exec(Requests, []),
- p("manager info when ending test: ~n~p", [mgr_info(MgrNode)]),
- p("agent info when ending test: ~n~p", [agent_info(AgentNode)]),
+ p("manager info when ending test: ~n~p", [MgrInfo()]),
+ p("agent info when ending test: ~n~p", [AgentInfo()]),
ok.
@@ -1585,6 +1883,36 @@ async_g_exec2(Node, TargetName, Oids) ->
%%======================================================================
+simple_async_get3(doc) ->
+ ["Simple (async) get-request - Version 3 API (TargetName and send-opts)"];
+simple_async_get3(suite) -> [];
+simple_async_get3(Config) when is_list(Config) ->
+ process_flag(trap_exit, true),
+ put(tname, sag3),
+ p("starting with Config: ~p~n", [Config]),
+ MgrNode = ?config(manager_node, Config),
+ AgentNode = ?config(agent_node, Config),
+ TargetName = ?config(manager_agent_target_name, Config),
+ Self = self(),
+ Msg = simple_async_get3,
+ Fun = fun() -> Self ! Msg end,
+ Extra = {?SNMPM_EXTRA_INFO_TAG, Fun},
+ SendOpts =
+ [
+ {extra, Extra}
+ ],
+ Get = fun(Oids) -> async_g_exec3(MgrNode, TargetName, Oids, SendOpts) end,
+ PostVerify = fun(ok) -> receive Msg -> ok end;
+ (Error) -> Error
+ end,
+ do_simple_async_sync_get2(Config, MgrNode, AgentNode, Get, PostVerify).
+
+async_g_exec3(Node, TargetName, Oids, SendOpts) ->
+ mgr_user_async_get2(Node, TargetName, Oids, SendOpts).
+
+
+%%======================================================================
+
simple_sync_get_next1(doc) -> ["Simple (sync) get_next-request - "
"Old style (Addr & Port)"];
simple_sync_get_next1(suite) -> [];
@@ -1722,23 +2050,33 @@ check_ssgn_vbs([Vb|_], [E|_]) ->
%%======================================================================
-simple_sync_get_next2(doc) -> ["Simple (sync) get_next-request - "
- "New style (TargetName)"];
+simple_sync_get_next2(doc) ->
+ ["Simple (sync) get_next-request - Version 2 API (TargetName)"];
simple_sync_get_next2(suite) -> [];
simple_sync_get_next2(Config) when is_list(Config) ->
process_flag(trap_exit, true),
- put(tname, ssgn),
+ put(tname, ssgn2),
p("starting with Config: ~p~n", [Config]),
- MgrNode = ?config(manager_node, Config),
- AgentNode = ?config(agent_node, Config),
+ GetNext = fun(Node, TargetName, Oids) ->
+ mgr_user_sync_get_next(Node, TargetName, Oids)
+ end,
+ PostVerify = fun(Res) -> Res end,
+ do_simple_sync_get_next2(Config, GetNext, PostVerify).
+
+do_simple_sync_get_next2(Config, GetNext, PostVerify)
+ when is_function(GetNext, 3) andalso is_function(PostVerify, 1) ->
+
+ MgrNode = ?config(manager_node, Config),
+ AgentNode = ?config(agent_node, Config),
TargetName = ?config(manager_agent_target_name, Config),
%% -- 1 --
Oids01 = [[1,3,7,1]],
VF01 = fun(X) -> verify_ssgn_reply1(X, [{[1,3,7,1],endOfMibView}]) end,
?line ok = do_simple_get_next(1,
- MgrNode, TargetName, Oids01, VF01),
+ MgrNode, TargetName, Oids01, VF01,
+ GetNext, PostVerify),
?line ok = mgr_user_load_mib(MgrNode, std_mib()),
@@ -1748,7 +2086,8 @@ simple_sync_get_next2(Config) when is_list(Config) ->
verify_ssgn_reply1(X, [?sysDescr_instance, endOfMibView])
end,
?line ok = do_simple_get_next(2,
- MgrNode, TargetName, Oids02, VF02),
+ MgrNode, TargetName, Oids02, VF02,
+ GetNext, PostVerify),
Test2Mib = test2_mib(Config),
?line ok = mgr_user_load_mib(MgrNode, Test2Mib),
@@ -1761,7 +2100,8 @@ simple_sync_get_next2(Config) when is_list(Config) ->
verify_ssgn_reply1(X, [{fl([TCnt2,2]), 100}])
end,
?line ok = do_simple_get_next(3,
- MgrNode, TargetName, Oids03, VF03),
+ MgrNode, TargetName, Oids03, VF03,
+ GetNext, PostVerify),
%% -- 4 --
Oids04 = [[TCnt2, 2]],
@@ -1769,7 +2109,8 @@ simple_sync_get_next2(Config) when is_list(Config) ->
verify_ssgn_reply1(X, [{fl([TCnt2,2]), endOfMibView}])
end,
?line ok = do_simple_get_next(4,
- MgrNode, TargetName, Oids04, VF04),
+ MgrNode, TargetName, Oids04, VF04,
+ GetNext, PostVerify),
%% -- 5 --
?line {ok, [TGenErr1|_]} = mgr_user_name_to_oid(MgrNode, tGenErr1),
@@ -1778,7 +2119,8 @@ simple_sync_get_next2(Config) when is_list(Config) ->
verify_ssgn_reply2(X, {genErr, 1, [TGenErr1]})
end,
?line ok = do_simple_get_next(5,
- MgrNode, TargetName, Oids05, VF05),
+ MgrNode, TargetName, Oids05, VF05,
+ GetNext, PostVerify),
%% -- 6 --
?line {ok, [TGenErr2|_]} = mgr_user_name_to_oid(MgrNode, tGenErr2),
@@ -1787,7 +2129,8 @@ simple_sync_get_next2(Config) when is_list(Config) ->
verify_ssgn_reply2(X, {genErr, 1, [TGenErr2]})
end,
?line ok = do_simple_get_next(6,
- MgrNode, TargetName, Oids06, VF06),
+ MgrNode, TargetName, Oids06, VF06,
+ GetNext, PostVerify),
%% -- 7 --
?line {ok, [TGenErr3|_]} = mgr_user_name_to_oid(MgrNode, tGenErr3),
@@ -1797,7 +2140,8 @@ simple_sync_get_next2(Config) when is_list(Config) ->
[?sysDescr, TGenErr3]})
end,
?line ok = do_simple_get_next(7,
- MgrNode, TargetName, Oids07, VF07),
+ MgrNode, TargetName, Oids07, VF07,
+ GetNext, PostVerify),
%% -- 8 --
?line {ok, [TTooBig|_]} = mgr_user_name_to_oid(MgrNode, tTooBig),
@@ -1806,18 +2150,19 @@ simple_sync_get_next2(Config) when is_list(Config) ->
verify_ssgn_reply2(X, {tooBig, 0, []})
end,
?line ok = do_simple_get_next(8,
- MgrNode, TargetName, Oids08, VF08),
+ MgrNode, TargetName, Oids08, VF08,
+ GetNext, PostVerify),
ok.
-do_simple_get_next(N, Node, TargetName, Oids, Verify) ->
+do_simple_get_next(N, Node, TargetName, Oids, Verify, GetNext, PostVerify) ->
p("issue get-next command ~w", [N]),
- case mgr_user_sync_get_next(Node, TargetName, Oids) of
+ case GetNext(Node, TargetName, Oids) of
{ok, Reply, Rem} ->
?DBG("get-next ok:"
"~n Reply: ~p"
"~n Rem: ~w", [Reply, Rem]),
- Verify(Reply);
+ PostVerify(Verify(Reply));
Error ->
{error, {unexpected_reply, Error}}
@@ -1826,6 +2171,33 @@ do_simple_get_next(N, Node, TargetName, Oids, Verify) ->
%%======================================================================
+simple_sync_get_next3(doc) ->
+ ["Simple (sync) get_next-request - "
+ "Version 3 API (TargetName with send-opts)"];
+simple_sync_get_next3(suite) -> [];
+simple_sync_get_next3(Config) when is_list(Config) ->
+ process_flag(trap_exit, true),
+ put(tname, ssgn3),
+ p("starting with Config: ~p~n", [Config]),
+ Self = self(),
+ Msg = simple_sync_get_next3,
+ Fun = fun() -> Self ! Msg end,
+ Extra = {?SNMPM_EXTRA_INFO_TAG, Fun},
+ SendOpts =
+ [
+ {extra, Extra}
+ ],
+ GetNext = fun(Node, TargetName, Oids) ->
+ mgr_user_sync_get_next2(Node, TargetName, Oids, SendOpts)
+ end,
+ PostVerify = fun(ok) -> receive Msg -> ok end;
+ (Error) -> Error
+ end,
+ do_simple_sync_get_next2(Config, GetNext, PostVerify).
+
+
+%%======================================================================
+
simple_async_get_next1(doc) -> ["Simple (async) get_next-request - "
"Old style (Addr & Port)"];
simple_async_get_next1(suite) -> [];
@@ -1923,8 +2295,8 @@ async_gn_exec1(Node, Addr, Port, Oids) ->
%%======================================================================
-simple_async_get_next2(doc) -> ["Simple (async) get_next-request - "
- "New style (TargetName)"];
+simple_async_get_next2(doc) ->
+ ["Simple (async) get_next-request - Version 2 API (TargetName)"];
simple_async_get_next2(suite) -> [];
simple_async_get_next2(Config) when is_list(Config) ->
process_flag(trap_exit, true),
@@ -1939,11 +2311,14 @@ simple_async_get_next2(Config) when is_list(Config) ->
Test2Mib = test2_mib(Config),
?line ok = mgr_user_load_mib(MgrNode, Test2Mib),
?line ok = agent_load_mib(AgentNode, Test2Mib),
-
- Exec = fun(X) ->
- async_gn_exec2(MgrNode, TargetName, X)
- end,
-
+ GetNext = fun(Oids) ->
+ async_gn_exec2(MgrNode, TargetName, Oids)
+ end,
+ PostVerify = fun(Res) -> Res end,
+ do_simple_async_get_next2(MgrNode, AgentNode, GetNext, PostVerify).
+
+do_simple_async_get_next2(MgrNode, AgentNode, GetNext, PostVerify)
+ when is_function(GetNext, 1) andalso is_function(PostVerify, 1) ->
?line {ok, [TCnt2|_]} = mgr_user_name_to_oid(MgrNode, tCnt2),
?line {ok, [TGenErr1|_]} = mgr_user_name_to_oid(MgrNode, tGenErr1),
?line {ok, [TGenErr2|_]} = mgr_user_name_to_oid(MgrNode, tGenErr2),
@@ -1954,51 +2329,60 @@ simple_async_get_next2(Config) when is_list(Config) ->
[
{1,
[[1,3,7,1]],
- Exec,
+ GetNext,
fun(X) ->
- verify_ssgn_reply1(X, [{[1,3,7,1], endOfMibView}])
+ PostVerify(
+ verify_ssgn_reply1(X, [{[1,3,7,1], endOfMibView}]))
+
end},
{2,
[[sysDescr], [1,3,7,1]],
- Exec,
+ GetNext,
fun(X) ->
- verify_ssgn_reply1(X, [?sysDescr_instance, endOfMibView])
+ PostVerify(
+ verify_ssgn_reply1(X, [?sysDescr_instance, endOfMibView]))
end},
{3,
[[TCnt2, 1]],
- Exec,
+ GetNext,
fun(X) ->
- verify_ssgn_reply1(X, [{fl([TCnt2,2]), 100}])
+ PostVerify(
+ verify_ssgn_reply1(X, [{fl([TCnt2,2]), 100}]))
end},
{4,
[[TCnt2, 2]],
- Exec,
+ GetNext,
fun(X) ->
- verify_ssgn_reply1(X, [{fl([TCnt2,2]), endOfMibView}])
+ PostVerify(
+ verify_ssgn_reply1(X, [{fl([TCnt2,2]), endOfMibView}]))
end},
{5,
[TGenErr1],
- Exec,
+ GetNext,
fun(X) ->
- verify_ssgn_reply2(X, {genErr, 1, [TGenErr1]})
+ PostVerify(
+ verify_ssgn_reply2(X, {genErr, 1, [TGenErr1]}))
end},
{6,
[TGenErr2],
- Exec,
+ GetNext,
fun(X) ->
- verify_ssgn_reply2(X, {genErr, 1, [TGenErr2]})
+ PostVerify(
+ verify_ssgn_reply2(X, {genErr, 1, [TGenErr2]}))
end},
{7,
[[sysDescr], TGenErr3],
- Exec,
+ GetNext,
fun(X) ->
- verify_ssgn_reply2(X, {genErr, 2, [TGenErr3]})
+ PostVerify(
+ verify_ssgn_reply2(X, {genErr, 2, [TGenErr3]}))
end},
{8,
[TTooBig],
- Exec,
+ GetNext,
fun(X) ->
- verify_ssgn_reply2(X, {tooBig, 0, []})
+ PostVerify(
+ verify_ssgn_reply2(X, {tooBig, 0, []}))
end}
],
@@ -2019,6 +2403,48 @@ async_gn_exec2(Node, TargetName, Oids) ->
%%======================================================================
+simple_async_get_next3(doc) ->
+ ["Simple (async) get_next-request - "
+ "Version 3 API (TargetName with send-opts)"];
+simple_async_get_next3(suite) -> [];
+simple_async_get_next3(Config) when is_list(Config) ->
+ process_flag(trap_exit, true),
+ put(tname, ssgn2),
+ p("starting with Config: ~p~n", [Config]),
+
+ MgrNode = ?config(manager_node, Config),
+ AgentNode = ?config(agent_node, Config),
+ TargetName = ?config(manager_agent_target_name, Config),
+
+ ?line ok = mgr_user_load_mib(MgrNode, std_mib()),
+ Test2Mib = test2_mib(Config),
+ ?line ok = mgr_user_load_mib(MgrNode, Test2Mib),
+ ?line ok = agent_load_mib(AgentNode, Test2Mib),
+
+ Self = self(),
+ Msg = simple_async_get_next3,
+ Fun = fun() -> Self ! Msg end,
+ Extra = {?SNMPM_EXTRA_INFO_TAG, Fun},
+ SendOpts =
+ [
+ {extra, Extra}
+ ],
+
+ GetNext = fun(Oids) ->
+ async_gn_exec3(MgrNode, TargetName, Oids, SendOpts)
+ end,
+ PostVerify = fun(ok) -> receive Msg -> ok end;
+ (Error) -> Error
+ end,
+
+ do_simple_async_get_next2(MgrNode, AgentNode, GetNext, PostVerify).
+
+async_gn_exec3(Node, TargetName, Oids, SendOpts) ->
+ mgr_user_async_get_next2(Node, TargetName, Oids, SendOpts).
+
+
+%%======================================================================
+
simple_sync_set1(doc) -> ["Simple (sync) set-request - "
"Old style (Addr & Port)"];
simple_sync_set1(suite) -> [];
@@ -2088,14 +2514,25 @@ value_of_vavs([{_Oid, Val}|VAVs], Acc) ->
%%======================================================================
-simple_sync_set2(doc) -> ["Simple (sync) set-request - New style (TargetName)"];
+simple_sync_set2(doc) ->
+ ["Simple (sync) set-request - Version 2 API (TargetName)"];
simple_sync_set2(suite) -> [];
simple_sync_set2(Config) when is_list(Config) ->
process_flag(trap_exit, true),
put(tname, sss2),
p("starting with Config: ~p~n", [Config]),
- Node = ?config(manager_node, Config),
+ Set = fun(Node, TargetName, VAVs) ->
+ mgr_user_sync_set(Node, TargetName, VAVs)
+ end,
+ PostVerify = fun() -> ok end,
+
+ do_simple_sync_set2(Config, Set, PostVerify).
+
+do_simple_sync_set2(Config, Set, PostVerify)
+ when is_function(Set, 3) andalso is_function(PostVerify, 0) ->
+
+ Node = ?config(manager_node, Config),
TargetName = ?config(manager_agent_target_name, Config),
p("issue set-request without loading the mib"),
@@ -2105,7 +2542,7 @@ simple_sync_set2(Config) when is_list(Config) ->
{?sysName_instance, s, Val11},
{?sysLocation_instance, s, Val12}
],
- ?line ok = do_simple_set2(Node, TargetName, VAVs1),
+ ?line ok = do_simple_set2(Node, TargetName, VAVs1, Set, PostVerify),
p("issue set-request after first loading the mibs"),
?line ok = mgr_user_load_mib(Node, std_mib()),
@@ -2115,12 +2552,12 @@ simple_sync_set2(Config) when is_list(Config) ->
{[sysName, 0], Val21},
{[sysLocation, 0], Val22}
],
- ?line ok = do_simple_set2(Node, TargetName, VAVs2),
+ ?line ok = do_simple_set2(Node, TargetName, VAVs2, Set, PostVerify),
ok.
-do_simple_set2(Node, TargetName, VAVs) ->
+do_simple_set2(Node, TargetName, VAVs, Set, PostVerify) ->
[SysName, SysLoc] = value_of_vavs(VAVs),
- ?line {ok, Reply, Rem} = mgr_user_sync_set(Node, TargetName, VAVs),
+ ?line {ok, Reply, Rem} = Set(Node, TargetName, VAVs),
?DBG("~n Reply: ~p"
"~n Rem: ~w", [Reply, Rem]),
@@ -2133,7 +2570,7 @@ do_simple_set2(Node, TargetName, VAVs) ->
value = SysName},
#varbind{oid = ?sysLocation_instance,
value = SysLoc}]} ->
- ok;
+ PostVerify();
{noError, 0, Vbs} ->
{error, {unexpected_vbs, Vbs}};
Else ->
@@ -2145,6 +2582,33 @@ do_simple_set2(Node, TargetName, VAVs) ->
%%======================================================================
+simple_sync_set3(doc) ->
+ ["Simple (sync) set-request - Version 3 API (TargetName with send-opts)"];
+simple_sync_set3(suite) -> [];
+simple_sync_set3(Config) when is_list(Config) ->
+ process_flag(trap_exit, true),
+ put(tname, sss3),
+ p("starting with Config: ~p~n", [Config]),
+
+ Self = self(),
+ Msg = simple_sync_set3,
+ Fun = fun() -> Self ! Msg end,
+ Extra = {?SNMPM_EXTRA_INFO_TAG, Fun},
+ SendOpts =
+ [
+ {extra, Extra}
+ ],
+
+ Set = fun(Node, TargetName, VAVs) ->
+ mgr_user_sync_set2(Node, TargetName, VAVs, SendOpts)
+ end,
+ PostVerify = fun() -> receive Msg -> ok end end,
+
+ do_simple_sync_set2(Config, Set, PostVerify).
+
+
+%%======================================================================
+
simple_async_set1(doc) -> ["Simple (async) set-request - "
"Old style (Addr & Port)"];
simple_async_set1(suite) -> [];
@@ -2237,8 +2701,8 @@ sas_verify_vbs([Vb|_], [E|_]) ->
%%======================================================================
-simple_async_set2(doc) -> ["Simple (async) set-request - "
- "New style (TargetName)"];
+simple_async_set2(doc) ->
+ ["Simple (async) set-request - Version 2 API (TargetName)"];
simple_async_set2(suite) -> [];
simple_async_set2(Config) when is_list(Config) ->
process_flag(trap_exit, true),
@@ -2254,31 +2718,40 @@ simple_async_set2(Config) when is_list(Config) ->
?line ok = mgr_user_load_mib(MgrNode, Test2Mib),
?line ok = agent_load_mib(AgentNode, Test2Mib),
- Exec = fun(X) ->
- async_s_exec2(MgrNode, TargetName, X)
- end,
+ Set =
+ fun(Oids) ->
+ async_s_exec2(MgrNode, TargetName, Oids)
+ end,
+ PostVerify = fun(Res) -> Res end,
+
+ do_simple_async_set2(MgrNode, AgentNode, Set, PostVerify).
+do_simple_async_set2(MgrNode, AgentNode, Set, PostVerify) ->
Requests =
[
{1,
[{?sysName_instance, s, "Arne Anka"}],
- Exec,
+ Set,
fun(X) ->
- sas_verify(X, [?sysName_instance])
+ PostVerify(sas_verify(X, [?sysName_instance]))
end},
{2,
[{?sysLocation_instance, s, "Stockholm"},
{?sysName_instance, s, "Arne Anka"}],
- Exec,
+ Set,
fun(X) ->
- sas_verify(X, [?sysLocation_instance, ?sysName_instance])
+ PostVerify(sas_verify(X,
+ [?sysLocation_instance,
+ ?sysName_instance]))
end},
{3,
[{[sysName, 0], "Gothenburg"},
{[sysLocation, 0], "Sune Anka"}],
- Exec,
+ Set,
fun(X) ->
- sas_verify(X, [?sysName_instance, ?sysLocation_instance])
+ PostVerify(sas_verify(X,
+ [?sysName_instance,
+ ?sysLocation_instance]))
end}
],
@@ -2299,6 +2772,48 @@ async_s_exec2(Node, TargetName, VAVs) ->
%%======================================================================
+simple_async_set3(doc) ->
+ ["Simple (async) set-request - Version 3 API (TargetName with send-opts)"];
+simple_async_set3(suite) -> [];
+simple_async_set3(Config) when is_list(Config) ->
+ process_flag(trap_exit, true),
+ put(tname, sas3),
+ p("starting with Config: ~p~n", [Config]),
+
+ MgrNode = ?config(manager_node, Config),
+ AgentNode = ?config(agent_node, Config),
+ TargetName = ?config(manager_agent_target_name, Config),
+
+ ?line ok = mgr_user_load_mib(MgrNode, std_mib()),
+ Test2Mib = test2_mib(Config),
+ ?line ok = mgr_user_load_mib(MgrNode, Test2Mib),
+ ?line ok = agent_load_mib(AgentNode, Test2Mib),
+
+ Self = self(),
+ Msg = simple_async_set3,
+ Fun = fun() -> Self ! Msg end,
+ Extra = {?SNMPM_EXTRA_INFO_TAG, Fun},
+ SendOpts =
+ [
+ {extra, Extra}
+ ],
+
+ Set =
+ fun(Oids) ->
+ async_s_exec3(MgrNode, TargetName, Oids, SendOpts)
+ end,
+ PostVerify = fun(ok) -> receive Msg -> ok end;
+ (Res) -> Res
+ end,
+
+ do_simple_async_set2(MgrNode, AgentNode, Set, PostVerify).
+
+async_s_exec3(Node, TargetName, VAVs, SendOpts) ->
+ mgr_user_async_set2(Node, TargetName, VAVs, SendOpts).
+
+
+%%======================================================================
+
simple_sync_get_bulk1(doc) -> ["Simple (sync) get_bulk-request - "
"Old style (Addr & Port)"];
simple_sync_get_bulk1(suite) -> [];
@@ -2470,8 +2985,8 @@ check_ssgb_vbs([R|_], [E|_]) ->
%%======================================================================
-simple_sync_get_bulk2(doc) -> ["Simple (sync) get_bulk-request - "
- "New style (TargetName)"];
+simple_sync_get_bulk2(doc) ->
+ ["Simple (sync) get_bulk-request - Version 2 API (TargetName)"];
simple_sync_get_bulk2(suite) -> [];
simple_sync_get_bulk2(Config) when is_list(Config) ->
process_flag(trap_exit, true),
@@ -2482,20 +2997,33 @@ simple_sync_get_bulk2(Config) when is_list(Config) ->
AgentNode = ?config(agent_node, Config),
TargetName = ?config(manager_agent_target_name, Config),
+ GetBulk =
+ fun(NonRep, MaxRep, Oids) ->
+ mgr_user_sync_get_bulk(MgrNode, TargetName,
+ NonRep, MaxRep, Oids)
+ end,
+ PostVerify = fun(Res) -> Res end,
+
+ do_simple_sync_get_bulk2(Config, MgrNode, AgentNode, GetBulk, PostVerify).
+
+do_simple_sync_get_bulk2(Config, MgrNode, AgentNode, GetBulk, PostVerify) ->
%% -- 1 --
?line ok = do_simple_get_bulk2(1,
- MgrNode, TargetName, 1, 1, [],
- fun verify_ssgb_reply1/1),
+ 1, 1, [],
+ fun verify_ssgb_reply1/1,
+ GetBulk, PostVerify),
%% -- 2 --
?line ok = do_simple_get_bulk2(2,
- MgrNode, TargetName, -1, 1, [],
- fun verify_ssgb_reply1/1),
+ -1, 1, [],
+ fun verify_ssgb_reply1/1,
+ GetBulk, PostVerify),
%% -- 3 --
?line ok = do_simple_get_bulk2(3,
- MgrNode, TargetName, -1, -1, [],
- fun verify_ssgb_reply1/1),
+ -1, -1, [],
+ fun verify_ssgb_reply1/1,
+ GetBulk, PostVerify),
?line ok = mgr_user_load_mib(MgrNode, std_mib()),
%% -- 4 --
@@ -2503,13 +3031,13 @@ simple_sync_get_bulk2(Config) when is_list(Config) ->
verify_ssgb_reply2(X, [?sysDescr_instance, endOfMibView])
end,
?line ok = do_simple_get_bulk2(4,
- MgrNode, TargetName,
- 2, 0, [[sysDescr],[1,3,7,1]], VF04),
+ 2, 0, [[sysDescr],[1,3,7,1]], VF04,
+ GetBulk, PostVerify),
%% -- 5 --
?line ok = do_simple_get_bulk2(5,
- MgrNode, TargetName,
- 1, 2, [[sysDescr],[1,3,7,1]], VF04),
+ 1, 2, [[sysDescr],[1,3,7,1]], VF04,
+ GetBulk, PostVerify),
%% -- 6 --
VF06 = fun(X) ->
@@ -2518,8 +3046,8 @@ simple_sync_get_bulk2(Config) when is_list(Config) ->
?sysObjectID_instance, endOfMibView])
end,
?line ok = do_simple_get_bulk2(6,
- MgrNode, TargetName,
- 0, 2, [[sysDescr],[1,3,7,1]], VF06),
+ 0, 2, [[sysDescr],[1,3,7,1]], VF06,
+ GetBulk, PostVerify),
%% -- 7 --
VF07 = fun(X) ->
@@ -2529,10 +3057,10 @@ simple_sync_get_bulk2(Config) when is_list(Config) ->
?sysObjectID_instance, endOfMibView])
end,
?line ok = do_simple_get_bulk2(7,
- MgrNode, TargetName,
2, 2,
[[sysDescr],[1,3,7,1],[sysDescr],[1,3,7,1]],
- VF07),
+ VF07,
+ GetBulk, PostVerify),
Test2Mib = test2_mib(Config),
?line ok = mgr_user_load_mib(MgrNode, Test2Mib),
@@ -2545,17 +3073,17 @@ simple_sync_get_bulk2(Config) when is_list(Config) ->
?sysDescr_instance])
end,
?line ok = do_simple_get_bulk2(8,
- MgrNode, TargetName,
1, 2,
[[sysDescr],[sysDescr],[tTooBig]],
- VF08),
+ VF08,
+ GetBulk, PostVerify),
%% -- 9 --
?line ok = do_simple_get_bulk2(9,
- MgrNode, TargetName,
1, 12,
[[tDescr2], [sysDescr]],
- fun verify_ssgb_reply1/1),
+ fun verify_ssgb_reply1/1,
+ GetBulk, PostVerify),
%% -- 10 --
VF10 = fun(X) ->
@@ -2566,13 +3094,13 @@ simple_sync_get_bulk2(Config) when is_list(Config) ->
{?sysDescr, 'NULL'}])
end,
?line ok = do_simple_get_bulk2(10,
- MgrNode, TargetName,
2, 2,
[[sysDescr],
[sysObjectID],
[tGenErr1],
[sysDescr]],
- VF10),
+ VF10,
+ GetBulk, PostVerify),
%% -- 11 --
?line {ok, [TCnt2|_]} = mgr_user_name_to_oid(MgrNode, tCnt2),
@@ -2583,20 +3111,25 @@ simple_sync_get_bulk2(Config) when is_list(Config) ->
{fl([TCnt2,2]), endOfMibView}])
end,
?line ok = do_simple_get_bulk2(11,
- MgrNode, TargetName,
0, 2,
- [[TCnt2, 1]], VF11),
+ [[TCnt2, 1]], VF11,
+ GetBulk, PostVerify),
ok.
-do_simple_get_bulk2(N, Node, TargetName, NonRep, MaxRep, Oids, Verify) ->
+do_simple_get_bulk2(N,
+ NonRep, MaxRep, Oids,
+ Verify, GetBulk, PostVerify)
+ when is_function(Verify, 1) andalso
+ is_function(GetBulk, 3) andalso
+ is_function(PostVerify) ->
p("issue get-bulk command ~w", [N]),
- case mgr_user_sync_get_bulk(Node, TargetName, NonRep, MaxRep, Oids) of
+ case GetBulk(NonRep, MaxRep, Oids) of
{ok, Reply, Rem} ->
?DBG("get-bulk ok:"
"~n Reply: ~p"
"~n Rem: ~w", [Reply, Rem]),
- Verify(Reply);
+ PostVerify(Verify(Reply));
Error ->
{error, {unexpected_reply, Error}}
@@ -2605,6 +3138,42 @@ do_simple_get_bulk2(N, Node, TargetName, NonRep, MaxRep, Oids, Verify) ->
%%======================================================================
+simple_sync_get_bulk3(doc) ->
+ ["Simple (sync) get_bulk-request - "
+ "Version 3 API (TargetName with send-opts)"];
+simple_sync_get_bulk3(suite) -> [];
+simple_sync_get_bulk3(Config) when is_list(Config) ->
+ process_flag(trap_exit, true),
+ put(tname, ssgb3),
+ p("starting with Config: ~p~n", [Config]),
+
+ MgrNode = ?config(manager_node, Config),
+ AgentNode = ?config(agent_node, Config),
+ TargetName = ?config(manager_agent_target_name, Config),
+
+ Self = self(),
+ Msg = simple_async_set3,
+ Fun = fun() -> Self ! Msg end,
+ Extra = {?SNMPM_EXTRA_INFO_TAG, Fun},
+ SendOpts =
+ [
+ {extra, Extra}
+ ],
+
+ GetBulk =
+ fun(NonRep, MaxRep, Oids) ->
+ mgr_user_sync_get_bulk2(MgrNode, TargetName,
+ NonRep, MaxRep, Oids, SendOpts)
+ end,
+ PostVerify = fun(ok) -> receive Msg -> ok end;
+ (Res) -> Res
+ end,
+
+ do_simple_sync_get_bulk2(Config, MgrNode, AgentNode, GetBulk, PostVerify).
+
+
+%%======================================================================
+
simple_async_get_bulk1(doc) -> ["Simple (async) get_bulk-request - "
"Old style (Addr & Port)"];
simple_async_get_bulk1(suite) -> [];
@@ -2748,8 +3317,8 @@ async_gb_exec1(Node, Addr, Port, {NR, MR, Oids}) ->
%%======================================================================
-simple_async_get_bulk2(doc) -> ["Simple (async) get_bulk-request - "
- "New style (TargetName)"];
+simple_async_get_bulk2(doc) ->
+ ["Simple (async) get_bulk-request - Version 2 API (TargetName)"];
simple_async_get_bulk2(suite) -> [];
simple_async_get_bulk2(Config) when is_list(Config) ->
process_flag(trap_exit, true),
@@ -2765,111 +3334,122 @@ simple_async_get_bulk2(Config) when is_list(Config) ->
?line ok = mgr_user_load_mib(MgrNode, Test2Mib),
?line ok = agent_load_mib(AgentNode, Test2Mib),
- Exec = fun(Data) ->
- async_gb_exec2(MgrNode, TargetName, Data)
- end,
+ GetBulk =
+ fun(Data) ->
+ async_gb_exec2(MgrNode, TargetName, Data)
+ end,
+ PostVerify = fun(Res) -> Res end,
+
+ do_simple_async_get_bulk2(MgrNode, AgentNode, GetBulk, PostVerify).
+do_simple_async_get_bulk2(MgrNode, AgentNode, GetBulk, PostVerify) ->
%% We re-use the verification functions from the ssgb test-case
VF04 = fun(X) ->
- verify_ssgb_reply2(X, [?sysDescr_instance, endOfMibView])
+ PostVerify(
+ verify_ssgb_reply2(X, [?sysDescr_instance, endOfMibView]))
end,
VF06 = fun(X) ->
- verify_ssgb_reply2(X,
- [?sysDescr_instance, endOfMibView,
- ?sysObjectID_instance, endOfMibView])
+ PostVerify(
+ verify_ssgb_reply2(X,
+ [?sysDescr_instance, endOfMibView,
+ ?sysObjectID_instance, endOfMibView]))
end,
VF07 = fun(X) ->
- verify_ssgb_reply2(X,
- [?sysDescr_instance, endOfMibView,
- ?sysDescr_instance, endOfMibView,
- ?sysObjectID_instance, endOfMibView])
+ PostVerify(
+ verify_ssgb_reply2(X,
+ [?sysDescr_instance, endOfMibView,
+ ?sysDescr_instance, endOfMibView,
+ ?sysObjectID_instance, endOfMibView]))
end,
VF08 = fun(X) ->
- verify_ssgb_reply2(X,
- [?sysDescr_instance,
- ?sysDescr_instance])
+ PostVerify(
+ verify_ssgb_reply2(X,
+ [?sysDescr_instance,
+ ?sysDescr_instance]))
end,
VF10 = fun(X) ->
- verify_ssgb_reply3(X,
- [{?sysDescr, 'NULL'},
- {?sysObjectID, 'NULL'},
- {?tGenErr1, 'NULL'},
- {?sysDescr, 'NULL'}])
+ PostVerify(
+ verify_ssgb_reply3(X,
+ [{?sysDescr, 'NULL'},
+ {?sysObjectID, 'NULL'},
+ {?tGenErr1, 'NULL'},
+ {?sysDescr, 'NULL'}]))
end,
?line {ok, [TCnt2|_]} = mgr_user_name_to_oid(MgrNode, tCnt2),
VF11 = fun(X) ->
- verify_ssgb_reply2(X,
- [{fl([TCnt2,2]), 100},
- {fl([TCnt2,2]), endOfMibView}])
+ PostVerify(
+ verify_ssgb_reply2(X,
+ [{fl([TCnt2,2]), 100},
+ {fl([TCnt2,2]), endOfMibView}]))
end,
Requests = [
{ 1,
{1, 1, []},
- Exec,
- fun verify_ssgb_reply1/1},
+ GetBulk,
+ fun(X) -> PostVerify(verify_ssgb_reply1(X)) end},
{ 2,
{-1, 1, []},
- Exec,
- fun verify_ssgb_reply1/1},
+ GetBulk,
+ fun(X) -> PostVerify(verify_ssgb_reply1(X)) end},
{ 3,
{-1, -1, []},
- Exec,
- fun verify_ssgb_reply1/1},
+ GetBulk,
+ fun(X) -> PostVerify(verify_ssgb_reply1(X)) end},
{ 4,
{2, 0, [[sysDescr],[1,3,7,1]]},
- Exec,
+ GetBulk,
VF04},
{ 5,
{1, 2, [[sysDescr],[1,3,7,1]]},
- Exec,
+ GetBulk,
VF04},
{ 6,
{0, 2, [[sysDescr],[1,3,7,1]]},
- Exec,
+ GetBulk,
VF06},
{ 7,
{2, 2, [[sysDescr],[1,3,7,1],[sysDescr],[1,3,7,1]]},
- Exec,
+ GetBulk,
VF07},
{ 8,
{1, 2, [[sysDescr],[sysDescr],[tTooBig]]},
- Exec,
+ GetBulk,
VF08},
{ 9,
{1, 12, [[tDescr2], [sysDescr]]},
- Exec,
- fun verify_ssgb_reply1/1},
+ GetBulk,
+ fun(X) -> PostVerify(verify_ssgb_reply1(X)) end},
{10,
{2, 2, [[sysDescr],[sysObjectID], [tGenErr1],[sysDescr]]},
- Exec,
+ GetBulk,
VF10},
{11,
{0, 2, [[TCnt2, 1]]},
- Exec,
+ GetBulk,
VF11},
{12,
{2, 0, [[sysDescr],[1,3,7,1]]},
- Exec,
+ GetBulk,
VF04},
{13,
{1, 12, [[tDescr2], [sysDescr]]},
- Exec,
- fun verify_ssgb_reply1/1},
+ GetBulk,
+ fun(X) -> PostVerify(verify_ssgb_reply1(X)) end},
{14,
{2, 2, [[sysDescr],[sysObjectID],[tGenErr1],[sysDescr]]},
- Exec,
+ GetBulk,
VF10},
{15,
{0, 2, [[TCnt2, 1]]},
- Exec,
+ GetBulk,
VF11},
{16,
{2, 2, [[sysDescr],[1,3,7,1],[sysDescr],[1,3,7,1]]},
- Exec,
+ GetBulk,
VF07},
{17,
{2, 2, [[sysDescr],[sysObjectID], [tGenErr1],[sysDescr]]},
- Exec,
+ GetBulk,
VF10}
],
@@ -2890,6 +3470,49 @@ async_gb_exec2(Node, TargetName, {NR, MR, Oids}) ->
%%======================================================================
+simple_async_get_bulk3(doc) ->
+ ["Simple (async) get_bulk-request - "
+ "Version 3 API (TargetName with send-opts)"];
+simple_async_get_bulk3(suite) -> [];
+simple_async_get_bulk3(Config) when is_list(Config) ->
+ process_flag(trap_exit, true),
+ put(tname, sagb3),
+ p("starting with Config: ~p~n", [Config]),
+
+ MgrNode = ?config(manager_node, Config),
+ AgentNode = ?config(agent_node, Config),
+ TargetName = ?config(manager_agent_target_name, Config),
+
+ ?line ok = mgr_user_load_mib(MgrNode, std_mib()),
+ Test2Mib = test2_mib(Config),
+ ?line ok = mgr_user_load_mib(MgrNode, Test2Mib),
+ ?line ok = agent_load_mib(AgentNode, Test2Mib),
+
+ Self = self(),
+ Msg = simple_async_get_bulk3,
+ Fun = fun() -> Self ! Msg end,
+ Extra = {?SNMPM_EXTRA_INFO_TAG, Fun},
+ SendOpts =
+ [
+ {extra, Extra}
+ ],
+
+ GetBulk =
+ fun(Data) ->
+ async_gb_exec3(MgrNode, TargetName, Data, SendOpts)
+ end,
+ PostVerify = fun(ok) -> receive Msg -> ok end;
+ (Res) -> Res
+ end,
+
+ do_simple_async_get_bulk2(MgrNode, AgentNode, GetBulk, PostVerify).
+
+async_gb_exec3(Node, TargetName, {NR, MR, Oids}, SendOpts) ->
+ mgr_user_async_get_bulk2(Node, TargetName, NR, MR, Oids, SendOpts).
+
+
+%%======================================================================
+
misc_async1(doc) -> ["Misc (async) request(s) - "
"Old style (Addr & Port)"];
misc_async1(suite) -> [];
@@ -3079,8 +3702,8 @@ misc_async1(Config) when is_list(Config) ->
%%======================================================================
-misc_async2(doc) -> ["Misc (async) request(s) - "
- "New style (TargetName)"];
+misc_async2(doc) ->
+ ["Misc (async) request(s) - Version 2 API (TargetName)"];
misc_async2(suite) -> [];
misc_async2(Config) when is_list(Config) ->
process_flag(trap_exit, true),
@@ -4440,7 +5063,7 @@ otp8395_1(suite) -> [];
otp8395_1(Config) when is_list(Config) ->
process_flag(trap_exit, true),
put(tname, otp8395_1),
- do_simple_get(Config).
+ do_simple_sync_get2(Config).
%%======================================================================
@@ -4986,6 +5609,9 @@ mgr_user_sync_get(Node, Addr_or_TargetName, Oids) ->
mgr_user_sync_get(Node, Addr, Port, Oids) ->
rcall(Node, snmp_manager_user, sync_get, [Addr, Port, Oids]).
+mgr_user_sync_get2(Node, TargetName, Oids, SendOpts) ->
+ rcall(Node, snmp_manager_user, sync_get2, [TargetName, Oids, SendOpts]).
+
%% mgr_user_async_get(Node, Oids) ->
%% mgr_user_async_get(Node, ?LOCALHOST(), ?AGENT_PORT, Oids).
mgr_user_async_get(Node, Addr_or_TargetName, Oids) ->
@@ -4993,6 +5619,9 @@ mgr_user_async_get(Node, Addr_or_TargetName, Oids) ->
mgr_user_async_get(Node, Addr, Port, Oids) ->
rcall(Node, snmp_manager_user, async_get, [Addr, Port, Oids]).
+mgr_user_async_get2(Node, TargetName, Oids, SendOpts) ->
+ rcall(Node, snmp_manager_user, async_get2, [TargetName, Oids, SendOpts]).
+
%% mgr_user_sync_get_next(Node, Oids) ->
%% mgr_user_sync_get_next(Node, ?LOCALHOST(), ?AGENT_PORT, Oids).
mgr_user_sync_get_next(Node, Addr_or_TargetName, Oids) ->
@@ -5000,6 +5629,9 @@ mgr_user_sync_get_next(Node, Addr_or_TargetName, Oids) ->
mgr_user_sync_get_next(Node, Addr, Port, Oids) ->
rcall(Node, snmp_manager_user, sync_get_next, [Addr, Port, Oids]).
+mgr_user_sync_get_next2(Node, TargetName, Oids, SendOpts) ->
+ rcall(Node, snmp_manager_user, sync_get_next2, [TargetName, Oids, SendOpts]).
+
%% mgr_user_async_get_next(Node, Oids) ->
%% mgr_user_async_get_next(Node, ?LOCALHOST(), ?AGENT_PORT, Oids).
mgr_user_async_get_next(Node, Addr_or_TargetName, Oids) ->
@@ -5007,6 +5639,9 @@ mgr_user_async_get_next(Node, Addr_or_TargetName, Oids) ->
mgr_user_async_get_next(Node, Addr, Port, Oids) ->
rcall(Node, snmp_manager_user, async_get_next, [Addr, Port, Oids]).
+mgr_user_async_get_next2(Node, TargetName, Oids, SendOpts) ->
+ rcall(Node, snmp_manager_user, async_get_next2, [TargetName, Oids, SendOpts]).
+
%% mgr_user_sync_set(Node, VAV) ->
%% mgr_user_sync_set(Node, ?LOCALHOST(), ?AGENT_PORT, VAV).
mgr_user_sync_set(Node, Addr_or_TargetName, VAV) ->
@@ -5014,6 +5649,9 @@ mgr_user_sync_set(Node, Addr_or_TargetName, VAV) ->
mgr_user_sync_set(Node, Addr, Port, VAV) ->
rcall(Node, snmp_manager_user, sync_set, [Addr, Port, VAV]).
+mgr_user_sync_set2(Node, TargetName, VAV, SendOpts) ->
+ rcall(Node, snmp_manager_user, sync_set2, [TargetName, VAV, SendOpts]).
+
%% mgr_user_async_set(Node, VAV) ->
%% mgr_user_async_set(Node, ?LOCALHOST(), ?AGENT_PORT, VAV).
mgr_user_async_set(Node, Addr_or_TargetName, VAV) ->
@@ -5021,26 +5659,37 @@ mgr_user_async_set(Node, Addr_or_TargetName, VAV) ->
mgr_user_async_set(Node, Addr, Port, VAV) ->
rcall(Node, snmp_manager_user, async_set, [Addr, Port, VAV]).
+mgr_user_async_set2(Node, TargetName, VAV, SendOpts) ->
+ rcall(Node, snmp_manager_user, async_set2, [TargetName, VAV, SendOpts]).
+
%% mgr_user_sync_get_bulk(Node, NonRep, MaxRep, Oids) ->
%% mgr_user_sync_get_bulk(Node, ?LOCALHOST(), ?AGENT_PORT,
%% NonRep, MaxRep, Oids).
mgr_user_sync_get_bulk(Node, Addr_or_TargetName, NonRep, MaxRep, Oids) ->
rcall(Node, snmp_manager_user, sync_get_bulk,
- [Addr_or_TargetName, NonRep, MaxRep, Oids]).
+ [Addr_or_TargetName, NonRep, MaxRep, Oids]).
mgr_user_sync_get_bulk(Node, Addr, Port, NonRep, MaxRep, Oids) ->
rcall(Node, snmp_manager_user, sync_get_bulk,
[Addr, Port, NonRep, MaxRep, Oids]).
+mgr_user_sync_get_bulk2(Node, TargetName, NonRep, MaxRep, Oids, SendOpts) ->
+ rcall(Node, snmp_manager_user, sync_get_bulk2,
+ [TargetName, NonRep, MaxRep, Oids, SendOpts]).
+
%% mgr_user_async_get_bulk(Node, NonRep, MaxRep, Oids) ->
%% mgr_user_async_get_bulk(Node, ?LOCALHOST(), ?AGENT_PORT,
%% NonRep, MaxRep, Oids).
mgr_user_async_get_bulk(Node, Addr_or_TargetName, NonRep, MaxRep, Oids) ->
rcall(Node, snmp_manager_user, async_get_bulk,
- [Addr_or_TargetName, NonRep, MaxRep, Oids]).
+ [Addr_or_TargetName, NonRep, MaxRep, Oids]).
mgr_user_async_get_bulk(Node, Addr, Port, NonRep, MaxRep, Oids) ->
rcall(Node, snmp_manager_user, async_get_bulk,
[Addr, Port, NonRep, MaxRep, Oids]).
+mgr_user_async_get_bulk2(Node, TargetName, NonRep, MaxRep, Oids, SendOpts) ->
+ rcall(Node, snmp_manager_user, async_get_bulk2,
+ [TargetName, NonRep, MaxRep, Oids, SendOpts]).
+
mgr_user_purify_oid(Node, Oid) ->
rcall(Node, snmp_manager_user, purify_oid, [Oid]).
diff --git a/lib/snmp/test/snmp_manager_user.erl b/lib/snmp/test/snmp_manager_user.erl
index b0e192344d..1b62b04960 100644
--- a/lib/snmp/test/snmp_manager_user.erl
+++ b/lib/snmp/test/snmp_manager_user.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2005-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -50,14 +50,14 @@
update_agent_info/3, update_agent_info/4,
which_all_agents/0, which_own_agents/0,
load_mib/1, unload_mib/1,
- sync_get/1, sync_get/2, sync_get/3,
- async_get/1, async_get/2, async_get/3,
- sync_get_next/1, sync_get_next/2, sync_get_next/3,
- async_get_next/1, async_get_next/2, async_get_next/3,
- sync_set/1, sync_set/2, sync_set/3,
- async_set/1, async_set/2, async_set/3,
- sync_get_bulk/3, sync_get_bulk/4, sync_get_bulk/5,
- async_get_bulk/3, async_get_bulk/4, async_get_bulk/5,
+ sync_get/1, sync_get/2, sync_get/3, sync_get2/3,
+ async_get/1, async_get/2, async_get/3, async_get2/3,
+ sync_get_next/1, sync_get_next/2, sync_get_next/3, sync_get_next2/3,
+ async_get_next/1, async_get_next/2, async_get_next/3, async_get_next2/3,
+ sync_set/1, sync_set/2, sync_set/3, sync_set2/3,
+ async_set/1, async_set/2, async_set/3, async_set2/3,
+ sync_get_bulk/3, sync_get_bulk/4, sync_get_bulk/5, sync_get_bulk2/5,
+ async_get_bulk/3, async_get_bulk/4, async_get_bulk/5, async_get_bulk2/5,
name_to_oid/1, oid_to_name/1,
purify_oid/1
]).
@@ -171,6 +171,10 @@ sync_get(Addr_or_TargetName, Oids) ->
sync_get(Addr, Port, Oids) ->
call({sync_get, Addr, Port, Oids}).
+sync_get2(TargetName, Oids, SendOpts) ->
+ call({sync_get2, TargetName, Oids, SendOpts}).
+
+
%% --
async_get(Oids) ->
@@ -182,6 +186,9 @@ async_get(Addr_or_TargetName, Oids) ->
async_get(Addr, Port, Oids) ->
call({async_get, Addr, Port, Oids}).
+async_get2(TargetName, Oids, SendOpts) ->
+ call({async_get2, TargetName, Oids, SendOpts}).
+
%% --
sync_get_next(Oids) ->
@@ -193,6 +200,9 @@ sync_get_next(Addr_or_TargetName, Oids) ->
sync_get_next(Addr, Port, Oids) ->
call({sync_get_next, Addr, Port, Oids}).
+sync_get_next2(TargetName, Oids, SendOpts) ->
+ call({sync_get_next2, TargetName, Oids, SendOpts}).
+
%% --
async_get_next(Oids) ->
@@ -204,6 +214,9 @@ async_get_next(Addr_or_TargetName, Oids) ->
async_get_next(Addr, Port, Oids) ->
call({async_get_next, Addr, Port, Oids}).
+async_get_next2(TargetName, Oids, SendOpts) ->
+ call({async_get_next2, TargetName, Oids, SendOpts}).
+
%% --
sync_set(VAV) ->
@@ -215,6 +228,9 @@ sync_set(Addr_or_TargetName, VAV) ->
sync_set(Addr, Port, VAV) ->
call({sync_set, Addr, Port, VAV}).
+sync_set2(TargetName, VAV, SendOpts) ->
+ call({sync_set2, TargetName, VAV, SendOpts}).
+
%% --
async_set(VAV) ->
@@ -226,6 +242,9 @@ async_set(Addr_or_TargetName, VAV) ->
async_set(Addr, Port, VAV) ->
call({async_set, Addr, Port, VAV}).
+async_set2(TargetName, VAV, SendOpts) ->
+ call({async_set2, TargetName, VAV, SendOpts}).
+
%% --
sync_get_bulk(NonRep, MaxRep, Oids) ->
@@ -237,6 +256,9 @@ sync_get_bulk(Addr_or_TargetName, NonRep, MaxRep, Oids) ->
sync_get_bulk(Addr, Port, NonRep, MaxRep, Oids) ->
call({sync_get_bulk, Addr, Port, NonRep, MaxRep, Oids}).
+sync_get_bulk2(TargetName, NonRep, MaxRep, Oids, SendOpts) ->
+ call({sync_get_bulk2, TargetName, NonRep, MaxRep, Oids, SendOpts}).
+
%% --
async_get_bulk(NonRep, MaxRep, Oids) ->
@@ -248,6 +270,9 @@ async_get_bulk(Addr_or_TargetName, NonRep, MaxRep, Oids) ->
async_get_bulk(Addr, Port, NonRep, MaxRep, Oids) ->
call({async_get_bulk, Addr, Port, NonRep, MaxRep, Oids}).
+async_get_bulk2(TargetName, NonRep, MaxRep, Oids, SendOpts) ->
+ call({async_get_bulk2, TargetName, NonRep, MaxRep, Oids, SendOpts}).
+
%% --
name_to_oid(Name) ->
@@ -400,6 +425,16 @@ loop(#state{parent = Parent, id = Id} = S) ->
%% -- (sync) get-request --
%%
+ {{sync_get2, TargetName, Oids, SendOpts}, From, Ref}
+ when is_list(TargetName) ->
+ d("loop -> received sync_get2 request with"
+ "~n TargetName: ~p"
+ "~n Oids: ~p"
+ "~n SendOpts: ~p", [TargetName, Oids, SendOpts]),
+ Res = snmpm:sync_get2(Id, TargetName, Oids, SendOpts),
+ reply(From, Res, Ref),
+ loop(S);
+
%% No agent specified, so send it to all of them
{{sync_get, Oids}, From, Ref} ->
d("loop -> received sync_get request "
@@ -439,6 +474,16 @@ loop(#state{parent = Parent, id = Id} = S) ->
%% -- (async) get-request --
%%
+ {{async_get2, TargetName, Oids, SendOpts}, From, Ref}
+ when is_list(TargetName) ->
+ d("loop -> received async_get2 request with"
+ "~n TargetName: ~p"
+ "~n Oids: ~p"
+ "~n SendOpts: ~p", [TargetName, Oids, SendOpts]),
+ Res = snmpm:async_get2(Id, TargetName, Oids, SendOpts),
+ reply(From, Res, Ref),
+ loop(S);
+
%% No agent specified, so send it to all of them
{{async_get, Oids}, From, Ref} ->
d("loop -> received async_get request"),
@@ -472,6 +517,16 @@ loop(#state{parent = Parent, id = Id} = S) ->
%% -- (sync) get_next-request --
%%
+ {{sync_get_next2, TargetName, Oids, SendOpts}, From, Ref}
+ when is_list(TargetName) ->
+ d("loop -> received sync_get_next2 request with"
+ "~n TargetName: ~p"
+ "~n Oids: ~p"
+ "~n SendOpts: ~p", [TargetName, Oids, SendOpts]),
+ Res = snmpm:sync_get_next2(Id, TargetName, Oids, SendOpts),
+ reply(From, Res, Ref),
+ loop(S);
+
%% No agent specified, so send it to all of them
{{sync_get_next, Oids}, From, Ref} ->
d("loop -> received sync_get_next request"),
@@ -505,6 +560,16 @@ loop(#state{parent = Parent, id = Id} = S) ->
%% -- (async) get_next-request --
%%
+ {{async_get_next2, TargetName, Oids, SendOpts}, From, Ref}
+ when is_list(TargetName) ->
+ d("loop -> received async_get_next2 request with"
+ "~n TargetName: ~p"
+ "~n Oids: ~p"
+ "~n SendOpts: ~p", [TargetName, Oids, SendOpts]),
+ Res = snmpm:async_get_next2(Id, TargetName, Oids, SendOpts),
+ reply(From, Res, Ref),
+ loop(S);
+
%% No agent specified, so send it to all of them
{{async_get_next, Oids}, From, Ref} ->
d("loop -> received async_get_next request"),
@@ -538,6 +603,16 @@ loop(#state{parent = Parent, id = Id} = S) ->
%% -- (sync) set-request --
%%
+ {{sync_set2, TargetName, VAV, SendOpts}, From, Ref}
+ when is_list(TargetName) ->
+ d("loop -> received sync_set2 request with"
+ "~n TargetName: ~p"
+ "~n VAV: ~p"
+ "~n SendOpts: ~p", [TargetName, VAV, SendOpts]),
+ Res = snmpm:sync_set2(Id, TargetName, VAV, SendOpts),
+ reply(From, Res, Ref),
+ loop(S);
+
{{sync_set, VAV}, From, Ref} ->
d("loop -> received sync_set request"),
Res = [snmpm:sync_set(Id, TargetName, VAV) ||
@@ -568,6 +643,16 @@ loop(#state{parent = Parent, id = Id} = S) ->
%% -- (async) set-request --
%%
+ {{async_set2, TargetName, VAV, SendOpts}, From, Ref}
+ when is_list(TargetName) ->
+ d("loop -> received async_set2 request with"
+ "~n TargetName: ~p"
+ "~n VAV: ~p"
+ "~n SendOpts: ~p", [TargetName, VAV, SendOpts]),
+ Res = snmpm:async_set2(Id, TargetName, VAV, SendOpts),
+ reply(From, Res, Ref),
+ loop(S);
+
{{async_set, VAV}, From, Ref} ->
d("loop -> received async_set request"),
Res = [snmpm:async_set(Id, TargetName, VAV) ||
@@ -598,6 +683,20 @@ loop(#state{parent = Parent, id = Id} = S) ->
%% -- (sync) get-bulk-request --
%%
+ {{sync_get_bulk2, TargetName, NonRep, MaxRep, Oids, SendOpts}, From, Ref}
+ when is_list(TargetName) ->
+ d("loop -> received sync_get_bulk request with"
+ "~n TargetName: ~p"
+ "~n NonRep: ~w"
+ "~n MaxRep: ~w"
+ "~n Oids: ~p"
+ "~n SendOpts: ~p",
+ [TargetName, NonRep, MaxRep, Oids, SendOpts]),
+ Res = snmpm:sync_get_bulk2(Id, TargetName,
+ NonRep, MaxRep, Oids, SendOpts),
+ reply(From, Res, Ref),
+ loop(S);
+
%% No agent specified, so send it to all of them
{{sync_get_bulk, NonRep, MaxRep, Oids}, From, Ref} ->
d("loop -> received sync_get_bulk request with"
@@ -645,6 +744,20 @@ loop(#state{parent = Parent, id = Id} = S) ->
%% -- (async) get-bulk-request --
%%
+ {{async_get_bulk2, TargetName, NonRep, MaxRep, Oids, SendOpts},
+ From, Ref} when is_list(TargetName) ->
+ d("loop -> received async_get_bulk2 request with"
+ "~n TargetName: ~p"
+ "~n NonRep: ~w"
+ "~n MaxRep: ~w"
+ "~n Oids: ~p"
+ "~n SendOpts: ~p",
+ [TargetName, NonRep, MaxRep, Oids, SendOpts]),
+ Res = snmpm:async_get_bulk2(Id, TargetName,
+ NonRep, MaxRep, Oids, SendOpts),
+ reply(From, Res, Ref),
+ loop(S);
+
%% No agent specified, so send it to all of them
{{async_get_bulk, NonRep, MaxRep, Oids}, From, Ref} ->
d("loop -> received async_get_bulk request with"
@@ -847,7 +960,11 @@ call(Req, To) when is_integer(To) ->
{error, timeout}
end.
-reply(Pid, Reply, Ref) ->
+reply(Pid, Reply, Ref) ->
+ d("reply -> entry with"
+ "~n Pid: ~p"
+ "~n Reply: ~p"
+ "~n Ref: ~p", [Pid, Reply, Ref]),
Pid ! {Reply, Ref}.
cast(Msg) ->
diff --git a/lib/snmp/test/snmp_manager_user_old.erl b/lib/snmp/test/snmp_manager_user_old.erl
index edffc80dd4..edffc80dd4 100755..100644
--- a/lib/snmp/test/snmp_manager_user_old.erl
+++ b/lib/snmp/test/snmp_manager_user_old.erl
diff --git a/lib/snmp/test/snmp_pdus_test.erl b/lib/snmp/test/snmp_pdus_test.erl
index ef510ad62e..07b6d6b657 100644
--- a/lib/snmp/test/snmp_pdus_test.erl
+++ b/lib/snmp/test/snmp_pdus_test.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2003-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2003-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -38,6 +38,8 @@
otp7575/1,
otp8563/1,
+ otp9022/1,
+
init_per_testcase/2, end_per_testcase/2
]).
@@ -75,7 +77,7 @@ all() ->
[{group, tickets}].
groups() ->
- [{tickets, [], [otp7575, otp8563]}].
+ [{tickets, [], [otp7575, otp8563, otp9022]}].
init_per_group(_GroupName, Config) ->
Config.
@@ -169,7 +171,56 @@ otp8563(Config) when is_list(Config) ->
Unexpected7 ->
exit({unexpected_encode_result, Unexpected7, Val7})
end,
-
+
+ ok.
+
+
+otp9022(suite) -> [];
+otp9022(doc) -> ["OTP-9022"];
+otp9022(Config) when is_list(Config) ->
+ Val1 = 16#7fffffff,
+ io:format("try encode and decode ~w~n", [Val1]),
+ Enc1 = snmp_pdus:enc_value('Counter32', Val1),
+ {{'Counter32', Val1}, []} = snmp_pdus:dec_value(Enc1),
+
+ Val2 = Val1 + 1,
+ io:format("try encode and decode ~w~n", [Val2]),
+ Enc2 = snmp_pdus:enc_value('Counter32', Val2),
+ {{'Counter32', Val2}, []} = snmp_pdus:dec_value(Enc2),
+
+ Val3 = Val2 + 1,
+ io:format("try encode and decode ~w~n", [Val3]),
+ Enc3 = snmp_pdus:enc_value('Counter32', Val3),
+ {{'Counter32', Val3}, []} = snmp_pdus:dec_value(Enc3),
+
+ Val4 = 16#fffffffe,
+ io:format("try encode and decode ~w~n", [Val4]),
+ Enc4 = snmp_pdus:enc_value('Counter32', Val4),
+ {{'Counter32', Val4}, []} = snmp_pdus:dec_value(Enc4),
+
+ Val5 = Val4 + 1,
+ io:format("try encode and decode ~w~n", [Val5]),
+ Enc5 = snmp_pdus:enc_value('Counter32', Val5),
+ {{'Counter32', Val5}, []} = snmp_pdus:dec_value(Enc5),
+
+ Val6 = 16#ffffffff + 1,
+ io:format("try and fail to encode ~w~n", [Val6]),
+ case (catch snmp_pdus:enc_value('Counter32', Val6)) of
+ {'EXIT', {error, {bad_counter32, Val6}}} ->
+ ok;
+ Unexpected6 ->
+ exit({unexpected_encode_result, Unexpected6, Val6})
+ end,
+
+ Val7 = -1,
+ io:format("try and fail to encode ~w~n", [Val7]),
+ case (catch snmp_pdus:enc_value('Counter32', Val7)) of
+ {'EXIT', {error, {bad_counter32, Val7}}} ->
+ ok;
+ Unexpected7 ->
+ exit({unexpected_encode_result, Unexpected7, Val7})
+ end,
+
ok.
diff --git a/lib/snmp/test/test_config/Makefile b/lib/snmp/test/test_config/Makefile
index d7bebbc431..d65bb8abe2 100644
--- a/lib/snmp/test/test_config/Makefile
+++ b/lib/snmp/test/test_config/Makefile
@@ -155,23 +155,23 @@ release_spec:
release_tests_spec: clean opt
$(INSTALL_DIR) $(RELSYSDIR)
- chmod -f -R u+w $(RELSYSDIR)
+ chmod -R u+w $(RELSYSDIR)
$(INSTALL_DIR) $(RELSYSDIR)/agent
- chmod -f -R u+w $(RELSYSDIR)/agent
+ chmod -R u+w $(RELSYSDIR)/agent
$(INSTALL_DIR) $(RELSYSDIR)/agent/conf
- chmod -f -R u+w $(RELSYSDIR)/agent/conf
+ chmod -R u+w $(RELSYSDIR)/agent/conf
$(INSTALL_DIR) $(RELSYSDIR)/agent/db
- chmod -f -R u+w $(RELSYSDIR)/agent/db
+ chmod -R u+w $(RELSYSDIR)/agent/db
$(INSTALL_DIR) $(RELSYSDIR)/agent/log
- chmod -f -R u+w $(RELSYSDIR)/agent/log
+ chmod -R u+w $(RELSYSDIR)/agent/log
$(INSTALL_DIR) $(RELSYSDIR)/manager
- chmod -f -R u+w $(RELSYSDIR)/manager
+ chmod -R u+w $(RELSYSDIR)/manager
$(INSTALL_DIR) $(RELSYSDIR)/manager/conf
- chmod -f -R u+w $(RELSYSDIR)/manager/conf
+ chmod -R u+w $(RELSYSDIR)/manager/conf
$(INSTALL_DIR) $(RELSYSDIR)/manager/db
- chmod -f -R u+w $(RELSYSDIR)/manager/db
+ chmod -R u+w $(RELSYSDIR)/manager/db
$(INSTALL_DIR) $(RELSYSDIR)/manager/log
- chmod -f -R u+w $(RELSYSDIR)/manager/log
+ chmod -R u+w $(RELSYSDIR)/manager/log
$(INSTALL_DATA) $(SYS_CONFIG_FILES) $(RELSYSDIR)
$(INSTALL_DATA) $(AGENT_CONFIG_FILES) $(RELSYSDIR)/agent/conf
$(INSTALL_DATA) $(MANAGER_CONFIG_FILES) $(RELSYSDIR)/manager/conf
diff --git a/lib/snmp/vsn.mk b/lib/snmp/vsn.mk
index e70c97dcb8..25e3a9470b 100644
--- a/lib/snmp/vsn.mk
+++ b/lib/snmp/vsn.mk
@@ -17,6 +17,6 @@
#
# %CopyrightEnd%
-SNMP_VSN = 4.19
+SNMP_VSN = 4.21.3
PRE_VSN =
APP_VSN = "snmp-$(SNMP_VSN)$(PRE_VSN)"