
Here's something simple to get started. IP6addr_t is added as a typedef (for consistency with IPaddr_t). I ended up borrowing and adapting the vsprintf code from Linux.
Here is an example of the printf formatting
With this code
IP6addr_t addr6 = {.u6_addr16[0] = 0x3ffe, .u6_addr16[1] = 0x1234, .u6_addr16[7] = 0x0001}; IPaddr_t addr4 = 0x7f000001;
printf("addr6=%pi6\n", &addr6); printf("addr6=%pI6\n", &addr6); printf("addr6=%pI6c\n", &addr6); printf("addr=%pI4\n", &addr4);
We get the output
addr6=3ffe1234000000000000000000000001 addr6=3ffe:1234:0000:0000:0000:0000:0000:0001 addr6=3ffe:1234::1 addr4=127.0.0.1
My work so far on this has raised a few questions:
1) Presumably the majority of the actual V6 code would be included by a config option (CONFIG_IPV6). How far should I take that? Should the vsprintf code be conditional?
2) Our current out of tree code parallels net.c and net.h. Should I continue this for the final version or integrate it into net.[ch].
3) rxhand_f currently takes an IPaddr_t. I haven't looked at the usage of this yet but to support V6 this may need to be a new union or a void *.
(note on my split personality, I use a gmail account to post to the u-boot mailing list but since this work is being done as part of my $dayjob the author and s-o-b are using my work email address)
##################################################################################### Scanned by MailMarshal - M86 Security's comprehensive email content security solution. #####################################################################################