summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_icmp.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-10-20 22:52:07 +0000
committerphk <phk@FreeBSD.org>2002-10-20 22:52:07 +0000
commit419afbc0d3d9432a72ea3e36f9c4974b31428c35 (patch)
tree3085be4699af33492ff2fa83133fe4d6b7d15a25 /sys/netinet/ip_icmp.c
parent58072098f10aafb040901741472830c4d8efcb3a (diff)
downloadFreeBSD-src-419afbc0d3d9432a72ea3e36f9c4974b31428c35.zip
FreeBSD-src-419afbc0d3d9432a72ea3e36f9c4974b31428c35.tar.gz
Fix two instances of variant struct definitions in sys/netinet:
Remove the never completed _IP_VHL version, it has not caught on anywhere and it would make us incompatible with other BSD netstacks to retain this version. Add a CTASSERT protecting sizeof(struct ip) == 20. Don't let the size of struct ipq depend on the IPDIVERT option. This is a functional no-op commit. Approved by: re
Diffstat (limited to 'sys/netinet/ip_icmp.c')
-rw-r--r--sys/netinet/ip_icmp.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index c893340..7fcc293 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -51,7 +51,6 @@
#include <net/if_types.h>
#include <net/route.h>
-#define _IP_VHL
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/in_var.h>
@@ -134,7 +133,7 @@ icmp_error(n, type, code, dest, destifp)
struct ifnet *destifp;
{
register struct ip *oip = mtod(n, struct ip *), *nip;
- register unsigned oiplen = IP_VHL_HL(oip->ip_vhl) << 2;
+ register unsigned oiplen = oip->ip_hl << 2;
register struct icmp *icp;
register struct mbuf *m;
unsigned icmplen;
@@ -220,7 +219,8 @@ icmp_error(n, type, code, dest, destifp)
nip = mtod(m, struct ip *);
bcopy((caddr_t)oip, (caddr_t)nip, sizeof(struct ip));
nip->ip_len = m->m_len;
- nip->ip_vhl = IP_VHL_BORING;
+ nip->ip_v = IPVERSION;
+ nip->ip_hl = 5;
nip->ip_p = IPPROTO_ICMP;
nip->ip_tos = 0;
icmp_reflect(m);
@@ -370,7 +370,7 @@ icmp_input(m, off)
* Problem with datagram; advise higher level routines.
*/
if (icmplen < ICMP_ADVLENMIN || icmplen < ICMP_ADVLEN(icp) ||
- IP_VHL_HL(icp->icmp_ip.ip_vhl) < (sizeof(struct ip) >> 2)) {
+ icp->icmp_ip.ip_hl < (sizeof(struct ip) >> 2)) {
icmpstat.icps_badlen++;
goto freeit;
}
@@ -532,7 +532,7 @@ reflect:
if (code > 3)
goto badcode;
if (icmplen < ICMP_ADVLENMIN || icmplen < ICMP_ADVLEN(icp) ||
- IP_VHL_HL(icp->icmp_ip.ip_vhl) < (sizeof(struct ip) >> 2)) {
+ icp->icmp_ip.ip_hl < (sizeof(struct ip) >> 2)) {
icmpstat.icps_badlen++;
break;
}
@@ -599,7 +599,7 @@ icmp_reflect(m)
struct in_ifaddr *ia;
struct in_addr t;
struct mbuf *opts = 0;
- int optlen = (IP_VHL_HL(ip->ip_vhl) << 2) - sizeof(struct ip);
+ int optlen = (ip->ip_hl << 2) - sizeof(struct ip);
struct route *ro = NULL, rt;
if (!in_canforward(ip->ip_src) &&
@@ -709,7 +709,8 @@ match:
* mbuf's data back, and adjust the IP length.
*/
ip->ip_len -= optlen;
- ip->ip_vhl = IP_VHL_BORING;
+ ip->ip_v = IPVERSION;
+ ip->ip_hl = 5;
m->m_len -= optlen;
if (m->m_flags & M_PKTHDR)
m->m_pkthdr.len -= optlen;
@@ -740,7 +741,7 @@ icmp_send(m, opts, rt)
register int hlen;
register struct icmp *icp;
- hlen = IP_VHL_HL(ip->ip_vhl) << 2;
+ hlen = ip->ip_hl << 2;
m->m_data += hlen;
m->m_len -= hlen;
icp = mtod(m, struct icmp *);
OpenPOWER on IntegriCloud