From 052863543868b442fa649ee99ea8e3e454c838b1 Mon Sep 17 00:00:00 2001 From: Raimo Niskanen Date: Wed, 7 Jun 2017 15:36:49 +0200 Subject: Accept IPv6 address %suffixes when parsing This only implements decimal suffixes, and furthermore only with a leading "0". A complete implementation would probably allow one and probably two digit suffixes without. But what primarily is missing is translating interface names to and from interface indexes. This also only implements the parsing, and uses the FreeBSD trick of squeezing in the Scope Id in the second 16-bit word of the fe80::/64 or ff02:/64 address prefix. But inet_drv is not prepared to handle this word, so it might only work on FreeBSD, not being supported even there... So inet_drv needs to handle this too. --- lib/kernel/test/inet_SUITE.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/kernel/test/inet_SUITE.erl') diff --git a/lib/kernel/test/inet_SUITE.erl b/lib/kernel/test/inet_SUITE.erl index bd842da4b3..3b502be8b8 100644 --- a/lib/kernel/test/inet_SUITE.erl +++ b/lib/kernel/test/inet_SUITE.erl @@ -544,6 +544,7 @@ parse_address(Config) when is_list(Config) -> {{16#c11,16#c22,16#5c33,0,0,0,0,0}, "c11:c22:5c33::"}, {{0,0,0,0,0,65535,258,65534},"::ffff:1.2.255.254"}, + {{16#fe80,12345,0,0,0,0,0,16#12},"fe80::12%012345"}, {{16#ffff,16#ffff,16#ffff,16#ffff,16#ffff,16#ffff,16#ffff,16#ffff}, "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"} |[{list_to_tuple(P++[(D1 bsl 8) bor D2,(D3 bsl 8) bor D4]), @@ -576,7 +577,8 @@ parse_address(Config) when is_list(Config) -> {{0,0,0,0},"0.00.0.0"}, {{0,0,0,0},"0.0.000000000000.0"}], V6Sloppy = - [{{16#a,16#b,16#c,16#0,16#0,16#d,16#e,16#f},"A:B:C::d:e:f"}] + [{{16#a,16#b,16#c,16#0,16#0,16#d,16#e,16#f},"A:B:C::d:e:f"}, + {{16#fe80,0,0,0,0,0,0,16#12},"fe80::12%XXXXXXX"}] ++ [{{P,0,0,0,0,D2,(D1 bsl 8) bor D2,(D3 bsl 8) bor D4}, Q++erlang:integer_to_list(D2, 16)++":"++S} -- cgit v1.2.3