mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] inet_ntop: do not compress single zeros in IPv6
@ 2018-06-05 23:51 Arthur Jones
  2018-06-26 20:54 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: Arthur Jones @ 2018-06-05 23:51 UTC (permalink / raw)
  To: musl; +Cc: chris

glibc does not compress a single :0: to ::, we're not
doing anything wrong, but this change will make us more
compatible w/ glibc and fix a downstream testing issue
here: https://github.com/FRRouting/frr/issues/2375

I ran the "fix" through libc-test inet_pton.c on alpine
linux edge and it passed...

I'm not subscribed to the mailing list so please CC me...
---
 src/network/inet_ntop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/network/inet_ntop.c b/src/network/inet_ntop.c
index 14f9f4c4..4bfef2c5 100644
--- a/src/network/inet_ntop.c
+++ b/src/network/inet_ntop.c
@@ -36,7 +36,7 @@ const char *inet_ntop(int af, const void *restrict a0, char *restrict s, socklen
 			j = strspn(buf+i, ":0");
 			if (j>max) best=i, max=j;
 		}
-		if (max>2) {
+		if (max>3) {
 			buf[best] = buf[best+1] = ':';
 			memmove(buf+best+2, buf+best+max, i-best-max+1);
 		}
-- 
2.15.1 (Apple Git-101)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] inet_ntop: do not compress single zeros in IPv6
  2018-06-05 23:51 [PATCH] inet_ntop: do not compress single zeros in IPv6 Arthur Jones
@ 2018-06-26 20:54 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2018-06-26 20:54 UTC (permalink / raw)
  To: Arthur Jones; +Cc: musl, chris

On Tue, Jun 05, 2018 at 04:51:27PM -0700, Arthur Jones wrote:
> glibc does not compress a single :0: to ::, we're not
> doing anything wrong, but this change will make us more
> compatible w/ glibc and fix a downstream testing issue
> here: https://github.com/FRRouting/frr/issues/2375
> 
> I ran the "fix" through libc-test inet_pton.c on alpine
> linux edge and it passed...
> 
> I'm not subscribed to the mailing list so please CC me...
> ---
>  src/network/inet_ntop.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/network/inet_ntop.c b/src/network/inet_ntop.c
> index 14f9f4c4..4bfef2c5 100644
> --- a/src/network/inet_ntop.c
> +++ b/src/network/inet_ntop.c
> @@ -36,7 +36,7 @@ const char *inet_ntop(int af, const void *restrict a0, char *restrict s, socklen
>  			j = strspn(buf+i, ":0");
>  			if (j>max) best=i, max=j;
>  		}
> -		if (max>2) {
> +		if (max>3) {
>  			buf[best] = buf[best+1] = ':';
>  			memmove(buf+best+2, buf+best+max, i-best-max+1);
>  		}
> -- 
> 2.15.1 (Apple Git-101)

Thanks. Philip Homburg also included a patch with the initial report
of this issue, but I think your patch is simpler/more efficient.
Applying.

Rich


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-26 20:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-05 23:51 [PATCH] inet_ntop: do not compress single zeros in IPv6 Arthur Jones
2018-06-26 20:54 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).