From 2b69f31280d0146670bded9889bfa9e3c0ef3134 Mon Sep 17 00:00:00 2001 From: Raimo Niskanen Date: Thu, 23 Apr 2015 15:04:08 +0200 Subject: Use port 0 with {fd,Fd}, use snmpm_fd in manager --- lib/snmp/src/agent/snmpa_net_if.erl | 67 +++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 33 deletions(-) (limited to 'lib/snmp/src/agent/snmpa_net_if.erl') diff --git a/lib/snmp/src/agent/snmpa_net_if.erl b/lib/snmp/src/agent/snmpa_net_if.erl index 840d56d563..1e580072ba 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-2014. All Rights Reserved. +%% Copyright Ericsson AB 2004-2015. 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 @@ -1447,38 +1447,39 @@ get_counters([Counter|Counters], Acc) -> %% ---------------------------------------------------------------- socket_opts(Domain, {IpAddr, IpPort}, Opts) -> - [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]. + 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. %% ---------------------------------------------------------------- -- cgit v1.2.3