Skip to content
Commit aa2f18a0 authored by Viacheslav Mitrofanov's avatar Viacheslav Mitrofanov Committed by Tom Rini
Browse files

net: ipv6: Add string_to_ip6 converter



This functions is used as a converter from IPv6 address string notation
to struct ip6_addr that is used everywhere in IPv6 implementation. For
example it is used to parse and convert IPv6 address from tftpboot
command. Conversion algorithm uses two passes, first to verify syntax and
locate colons and second pass to read the address. In case of valid IPv6
address it returns 0.

Examples of valid strings:
	2001:db8::0:1234:1
	2001:0db8:0000:0000:0000:0000:1234:0001
	::1
	::ffff:192.168.1.1

Examples of invalid strings
	2001:db8::0::0          (:: can only appear once)
	2001:db8:192.168.1.1::1 (v4 part can only appear at the end)
	192.168.1.1             (we don't implicity map v4)

Series-changes: 3
- Added function description
- Added length parameter to string_to_ip6()

Series-changes: 4
- Fixed function description style

Signed-off-by: default avatarViacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: default avatarRamon Fried <rfried.dev@gmail.com>
Reviewed-by: default avatarSimon Glass <sjg@chromium.org>
parent 77ff2759
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment