summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--share/man/man4/ip.414
-rw-r--r--sys/contrib/ipfilter/netinet/ip_auth.c2
-rw-r--r--sys/contrib/ipfilter/netinet/ip_fil.c2
-rw-r--r--sys/net/bridge.c2
-rw-r--r--sys/netinet/ip_auth.c2
-rw-r--r--sys/netinet/ip_divert.c1
-rw-r--r--sys/netinet/ip_fil.c2
-rw-r--r--sys/netinet/ip_icmp.c1
-rw-r--r--sys/netinet/ip_input.c4
-rw-r--r--sys/netinet/ip_mroute.c3
-rw-r--r--sys/netinet/ip_output.c10
-rw-r--r--sys/netinet/raw_ip.c2
-rw-r--r--sys/netinet6/ah_input.c2
13 files changed, 10 insertions, 37 deletions
diff --git a/share/man/man4/ip.4 b/share/man/man4/ip.4
index 593473bf5..491da48 100644
--- a/share/man/man4/ip.4
+++ b/share/man/man4/ip.4
@@ -32,7 +32,7 @@
.\" @(#)ip.4 8.2 (Berkeley) 11/30/93
.\" $FreeBSD$
.\"
-.Dd September 1, 2000
+.Dd November 30, 1993
.Dt IP 4
.Os BSD 4.2
.Sh NAME
@@ -368,10 +368,6 @@ ip->ip_off = offset;
If the header source address is set to
.Dv INADDR_ANY,
the kernel will choose an appropriate address.
-.Pp
-The header identification field
-.Dq Li ip_id
-is expected in host byte order.
.Sh DIAGNOSTICS
A socket operation may fail with one of the following errors returned:
.Bl -tag -width [EADDRNOTAVAIL]
@@ -420,11 +416,3 @@ The
.Nm
protocol appeared in
.Bx 4.2 .
-.Pp
-If the
-.Dv IP_HDRINCL
-option is in use,
-.Fx 4.2
-and above expect the
-.Dq Li ip_id
-field in host byte order.
diff --git a/sys/contrib/ipfilter/netinet/ip_auth.c b/sys/contrib/ipfilter/netinet/ip_auth.c
index ff72825..4ce6a69 100644
--- a/sys/contrib/ipfilter/netinet/ip_auth.c
+++ b/sys/contrib/ipfilter/netinet/ip_auth.c
@@ -250,7 +250,7 @@ ip_t *ip;
bo = ip->ip_len;
ip->ip_len = htons(bo);
-# if !SOLARIS && !defined(__NetBSD__)
+# if !SOLARIS && !defined(__NetBSD__) && !defined(__FreeBSD__)
/* 4.4BSD converts this ip_input.c, but I don't in solaris.c */
bo = ip->ip_id;
ip->ip_id = htons(bo);
diff --git a/sys/contrib/ipfilter/netinet/ip_fil.c b/sys/contrib/ipfilter/netinet/ip_fil.c
index bd76b39..d609f25 100644
--- a/sys/contrib/ipfilter/netinet/ip_fil.c
+++ b/sys/contrib/ipfilter/netinet/ip_fil.c
@@ -1369,7 +1369,9 @@ frdest_t *fdp;
i = 1;
# endif
# ifndef sparc
+# ifndef __FreeBSD__
ip->ip_id = htons(ip->ip_id);
+# endif
ip->ip_len = htons(ip->ip_len);
ip->ip_off = htons(ip->ip_off);
# endif
diff --git a/sys/net/bridge.c b/sys/net/bridge.c
index ec9aada..7827a0c 100644
--- a/sys/net/bridge.c
+++ b/sys/net/bridge.c
@@ -718,7 +718,6 @@ bdg_forward(struct mbuf **m0, struct ether_header *const eh, struct ifnet *dst)
*/
ip = mtod(m, struct ip *);
NTOHS(ip->ip_len);
- NTOHS(ip->ip_id);
NTOHS(ip->ip_off);
/*
@@ -744,7 +743,6 @@ bdg_forward(struct mbuf **m0, struct ether_header *const eh, struct ifnet *dst)
* Then, if canfree==1, also restore *m0.
*/
HTONS(ip->ip_len);
- HTONS(ip->ip_id);
HTONS(ip->ip_off);
if (canfree) /* m was a reference to *m0, so update *m0 */
*m0 = m ;
diff --git a/sys/netinet/ip_auth.c b/sys/netinet/ip_auth.c
index ff72825..4ce6a69 100644
--- a/sys/netinet/ip_auth.c
+++ b/sys/netinet/ip_auth.c
@@ -250,7 +250,7 @@ ip_t *ip;
bo = ip->ip_len;
ip->ip_len = htons(bo);
-# if !SOLARIS && !defined(__NetBSD__)
+# if !SOLARIS && !defined(__NetBSD__) && !defined(__FreeBSD__)
/* 4.4BSD converts this ip_input.c, but I don't in solaris.c */
bo = ip->ip_id;
ip->ip_id = htons(bo);
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index 12acdfd..b2f92b8 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -293,7 +293,6 @@ div_output(so, m, addr, control)
/* Convert fields to host order for ip_output() */
NTOHS(ip->ip_len);
- NTOHS(ip->ip_id);
NTOHS(ip->ip_off);
/* Send packet to output processing */
diff --git a/sys/netinet/ip_fil.c b/sys/netinet/ip_fil.c
index bd76b39..d609f25 100644
--- a/sys/netinet/ip_fil.c
+++ b/sys/netinet/ip_fil.c
@@ -1369,7 +1369,9 @@ frdest_t *fdp;
i = 1;
# endif
# ifndef sparc
+# ifndef __FreeBSD__
ip->ip_id = htons(ip->ip_id);
+# endif
ip->ip_len = htons(ip->ip_len);
ip->ip_off = htons(ip->ip_off);
# endif
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index 91c0bc0..dc2040e 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -196,7 +196,6 @@ icmp_error(n, type, code, dest, destifp)
* Convert fields to network representation.
*/
HTONS(nip->ip_len);
- HTONS(nip->ip_id);
HTONS(nip->ip_off);
/*
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 5ba5750..bd04b01 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -346,7 +346,6 @@ ip_input(struct mbuf *m)
ipstat.ips_badlen++;
goto bad;
}
- NTOHS(ip->ip_id);
NTOHS(ip->ip_off);
/*
@@ -692,10 +691,8 @@ found:
ip->ip_len += hlen;
HTONS(ip->ip_len);
HTONS(ip->ip_off);
- HTONS(ip->ip_id);
ip->ip_sum = 0;
ip->ip_sum = in_cksum_hdr(ip);
- NTOHS(ip->ip_id);
NTOHS(ip->ip_off);
NTOHS(ip->ip_len);
ip->ip_len -= hlen;
@@ -725,7 +722,6 @@ found:
ip->ip_len += hlen;
HTONS(ip->ip_len);
HTONS(ip->ip_off);
- HTONS(ip->ip_id);
/* Deliver packet to divert input routine */
ip_divert_cookie = divert_cookie;
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index 73ab039..1d165f5 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -1581,7 +1581,7 @@ encap_send(ip, vifp, m)
*/
ip_copy = mtod(mb_copy, struct ip *);
*ip_copy = multicast_encap_iphdr;
- ip_copy->ip_id = ip_id++;
+ ip_copy->ip_id = htons(ip_id++);
ip_copy->ip_len += len;
ip_copy->ip_src = vifp->v_lcl_addr;
ip_copy->ip_dst = vifp->v_rmt_addr;
@@ -1592,7 +1592,6 @@ encap_send(ip, vifp, m)
ip = (struct ip *)((caddr_t)ip_copy + sizeof(multicast_encap_iphdr));
--ip->ip_ttl;
HTONS(ip->ip_len);
- HTONS(ip->ip_id);
HTONS(ip->ip_off);
ip->ip_sum = 0;
mb_copy->m_data += sizeof(multicast_encap_iphdr);
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 9fe7001..baaf332 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -211,7 +211,7 @@ ip_output(m0, opt, ro, flags, imo)
if ((flags & (IP_FORWARDING|IP_RAWOUTPUT)) == 0) {
ip->ip_vhl = IP_MAKE_VHL(IPVERSION, hlen >> 2);
ip->ip_off &= IP_DF;
- ip->ip_id = ip_id++;
+ ip->ip_id = htons(ip_id++);
ipstat.ips_localout++;
} else {
hlen = IP_VHL_HL(ip->ip_vhl) << 2;
@@ -520,7 +520,6 @@ sendit:
/* Restore packet header fields to original values */
HTONS(ip->ip_len);
- HTONS(ip->ip_id);
HTONS(ip->ip_off);
/* Deliver packet to divert input routine */
@@ -595,7 +594,6 @@ sendit:
m->m_pkthdr.csum_flags |=
CSUM_IP_CHECKED | CSUM_IP_VALID;
HTONS(ip->ip_len);
- HTONS(ip->ip_id);
HTONS(ip->ip_off);
ip_input(m);
goto done;
@@ -715,7 +713,6 @@ pass:
}
HTONS(ip->ip_len);
- HTONS(ip->ip_id);
HTONS(ip->ip_off);
error = ipsec4_output(&state, sp, flags);
@@ -776,7 +773,6 @@ pass:
/* make it flipped, again. */
NTOHS(ip->ip_len);
- NTOHS(ip->ip_id);
NTOHS(ip->ip_off);
skip_ipsec:
#endif /*IPSEC*/
@@ -796,7 +792,6 @@ skip_ipsec:
if ((u_short)ip->ip_len <= ifp->if_mtu ||
ifp->if_hwassist & CSUM_FRAGMENT) {
HTONS(ip->ip_len);
- HTONS(ip->ip_id);
HTONS(ip->ip_off);
ip->ip_sum = 0;
if (sw_csum & CSUM_DELAY_IP) {
@@ -892,7 +887,6 @@ skip_ipsec:
m->m_pkthdr.len = mhlen + len;
m->m_pkthdr.rcvif = (struct ifnet *)0;
m->m_pkthdr.csum_flags = m0->m_pkthdr.csum_flags;
- HTONS(mhip->ip_id);
HTONS(mhip->ip_off);
mhip->ip_sum = 0;
if (sw_csum & CSUM_DELAY_IP) {
@@ -921,7 +915,6 @@ skip_ipsec:
m_adj(m, hlen + firstlen - (u_short)ip->ip_len);
m->m_pkthdr.len = hlen + firstlen;
ip->ip_len = htons((u_short)m->m_pkthdr.len);
- HTONS(ip->ip_id);
ip->ip_off |= IP_MF;
HTONS(ip->ip_off);
ip->ip_sum = 0;
@@ -1864,7 +1857,6 @@ ip_mloopback(ifp, m, dst, hlen)
*/
ip = mtod(copym, struct ip *);
HTONS(ip->ip_len);
- HTONS(ip->ip_id);
HTONS(ip->ip_off);
ip->ip_sum = 0;
if (ip->ip_vhl == IP_VHL_BORING) {
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index 94046e8..5d056ce 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -221,7 +221,7 @@ rip_output(m, so, dst)
return EINVAL;
}
if (ip->ip_id == 0)
- ip->ip_id = ip_id++;
+ ip->ip_id = htons(ip_id++);
/* XXX prevent ip_output from overwriting header fields */
flags |= IP_RAWOUTPUT;
ipstat.ips_rawout++;
diff --git a/sys/netinet6/ah_input.c b/sys/netinet6/ah_input.c
index c50f72b..1aaa0c4 100644
--- a/sys/netinet6/ah_input.c
+++ b/sys/netinet6/ah_input.c
@@ -291,7 +291,6 @@ ah4_input(m, va_alist)
* convert them back to network endian. VERY stupid.
*/
ip->ip_len = htons(ip->ip_len + hlen);
- ip->ip_id = htons(ip->ip_id);
ip->ip_off = htons(ip->ip_off);
#endif
if (ah4_calccksum(m, (caddr_t)cksum, siz1, algo, sav)) {
@@ -305,7 +304,6 @@ ah4_input(m, va_alist)
* flip them back.
*/
ip->ip_len = ntohs(ip->ip_len) - hlen;
- ip->ip_id = ntohs(ip->ip_id);
ip->ip_off = ntohs(ip->ip_off);
#endif
}
OpenPOWER on IntegriCloud