aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2014-07-02 15:38:01 +0200
committerRaimo Niskanen <[email protected]>2014-07-25 12:17:51 +0200
commit81d2a6e1b13e944893377d93505523b8e7995e53 (patch)
tree8171e7a3919a68dbd6b9c2b46e6a7b480f4505fc /lib/snmp
parentd38674e8dd8224da8a66d77ca4f5a8073e01f794 (diff)
downloadotp-81d2a6e1b13e944893377d93505523b8e7995e53.tar.gz
otp-81d2a6e1b13e944893377d93505523b8e7995e53.tar.bz2
otp-81d2a6e1b13e944893377d93505523b8e7995e53.zip
Remove commented out code
Diffstat (limited to 'lib/snmp')
-rw-r--r--lib/snmp/src/agent/snmp_framework_mib.erl23
-rw-r--r--lib/snmp/src/agent/snmpa_net_if.erl197
-rw-r--r--lib/snmp/src/agent/snmpa_trap.erl53
3 files changed, 9 insertions, 264 deletions
diff --git a/lib/snmp/src/agent/snmp_framework_mib.erl b/lib/snmp/src/agent/snmp_framework_mib.erl
index 3b33cae3ec..922215ff00 100644
--- a/lib/snmp/src/agent/snmp_framework_mib.erl
+++ b/lib/snmp/src/agent/snmp_framework_mib.erl
@@ -138,8 +138,6 @@ read_agent(Dir) ->
end,
Mand =
[{intAgentTransports, mandatory},
-%%% {intAgentIpAddress, mandatory},
-%%% {intAgentUDPPort, mandatory},
{snmpEngineMaxMessageSize, mandatory},
{snmpEngineID, mandatory}],
{ok, Conf} = snmp_conf:check_mandatory(Conf0, Mand),
@@ -227,27 +225,6 @@ check_agent({intAgentTransports = Tag, Transports}, {_, Port} = State) ->
check_agent(Entry, State) ->
{check_agent(Entry), State}.
-%%% XXX remove
-%%%
-%%% check_agent({intAgentTransportDomain, D}, _Domain) ->
-%%% {snmp_conf:check_domain(D), D};
-%%% check_agent({intAgentIpAddress = Tag, Value}, D) ->
-%%% Domain =
-%%% case D of
-%%% undefined ->
-%%% snmp_target_mib:default_domain();
-%%% _ ->
-%%% D
-%%% end,
-%%% {case snmp_conf:check_ip(Domain, Value) of
-%%% ok ->
-%%% ok;
-%%% {ok, FixedIp} ->
-%%% {ok, {Tag, FixedIp}}
-%%% end, Domain};
-%%% check_agent(Entry, Domain) ->
-%%% {check_agent(Entry), Domain}.
-
%% This one is kept for backwards compatibility
check_agent({intAgentMaxPacketSize, Value}) ->
snmp_conf:check_packet_size(Value);
diff --git a/lib/snmp/src/agent/snmpa_net_if.erl b/lib/snmp/src/agent/snmpa_net_if.erl
index 66964faed7..8f6706166b 100644
--- a/lib/snmp/src/agent/snmpa_net_if.erl
+++ b/lib/snmp/src/agent/snmpa_net_if.erl
@@ -117,24 +117,6 @@ get_transports() ->
{value, Transports} = snmp_framework_mib:intAgentTransports(get),
Transports.
-%%% XXX remove
-%%%
-%%% get_ip_port() ->
-%%% {value, UDPPort} = snmp_framework_mib:intAgentUDPPort(get),
-%%% UDPPort.
-%%%
-%%% get_address() ->
-%%% {value, IPAddress} = snmp_framework_mib:intAgentIpAddress(get),
-%%% IPAddress.
-%%%
-%%% get_domain() ->
-%%% case snmp_framework_mib:intAgentTransportDomain(get) of
-%%% {value, Domain} ->
-%%% Domain;
-%%% genErr ->
-%%% snmpUDPDomain
-%%% end.
-
filter_reset(Pid) ->
Pid ! filter_reset.
@@ -185,16 +167,6 @@ do_init(Prio, NoteStore, MasterAgent, Parent, Opts) ->
put(verbosity,get_verbosity(Opts)),
?vlog("starting",[]),
-%%% XXX remove
-%%%
-%%% %% -- Port and address --
-%%% Domain = get_domain(),
-%%% ?vdebug("domain: ~w",[Domain]),
-%%% UDPPort = get_ip_port(),
-%%% ?vdebug("port: ~w",[UDPPort]),
-%%% IPAddress = get_address(),
-%%% ?vdebug("addr: ~w",[IPAddress]),
-
%% -- Versions --
Vsns = get_vsns(Opts),
?vdebug("vsns: ~w",[Vsns]),
@@ -245,38 +217,6 @@ do_init(Prio, NoteStore, MasterAgent, Parent, Opts) ->
{error, Error}
end.
-%%% XXX remove
-%%%
-%%% %% -- Socket --
-%%% IPOpts1 = ip_opt_bind_to_ip_address(Opts, IPAddress),
-%%% IPOpts2 = ip_opt_no_reuse_address(Opts),
-%%% IPOpts3 = ip_opt_recbuf(Opts),
-%%% IPOpts4 = ip_opt_sndbuf(Opts),
-%%% IPOpts =
-%%% [binary, snmp_conf:tdomain_to_family(Domain)
-%%% | IPOpts1 ++ IPOpts2 ++ IPOpts3 ++ IPOpts4],
-%%% case gen_udp_open(UDPPort, IPOpts) of
-%%% {ok, Sock} ->
-%%% MpdState = snmpa_mpd:init(Vsns),
-%%% init_counters(),
-%%% active_once(Sock),
-%%% S = #state{parent = Parent,
-%%% note_store = NoteStore,
-%%% master_agent = MasterAgent,
-%%% mpd_state = MpdState,
-%%% usock = Sock,
-%%% usock_opts = IPOpts,
-%%% log = Log,
-%%% limit = Limit,
-%%% filter = FilterMod,
-%%% domain = Domain},
-%%% ?vdebug("started with MpdState: ~p", [MpdState]),
-%%% {ok, S};
-%%% {error, Reason} ->
-%%% ?vinfo("Failed to open UDP socket: ~p", [Reason]),
-%%% {error, {udp_open, UDPPort, Reason}}
-%%% end.
-
create_log() ->
case ets:lookup(snmp_agent_table, audit_trail_log) of
@@ -664,53 +604,13 @@ update_req_counter_incoming(
S
end.
-update_transport_req_refs(
- #state{transports = Transports} = S,
- #transport{socket = Socket} = T,
- ReqRefs) ->
- S#state{
- transports =
- lists:keyreplace(
- Socket, #transport.socket, Transports,
- T#transport{req_refs = ReqRefs})}.
-
-%%% XXX remove
-%%%
-%%% update_req_counter_incoming(#state{limit = infinity, usock = Sock} = S, _) ->
-%%% active_once(Sock), %% No limit so activate directly
-%%% S;
-%%% update_req_counter_incoming(#state{limit = Limit,
-%%% rcnt = RCnt,
-%%% usock = Sock} = S, Rid)
-%%% when length(RCnt) + 1 >= Limit ->
-%%% %% Ok, one more and we are at the limit.
-%%% %% Just make sure we are not already processing this one...
-%%% case lists:member(Rid, RCnt) of
-%%% false ->
-%%% %% We are at the limit, do _not_ activate socket
-%%% S#state{rcnt = [Rid|RCnt]};
-%%% true ->
-%%% active_once(Sock),
-%%% S
-%%% end;
-%%% update_req_counter_incoming(#state{rcnt = RCnt,
-%%% usock = Sock} = S, Rid) ->
-%%% active_once(Sock),
-%%% case lists:member(Rid, RCnt) of
-%%% false ->
-%%% S#state{rcnt = [Rid|RCnt]};
-%%% true ->
-%%% S
-%%% end.
-
-
update_req_counter_outgoing(
#state{limit = infinity} = S,
_Transport, _ReqRef) ->
%% Already activated (in the incoming function)
S;
update_req_counter_outgoing(
- #state{limit = Limit, transports = Transports} = S,
+ #state{limit = Limit} = S,
#transport{socket = Socket, req_refs = ReqRefs} = Transport,
ReqRef) ->
LengthReqRefs = length(ReqRefs),
@@ -725,39 +625,18 @@ update_req_counter_outgoing(
"passed below limit: activate", []),
active_once(Socket)
end,
+ update_transport_req_refs(S, Transport, NewReqRefs).
+
+update_transport_req_refs(
+ #state{transports = Transports} = S,
+ #transport{socket = Socket} = T,
+ ReqRefs) ->
S#state{
transports =
- snmp_misc:keyreplace(
+ lists:keyreplace(
Socket, #transport.socket, Transports,
- Transport#transport{req_refs = NewReqRefs})}.
+ T#transport{req_refs = ReqRefs})}.
-%%% XXX remove
-%%%
-%%% update_req_counter_outgoing(
-%%% #state{limit = Limit,
-%%% rcnt = RCnt,
-%%% usock = Sock} = S, Rid)
-%%% when length(RCnt) >= Limit ->
-%%% ?vtrace("handle_req_counter_outgoing(~w) -> entry with"
-%%% "~n Rid: ~w"
-%%% "~n length(RCnt): ~w", [Limit, Rid, length(RCnt)]),
-%%% case lists:delete(Rid, RCnt) of
-%%% NewRCnt when length(NewRCnt) < Limit ->
-%%% ?vtrace("update_req_counter_outgoing -> "
-%%% "passed below limit: activate", []),
-%%% active_once(Sock),
-%%% S#state{rcnt = NewRCnt};
-%%% _ ->
-%%% S
-%%% end;
-%%% update_req_counter_outgoing(#state{limit = Limit, rcnt = RCnt} = S,
-%%% Rid) ->
-%%% ?vtrace("handle_req_counter_outgoing(~w) -> entry with"
-%%% "~n Rid: ~w"
-%%% "~n length(RCnt): ~w", [Limit, Rid, length(RCnt)]),
-%%% NewRCnt = lists:delete(Rid, RCnt),
-%%% S#state{rcnt = NewRCnt}.
-
maybe_handle_recv(
#state{filter = FilterMod} = S,
@@ -915,17 +794,6 @@ handle_recv_pdu(
"~n No receiver available for response pdu", [])
end,
S;
-%%% XXX remove
-%%%
-%%% handle_recv_pdu(
-%%% #state{} = S,
-%%% #transport{socket = Socket} = Transport,
-%%% From, Vsn,
-%%% #pdu{type = 'get-response'} = Pdu,
-%%% _PduMS, _ACMData) ->
-%%% active_once(Socket),
-%%% handle_response(S, Pdu, From, Vsn),
-%%% S;
handle_recv_pdu(
#state{master_agent = Pid} = S,
#transport{} = Transport,
@@ -1219,21 +1087,6 @@ do_handle_send_pdu1(
end,
Addresses).
-%%% XXX remove
-%%%
-%%% handle_response(
-%%% #state{reqs = Reqs} = S, Pdu#pdu{request_id = ReqId}, From, Vsn)
-%%% when is_pid(From) ->
-%%% case lists:keyfind(ReqId, 1, S#state.reqs) of
-%%% {ReqId, Pid} ->
-%%% ?vdebug("handle_response -> "
-%%% "~n send response to receiver ~p", [Pid]),
-%%% Pid ! {snmp_response_received, Vsn, Pdu, From};
-%%% false ->
-%%% ?vdebug("handle_response -> "
-%%% "~n No receiver available for response pdu", [])
-%%% end.
-
maybe_udp_send(
#state{filter = FilterMod, transports = Transports},
#transport{socket = Socket},
@@ -1622,38 +1475,6 @@ socket_opts(Domain, {IpAddr, IpPort}, Opts) ->
[{sndbuf, Sz}]
end].
-ip_opt_bind_to_ip_address(Opts, Ip) ->
- case get_bind_to_ip_address(Opts) of
- true ->
- [{ip, Ip}];
- _ ->
- []
- end.
-
-ip_opt_no_reuse_address(Opts) ->
- case get_no_reuse_address(Opts) of
- false ->
- [{reuseaddr, true}];
- _ ->
- []
- end.
-
-ip_opt_recbuf(Opts) ->
- case get_recbuf(Opts) of
- use_default ->
- [];
- Sz ->
- [{recbuf, Sz}]
- end.
-
-ip_opt_sndbuf(Opts) ->
- case get_sndbuf(Opts) of
- use_default ->
- [];
- Sz ->
- [{sndbuf, Sz}]
- end.
-
%% ----------------------------------------------------------------
diff --git a/lib/snmp/src/agent/snmpa_trap.erl b/lib/snmp/src/agent/snmpa_trap.erl
index 40956c40fb..a79b150f57 100644
--- a/lib/snmp/src/agent/snmpa_trap.erl
+++ b/lib/snmp/src/agent/snmpa_trap.erl
@@ -800,32 +800,6 @@ send_v1_trap(
"~n to"
"~n ~p", [Enter, Spec, V1Res]),
do_send_v1_trap(Enter, Spec, V1Res, Vbs, ExtraInfo, NetIf, SysUpTime);
-%%% AgentDomain =
-%%% case snmp_framework_mib:intAgentTransportDomain(get) of
-%%% {value, AD} ->
-%%% AD;
-%%% genErr ->
-%%% snmp_target_mib:default_domain()
-%%% end,
-%%% case AgentDomain of
-%%% snmpUDPDomain ->
-%%% {value, AgentIp} = snmp_framework_mib:intAgentIpAddress(get),
-%%% TrapPdu = make_v1_trap_pdu(Enter, Spec, Vbs, SysUpTime, AgentIp),
-%%% AddrCommunities = mk_addr_communities(V1Res),
-%%% lists:foreach(
-%%% fun ({Community, Addrs}) ->
-%%% ?vtrace("send v1 trap pdu to ~p",[Addrs]),
-%%% NetIf ! {send_pdu, 'version-1', TrapPdu,
-%%% {community, Community}, Addrs, ExtraInfo}
-%%% end, AddrCommunities);
-%%% _ ->
-%%% ?vtrace(
-%%% "snmpa_trap: can not send v1 trap with domain: ~w",
-%%% [AgentDomain]),
-%%% user_err(
-%%% "snmpa_trap: can not send v1 trap with domain: ~w",
-%%% [AgentDomain])
-%%% end;
send_v1_trap(
#notification{oid = Oid},
V1Res, Vbs, ExtraInfo, NetIf, SysUpTime) ->
@@ -877,33 +851,6 @@ do_send_v1_trap(Enter, Spec, V1Res, NVbs, ExtraInfo, NetIf, SysUpTime) ->
{community, Community}, Addrs, ExtraInfo}
end, AddrCommunities).
-%%% AgentDomain =
-%%% case snmp_framework_mib:intAgentTransportDomain(get) of
-%%% {value, AD} ->
-%%% AD;
-%%% genErr ->
-%%% snmp_target_mib:default_domain()
-%%% end,
-%%% case AgentDomain of
-%%% snmpUDPDomain ->
-%%% {value, AgentIp} = snmp_framework_mib:intAgentIpAddress(get),
-%%% TrapPdu = make_v1_trap_pdu(Enter, Spec, NVbs, SysUpTime, AgentIp),
-%%% AddrCommunities = mk_addr_communities(V1Res),
-%%% lists:foreach(
-%%% fun ({Community, Addrs}) ->
-%%% ?vtrace("send v1 trap to ~p",[Addrs]),
-%%% NetIf ! {send_pdu, 'version-1', TrapPdu,
-%%% {community, Community}, Addrs, ExtraInfo}
-%%% end, AddrCommunities);
-%%% _ ->
-%%% ?vtrace(
-%%% "snmpa_trap: can not send v1 trap with domain: ~w",
-%%% [AgentDomain]),
-%%% user_err(
-%%% "snmpa_trap: can not send v1 trap with domain: ~w",
-%%% [AgentDomain])
-%%% end.
-
send_v2_trap(_TrapRec, [], _Vbs, _Recv, _ExtraInfo, _NetIf, _SysUpTime) ->
ok;
send_v2_trap(TrapRec, V2Res, Vbs, Recv, ExtraInfo, NetIf, SysUpTime) ->