File 0983-snmp-test-Make-sure-manager-and-agent-has-the-same-l.patch of Package erlang
From 5b314f61089ca82fe5d09f7a2e8a791afa8f7ec2 Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Wed, 16 Jul 2025 09:16:05 +0200
Subject: [PATCH 2/2] [snmp|test] Make sure manager and agent has the same
(local host) info
Make sure that manager and agent use the same (local) address
info. Previously the address used by the agent and the manager
where retrieved at two different times. So if some network glich
occured, this could cause the agent to use one address and the
manager get another for the agent (causing messages from the agent
to the manager to be rejected).
---
lib/snmp/test/snmp_agent_SUITE.erl | 32 ++++++++++++++++--------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/lib/snmp/test/snmp_agent_SUITE.erl b/lib/snmp/test/snmp_agent_SUITE.erl
index 1e8b21ab74..af326c30fd 100644
--- a/lib/snmp/test/snmp_agent_SUITE.erl
+++ b/lib/snmp/test/snmp_agent_SUITE.erl
@@ -8164,13 +8164,13 @@ otp16649(N, Config) ->
length(AgentRawTransports), length(TIs)})
end,
- ?IPRINT("validate transports"),
+ ?IPRINT("validate agent transports"),
otp16649_validate_transports(AgentRawTransports, TIs),
- ?IPRINT("which req-responder port-no"),
+ ?IPRINT("which agent req-responder port-no"),
AgentReqPortNo = otp16649_which_req_port_no(TIs),
- ?IPRINT("which trap-sender port-no"),
+ ?IPRINT("which agent trap-sender port-no"),
AgentTrapPortNo = otp16649_which_trap_port_no(TIs),
?IPRINT("(mgr) register user"),
@@ -8182,13 +8182,15 @@ otp16649(N, Config) ->
TrapTarget = TargetBase ++ "trap",
ok = otp16649_mgr_reg_agent(ManagerNode,
- ?config(ipfamily, Config),
- ?config(tdomain, Config),
- ReqTarget, AgentReqPortNo),
+ ?config(ipfamily, Config),
+ ?config(ip, Config),
+ ?config(tdomain, Config),
+ ReqTarget, AgentReqPortNo),
ok = otp16649_mgr_reg_agent(ManagerNode,
- ?config(ipfamily, Config),
- ?config(tdomain, Config),
- TrapTarget, AgentTrapPortNo),
+ ?config(ipfamily, Config),
+ ?config(ip, Config),
+ ?config(tdomain, Config),
+ TrapTarget, AgentTrapPortNo),
?IPRINT("(mgr) simple (sync) get request"),
Oids = [?sysObjectID_instance, ?sysDescr_instance, ?sysUpTime_instance],
@@ -8290,7 +8292,7 @@ otp16649_init(N, AgentPreTransports, Config) ->
Host = snmp_test_lib:hostname(),
Ip = ?config(ip, Config),
%% We should really "extract" the address from the hostnames,
- %% but because on some OSes (Ubuntu) adds 12.7.0.1.1 to its hosts file,
+ %% but because on some OSes (Ubuntu) adds 127.0.1.1 to its hosts file,
%% this does not work. We want a "proper" address.
%% Also, since both nodes (agent and manager) are both started locally,
%% we can use 'Ip' for both!
@@ -8516,15 +8518,15 @@ otp16649_mgr_reg_user(Node) ->
rpc:call(Node, snmpm, register_user,
[otp16649, snmp_otp16649_user, self()]).
-otp16649_mgr_reg_agent(Node, IPFam, TDomain, Target, PortNo) ->
+otp16649_mgr_reg_agent(Node, IPFam, IP, TDomain, Target, PortNo) ->
?IPRINT("otp16649_mgr_reg_agent -> entry with"
"~n Node: ~p"
"~n IPFam: ~p"
+ "~n IP: ~p"
"~n TDomain: ~p"
"~n Target: ~p"
"~n PortNo: ~p",
- [Node, IPFam, TDomain, Target, PortNo]),
- Localhost = ?LOCALHOST(IPFam),
+ [Node, IPFam, IP, TDomain, Target, PortNo]),
Version = v1,
EngineId = "agentEngine",
?IPRINT("otp16649_mgr_reg_agent -> register agent:"
@@ -8534,8 +8536,8 @@ otp16649_mgr_reg_agent(Node, IPFam, TDomain, Target, PortNo) ->
"~n Version: ~p"
"~n TDomain: ~p"
"~n EngineId: ~p",
- [Target, Localhost, PortNo, Version, TDomain, EngineId]),
- Config = [{address, Localhost},
+ [Target, IP, PortNo, Version, TDomain, EngineId]),
+ Config = [{address, IP},
{port, PortNo},
{version, Version},
{tdomain, TDomain},
--
2.43.0