Subject: lib/25902: htons functions do not follow POSIX notation
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <ianzag@mail.ru>
List: netbsd-bugs
Date: 06/11/2004 09:10:05
>Number:         25902
>Category:       lib
>Synopsis:       htons functions do not follow POSIX notation
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 11 09:11:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Ian Zagorskih
>Release:        NetBSD-release-2-0
>Organization:
NOKB GP
>Environment:
NetBSD IANZAG 2.0_BETA NetBSD 2.0_BETA (IANZAG) #0: Thu Jun  3 20:54:46 NOVST 2004  ianzag@IANZAG:/usr/src/sys/arch/i386/compile/IANZAG i386
>Description:

htons,htonl,ntohs and ntohl functions do not follow POSIX 1003.1 specification.

NetBSD declares this functions as:

     #include <sys/types.h>

     in_addr_t
     htonl(in_addr_t host32);

     in_port_t
     htons(in_port_t host16);

     in_addr_t
     ntohl(in_addr_t net32);

     in_port_t
     ntohs(in_port_t net16);

POSIX declares this functions as:

 #include <arpa/inet.h>
 
 uint32_t htonl(uint32_t hostlong);
 uint16_t htons(uint16_t hostshort);
 uint32_t ntohl(uint32_t netlong);
 uint16_t ntohs(uint16_t netshort);

>How-To-Repeat:

Check POSIX specification at
http://www.opengroup.org/onlinepubs/009695399/functions/htonl.html and NetBSD manual page for htons

>Fix:

Just substitute in_port_t and in_addr_t with uint16_t and uint32_t respectively in proper header files.

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