remove ifdefs to skip htons() on some big-endian platforms.

This commit is contained in:
chs 2000-04-16 20:58:52 +00:00
parent d444bb4032
commit 46faa6bb58
3 changed files with 8 additions and 22 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_auth.c,v 1.14 2000/03/30 13:24:57 augustss Exp $ */
/* $NetBSD: ip_auth.c,v 1.15 2000/04/16 20:58:52 chs Exp $ */
/*
* Copyright (C) 1998 by Darren Reed & Guido van Rooij.
@ -9,7 +9,7 @@
*/
#if !defined(lint)
#if defined(__NetBSD__)
static const char rcsid[] = "$NetBSD: ip_auth.c,v 1.14 2000/03/30 13:24:57 augustss Exp $";
static const char rcsid[] = "$NetBSD: ip_auth.c,v 1.15 2000/04/16 20:58:52 chs Exp $";
#else
static const char rcsid[] = "@(#)Id: ip_auth.c,v 2.1.2.2 2000/01/16 10:12:14 darrenr Exp";
#endif
@ -238,7 +238,7 @@ ip_t *ip;
fr_auth[i].fra_pass = 0;
fr_auth[i].fra_age = fr_defaultauthage;
bcopy((char *)fin, (char *)&fr_auth[i].fra_info, sizeof(*fin));
#if !defined(sparc) && !defined(m68k)
/*
* No need to copyback here as we want to undo the changes, not keep
* them.
@ -258,7 +258,7 @@ ip_t *ip;
bo = ip->ip_off;
ip->ip_off = htons(bo);
}
#endif
#if SOLARIS && defined(_KERNEL)
m->b_rptr -= qif->qf_off;
fr_authpkts[i] = *(mblk_t **)fin->fin_mp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_fil.c,v 1.47 2000/03/30 13:24:57 augustss Exp $ */
/* $NetBSD: ip_fil.c,v 1.48 2000/04/16 20:58:53 chs Exp $ */
/*
* Copyright (C) 1993-1998 by Darren Reed.
@ -9,7 +9,7 @@
*/
#if !defined(lint)
#if defined(__NetBSD__)
static const char rcsid[] = "$NetBSD: ip_fil.c,v 1.47 2000/03/30 13:24:57 augustss Exp $";
static const char rcsid[] = "$NetBSD: ip_fil.c,v 1.48 2000/04/16 20:58:53 chs Exp $";
#else
static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-1995 Darren Reed";
static const char rcsid[] = "@(#)Id: ip_fil.c,v 2.4.2.16 2000/01/16 10:12:42 darrenr Exp";
@ -1035,7 +1035,6 @@ struct in_addr dst;
bcopy((char *)oip, (char *)&icmp->icmp_ip, sizeof(*oip));
bcopy((char *)oip + (oip->ip_hl << 2),
(char *)&icmp->icmp_ip + sizeof(*oip), 8); /* 64 bits */
# ifndef sparc
{
u_short __iplen, __ipoff;
ip_t *ip = &icmp->icmp_ip;
@ -1045,7 +1044,6 @@ struct in_addr dst;
ip->ip_len = htons(__iplen);
ip->ip_off = htons(__ipoff);
}
# endif
icmp->icmp_cksum = ipf_cksum((u_short *)icmp, sizeof(*icmp) + 8);
return send_ip(m, nip);
}
@ -1174,13 +1172,11 @@ frdest_t *fdp;
* If small enough for interface, can just send directly.
*/
if (ip->ip_len <= ifp->if_mtu) {
# ifndef sparc
# ifndef __NetBSD__
ip->ip_id = htons(ip->ip_id);
# endif
ip->ip_len = htons(ip->ip_len);
ip->ip_off = htons(ip->ip_off);
# endif
if (!ip->ip_sum)
ip->ip_sum = in_cksum(m, hlen);
# if BSD >= 199306
@ -1262,9 +1258,7 @@ frdest_t *fdp;
m->m_pkthdr.len = mhlen + len;
m->m_pkthdr.rcvif = NULL;
# endif
# ifndef sparc
mhip->ip_off = htons((u_short)mhip->ip_off);
# endif
mhip->ip_sum = 0;
mhip->ip_sum = in_cksum(m, mhlen);
*mnext = m;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_nat.c,v 1.29 2000/03/30 13:25:01 augustss Exp $ */
/* $NetBSD: ip_nat.c,v 1.30 2000/04/16 20:58:53 chs Exp $ */
/*
* Copyright (C) 1995-1998 by Darren Reed.
@ -11,7 +11,7 @@
*/
#if !defined(lint)
#if defined(__NetBSD__)
static const char rcsid[] = "$NetBSD: ip_nat.c,v 1.29 2000/03/30 13:25:01 augustss Exp $";
static const char rcsid[] = "$NetBSD: ip_nat.c,v 1.30 2000/04/16 20:58:53 chs Exp $";
#else
static const char sccsid[] = "@(#)ip_nat.c 1.11 6/5/96 (C) 1995 Darren Reed";
static const char rcsid[] = "@(#)Id: ip_nat.c,v 2.2.2.12 2000/01/24 12:43:40 darrenr Exp";
@ -242,11 +242,7 @@ int len;
return;
}
#endif
#ifdef sparc
sum1 = (~(*sp)) & 0xffff;
#else
sum1 = (~ntohs(*sp)) & 0xffff;
#endif
sum1 += ~(n) & 0xffff;
sum1 = (sum1 >> 16) + (sum1 & 0xffff);
/* Again */
@ -740,11 +736,7 @@ int direction;
np->in_outip)
in.s_addr = 0;
else
#ifndef sparc
in.s_addr = ntohl(in.s_addr);
#else
;
#endif
}
}