From 491f63a5b35e8df0d3062f69d4a0d89aada6f03b Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Thu, 29 Mar 2007 14:31:08 +0000 Subject: Further _IP_VHL removal preps. --- cpukit/libnetworking/netinet/ip_icmp.c | 2 +- cpukit/libnetworking/netinet/ip_input.c | 2 +- cpukit/libnetworking/netinet/ip_output.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) (limited to 'cpukit/libnetworking/netinet') diff --git a/cpukit/libnetworking/netinet/ip_icmp.c b/cpukit/libnetworking/netinet/ip_icmp.c index 2a4ce8014c..bf50ba0faa 100644 --- a/cpukit/libnetworking/netinet/ip_icmp.c +++ b/cpukit/libnetworking/netinet/ip_icmp.c @@ -118,7 +118,7 @@ icmp_error(n, type, code, dest, destifp) #ifdef _IP_VHL register unsigned oiplen = IP_VHL_HL(oip->ip_vhl) << 2; #else - register unsigned oiphlen = oip->ip_hl << 2; + register unsigned oiplen = oip->ip_hl << 2; #endif register struct icmp *icp; register struct mbuf *m; diff --git a/cpukit/libnetworking/netinet/ip_input.c b/cpukit/libnetworking/netinet/ip_input.c index 02f50de2ec..4a34aa78ed 100644 --- a/cpukit/libnetworking/netinet/ip_input.c +++ b/cpukit/libnetworking/netinet/ip_input.c @@ -734,7 +734,7 @@ insert: #ifdef _IP_VHL if (next + (IP_VHL_HL(((struct ip *)fp->ipq_next)->ip_vhl) << 2) #else - if (next + (((struct ip *)fp->ipq_next)->ip_hl) << 2) + if (next + ((((struct ip *)fp->ipq_next)->ip_hl) << 2) #endif > IP_MAXPACKET) { ipstat.ips_toolong++; diff --git a/cpukit/libnetworking/netinet/ip_output.c b/cpukit/libnetworking/netinet/ip_output.c index 6621ec5e67..7ef4cc39d3 100644 --- a/cpukit/libnetworking/netinet/ip_output.c +++ b/cpukit/libnetworking/netinet/ip_output.c @@ -128,7 +128,11 @@ ip_output(m0, opt, ro, flags, imo) ip->ip_id = htons(ip_id++); ipstat.ips_localout++; } else { +#ifdef _IP_VHL hlen = IP_VHL_HL(ip->ip_vhl) << 2; +#else + hlen = ip->ip_hl << 2; +#endif } dst = (struct sockaddr_in *)&ro->ro_dst; @@ -381,7 +385,11 @@ sendit: ip->ip_len = htons(ip->ip_len); ip->ip_off = htons(ip->ip_off); ip->ip_sum = 0; +#ifdef _IP_VHL if (ip->ip_vhl == IP_VHL_BORING) { +#else + if ((ip->ip_hl == 5) && (ip->ip_v = IPVERSION)) { +#endif ip->ip_sum = in_cksum_hdr(ip); } else { ip->ip_sum = in_cksum(m, hlen); @@ -439,7 +447,12 @@ sendit: *mhip = *ip; if (hlen > sizeof (struct ip)) { mhlen = ip_optcopy(ip, mhip) + sizeof (struct ip); +#ifdef _IP_VHL mhip->ip_vhl = IP_MAKE_VHL(IPVERSION, mhlen >> 2); +#else + mhip->ip_v = IPVERSION; + mhip->ip_hl = mhlen >> 2; +#endif } m->m_len = mhlen; mhip->ip_off = ((off - hlen) >> 3) + (ip->ip_off & ~IP_MF); @@ -461,7 +474,11 @@ sendit: m->m_pkthdr.rcvif = NULL; mhip->ip_off = htons(mhip->ip_off); mhip->ip_sum = 0; +#ifdef _IP_VHL if (mhip->ip_vhl == IP_VHL_BORING) { +#else + if ((mhip->ip_hl == 5) && (mhip->ip_v == IPVERSION) ) { +#endif mhip->ip_sum = in_cksum_hdr(mhip); } else { mhip->ip_sum = in_cksum(m, mhlen); @@ -481,7 +498,11 @@ sendit: ip->ip_off |= IP_MF; ip->ip_off = htons(ip->ip_off); ip->ip_sum = 0; +#ifdef _IP_VHL if (ip->ip_vhl == IP_VHL_BORING) { +#else + if ((ip->ip_hl == 5) && (ip->ip_v == IPVERSION) ) { +#endif ip->ip_sum = in_cksum_hdr(ip); } else { ip->ip_sum = in_cksum(m, hlen); @@ -551,7 +572,12 @@ ip_insertoptions(m, opt, phlen) ip = mtod(m, struct ip *); bcopy(p->ipopt_list, ip + 1, optlen); *phlen = sizeof(struct ip) + optlen; +#ifdef _IP_VHL ip->ip_vhl = IP_MAKE_VHL(IPVERSION, *phlen >> 2); +#else + ip->ip_v = IPVERSION; + ip->ip_hl = *phlen >> 2; +#endif ip->ip_len += optlen; return (m); } @@ -569,7 +595,11 @@ ip_optcopy(ip, jp) cp = (u_char *)(ip + 1); dp = (u_char *)(jp + 1); +#ifdef _IP_VHL cnt = (IP_VHL_HL(ip->ip_vhl) << 2) - sizeof (struct ip); +#else + cnt = (ip->ip_hl << 2) - sizeof (struct ip); +#endif for (; cnt > 0; cnt -= optlen, cp += optlen) { opt = cp[0]; if (opt == IPOPT_EOL) -- cgit v1.2.3