of u_short or u_int16_t.
-.\" $OpenBSD: byteorder.3,v 1.3 1996/11/25 13:11:12 niklas Exp $
+.\" $OpenBSD: byteorder.3,v 1.4 1997/04/05 21:13:05 millert Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.Bx 4.2 .
.Sh BUGS
On the
-.Tn VAX
+.Tn VAX ,
+.Tn ALPHA ,
+and
+.Tn iX86
bytes are handled backwards from most everyone else in
the world. This is not expected to be fixed in the near future.
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: getnetbyaddr.c,v 1.3 1997/03/13 19:07:25 downsj Exp $";
+static char rcsid[] = "$OpenBSD: getnetbyaddr.c,v 1.4 1997/04/05 21:13:06 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <netdb.h>
struct netent *
_getnetbyaddr(net, type)
- register unsigned long net;
+ register in_addr_t net;
register int type;
{
register struct netent *p;
-.\" $OpenBSD: getnetent.3,v 1.3 1997/03/13 19:07:26 downsj Exp $
+.\" $OpenBSD: getnetent.3,v 1.4 1997/04/05 21:13:07 millert Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.Ft struct netent *
.Fn getnetbyname "char *name"
.Ft struct netent *
-.Fn getnetbyaddr "unsigned long net" "int type"
+.Fn getnetbyaddr "in_addr_t net" "int type"
.Fn setnetent "int stayopen"
.Fn endnetent
.Sh DESCRIPTION
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
int n_addrtype; /* net number type */
- unsigned long n_net; /* net number */
+ in_addr_t n_net; /* net number */
};
.Ed
.Pp
-/* $OpenBSD: getnetnamadr.c,v 1.4 1997/04/03 08:33:06 downsj Exp $ */
+/* $OpenBSD: getnetnamadr.c,v 1.5 1997/04/05 21:13:08 millert Exp $ */
/* Copyright (c) 1993 Carlos Leandro and Rui Salgueiro
* Dep. Matematica Universidade de Coimbra, Portugal, Europe
static char sccsid_[] = "from getnetnamadr.c 1.4 (Coimbra) 93/06/03";
static char rcsid[] = "$From: getnetnamadr.c,v 8.7 1996/08/05 08:31:35 vixie Exp $";
#else
-static char rcsid[] = "$OpenBSD: getnetnamadr.c,v 1.4 1997/04/03 08:33:06 downsj Exp $";
+static char rcsid[] = "$OpenBSD: getnetnamadr.c,v 1.5 1997/04/05 21:13:08 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
extern int h_errno;
-struct netent *_getnetbyaddr __P((long net, int type));
+struct netent *_getnetbyaddr __P((in_addr_t net, int type));
struct netent *_getnetbyname __P((const char *name));
int _hokchar __P((const char *));
struct netent *
getnetbyaddr(net, net_type)
- register u_long net;
+ register in_addr_t net;
register int net_type;
{
unsigned int netbr[4];
int nn, anslen;
querybuf buf;
char qbuf[MAXDNAME];
- unsigned long net2;
+ in_addr_t net2;
struct netent *net_entry;
char lookups[MAXDNSLUS];
int i;
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: getservent.c,v 1.2 1996/08/19 08:29:00 tholo Exp $";
+static char rcsid[] = "$OpenBSD: getservent.c,v 1.3 1997/04/05 21:13:09 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
if (cp == NULL)
goto again;
*cp++ = '\0';
- serv.s_port = htons((u_short)atoi(p));
+ serv.s_port = htons((in_port_t)atoi(p));
serv.s_proto = cp;
q = serv.s_aliases = serv_aliases;
cp = strpbrk(cp, " \t");
-.\" $OpenBSD: inet.3,v 1.2 1996/08/19 08:29:06 tholo Exp $
+.\" $OpenBSD: inet.3,v 1.3 1997/04/05 21:13:10 millert Exp $
.\"
.\" Copyright (c) 1983, 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.Fd #include <arpa/inet.h>
.Ft int
.Fn inet_aton "const char *cp" "struct in_addr *pin"
-.Ft unsigned long
+.Ft in_addr_t
.Fn inet_addr "const char *cp"
-.Ft unsigned long
+.Ft in_addr_t
.Fn inet_network "const char *cp"
.Ft char *
.Fn inet_ntoa "struct in_addr in"
.Ft struct in_addr
.Fn inet_makeaddr "int net" "int lna"
-.Ft unsigned long
+.Ft in_addr_t
.Fn inet_lnaof "struct in_addr in"
-.Ft unsigned long
+.Ft in_addr_t
.Fn inet_netof "struct in_addr in"
.Sh DESCRIPTION
The routines
-/* $OpenBSD: inet_addr.c,v 1.4 1997/03/13 19:07:29 downsj Exp $ */
+/* $OpenBSD: inet_addr.c,v 1.5 1997/04/05 21:13:10 millert Exp $ */
/*
* ++Copyright++ 1983, 1990, 1993
static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93";
static char rcsid[] = "$From: inet_addr.c,v 8.5 1996/08/05 08:31:35 vixie Exp $";
#else
-static char rcsid[] = "$OpenBSD: inet_addr.c,v 1.4 1997/03/13 19:07:29 downsj Exp $";
+static char rcsid[] = "$OpenBSD: inet_addr.c,v 1.5 1997/04/05 21:13:10 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
* Ascii internet address interpretation routine.
* The value returned is in network order.
*/
-u_long
+in_addr_t
inet_addr(cp)
register const char *cp;
{
register const char *cp;
struct in_addr *addr;
{
- register u_long val;
+ register in_addr_t val;
register int base, n;
register char c;
u_int parts[4];
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: inet_lnaof.c,v 1.2 1996/08/19 08:29:09 tholo Exp $";
+static char rcsid[] = "$OpenBSD: inet_lnaof.c,v 1.3 1997/04/05 21:13:11 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
* internet address; handles class a/b/c network
* number formats.
*/
-u_long
+in_addr_t
inet_lnaof(in)
struct in_addr in;
{
- register u_long i = ntohl(in.s_addr);
+ register in_addr_t i = ntohl(in.s_addr);
if (IN_CLASSA(i))
return ((i)&IN_CLASSA_HOST);
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: inet_makeaddr.c,v 1.2 1996/08/19 08:29:11 tholo Exp $";
+static char rcsid[] = "$OpenBSD: inet_makeaddr.c,v 1.3 1997/04/05 21:13:12 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
*/
struct in_addr
inet_makeaddr(net, host)
- u_long net, host;
+ in_addr_t net, host;
{
- u_long addr;
+ in_addr_t addr;
if (net < 128)
addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST);
-/* $OpenBSD: inet_neta.c,v 1.1 1997/03/13 19:07:31 downsj Exp $ */
+/* $OpenBSD: inet_neta.c,v 1.2 1997/04/05 21:13:12 millert Exp $ */
/*
* Copyright (c) 1996 by Internet Software Consortium.
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
-static const char rcsid[] = "$Id: inet_neta.c,v 1.1 1997/03/13 19:07:31 downsj Exp $";
+static const char rcsid[] = "$Id: inet_neta.c,v 1.2 1997/04/05 21:13:12 millert Exp $";
#else
-static const char rcsid[] = "$OpenBSD: inet_neta.c,v 1.1 1997/03/13 19:07:31 downsj Exp $";
+static const char rcsid[] = "$OpenBSD: inet_neta.c,v 1.2 1997/04/05 21:13:12 millert Exp $";
#endif
#endif
#include <errno.h>
#include <stdio.h>
+#include <string.h>
/*
* char *
* inet_neta(src, dst, size)
- * format a u_long network number into presentation format.
+ * format an in_addr_t network number into presentation format.
* return:
* pointer to dst, or NULL if an error occurred (check errno).
* note:
*/
char *
inet_neta(src, dst, size)
- u_long src;
+ in_addr_t src;
char *dst;
size_t size;
{
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: inet_netof.c,v 1.2 1996/08/19 08:29:12 tholo Exp $";
+static char rcsid[] = "$OpenBSD: inet_netof.c,v 1.3 1997/04/05 21:13:13 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
* Return the network number from an internet
* address; handles class a/b/c network #'s.
*/
-u_long
+in_addr_t
inet_netof(in)
struct in_addr in;
{
- register u_long i = ntohl(in.s_addr);
+ register in_addr_t i = ntohl(in.s_addr);
if (IN_CLASSA(i))
return (((i)&IN_CLASSA_NET) >> IN_CLASSA_NSHIFT);
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: inet_network.c,v 1.4 1996/08/19 08:29:14 tholo Exp $";
+static char rcsid[] = "$OpenBSD: inet_network.c,v 1.5 1997/04/05 21:13:14 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
* The library routines call this routine to interpret
* network numbers.
*/
-u_long
+in_addr_t
inet_network(cp)
register const char *cp;
{
- register u_long val, base, n;
+ register in_addr_t val, base, n;
register char c;
- u_long parts[4], *pp = parts;
+ in_addr_t parts[4], *pp = parts;
register int i;
again:
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: ns_ntoa.c,v 1.3 1996/08/19 08:29:31 tholo Exp $";
+static char rcsid[] = "$OpenBSD: ns_ntoa.c,v 1.4 1997/04/05 21:13:15 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
{
static char obuf[40];
union { union ns_net net_e; u_long long_e; } net;
- u_short port = htons(addr.x_port);
+ in_port_t port = htons(addr.x_port);
register char *cp;
char *cp2;
register u_char *up = addr.x_host.c_host;
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: rcmd.c,v 1.19 1997/01/25 21:30:37 deraadt Exp $";
+static char *rcsid = "$OpenBSD: rcmd.c,v 1.20 1997/04/05 21:13:15 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
#include <syslog.h>
#include <stdlib.h>
-int __ivaliduser __P((FILE *, u_long, const char *, const char *));
+int __ivaliduser __P((FILE *, in_addr_t, const char *, const char *));
static int __icheckhost __P((u_int32_t, const char *));
static char *__gethostloop __P((u_int32_t));
int
rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
char **ahost;
- u_short rport;
+ in_port_t rport;
const char *locuser, *remuser, *cmd;
int *fd2p;
{
s = socket(AF_INET, SOCK_STREAM, 0);
if (s < 0)
return (-1);
- sin.sin_port = htons((u_short)*alport);
+ sin.sin_port = htons((in_port_t)*alport);
if (*alport < IPPORT_RESERVED - 1) {
if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
return (s);
addrs[i] = 0;
for (i = 0; i < MAXADDRS && addrs[i]; i++)
- if (iruserok((u_long)addrs[i], superuser, ruser, luser) == 0)
+ if (iruserok((in_addr_t)addrs[i], superuser, ruser, luser) == 0)
return (0);
return (-1);
}
int
__ivaliduser(hostf, raddrl, luser, ruser)
FILE *hostf;
- u_long raddrl;
+ in_addr_t raddrl;
const char *luser, *ruser;
{
register char *user, *p;
-/* $OpenBSD: res_debug.c,v 1.5 1997/03/13 19:07:37 downsj Exp $ */
+/* $OpenBSD: res_debug.c,v 1.6 1997/04/05 21:13:16 millert Exp $ */
/*
* ++Copyright++ 1985, 1990, 1993
static char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "$From: res_debug.c,v 8.19 1996/11/26 10:11:23 vixie Exp $";
#else
-static char rcsid[] = "$OpenBSD: res_debug.c,v 1.5 1997/03/13 19:07:37 downsj Exp $";
+static char rcsid[] = "$OpenBSD: res_debug.c,v 1.6 1997/04/05 21:13:16 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
} else if (dlen == 7) {
char *address;
u_char protocol;
- u_short port;
+ in_port_t port;
address = inet_ntoa(inaddr);
cp += INADDRSZ;
-/* $OpenBSD: res_init.c,v 1.12 1997/04/03 05:53:46 deraadt Exp $ */
+/* $OpenBSD: res_init.c,v 1.13 1997/04/05 21:13:17 millert Exp $ */
/*
* ++Copyright++ 1985, 1989, 1993
static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
static char rcsid[] = "$From: res_init.c,v 8.7 1996/09/28 06:51:07 vixie Exp $";
#else
-static char rcsid[] = "$OpenBSD: res_init.c,v 1.12 1997/04/03 05:53:46 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: res_init.c,v 1.13 1997/04/05 21:13:17 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
u_int
res_randomid()
{
- struct timeval now;
-
- gettimeofday(&now, NULL);
- return (0xffff & (now.tv_sec ^ now.tv_usec ^ getpid()));
+ return (0xffff & arc4random());
}