summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>1999-01-08 21:51:24 +0000
committerNiels Provos <provos@cvs.openbsd.org>1999-01-08 21:51:24 +0000
commitc07341fac2ce2741b6a76adc2a128945bb889594 (patch)
tree321668943b40bf61453e796600fb41cd7fa98c51 /sys/netinet
parentf516dcb4a03468a0ee9f72fa265fd61d97333609 (diff)
dont call ip_randomid() in htons().
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_ip4.c5
-rw-r--r--sys/netinet/ip_mroute.c5
-rw-r--r--sys/netinet/ip_output.c5
-rw-r--r--sys/netinet/raw_ip.c8
4 files changed, 14 insertions, 9 deletions
diff --git a/sys/netinet/ip_ip4.c b/sys/netinet/ip_ip4.c
index 50a819b4246..0315ea03494 100644
--- a/sys/netinet/ip_ip4.c
+++ b/sys/netinet/ip_ip4.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ip4.c,v 1.21 1998/12/26 12:35:11 provos Exp $ */
+/* $OpenBSD: ip_ip4.c,v 1.22 1999/01/08 21:51:21 provos Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
@@ -224,7 +224,8 @@ ipe4_output(struct mbuf *m, struct sockaddr_encap *gw, struct tdb *tdb,
ipo->ip_hl = 5;
ipo->ip_tos = ipi->ip_tos;
ipo->ip_len = htons(ilen + sizeof(struct ip));
- ipo->ip_id = htons(ip_randomid());
+ ipo->ip_id = ip_randomid();
+ HTONS(ipo->ip_id);
ipo->ip_off = ipi->ip_off & ~(IP_MF | IP_OFFMASK); /* keep C and DF */
if (tdb->tdb_flags & TDBF_SAME_TTL)
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index 3471e902b95..69ce5fb48f4 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_mroute.c,v 1.12 1999/01/08 01:04:17 deraadt Exp $ */
+/* $OpenBSD: ip_mroute.c,v 1.13 1999/01/08 21:51:22 provos Exp $ */
/* $NetBSD: ip_mroute.c,v 1.27 1996/05/07 02:40:50 thorpej Exp $ */
/*
@@ -1397,7 +1397,8 @@ encap_send(ip, vifp, m)
*/
ip_copy = mtod(mb_copy, struct ip *);
*ip_copy = multicast_encap_iphdr;
- ip_copy->ip_id = htons(ip_randomid());
+ ip_copy->ip_id = ip_randomid();
+ HTONS(ip_copy->ip_id);
ip_copy->ip_len = len;
ip_copy->ip_src = vifp->v_lcl_addr;
ip_copy->ip_dst = vifp->v_rmt_addr;
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index cae2c256a0a..36e911f76be 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_output.c,v 1.37 1998/12/26 12:35:11 provos Exp $ */
+/* $OpenBSD: ip_output.c,v 1.38 1999/01/08 21:51:22 provos Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
@@ -151,7 +151,8 @@ ip_output(m0, va_alist)
if ((flags & (IP_FORWARDING|IP_RAWOUTPUT)) == 0) {
ip->ip_v = IPVERSION;
ip->ip_off &= IP_DF;
- ip->ip_id = htons(ip_randomid());
+ ip->ip_id = ip_randomid();
+ HTONS(ip->ip_id);
ip->ip_hl = hlen >> 2;
ipstat.ips_localout++;
} else {
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index 11cf3f5b69e..344dc62fb23 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip.c,v 1.13 1998/12/26 12:35:12 provos Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.14 1999/01/08 21:51:23 provos Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
@@ -206,8 +206,10 @@ rip_output(m, va_alist)
m_freem(m);
return (EINVAL);
}
- if (ip->ip_id == 0)
- ip->ip_id = htons(ip_randomid());
+ if (ip->ip_id == 0) {
+ ip->ip_id = ip_randomid();
+ HTONS(ip->ip_id);
+ }
/* XXX prevent ip_output from overwriting header fields */
flags |= IP_RAWOUTPUT;
ipstat.ips_rawout++;