[U-Boot] [RFC PATCH v3 03/11] lib: net_utils: add string_to_ip6
Simon Glass
sjg at chromium.org
Mon Feb 6 15:32:37 UTC 2017
Hi Chris,
On 25 January 2017 at 01:56, Chris Packham <judge.packham at 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 at 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 at 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.
More information about the U-Boot
mailing list