
Hi Chris,
On 25 January 2017 at 01:56, Chris Packham judge.packham@gmail.com wrote:
string_to_ip6 parses an IPv6 address from a string. Parsing v6 addresses is a bit more complicated than parsing v4 because there are a number of different formats that can be used.
Signed-off-by: Chris Packham judge.packham@gmail.com
I'm sure the parsing can be better and done in less code with only a single pass but I haven't yet figured it out. The main problem is that "::" can represent a variable number of contiguous "0000:" so when parsing "::" we can't tell how many half words to skip.
Changes in v3: None Changes in v2: None
include/net6.h | 3 ++ lib/net_utils.c | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org
But I'd like to see a test for this. You could write something like test/net_ut and have it called by the pytests. I think it is valuable to have tests to verify the behaviour and make it easier to change / improve the code later.