NetBSD Problem Report #6355

Received: (qmail 3812 invoked from network); 25 Oct 1998 07:45:21 -0000
Message-Id: <m0zXKrU-0009LFC@most.weird.com>
Date: Sun, 25 Oct 1998 02:45:16 -0500 (EST)
From: woods@weird.com
Reply-To: woods@planix.com
To: gnats-bugs@gnats.netbsd.org
Subject: attempt to clear up some of the network byte order confusion in inet(3)
X-Send-Pr-Version: 3.95

>Number:         6355
>Category:       lib
>Synopsis:       attempt to clear up some of the network byte order confusion in inet(3)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 25 00:50:01 +0000 1998
>Closed-Date:    Wed Mar 17 23:19:57 +0000 1999
>Last-Modified:  Wed Mar 17 23:20:11 +0000 1999
>Originator:     Greg A. Woods
>Release:        NetBSD-current sup 909143147
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Environment:

irrelevant

>Description:

	as per the BUG noted at the bottom of the inet(3) manual page,
	it always takes me a bit of time and hard thinking to remember
	exactly what's what with the byte order of arguments and reutrn
	values for each function described therein

>How-To-Repeat:

	Write some code that attempts to pass raw network addresses back
	through inet_ntoa(inet_makeaddr()) and wonder why it doesn't
	work on i386....

>Fix:

	apply the attached patch (but do *not* remove the BUG! ;-):

Index: inet.3
===================================================================
RCS file: /cvs/NetBSD/src/lib/libc/net/inet.3,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 inet.3
*** inet.3	1998/02/20 00:31:47	1.1.1.1
--- inet.3	1998/10/25 07:16:30
***************
*** 126,140 ****
  .Ql \&.
  notation.  The routine
  .Fn inet_makeaddr
! takes an Internet network number and a local
! network address and constructs an Internet address
! from it.  The routines
  .Fn inet_netof
  and
  .Fn inet_lnaof
! break apart Internet host addresses, returning
! the network number and local network address part,
! respectively.
  .Pp
  All Internet addresses are returned in network
  order (bytes ordered from left to right).
--- 126,145 ----
  .Ql \&.
  notation.  The routine
  .Fn inet_makeaddr
! takes an Internet network number and a local network address (both in
! host order) and constructs an Internet address from it.  Note that to
! convert only a single value to a
! .Ft struct in_addr
! form that value shoud be passed as the first parameter and
! .Ql 0L
! should be given for the second parameter.
! .Pp
! The routines
  .Fn inet_netof
  and
  .Fn inet_lnaof
! break apart Internet host addresses, returning the network number and
! local network address part, respectively (both in host order).
  .Pp
  All Internet addresses are returned in network
  order (bytes ordered from left to right).

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: fair 
State-Changed-When: Wed Mar 17 15:19:57 PST 1999 
State-Changed-Why:  
patch applied. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.