aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src/misc
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2014-05-20 15:15:43 +0200
committerRaimo Niskanen <[email protected]>2014-07-25 12:15:16 +0200
commitcc1ab998ce905cd673c7ea14ee4e31ddb2412350 (patch)
treeee74e4790f89a8282d077458ee9d1af472d8a914 /lib/snmp/src/misc
parentc1104d6708917d7ec0b3b77340242b679ee10122 (diff)
downloadotp-cc1ab998ce905cd673c7ea14ee4e31ddb2412350.tar.gz
otp-cc1ab998ce905cd673c7ea14ee4e31ddb2412350.tar.bz2
otp-cc1ab998ce905cd673c7ea14ee4e31ddb2412350.zip
Don't encode IPv6 address into v1 trap and fix legacy arguments to snmpa_network_interface_filter functions
Diffstat (limited to 'lib/snmp/src/misc')
-rw-r--r--lib/snmp/src/misc/snmp_conf.erl13
-rw-r--r--lib/snmp/src/misc/snmp_pdus.erl13
2 files changed, 11 insertions, 15 deletions
diff --git a/lib/snmp/src/misc/snmp_conf.erl b/lib/snmp/src/misc/snmp_conf.erl
index 594cfce705..2d91cb1f55 100644
--- a/lib/snmp/src/misc/snmp_conf.erl
+++ b/lib/snmp/src/misc/snmp_conf.erl
@@ -634,9 +634,16 @@ mk_taddress(transportDomainUdpIpv6 = Domain, Address) ->
case Address of
[] -> % Empty mask
[];
- {Ip, Port}
- when tuple_size(Ip) =:= 8, is_integer(Port) ->
- tuple_to_list(Ip) ++ mk_bytes(Port);
+ {{A, B, C, D, E, F, G, H}, Port} ->
+ [A bsr 8, A band 255,
+ B bsr 8, B band 255,
+ C bsr 8, C band 255,
+ D bsr 8, D band 255,
+ E bsr 8, E band 255,
+ F bsr 8, F band 255,
+ G bsr 8, G band 255,
+ H bsr 8, H band 255,
+ Port bsr 8, Port band 255];
_ ->
erlang:error(badarg, [Domain,Address])
end;
diff --git a/lib/snmp/src/misc/snmp_pdus.erl b/lib/snmp/src/misc/snmp_pdus.erl
index a780fee7a3..90fa4c0dea 100644
--- a/lib/snmp/src/misc/snmp_pdus.erl
+++ b/lib/snmp/src/misc/snmp_pdus.erl
@@ -174,7 +174,7 @@ dec_pdu_tag(168) ->
dec_pdu([164 | Bytes]) -> % It's a trap
Bytes2 = get_data_bytes(Bytes),
{Enterprise, Rest1} = dec_oid_tag(Bytes2),
- {{'IpAddress', AgentAddr}, Rest2} = dec_value(Rest1),
+ {{'IpAddress', [_, _, _, _] = AgentAddr}, Rest2} = dec_value(Rest1),
{GenericTrap, Rest3} = dec_int_tag(Rest2),
{SpecificTrap, Rest4} = dec_int_tag(Rest3),
{{'TimeTicks', TimeStamp}, VBBytes} = dec_value(Rest4),
@@ -666,17 +666,6 @@ enc_value('OBJECT IDENTIFIER', Val) ->
enc_oid_tag(Val);
enc_value('IpAddress', {A, B, C, D}) ->
enc_value('IpAddress', [A,B,C,D]);
-enc_value('IpAddress', {A, B, C, D, E, F, G, H}) ->
- enc_value(
- 'IpAddress',
- [A bsr 8, A band 255,
- B bsr 8, B band 255,
- C bsr 8, C band 255,
- D bsr 8, D band 255,
- E bsr 8, E band 255,
- F bsr 8, F band 255,
- G bsr 8, G band 255,
- H bsr 8, H band 255]);
enc_value('IpAddress', Val) when is_list(Val) ->
Bytes2 = enc_oct_str_notag(Val),
Len2 = elength(length(Bytes2)),