Eliminate some more references to separate ip_v and ip_hl fields.
This commit is contained in:
parent
ad62df628f
commit
730d9ea60b
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ip_icmp.c 8.2 (Berkeley) 1/4/94
|
||||
* $Id: ip_icmp.c,v 1.19 1996/04/02 12:26:10 phk Exp $
|
||||
* $Id: ip_icmp.c,v 1.20 1996/04/03 18:52:22 wollman Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -48,6 +48,7 @@
|
||||
#include <net/if.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#define _IP_VHL
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/in_var.h>
|
||||
@ -92,7 +93,7 @@ icmp_error(n, type, code, dest, destifp)
|
||||
struct ifnet *destifp;
|
||||
{
|
||||
register struct ip *oip = mtod(n, struct ip *), *nip;
|
||||
register unsigned oiplen = oip->ip_hl << 2;
|
||||
register unsigned oiplen = IP_VHL_HL(oip->ip_vhl) << 2;
|
||||
register struct icmp *icp;
|
||||
register struct mbuf *m;
|
||||
unsigned icmplen;
|
||||
@ -168,7 +169,7 @@ 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_hl = sizeof(struct ip) >> 2;
|
||||
nip->ip_vhl = IP_VHL_BORING;
|
||||
nip->ip_p = IPPROTO_ICMP;
|
||||
nip->ip_tos = 0;
|
||||
icmp_reflect(m);
|
||||
@ -297,7 +298,7 @@ icmp_input(m, hlen)
|
||||
* Problem with datagram; advise higher level routines.
|
||||
*/
|
||||
if (icmplen < ICMP_ADVLENMIN || icmplen < ICMP_ADVLEN(icp) ||
|
||||
icp->icmp_ip.ip_hl < (sizeof(struct ip) >> 2)) {
|
||||
IP_VHL_HL(icp->icmp_ip.ip_vhl) < (sizeof(struct ip) >> 2)) {
|
||||
icmpstat.icps_badlen++;
|
||||
goto freeit;
|
||||
}
|
||||
@ -423,7 +424,7 @@ reflect:
|
||||
if (code > 3)
|
||||
goto badcode;
|
||||
if (icmplen < ICMP_ADVLENMIN || icmplen < ICMP_ADVLEN(icp) ||
|
||||
icp->icmp_ip.ip_hl < (sizeof(struct ip) >> 2)) {
|
||||
IP_VHL_HL(icp->icmp_ip.ip_vhl) < (sizeof(struct ip) >> 2)) {
|
||||
icmpstat.icps_badlen++;
|
||||
break;
|
||||
}
|
||||
@ -486,7 +487,7 @@ icmp_reflect(m)
|
||||
register struct in_ifaddr *ia;
|
||||
struct in_addr t;
|
||||
struct mbuf *opts = 0;
|
||||
int optlen = (ip->ip_hl << 2) - sizeof(struct ip);
|
||||
int optlen = (IP_VHL_HL(ip->ip_vhl) << 2) - sizeof(struct ip);
|
||||
|
||||
if (!in_canforward(ip->ip_src) &&
|
||||
((ntohl(ip->ip_src.s_addr) & IN_CLASSA_NET) !=
|
||||
@ -584,7 +585,7 @@ icmp_reflect(m)
|
||||
* mbuf's data back, and adjust the IP length.
|
||||
*/
|
||||
ip->ip_len -= optlen;
|
||||
ip->ip_hl = sizeof(struct ip) >> 2;
|
||||
ip->ip_vhl = IP_VHL_BORING;
|
||||
m->m_len -= optlen;
|
||||
if (m->m_flags & M_PKTHDR)
|
||||
m->m_pkthdr.len -= optlen;
|
||||
@ -613,7 +614,7 @@ icmp_send(m, opts)
|
||||
register struct icmp *icp;
|
||||
struct route ro;
|
||||
|
||||
hlen = ip->ip_hl << 2;
|
||||
hlen = IP_VHL_HL(ip->ip_vhl) << 2;
|
||||
m->m_data += hlen;
|
||||
m->m_len -= hlen;
|
||||
icp = mtod(m, struct icmp *);
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93
|
||||
* $Id: ip_icmp.h,v 1.6 1996/01/19 01:19:08 fenner Exp $
|
||||
* $Id: ip_icmp.h,v 1.7 1996/01/30 22:58:24 mpp Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NETINET_IP_ICMP_H_
|
||||
@ -123,8 +123,13 @@ struct icmp {
|
||||
#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */
|
||||
#define ICMP_MASKLEN 12 /* address mask */
|
||||
#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
|
||||
#ifndef _IP_VHL
|
||||
#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
|
||||
/* N.B.: must separately check that ip_hl >= 5 */
|
||||
#else
|
||||
#define ICMP_ADVLEN(p) (8 + (IP_VHL_HL((p)->icmp_ip.ip_vhl) << 2) + 8)
|
||||
/* N.B.: must separately check that header length >= 5 */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Definition of type and code field values.
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)raw_ip.c 8.7 (Berkeley) 5/15/95
|
||||
* $Id: raw_ip.c,v 1.31 1996/05/22 17:23:09 wollman Exp $
|
||||
* $Id: raw_ip.c,v 1.32 1996/07/20 00:16:20 alex Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -47,6 +47,7 @@
|
||||
#include <net/if.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#define _IP_VHL
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
@ -177,8 +178,9 @@ rip_output(m, so, dst)
|
||||
ip = mtod(m, struct ip *);
|
||||
/* don't allow both user specified and setsockopt options,
|
||||
and don't allow packet length sizes that will crash */
|
||||
if (((ip->ip_hl != (sizeof (*ip) >> 2)) && inp->inp_options) ||
|
||||
(ip->ip_len > m->m_pkthdr.len)) {
|
||||
if (((IP_VHL_HL(ip->ip_vhl) != (sizeof (*ip) >> 2))
|
||||
&& inp->inp_options)
|
||||
|| (ip->ip_len > m->m_pkthdr.len)) {
|
||||
m_freem(m);
|
||||
return EINVAL;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95
|
||||
* $Id: tcp_subr.c,v 1.29 1996/06/05 16:57:37 wollman Exp $
|
||||
* $Id: tcp_subr.c,v 1.30 1996/06/14 17:17:32 wollman Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -50,6 +50,7 @@
|
||||
#include <net/route.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#define _IP_VHL
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
@ -466,7 +467,8 @@ tcp_ctlinput(cmd, sa, vip)
|
||||
((unsigned)cmd > PRC_NCMDS || inetctlerrmap[cmd] == 0))
|
||||
return;
|
||||
if (ip) {
|
||||
th = (struct tcphdr *)((caddr_t)ip + (ip->ip_hl << 2));
|
||||
th = (struct tcphdr *)((caddr_t)ip
|
||||
+ (IP_VHL_HL(ip->ip_vhl) << 2));
|
||||
in_pcbnotify(&tcb, sa, th->th_dport, ip->ip_src, th->th_sport,
|
||||
cmd, notify);
|
||||
} else
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95
|
||||
* $Id: tcp_subr.c,v 1.29 1996/06/05 16:57:37 wollman Exp $
|
||||
* $Id: tcp_subr.c,v 1.30 1996/06/14 17:17:32 wollman Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -50,6 +50,7 @@
|
||||
#include <net/route.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#define _IP_VHL
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
@ -466,7 +467,8 @@ tcp_ctlinput(cmd, sa, vip)
|
||||
((unsigned)cmd > PRC_NCMDS || inetctlerrmap[cmd] == 0))
|
||||
return;
|
||||
if (ip) {
|
||||
th = (struct tcphdr *)((caddr_t)ip + (ip->ip_hl << 2));
|
||||
th = (struct tcphdr *)((caddr_t)ip
|
||||
+ (IP_VHL_HL(ip->ip_vhl) << 2));
|
||||
in_pcbnotify(&tcb, sa, th->th_dport, ip->ip_src, th->th_sport,
|
||||
cmd, notify);
|
||||
} else
|
||||
|
Loading…
x
Reference in New Issue
Block a user