projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(By Sklower) checkpoint the current state of Cherenson's work.
[unix-history]
/
usr
/
src
/
sys
/
netinet
/
ip_input.c
diff --git
a/usr/src/sys/netinet/ip_input.c
b/usr/src/sys/netinet/ip_input.c
index
aa5819f
..
fe873ae
100644
(file)
--- a/
usr/src/sys/netinet/ip_input.c
+++ b/
usr/src/sys/netinet/ip_input.c
@@
-4,7
+4,7
@@
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ip_input.c 7.2
3
(Berkeley) %G%
+ * @(#)ip_input.c 7.2
4
(Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
@@
-175,6
+175,9
@@
next:
ipstat.ips_badsum++;
goto bad;
}
ipstat.ips_badsum++;
goto bad;
}
+ if (ip->ip_v != IPVERSION) {
+ goto bad;
+ }
/*
* Convert fields to host representation.
/*
* Convert fields to host representation.
@@
-246,7
+249,6
@@
next:
goto ours;
}
}
goto ours;
}
}
-#ifdef MULTICAST
if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) {
struct in_multi *inm;
#ifdef MROUTING
if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) {
struct in_multi *inm;
#ifdef MROUTING
@@
-267,6
+269,7
@@
next:
*/
ip->ip_id = htons(ip->ip_id);
if (ip_mforward(m, m->m_pkthdr.rcvif) != 0) {
*/
ip->ip_id = htons(ip->ip_id);
if (ip_mforward(m, m->m_pkthdr.rcvif) != 0) {
+ ipstat.ips_cantforward++;
m_freem(m);
goto next;
}
m_freem(m);
goto next;
}
@@
-279,6
+282,7
@@
next:
*/
if (ip->ip_p == IPPROTO_IGMP)
goto ours;
*/
if (ip->ip_p == IPPROTO_IGMP)
goto ours;
+ ipstat.ips_forward++;
}
#endif
/*
}
#endif
/*
@@
-287,12
+291,12
@@
next:
*/
IN_LOOKUP_MULTI(ip->ip_dst, m->m_pkthdr.rcvif, inm);
if (inm == NULL) {
*/
IN_LOOKUP_MULTI(ip->ip_dst, m->m_pkthdr.rcvif, inm);
if (inm == NULL) {
+ ipstat.ips_cantforward++;
m_freem(m);
goto next;
}
goto ours;
}
m_freem(m);
goto next;
}
goto ours;
}
-#endif
if (ip->ip_dst.s_addr == (u_long)INADDR_BROADCAST)
goto ours;
if (ip->ip_dst.s_addr == INADDR_ANY)
if (ip->ip_dst.s_addr == (u_long)INADDR_BROADCAST)
goto ours;
if (ip->ip_dst.s_addr == INADDR_ANY)
@@
-358,8
+362,7
@@
found:
ip = ip_reass((struct ipasfrag *)ip, fp);
if (ip == 0)
goto next;
ip = ip_reass((struct ipasfrag *)ip, fp);
if (ip == 0)
goto next;
- else
- ipstat.ips_reassembled++;
+ ipstat.ips_reassembled++;
m = dtom(ip);
} else
if (fp)
m = dtom(ip);
} else
if (fp)
@@
-704,7
+707,10
@@
ip_dooptions(m)
(caddr_t)(cp + off), sizeof(struct in_addr));
cp[IPOPT_OFFSET] += sizeof(struct in_addr);
forward = 1;
(caddr_t)(cp + off), sizeof(struct in_addr));
cp[IPOPT_OFFSET] += sizeof(struct in_addr);
forward = 1;
- forward = 1;
+ /*
+ * Let ip_intr's mcast routing check handle mcast pkts
+ */
+ forward = !IN_MULTICAST(ntohl(ip->ip_dst.s_addr));
break;
case IPOPT_RR:
break;
case IPOPT_RR:
@@
-784,10
+790,12
@@
ip_dooptions(m)
if (forward) {
ip_forward(m, 1);
return (1);
if (forward) {
ip_forward(m, 1);
return (1);
- }
else
-
return (0);
+ }
+ return (0);
bad:
bad:
+ ip->ip_len -= ip->ip_hl << 2; /* XXX icmp_error adds in hdr length */
icmp_error(m, type, code);
icmp_error(m, type, code);
+ ipstat.ips_badoptions++;
return (1);
}
return (1);
}
@@
-990,6
+998,7
@@
ip_forward(m, srcrt)
int error, type = 0, code;
struct mbuf *mcopy;
struct in_addr dest;
int error, type = 0, code;
struct mbuf *mcopy;
struct in_addr dest;
+ struct ifnet *destifp;
dest.s_addr = 0;
#ifdef DIAGNOSTIC
dest.s_addr = 0;
#ifdef DIAGNOSTIC
@@
-1083,7
+1092,7
@@
ip_forward(m, srcrt)
}
}
}
}
- error = ip_output(m, (struct mbuf *)0, &ipforward_rt, IP_FORWARDING);
+ error = ip_output(m, (struct mbuf *)0, &ipforward_rt, IP_FORWARDING
, 0
);
if (error)
ipstat.ips_cantforward++;
else {
if (error)
ipstat.ips_cantforward++;
else {
@@
-1098,6
+1107,8
@@
ip_forward(m, srcrt)
}
if (mcopy == NULL)
return;
}
if (mcopy == NULL)
return;
+ destifp = NULL;
+
switch (error) {
case 0: /* forwarded, but need redirect */
switch (error) {
case 0: /* forwarded, but need redirect */
@@
-1116,6
+1127,8
@@
ip_forward(m, srcrt)
case EMSGSIZE:
type = ICMP_UNREACH;
code = ICMP_UNREACH_NEEDFRAG;
case EMSGSIZE:
type = ICMP_UNREACH;
code = ICMP_UNREACH_NEEDFRAG;
+ if (ipforward_rt.ro_rt)
+ destifp = ipforward_rt.ro_rt->rt_ifp;
ipstat.ips_cantfrag++;
break;
ipstat.ips_cantfrag++;
break;
@@
-1124,5
+1137,5
@@
ip_forward(m, srcrt)
code = 0;
break;
}
code = 0;
break;
}
- icmp_error(mcopy, type, code, dest);
+ icmp_error(mcopy, type, code, dest
, destifp
);
}
}