summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1995-11-16 14:23:28 +0000
committerderaadt <deraadt@openbsd.org>1995-11-16 14:23:28 +0000
commit540eaef7284315df2a481092c867d72c06044a3b (patch)
treef8221c794df34d43fb12ee7d50fa5d19a98a1b2e
parentAdd `1.1' to Nx macro; from netbsd (diff)
downloadwireguard-openbsd-540eaef7284315df2a481092c867d72c06044a3b.tar.xz
wireguard-openbsd-540eaef7284315df2a481092c867d72c06044a3b.zip
repair byte order botches; from scottr@plexus.com via netbsd
-rw-r--r--usr.sbin/rbootd/bpf.c8
-rw-r--r--usr.sbin/rbootd/rmp_var.h8
-rw-r--r--usr.sbin/rbootd/rmpproto.c7
-rw-r--r--usr.sbin/rbootd/utils.c6
4 files changed, 14 insertions, 15 deletions
diff --git a/usr.sbin/rbootd/bpf.c b/usr.sbin/rbootd/bpf.c
index fcb06445bc9..aae7d173a09 100644
--- a/usr.sbin/rbootd/bpf.c
+++ b/usr.sbin/rbootd/bpf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bpf.c,v 1.5 1995/10/06 05:12:12 thorpej Exp $ */
+/* $NetBSD: bpf.c,v 1.5.2.1 1995/11/14 08:45:42 thorpej Exp $ */
/*
* Copyright (c) 1988, 1992 The University of Utah and the Center
@@ -48,7 +48,7 @@
#ifndef lint
/*static char sccsid[] = "@(#)bpf.c 8.1 (Berkeley) 6/4/93";*/
-static char rcsid[] = "$NetBSD: bpf.c,v 1.5 1995/10/06 05:12:12 thorpej Exp $";
+static char rcsid[] = "$NetBSD: bpf.c,v 1.5.2.1 1995/11/14 08:45:42 thorpej Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -350,7 +350,7 @@ BpfRead(rconn, doread)
syslog(LOG_ERR, "bpf: large packet dropped (%d bytes)",
caplen);
else {
- rconn->rmplen = htons(caplen);
+ rconn->rmplen = caplen;
bcopy((char *)&bhp->bh_tstamp, (char *)&rconn->tstamp,
sizeof(struct timeval));
bcopy((char *)bp + hdrlen, (char *)&rconn->rmp, caplen);
@@ -379,7 +379,7 @@ int
BpfWrite(rconn)
RMPCONN *rconn;
{
- if (write(BpfFd, (char *)&rconn->rmp, ntohs(rconn->rmplen)) < 0) {
+ if (write(BpfFd, (char *)&rconn->rmp, rconn->rmplen) < 0) {
syslog(LOG_ERR, "write: %s: %m", EnetStr(rconn));
return(0);
}
diff --git a/usr.sbin/rbootd/rmp_var.h b/usr.sbin/rbootd/rmp_var.h
index f00d90583cc..b184c094a1d 100644
--- a/usr.sbin/rbootd/rmp_var.h
+++ b/usr.sbin/rbootd/rmp_var.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rmp_var.h,v 1.7 1995/10/06 05:12:19 thorpej Exp $ */
+/* $NetBSD: rmp_var.h,v 1.7.2.1 1995/11/14 08:45:43 thorpej Exp $ */
/*
* Copyright (c) 1988, 1992 The University of Utah and the Center
@@ -98,12 +98,12 @@
* limited to 255 bytes due to the preceding 1-byte length field.
*/
-#define RMPBOOTSIZE(s) htons(sizeof(struct hp_hdr) + sizeof(struct hp_llc) + \
+#define RMPBOOTSIZE(s) (sizeof(struct hp_hdr) + sizeof(struct hp_llc) + \
sizeof(struct rmp_boot_repl) + s - sizeof(restofpkt))
-#define RMPREADSIZE(s) htons(sizeof(struct hp_hdr) + sizeof(struct hp_llc) + \
+#define RMPREADSIZE(s) (sizeof(struct hp_hdr) + sizeof(struct hp_llc) + \
sizeof(struct rmp_read_repl) + s - sizeof(restofpkt) \
- sizeof(u_int8_t))
-#define RMPDONESIZE htons(sizeof(struct hp_hdr) + sizeof(struct hp_llc) + \
+#define RMPDONESIZE (sizeof(struct hp_hdr) + sizeof(struct hp_llc) + \
sizeof(struct rmp_boot_done))
#define RMPBOOTDATA 255
#define RMPREADDATA (RMPDATALEN - \
diff --git a/usr.sbin/rbootd/rmpproto.c b/usr.sbin/rbootd/rmpproto.c
index d752ac0e9aa..83e2ebe74d9 100644
--- a/usr.sbin/rbootd/rmpproto.c
+++ b/usr.sbin/rbootd/rmpproto.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rmpproto.c,v 1.5 1995/10/06 05:12:21 thorpej Exp $ */
+/* $NetBSD: rmpproto.c,v 1.5.2.1 1995/11/14 08:45:44 thorpej Exp $ */
/*
* Copyright (c) 1988, 1992 The University of Utah and the Center
@@ -48,7 +48,7 @@
#ifndef lint
/*static char sccsid[] = "@(#)rmpproto.c 8.1 (Berkeley) 6/4/93";*/
-static char rcsid[] = "$NetBSD: rmpproto.c,v 1.5 1995/10/06 05:12:21 thorpej Exp $";
+static char rcsid[] = "$NetBSD: rmpproto.c,v 1.5.2.1 1995/11/14 08:45:44 thorpej Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -574,8 +574,7 @@ SendPacket(rconn)
*/
bcopy((char *)&rconn->rmp.hp_hdr.saddr[0],
(char *)&rconn->rmp.hp_hdr.daddr[0], RMP_ADDRLEN);
- rconn->rmp.hp_hdr.len = htons(ntohs(rconn->rmplen)
- - sizeof(struct hp_hdr));
+ rconn->rmp.hp_hdr.len = htons(rconn->rmplen - sizeof(struct hp_hdr));
/*
* Reverse 802.2/HP Extended Source & Destination Access Pts.
diff --git a/usr.sbin/rbootd/utils.c b/usr.sbin/rbootd/utils.c
index 5f891613d8a..eb2ffa9d9ac 100644
--- a/usr.sbin/rbootd/utils.c
+++ b/usr.sbin/rbootd/utils.c
@@ -1,4 +1,4 @@
-/* $NetBSD: utils.c,v 1.5 1995/10/06 05:12:22 thorpej Exp $ */
+/* $NetBSD: utils.c,v 1.5.2.1 1995/11/14 08:45:46 thorpej Exp $ */
/*
* Copyright (c) 1988, 1992 The University of Utah and the Center
@@ -48,7 +48,7 @@
#ifndef lint
/*static char sccsid[] = "@(#)utils.c 8.1 (Berkeley) 6/4/93";*/
-static char rcsid[] = "$NetBSD: utils.c,v 1.5 1995/10/06 05:12:22 thorpej Exp $";
+static char rcsid[] = "$NetBSD: utils.c,v 1.5.2.1 1995/11/14 08:45:46 thorpej Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -166,7 +166,7 @@ DispPkt(rconn, direct)
(void) fprintf(DbgFp, ReadFmt, rmp->r_rrpl.rmp_retcode,
t, ntohs(rmp->r_rrpl.rmp_session));
(void) fprintf(DbgFp, "\t\tNoOfBytesSent: %d\n",
- ntohs(rconn->rmplen) - ntohs(RMPREADSIZE(0)));
+ rconn->rmplen - RMPREADSIZE(0));
break;
case RMP_BOOT_DONE: /* boot complete */
(void) fprintf(DbgFp, "\tBoot Complete:\n");