Re: [PATCH] ip(7), ipv6(7): small fixes: network byte order, etc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Askar,

On Sun, May 12, 2024 at 01:16:57AM GMT, Askar Safin wrote:
> Signed-off-by: Askar Safin <safinaskar@xxxxxxxxxxxx>
> ---
>  man/man7/ip.7   |  2 +-
>  man/man7/ipv6.7 | 10 +++++-----
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/man/man7/ip.7 b/man/man7/ip.7
> index 4fc9bde..8678979 100644
> --- a/man/man7/ip.7
> +++ b/man/man7/ip.7
> @@ -198,7 +198,7 @@ The
>  member of
>  .I struct in_addr
>  contains the host interface address in network byte order.
> -.I in_addr
> +.I s_addr
>  should be assigned one of the
>  .B INADDR_*
>  values

LGTM.  The type of INADDR_* are in_addr_t, not a structure.

$ grepc -tm 'INADDR_[_A-Z]*' /usr/include/
/usr/include/mit-krb5/gssrpc/types.h:#define       INADDR_LOOPBACK         (uint32_t)0x7F000001
/usr/include/netinet/in.h:#define	INADDR_ANY		((in_addr_t) 0x00000000)
/usr/include/netinet/in.h:#define	INADDR_BROADCAST	((in_addr_t) 0xffffffff)
/usr/include/netinet/in.h:#define	INADDR_NONE		((in_addr_t) 0xffffffff)
/usr/include/netinet/in.h:#define	INADDR_DUMMY		((in_addr_t) 0xc0000008)
/usr/include/netinet/in.h:# define INADDR_LOOPBACK	((in_addr_t) 0x7f000001) /* Inet 127.0.0.1.  */
/usr/include/netinet/in.h:#define INADDR_UNSPEC_GROUP	((in_addr_t) 0xe0000000) /* 224.0.0.0 */
/usr/include/netinet/in.h:#define INADDR_ALLHOSTS_GROUP	((in_addr_t) 0xe0000001) /* 224.0.0.1 */
/usr/include/netinet/in.h:#define INADDR_ALLRTRS_GROUP    ((in_addr_t) 0xe0000002) /* 224.0.0.2 */
/usr/include/netinet/in.h:#define INADDR_ALLSNOOPERS_GROUP ((in_addr_t) 0xe000006a) /* 224.0.0.106 */
/usr/include/netinet/in.h:#define INADDR_MAX_LOCAL_GROUP  ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */
/usr/include/X11/Xtrans/Xtranssock.c:#define INADDR_NONE ((in_addr_t) 0xffffffff)
/usr/include/linux/in.h:#define	INADDR_ANY		((unsigned long int) 0x00000000)
/usr/include/linux/in.h:#define	INADDR_BROADCAST	((unsigned long int) 0xffffffff)
/usr/include/linux/in.h:#define	INADDR_NONE		((unsigned long int) 0xffffffff)
/usr/include/linux/in.h:#define	INADDR_DUMMY		((unsigned long int) 0xc0000008)
/usr/include/linux/in.h:#define	INADDR_LOOPBACK		0x7f000001	/* 127.0.0.1   */
/usr/include/linux/in.h:#define INADDR_UNSPEC_GROUP		0xe0000000U	/* 224.0.0.0   */
/usr/include/linux/in.h:#define INADDR_ALLHOSTS_GROUP		0xe0000001U	/* 224.0.0.1   */
/usr/include/linux/in.h:#define INADDR_ALLRTRS_GROUP		0xe0000002U	/* 224.0.0.2 */
/usr/include/linux/in.h:#define INADDR_ALLSNOOPERS_GROUP	0xe000006aU	/* 224.0.0.106 */
/usr/include/linux/in.h:#define INADDR_MAX_LOCAL_GROUP		0xe00000ffU	/* 224.0.0.255 */

> diff --git a/man/man7/ipv6.7 b/man/man7/ipv6.7
> index d9241cc..e38658f 100644
> --- a/man/man7/ipv6.7
> +++ b/man/man7/ipv6.7
> @@ -105,7 +105,7 @@ Only differences are described in this man page.
>  .P
>  To bind an
>  .B AF_INET6
> -socket to any process, the local address should be copied from the
> +socket to any interface, the address should be copied from the
>  .I in6addr_any
>  variable which has
>  .I in6_addr

Sounds good.

> @@ -138,14 +138,14 @@ its source address will be mapped to v6.
>  .EX
>  struct sockaddr_in6 {
>      sa_family_t     sin6_family;   /* AF_INET6 */
> -    in_port_t       sin6_port;     /* port number */
> +    in_port_t       sin6_port;     /* port number in network byte order */

You probably want to also check <man/man3type/sockaddr_in6.3type>, where
you'll want to apply the same fix.

BTW, we should consider removing those definitions from ipv6(7), and
refer to sockaddr(3type).

>      uint32_t        sin6_flowinfo; /* IPv6 flow information */
>      struct in6_addr sin6_addr;     /* IPv6 address */
>      uint32_t        sin6_scope_id; /* Scope ID (new in Linux 2.4) */
>  };
>  \&
>  struct in6_addr {
> -    unsigned char   s6_addr[16];   /* IPv6 address */
> +    unsigned char   s6_addr[16];   /* IPv6 address in network byte order */
>  };
>  .EE
>  .in
> @@ -154,14 +154,14 @@ struct in6_addr {
>  is always set to
>  .BR AF_INET6 ;
>  .I sin6_port
> -is the protocol port (see
> +is the protocol port in network byte order (see
>  .I sin_port
>  in
>  .BR ip (7));

LGTM.

>  .I sin6_flowinfo
>  is the IPv6 flow identifier;
>  .I sin6_addr
> -is the 128-bit IPv6 address.
> +is the 128-bit IPv6 address in network byte order.
>  .I sin6_scope_id
>  is an ID depending on the scope of the address.
>  It is new in Linux 2.4.

LGTM.

Thanks,
and have a lovely night!
Alex

-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux