linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] inet_pton.3: Mention byte order
@ 2016-05-12  7:16 Stefan Puiu
       [not found] ` <CACKs7VAgKPUOp7+_0NzWujruw0fsMF0L+UnsNqV=zsfmF+tqrw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Puiu @ 2016-05-12  7:16 UTC (permalink / raw)
  To: lnx-man

Hi,

I was a bit stumped recently to realize that both inet_ntop() and
inet_pton() work with addresses in network byte order. inet_ntop.3
mentions that, and the example from inet_pton(), as far as I can tell,
implies that you can call inet_ntop() on the result of inet_pton(), so
the byte order needs to match, but I think it's better to mention this
explicitly in the man page text. How about this (patch against git)?

diff --git a/man3/inet_pton.3 b/man3/inet_pton.3
index 4ff16b9..8b1017e 100644
--- a/man3/inet_pton.3
+++ b/man3/inet_pton.3
@@ -64,6 +64,8 @@ and copied to
 which must be
 .I sizeof(struct in_addr)
 (4) bytes (32 bits) long.
+.IR dst
+is written in network byte order.
 .TP
 .B AF_INET6
 .I src

Thanks,
Stefan.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] inet_pton.3: Mention byte order
       [not found] ` <CACKs7VAgKPUOp7+_0NzWujruw0fsMF0L+UnsNqV=zsfmF+tqrw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-05-12  7:23   ` Stefan Puiu
       [not found]     ` <CACKs7VAa+v_0q1JOWOka=g0UiTzyMv-hSKYZZKebm04U5Z1_Jw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2016-05-18 20:36   ` Michael Kerrisk (man-pages)
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Puiu @ 2016-05-12  7:23 UTC (permalink / raw)
  To: lnx-man

Come to think of it, this probably applies to IPv6 as well. Moving to
the paragraph before:

diff --git a/man3/inet_pton.3 b/man3/inet_pton.3
index 4ff16b9..2c487c5 100644
--- a/man3/inet_pton.3
+++ b/man3/inet_pton.3
@@ -48,6 +48,8 @@ argument must be either
 .B AF_INET
 or
 .BR AF_INET6 .
+.IR dst
+is written in network byte order.
 .PP
 The following address families are currently supported:
 .TP

On Thu, May 12, 2016 at 10:16 AM, Stefan Puiu <stefan.puiu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hi,
>
> I was a bit stumped recently to realize that both inet_ntop() and
> inet_pton() work with addresses in network byte order. inet_ntop.3
> mentions that, and the example from inet_pton(), as far as I can tell,
> implies that you can call inet_ntop() on the result of inet_pton(), so
> the byte order needs to match, but I think it's better to mention this
> explicitly in the man page text. How about this (patch against git)?
>
> diff --git a/man3/inet_pton.3 b/man3/inet_pton.3
> index 4ff16b9..8b1017e 100644
> --- a/man3/inet_pton.3
> +++ b/man3/inet_pton.3
> @@ -64,6 +64,8 @@ and copied to
>  which must be
>  .I sizeof(struct in_addr)
>  (4) bytes (32 bits) long.
> +.IR dst
> +is written in network byte order.
>  .TP
>  .B AF_INET6
>  .I src
>
> Thanks,
> Stefan.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] inet_pton.3: Mention byte order
       [not found] ` <CACKs7VAgKPUOp7+_0NzWujruw0fsMF0L+UnsNqV=zsfmF+tqrw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2016-05-12  7:23   ` Stefan Puiu
@ 2016-05-18 20:36   ` Michael Kerrisk (man-pages)
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Kerrisk (man-pages) @ 2016-05-18 20:36 UTC (permalink / raw)
  To: Stefan Puiu, lnx-man; +Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w

Hello Stefan,

On 05/12/2016 09:16 AM, Stefan Puiu wrote:
> Hi,
> 
> I was a bit stumped recently to realize that both inet_ntop() and
> inet_pton() work with addresses in network byte order.

Yes, that's correct.

> inet_ntop.3
> mentions that, and the example from inet_pton(), as far as I can tell,
> implies that you can call inet_ntop() on the result of inet_pton(), so
> the byte order needs to match, but I think it's better to mention this
> explicitly in the man page text. 

Yes, it should be mentioned.

> How about this (patch against git)?

Following up in next mail...

Cheers,

Michael


> diff --git a/man3/inet_pton.3 b/man3/inet_pton.3
> index 4ff16b9..8b1017e 100644
> --- a/man3/inet_pton.3
> +++ b/man3/inet_pton.3
> @@ -64,6 +64,8 @@ and copied to
>  which must be
>  .I sizeof(struct in_addr)
>  (4) bytes (32 bits) long.
> +.IR dst
> +is written in network byte order.
>  .TP
>  .B AF_INET6
>  .I src
> 
> Thanks,
> Stefan.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-man" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> .
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] inet_pton.3: Mention byte order
       [not found]     ` <CACKs7VAa+v_0q1JOWOka=g0UiTzyMv-hSKYZZKebm04U5Z1_Jw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-05-18 20:36       ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Kerrisk (man-pages) @ 2016-05-18 20:36 UTC (permalink / raw)
  To: Stefan Puiu, lnx-man; +Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w

On 05/12/2016 09:23 AM, Stefan Puiu wrote:
> Come to think of it, this probably applies to IPv6 as well. Moving to
> the paragraph before:

Thanks, Stefan. Patch applied.

Cheers,

Michael


> diff --git a/man3/inet_pton.3 b/man3/inet_pton.3
> index 4ff16b9..2c487c5 100644
> --- a/man3/inet_pton.3
> +++ b/man3/inet_pton.3
> @@ -48,6 +48,8 @@ argument must be either
>  .B AF_INET
>  or
>  .BR AF_INET6 .
> +.IR dst
> +is written in network byte order.
>  .PP
>  The following address families are currently supported:
>  .TP
> 
> On Thu, May 12, 2016 at 10:16 AM, Stefan Puiu <stefan.puiu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> Hi,
>>
>> I was a bit stumped recently to realize that both inet_ntop() and
>> inet_pton() work with addresses in network byte order. inet_ntop.3
>> mentions that, and the example from inet_pton(), as far as I can tell,
>> implies that you can call inet_ntop() on the result of inet_pton(), so
>> the byte order needs to match, but I think it's better to mention this
>> explicitly in the man page text. How about this (patch against git)?
>>
>> diff --git a/man3/inet_pton.3 b/man3/inet_pton.3
>> index 4ff16b9..8b1017e 100644
>> --- a/man3/inet_pton.3
>> +++ b/man3/inet_pton.3
>> @@ -64,6 +64,8 @@ and copied to
>>  which must be
>>  .I sizeof(struct in_addr)
>>  (4) bytes (32 bits) long.
>> +.IR dst
>> +is written in network byte order.
>>  .TP
>>  .B AF_INET6
>>  .I src
>>
>> Thanks,
>> Stefan.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-man" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2016-05-18 20:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-12  7:16 [PATCH] inet_pton.3: Mention byte order Stefan Puiu
     [not found] ` <CACKs7VAgKPUOp7+_0NzWujruw0fsMF0L+UnsNqV=zsfmF+tqrw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-05-12  7:23   ` Stefan Puiu
     [not found]     ` <CACKs7VAa+v_0q1JOWOka=g0UiTzyMv-hSKYZZKebm04U5Z1_Jw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-05-18 20:36       ` Michael Kerrisk (man-pages)
2016-05-18 20:36   ` Michael Kerrisk (man-pages)

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).