aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/inet_SUITE.erl
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2017-06-07 15:36:49 +0200
committerRaimo Niskanen <[email protected]>2017-06-12 09:33:58 +0200
commit052863543868b442fa649ee99ea8e3e454c838b1 (patch)
tree764ab478ef93a189d206a26eb6736f31dd83d6bc /lib/kernel/test/inet_SUITE.erl
parent33ed2e24a516e1024fa984a96ddab90a01a97475 (diff)
downloadotp-052863543868b442fa649ee99ea8e3e454c838b1.tar.gz
otp-052863543868b442fa649ee99ea8e3e454c838b1.tar.bz2
otp-052863543868b442fa649ee99ea8e3e454c838b1.zip
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.
Diffstat (limited to 'lib/kernel/test/inet_SUITE.erl')
-rw-r--r--lib/kernel/test/inet_SUITE.erl4
1 files changed, 3 insertions, 1 deletions
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}