docs/188786: Bug in inet3) man page (inet_aton())

Michael Kerrisk mtk.manpages at gmail.com
Sat Apr 19 07:10:00 UTC 2014


>Number:         188786
>Category:       docs
>Synopsis:       Bug in inet3) man page (inet_aton())
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-doc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Apr 19 07:10:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Michael Kerrisk
>Release:        10.0
>Organization:
Linux man-pages maintainer
>Environment:
n/a
>Description:
As http://www.freebsd.org/cgi/man.cgi?query=inet_aton&apropos=0&sektion=0&manpath=FreeBSD+10.0-RELEASE&arch=default&format=html, on sees the text:

     When a two	part address is	supplied, the last part	is interpreted as a
     24-bit quantity and placed	in the right most three	bytes of the network
     address.  This makes the two part address format convenient for specify-
     ing Class A network addresses as ``net.host''.

In the second line, there should I believe be the substitution: s/network$/host$/. 

I have no FreeBSD system to test, but have tested on OpenBSD and Linux. Furthermore, the change makes sense when one reads the surrounding text.

I see the same text in the OpenBSD page, and also the NetBSD page. How does this work -- should I submit bugs for each of those systems, or do communicate such problems to one another?

Thanks,

Michael Kerrisk
(maintainer, Linux man-pages project)

Test code:
#define _BSD_SOURCE
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>

static void
printBytes(in_addr_t a)
{
    printf("%d", (a >> 24) & 0xff);
    printf(".");
    printf("%d", (a >> 16) & 0xff);
    printf(".");
    printf("%d", (a >> 8) & 0xff);
    printf(".");
    printf("%d", (a & 0xff));
} /* printBytes */

int
main(int argc, char *argv[])
{
    struct in_addr addr;

    if (argc != 2) {
        fprintf(stderr, "%s <dotted-address>\n", argv[0]);
        exit(EXIT_FAILURE);
    }

    if (inet_aton(argv[1], &addr) == 0) {
        fprintf(stderr, "inet_aton() failed\n");
        exit(EXIT_FAILURE);
    }

    printf("%s\n", inet_ntoa(addr));

    struct in_addr n, h;

    n.s_addr = inet_netof(addr);
    printf("Network number       : ");
    printBytes(n.s_addr);
    printf("\n");

    h.s_addr = inet_lnaof(addr);
    printf("Local network address: ");
    printBytes(h.s_addr);
    printf("\n");

    addr = inet_makeaddr(n.s_addr, h.s_addr);
    printf("Made address: %s\n", inet_ntoa(addr));

    exit(EXIT_SUCCESS);
}

>How-To-Repeat:

>Fix:
As above

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-doc mailing list