aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2015-04-30 15:39:49 +0200
committerRaimo Niskanen <[email protected]>2015-04-30 15:39:49 +0200
commit82e45c23a31ce2bf7bf4ac7ed9c9a4e6187f6574 (patch)
treee63139b84c33cf3da76356e2ebdbb3c55821777a
parent2b69f31280d0146670bded9889bfa9e3c0ef3134 (diff)
downloadotp-82e45c23a31ce2bf7bf4ac7ed9c9a4e6187f6574.tar.gz
otp-82e45c23a31ce2bf7bf4ac7ed9c9a4e6187f6574.tar.bz2
otp-82e45c23a31ce2bf7bf4ac7ed9c9a4e6187f6574.zip
Improve agent fix as in manager
-rw-r--r--lib/snmp/src/agent/snmpa_net_if.erl69
1 files changed, 34 insertions, 35 deletions
diff --git a/lib/snmp/src/agent/snmpa_net_if.erl b/lib/snmp/src/agent/snmpa_net_if.erl
index 1e580072ba..57d63bab5b 100644
--- a/lib/snmp/src/agent/snmpa_net_if.erl
+++ b/lib/snmp/src/agent/snmpa_net_if.erl
@@ -297,14 +297,14 @@ socket_open(snmpUDPDomain = Domain, [IpPort | Opts]) ->
Fd = list_to_integer(FdStr),
?vdebug("socket_open(~p, [~p | ~p]) Fd: ~p",
[Domain, IpPort, Opts, Fd]),
- gen_udp_open(IpPort, [{fd, Fd} | Opts]);
+ gen_udp_open(0, [{fd, Fd} | Opts]);
error ->
case init:get_argument(snmpa_fd) of
{ok, [[FdStr]]} ->
Fd = list_to_integer(FdStr),
?vdebug("socket_open(~p, [~p | ~p]) Fd: ~p",
[Domain, IpPort, Opts, Fd]),
- gen_udp_open(IpPort, [{fd, Fd} | Opts]);
+ gen_udp_open(0, [{fd, Fd} | Opts]);
error ->
?vdebug("socket_open(~p, [~p | ~p])",
[Domain, IpPort, Opts]),
@@ -1447,39 +1447,38 @@ get_counters([Counter|Counters], Acc) ->
%% ----------------------------------------------------------------
socket_opts(Domain, {IpAddr, IpPort}, Opts) ->
- case get_bind_to_ip_address(Opts) of
- true ->
- [IpPort, % Picked off at socket open, separate argument
- binary,
- {ip, IpAddr}];
- _ ->
- [0, % Picked off at socket open, separate argument
- binary]
- end ++
- case snmp_conf:tdomain_to_family(Domain) of
- inet6 = Family ->
- [Family, {ipv6_v6only, true}];
- Family ->
- [Family]
- end ++
- case get_no_reuse_address(Opts) of
- false ->
- [{reuseaddr, true}];
- _ ->
- []
- end ++
- case get_recbuf(Opts) of
- use_default ->
- [];
- Sz ->
- [{recbuf, Sz}]
- end ++
- case get_sndbuf(Opts) of
- use_default ->
- [];
- Sz ->
- [{sndbuf, Sz}]
- end.
+ [IpPort, % Picked off at socket open, separate argument
+ binary
+ | case snmp_conf:tdomain_to_family(Domain) of
+ inet6 = Family ->
+ [Family, {ipv6_v6only, true}];
+ Family ->
+ [Family]
+ end ++
+ case get_bind_to_ip_address(Opts) of
+ true ->
+ [{ip, IpAddr}];
+ _ ->
+ []
+ end ++
+ case get_no_reuse_address(Opts) of
+ false ->
+ [{reuseaddr, true}];
+ _ ->
+ []
+ end ++
+ case get_recbuf(Opts) of
+ use_default ->
+ [];
+ Sz ->
+ [{recbuf, Sz}]
+ end ++
+ case get_sndbuf(Opts) of
+ use_default ->
+ [];
+ Sz ->
+ [{sndbuf, Sz}]
+ end].
%% ----------------------------------------------------------------