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
This commit is contained in:
parent
e6a5564ee2
commit
53be11f680
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=105586
@ -47,9 +47,6 @@
|
||||
* Structure of an internet header, naked of options.
|
||||
*/
|
||||
struct ip {
|
||||
#ifdef _IP_VHL
|
||||
u_char ip_vhl; /* version << 4 | header length >> 2 */
|
||||
#else
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
u_int ip_hl:4, /* header length */
|
||||
ip_v:4; /* version */
|
||||
@ -58,7 +55,6 @@ struct ip {
|
||||
u_int ip_v:4, /* version */
|
||||
ip_hl:4; /* header length */
|
||||
#endif
|
||||
#endif /* not _IP_VHL */
|
||||
u_char ip_tos; /* type of service */
|
||||
u_short ip_len; /* total length */
|
||||
u_short ip_id; /* identification */
|
||||
@ -71,13 +67,10 @@ struct ip {
|
||||
u_char ip_p; /* protocol */
|
||||
u_short ip_sum; /* checksum */
|
||||
struct in_addr ip_src,ip_dst; /* source and dest address */
|
||||
};
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#ifdef _IP_VHL
|
||||
#define IP_MAKE_VHL(v, hl) ((v) << 4 | (hl))
|
||||
#define IP_VHL_HL(vhl) ((vhl) & 0x0f)
|
||||
#define IP_VHL_V(vhl) ((vhl) >> 4)
|
||||
#define IP_VHL_BORING 0x45
|
||||
#ifdef CTASSERT
|
||||
CTASSERT(sizeof (struct ip) == 20);
|
||||
#endif
|
||||
|
||||
#define IP_MAXPACKET 65535 /* maximum packet size */
|
||||
|
@ -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 @@ icmp_input(m, off)
|
||||
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 @@ icmp_reflect(m)
|
||||
* 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 *);
|
||||
|
@ -123,13 +123,8 @@ 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.
|
||||
|
@ -34,8 +34,6 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define _IP_VHL
|
||||
|
||||
#include "opt_bootp.h"
|
||||
#include "opt_ipfw.h"
|
||||
#include "opt_ipdn.h"
|
||||
@ -335,7 +333,7 @@ ip_input(struct mbuf *m)
|
||||
|
||||
if (args.rule) { /* dummynet already filtered us */
|
||||
ip = mtod(m, struct ip *);
|
||||
hlen = IP_VHL_HL(ip->ip_vhl) << 2;
|
||||
hlen = ip->ip_hl << 2;
|
||||
goto iphack ;
|
||||
}
|
||||
|
||||
@ -351,12 +349,12 @@ ip_input(struct mbuf *m)
|
||||
}
|
||||
ip = mtod(m, struct ip *);
|
||||
|
||||
if (IP_VHL_V(ip->ip_vhl) != IPVERSION) {
|
||||
if (ip->ip_v != IPVERSION) {
|
||||
ipstat.ips_badvers++;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
hlen = IP_VHL_HL(ip->ip_vhl) << 2;
|
||||
hlen = ip->ip_hl << 2;
|
||||
if (hlen < sizeof(struct ip)) { /* minimum header length */
|
||||
ipstat.ips_badhlen++;
|
||||
goto bad;
|
||||
@ -789,7 +787,7 @@ ip_input(struct mbuf *m)
|
||||
ipstat.ips_reassembled++;
|
||||
ip = mtod(m, struct ip *);
|
||||
/* Get the header length of the reassembled packet */
|
||||
hlen = IP_VHL_HL(ip->ip_vhl) << 2;
|
||||
hlen = ip->ip_hl << 2;
|
||||
#ifdef IPDIVERT
|
||||
/* Restore original checksum before diverting packet */
|
||||
if (divert_info != 0) {
|
||||
@ -955,7 +953,7 @@ ip_reass(struct mbuf *m, struct ipqhead *head, struct ipq *fp,
|
||||
struct ip *ip = mtod(m, struct ip *);
|
||||
register struct mbuf *p, *q, *nq;
|
||||
struct mbuf *t;
|
||||
int hlen = IP_VHL_HL(ip->ip_vhl) << 2;
|
||||
int hlen = ip->ip_hl << 2;
|
||||
int i, next;
|
||||
|
||||
/*
|
||||
@ -1093,7 +1091,7 @@ ip_reass(struct mbuf *m, struct ipqhead *head, struct ipq *fp,
|
||||
*/
|
||||
q = fp->ipq_frags;
|
||||
ip = GETIP(q);
|
||||
if (next + (IP_VHL_HL(ip->ip_vhl) << 2) > IP_MAXPACKET) {
|
||||
if (next + (ip->ip_hl << 2) > IP_MAXPACKET) {
|
||||
ipstat.ips_toolong++;
|
||||
ip_freef(head, fp);
|
||||
return (0);
|
||||
@ -1141,8 +1139,8 @@ ip_reass(struct mbuf *m, struct ipqhead *head, struct ipq *fp,
|
||||
nipq--;
|
||||
(void) m_free(dtom(fp));
|
||||
ip_nfragpackets--;
|
||||
m->m_len += (IP_VHL_HL(ip->ip_vhl) << 2);
|
||||
m->m_data -= (IP_VHL_HL(ip->ip_vhl) << 2);
|
||||
m->m_len += (ip->ip_hl << 2);
|
||||
m->m_data -= (ip->ip_hl << 2);
|
||||
/* some debugging cruft by sklower, below, will go away soon */
|
||||
if (m->m_flags & M_PKTHDR) /* XXX this should be done elsewhere */
|
||||
m_fixhdr(m);
|
||||
@ -1266,7 +1264,7 @@ ip_dooptions(struct mbuf *m, int pass, struct sockaddr_in *next_hop)
|
||||
|
||||
dst = ip->ip_dst;
|
||||
cp = (u_char *)(ip + 1);
|
||||
cnt = (IP_VHL_HL(ip->ip_vhl) << 2) - sizeof (struct ip);
|
||||
cnt = (ip->ip_hl << 2) - sizeof (struct ip);
|
||||
for (; cnt > 0; cnt -= optlen, cp += optlen) {
|
||||
opt = cp[IPOPT_OPTVAL];
|
||||
if (opt == IPOPT_EOL)
|
||||
@ -1655,14 +1653,15 @@ ip_stripoptions(m, mopt)
|
||||
register caddr_t opts;
|
||||
int olen;
|
||||
|
||||
olen = (IP_VHL_HL(ip->ip_vhl) << 2) - sizeof (struct ip);
|
||||
olen = (ip->ip_hl << 2) - sizeof (struct ip);
|
||||
opts = (caddr_t)(ip + 1);
|
||||
i = m->m_len - (sizeof (struct ip) + olen);
|
||||
bcopy(opts + olen, opts, (unsigned)i);
|
||||
m->m_len -= olen;
|
||||
if (m->m_flags & M_PKTHDR)
|
||||
m->m_pkthdr.len -= olen;
|
||||
ip->ip_vhl = IP_MAKE_VHL(IPVERSION, sizeof(struct ip) >> 2);
|
||||
ip->ip_v = IPVERSION;
|
||||
ip->ip_hl = sizeof(struct ip) >> 2;
|
||||
}
|
||||
|
||||
u_char inetctlerrmap[PRC_NCMDS] = {
|
||||
@ -1759,7 +1758,7 @@ ip_forward(struct mbuf *m, int srcrt, struct sockaddr_in *next_hop)
|
||||
MGET(mcopy, M_DONTWAIT, m->m_type);
|
||||
if (mcopy != NULL) {
|
||||
M_COPY_PKTHDR(mcopy, m);
|
||||
mcopy->m_len = imin((IP_VHL_HL(ip->ip_vhl) << 2) + 8,
|
||||
mcopy->m_len = imin((ip->ip_hl << 2) + 8,
|
||||
(int)ip->ip_len);
|
||||
m_copydata(m, 0, mcopy->m_len, mtod(mcopy, caddr_t));
|
||||
#ifdef MAC
|
||||
|
@ -34,8 +34,6 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define _IP_VHL
|
||||
|
||||
#include "opt_ipfw.h"
|
||||
#include "opt_ipdn.h"
|
||||
#include "opt_ipdivert.h"
|
||||
@ -202,7 +200,7 @@ ip_output(m0, opt, ro, flags, imo, inp)
|
||||
|
||||
if (args.rule != NULL) { /* dummynet already saw us */
|
||||
ip = mtod(m, struct ip *);
|
||||
hlen = IP_VHL_HL(ip->ip_vhl) << 2 ;
|
||||
hlen = ip->ip_hl << 2 ;
|
||||
if (ro->ro_rt)
|
||||
ia = ifatoia(ro->ro_rt->rt_ifa);
|
||||
goto sendit;
|
||||
@ -221,7 +219,8 @@ ip_output(m0, opt, ro, flags, imo, inp)
|
||||
* Fill in IP header.
|
||||
*/
|
||||
if ((flags & (IP_FORWARDING|IP_RAWOUTPUT)) == 0) {
|
||||
ip->ip_vhl = IP_MAKE_VHL(IPVERSION, hlen >> 2);
|
||||
ip->ip_v = IPVERSION;
|
||||
ip->ip_hl = hlen >> 2;
|
||||
ip->ip_off &= IP_DF;
|
||||
#ifdef RANDOM_IP_ID
|
||||
ip->ip_id = ip_randomid();
|
||||
@ -230,7 +229,7 @@ ip_output(m0, opt, ro, flags, imo, inp)
|
||||
#endif
|
||||
ipstat.ips_localout++;
|
||||
} else {
|
||||
hlen = IP_VHL_HL(ip->ip_vhl) << 2;
|
||||
hlen = ip->ip_hl << 2;
|
||||
}
|
||||
|
||||
#ifdef FAST_IPSEC
|
||||
@ -570,11 +569,7 @@ ip_output(m0, opt, ro, flags, imo, inp)
|
||||
|
||||
/* be sure to update variables that are affected by ipsec4_output() */
|
||||
ip = mtod(m, struct ip *);
|
||||
#ifdef _IP_VHL
|
||||
hlen = IP_VHL_HL(ip->ip_vhl) << 2;
|
||||
#else
|
||||
hlen = ip->ip_hl << 2;
|
||||
#endif
|
||||
if (ro->ro_rt == NULL) {
|
||||
if ((flags & IP_ROUTETOIF) == 0) {
|
||||
printf("ip_output: "
|
||||
@ -992,13 +987,8 @@ ip_output(m0, opt, ro, flags, imo, inp)
|
||||
ip->ip_len = htons(ip->ip_len);
|
||||
ip->ip_off = htons(ip->ip_off);
|
||||
ip->ip_sum = 0;
|
||||
if (sw_csum & CSUM_DELAY_IP) {
|
||||
if (ip->ip_vhl == IP_VHL_BORING) {
|
||||
ip->ip_sum = in_cksum_hdr(ip);
|
||||
} else {
|
||||
ip->ip_sum = in_cksum(m, hlen);
|
||||
}
|
||||
}
|
||||
if (sw_csum & CSUM_DELAY_IP)
|
||||
ip->ip_sum = in_cksum(m, hlen);
|
||||
|
||||
/* Record statistics for this interface address. */
|
||||
if (!(flags & IP_FORWARDING) && ia) {
|
||||
@ -1118,7 +1108,8 @@ ip_output(m0, opt, ro, flags, imo, inp)
|
||||
*mhip = *ip;
|
||||
if (hlen > sizeof (struct ip)) {
|
||||
mhlen = ip_optcopy(ip, mhip) + sizeof (struct ip);
|
||||
mhip->ip_vhl = IP_MAKE_VHL(IPVERSION, mhlen >> 2);
|
||||
mhip->ip_v = IPVERSION;
|
||||
mhip->ip_hl = mhlen >> 2;
|
||||
}
|
||||
m->m_len = mhlen;
|
||||
mhip->ip_off = ((off - hlen) >> 3) + ip->ip_off;
|
||||
@ -1142,13 +1133,8 @@ ip_output(m0, opt, ro, flags, imo, inp)
|
||||
m->m_pkthdr.csum_flags = m0->m_pkthdr.csum_flags;
|
||||
mhip->ip_off = htons(mhip->ip_off);
|
||||
mhip->ip_sum = 0;
|
||||
if (sw_csum & CSUM_DELAY_IP) {
|
||||
if (mhip->ip_vhl == IP_VHL_BORING) {
|
||||
mhip->ip_sum = in_cksum_hdr(mhip);
|
||||
} else {
|
||||
mhip->ip_sum = in_cksum(m, mhlen);
|
||||
}
|
||||
}
|
||||
if (sw_csum & CSUM_DELAY_IP)
|
||||
mhip->ip_sum = in_cksum(m, mhlen);
|
||||
*mnext = m;
|
||||
mnext = &m->m_nextpkt;
|
||||
nfrags++;
|
||||
@ -1171,13 +1157,8 @@ ip_output(m0, opt, ro, flags, imo, inp)
|
||||
ip->ip_off |= IP_MF;
|
||||
ip->ip_off = htons(ip->ip_off);
|
||||
ip->ip_sum = 0;
|
||||
if (sw_csum & CSUM_DELAY_IP) {
|
||||
if (ip->ip_vhl == IP_VHL_BORING) {
|
||||
ip->ip_sum = in_cksum_hdr(ip);
|
||||
} else {
|
||||
ip->ip_sum = in_cksum(m, hlen);
|
||||
}
|
||||
}
|
||||
if (sw_csum & CSUM_DELAY_IP)
|
||||
ip->ip_sum = in_cksum(m, hlen);
|
||||
sendorfree:
|
||||
for (m = m0; m; m = m0) {
|
||||
m0 = m->m_nextpkt;
|
||||
@ -1235,7 +1216,7 @@ in_delayed_cksum(struct mbuf *m)
|
||||
u_short csum, offset;
|
||||
|
||||
ip = mtod(m, struct ip *);
|
||||
offset = IP_VHL_HL(ip->ip_vhl) << 2 ;
|
||||
offset = ip->ip_hl << 2 ;
|
||||
csum = in_cksum_skip(m, ip->ip_len, offset);
|
||||
if (m->m_pkthdr.csum_flags & CSUM_UDP && csum == 0)
|
||||
csum = 0xffff;
|
||||
@ -1307,7 +1288,8 @@ ip_insertoptions(m, opt, phlen)
|
||||
ip = mtod(m, struct ip *);
|
||||
bcopy(p->ipopt_list, ip + 1, optlen);
|
||||
*phlen = sizeof(struct ip) + optlen;
|
||||
ip->ip_vhl = IP_MAKE_VHL(IPVERSION, *phlen >> 2);
|
||||
ip->ip_v = IPVERSION;
|
||||
ip->ip_hl = *phlen >> 2;
|
||||
ip->ip_len += optlen;
|
||||
return (m);
|
||||
}
|
||||
@ -1325,7 +1307,7 @@ ip_optcopy(ip, jp)
|
||||
|
||||
cp = (u_char *)(ip + 1);
|
||||
dp = (u_char *)(jp + 1);
|
||||
cnt = (IP_VHL_HL(ip->ip_vhl) << 2) - sizeof (struct ip);
|
||||
cnt = (ip->ip_hl << 2) - sizeof (struct ip);
|
||||
for (; cnt > 0; cnt -= optlen, cp += optlen) {
|
||||
opt = cp[0];
|
||||
if (opt == IPOPT_EOL)
|
||||
@ -2163,11 +2145,7 @@ ip_mloopback(ifp, m, dst, hlen)
|
||||
ip->ip_len = htons(ip->ip_len);
|
||||
ip->ip_off = htons(ip->ip_off);
|
||||
ip->ip_sum = 0;
|
||||
if (ip->ip_vhl == IP_VHL_BORING) {
|
||||
ip->ip_sum = in_cksum_hdr(ip);
|
||||
} else {
|
||||
ip->ip_sum = in_cksum(copym, hlen);
|
||||
}
|
||||
ip->ip_sum = in_cksum(copym, hlen);
|
||||
/*
|
||||
* NB:
|
||||
* It's not clear whether there are any lingering
|
||||
|
@ -68,10 +68,8 @@ struct ipq {
|
||||
u_short ipq_id; /* sequence id for reassembly */
|
||||
struct mbuf *ipq_frags; /* to ip headers of fragments */
|
||||
struct in_addr ipq_src,ipq_dst;
|
||||
#ifdef IPDIVERT
|
||||
u_int32_t ipq_div_info; /* ipfw divert port & flags */
|
||||
u_int16_t ipq_div_cookie; /* ipfw divert cookie */
|
||||
#endif
|
||||
struct label ipq_label; /* MAC label */
|
||||
};
|
||||
#endif /* _KERNEL */
|
||||
|
@ -59,7 +59,6 @@
|
||||
#include <net/if.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#define _IP_VHL
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/in_pcb.h>
|
||||
@ -283,10 +282,10 @@ 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_VHL_HL(ip->ip_vhl) != (sizeof (*ip) >> 2))
|
||||
if (((ip->ip_hl != (sizeof (*ip) >> 2))
|
||||
&& inp->inp_options)
|
||||
|| (ip->ip_len > m->m_pkthdr.len)
|
||||
|| (ip->ip_len < (IP_VHL_HL(ip->ip_vhl) << 2))) {
|
||||
|| (ip->ip_len < (ip->ip_hl << 2))) {
|
||||
m_freem(m);
|
||||
return EINVAL;
|
||||
}
|
||||
|
@ -62,7 +62,6 @@
|
||||
#include <net/route.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#define _IP_VHL
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
@ -292,7 +291,8 @@ tcp_fillheaders(tp, ip_ptr, tcp_ptr)
|
||||
{
|
||||
struct ip *ip = (struct ip *) ip_ptr;
|
||||
|
||||
ip->ip_vhl = IP_VHL_BORING;
|
||||
ip->ip_v = IPVERSION;
|
||||
ip->ip_hl = 5;
|
||||
ip->ip_tos = 0;
|
||||
ip->ip_len = 0;
|
||||
ip->ip_id = 0;
|
||||
@ -379,7 +379,7 @@ tcp_respond(tp, ipgen, th, m, ack, seq, flags)
|
||||
KASSERT(tp != NULL || m != NULL, ("tcp_respond: tp and m both NULL"));
|
||||
|
||||
#ifdef INET6
|
||||
isipv6 = IP_VHL_V(((struct ip *)ipgen)->ip_vhl) == 6;
|
||||
isipv6 = ((struct ip *)ipgen)->ip_v == 6;
|
||||
ip6 = ipgen;
|
||||
#endif /* INET6 */
|
||||
ip = ipgen;
|
||||
@ -1105,7 +1105,7 @@ tcp_ctlinput(cmd, sa, vip)
|
||||
if (ip) {
|
||||
s = splnet();
|
||||
th = (struct tcphdr *)((caddr_t)ip
|
||||
+ (IP_VHL_HL(ip->ip_vhl) << 2));
|
||||
+ (ip->ip_hl << 2));
|
||||
INP_INFO_WLOCK(&tcbinfo);
|
||||
inp = in_pcblookup_hash(&tcbinfo, faddr, th->th_dport,
|
||||
ip->ip_src, th->th_sport, 0, NULL);
|
||||
|
@ -62,7 +62,6 @@
|
||||
#include <net/route.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#define _IP_VHL
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
@ -292,7 +291,8 @@ tcp_fillheaders(tp, ip_ptr, tcp_ptr)
|
||||
{
|
||||
struct ip *ip = (struct ip *) ip_ptr;
|
||||
|
||||
ip->ip_vhl = IP_VHL_BORING;
|
||||
ip->ip_v = IPVERSION;
|
||||
ip->ip_hl = 5;
|
||||
ip->ip_tos = 0;
|
||||
ip->ip_len = 0;
|
||||
ip->ip_id = 0;
|
||||
@ -379,7 +379,7 @@ tcp_respond(tp, ipgen, th, m, ack, seq, flags)
|
||||
KASSERT(tp != NULL || m != NULL, ("tcp_respond: tp and m both NULL"));
|
||||
|
||||
#ifdef INET6
|
||||
isipv6 = IP_VHL_V(((struct ip *)ipgen)->ip_vhl) == 6;
|
||||
isipv6 = ((struct ip *)ipgen)->ip_v == 6;
|
||||
ip6 = ipgen;
|
||||
#endif /* INET6 */
|
||||
ip = ipgen;
|
||||
@ -1105,7 +1105,7 @@ tcp_ctlinput(cmd, sa, vip)
|
||||
if (ip) {
|
||||
s = splnet();
|
||||
th = (struct tcphdr *)((caddr_t)ip
|
||||
+ (IP_VHL_HL(ip->ip_vhl) << 2));
|
||||
+ (ip->ip_hl << 2));
|
||||
INP_INFO_WLOCK(&tcbinfo);
|
||||
inp = in_pcblookup_hash(&tcbinfo, faddr, th->th_dport,
|
||||
ip->ip_src, th->th_sport, 0, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user