diff --git a/CHANGES b/CHANGES index 3ee6981..b530ab8 100644 --- a/CHANGES +++ b/CHANGES @@ -25,6 +25,7 @@ support MacOS X sendfile (and comment it out again, the headers declare it but it's not actually there) (thanks to Bernhard Schmidt) support AIX 5 (thanks to Lutz Chwala and Arthur Erhardt) + fix ip6_fmt (martin paljak) 0.16: add buffer_fromsa (make buffer from stralloc) diff --git a/socket/fmt_ip6.c b/socket/fmt_ip6.c index f368817..a018884 100644 --- a/socket/fmt_ip6.c +++ b/socket/fmt_ip6.c @@ -9,9 +9,10 @@ unsigned int fmt_ip6(char *s,const char ip[16]) unsigned int i; unsigned int temp; unsigned int compressing; + unsigned int compressed; int j; - len = 0; compressing = 0; + len = 0; compressing = 0; compressed = 0; for (j=0; j<16; j+=2) { if (j==12 && ip6_isv4mapped(ip)) { temp=ip4_fmt(s,ip+12); @@ -20,7 +21,7 @@ unsigned int fmt_ip6(char *s,const char ip[16]) } temp = ((unsigned long) (unsigned char) ip[j] << 8) + (unsigned long) (unsigned char) ip[j+1]; - if (temp == 0) { + if (temp == 0 && !compressed) { if (!compressing) { compressing=1; if (j==0) { @@ -29,7 +30,7 @@ unsigned int fmt_ip6(char *s,const char ip[16]) } } else { if (compressing) { - compressing=0; + compressing=0; ++compressed; if (s) *s++=':'; ++len; } i = fmt_xlong(s,temp); len += i; if (s) s += i;