Patch for ip6_sprintf(), please review

Alfred Perlstein alfred at freebsd.org
Sun May 16 06:37:37 UTC 2010


Hello,

The following patch seems appropriate to apply
to fix the kernel ip6_sprintf() function.

What it is doing is ensuring that when we
abbreviate addresses that the longest string
of zeros is shortend, not the first run of
zeros.

Our internal commit log is:
problem:
Unification of IPv6 address representation
fix:
recommended format of text representing an IPv6 address
is summarized as follows.

1. omit leading zeros

2. "::" used to their maximum extent whenever possible

3. "::" used where shortens address the most

4. "::" used in the former part in case of a tie breaker

5. do not shorten one 16 bit 0 field

6. use lower case

Present code in ip6_sprintf() is following rules 1,2,5,6.
Adding fix for following other rules also.For following
rules 3 and 4, finding out the index where to replace zero's
with '::' and using that index.
References:
http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-04.html


Diff is attached in text format.

-- 
- Alfred Perlstein
.- AMA, VMOA #5191, 03 vmax, 92 gs500, 85 ch250, 07 zx10
.- FreeBSD committer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: in6.diff
Type: text/x-diff
Size: 1150 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20100516/c5bab289/in6.bin


More information about the freebsd-net mailing list