|
|
@ -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; |
|
|
|