summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2000-10-26 13:14:48 +0000
committerru <ru@FreeBSD.org>2000-10-26 13:14:48 +0000
commit9018a02c925a31789dec50f88f775ddb5649876f (patch)
tree1d0b83096ffcc9fa5892918020ef56184ca1de0e /sys
parent19fc1404db530a797fa9749bd9e43a4ff6443af2 (diff)
downloadFreeBSD-src-9018a02c925a31789dec50f88f775ddb5649876f.zip
FreeBSD-src-9018a02c925a31789dec50f88f775ddb5649876f.tar.gz
RFC 791 says that IP_RF bit should always be zero, but nothing
in the code enforces this. So, do not check for and attempt a false reassembly if only IP_RF is set. Also, removed the dead code, since we no longer use dtom() on return from ip_reass().
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_input.c81
1 files changed, 29 insertions, 52 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 1374d25..ed68439 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -254,7 +254,7 @@ ip_input(struct mbuf *m)
struct ip *ip;
struct ipq *fp;
struct in_ifaddr *ia = NULL;
- int i, hlen, mff;
+ int i, hlen;
u_short sum;
u_int16_t divert_cookie; /* firewall cookie */
#ifdef IPDIVERT
@@ -598,23 +598,8 @@ ours:
* if the packet was previously fragmented,
* but it's not worth the time; just let them time out.)
*/
- if (ip->ip_off & (IP_MF | IP_OFFMASK | IP_RF)) {
+ if (ip->ip_off & (IP_MF | IP_OFFMASK)) {
-#if 0 /*
- * Reassembly should be able to treat a mbuf cluster, for later
- * operation of contiguous protocol headers on the cluster. (KAME)
- */
- if (m->m_flags & M_EXT) { /* XXX */
- if ((m = m_pullup(m, hlen)) == 0) {
- ipstat.ips_toosmall++;
-#ifdef IPFIREWALL_FORWARD
- ip_fw_fwd_addr = NULL;
-#endif
- return;
- }
- ip = mtod(m, struct ip *);
- }
-#endif
sum = IPREASS_HASH(ip->ip_src.s_addr, ip->ip_id);
/*
* Look for queue of fragments
@@ -648,12 +633,10 @@ ours:
found:
/*
* Adjust ip_len to not reflect header,
- * set ip_mff if more fragments are expected,
* convert offset of this to bytes.
*/
ip->ip_len -= hlen;
- mff = (ip->ip_off & IP_MF) != 0;
- if (mff) {
+ if (ip->ip_off & IP_MF) {
/*
* Make sure that fragments have a data length
* that's a non-zero multiple of 8 bytes.
@@ -667,45 +650,39 @@ found:
ip->ip_off <<= 3;
/*
- * If datagram marked as having more fragments
- * or if this is not the first fragment,
- * attempt reassembly; if it succeeds, proceed.
+ * Attempt reassembly; if it succeeds, proceed.
*/
- if (mff || ip->ip_off) {
- ipstat.ips_fragments++;
- m->m_pkthdr.header = ip;
+ ipstat.ips_fragments++;
+ m->m_pkthdr.header = ip;
#ifdef IPDIVERT
- m = ip_reass(m,
- fp, &ipq[sum], &divert_info, &divert_cookie);
+ m = ip_reass(m,
+ fp, &ipq[sum], &divert_info, &divert_cookie);
#else
- m = ip_reass(m, fp, &ipq[sum]);
+ m = ip_reass(m, fp, &ipq[sum]);
#endif
- if (m == 0) {
+ if (m == 0) {
#ifdef IPFIREWALL_FORWARD
- ip_fw_fwd_addr = NULL;
+ ip_fw_fwd_addr = NULL;
#endif
- return;
- }
- ipstat.ips_reassembled++;
- ip = mtod(m, struct ip *);
- /* Get the header length of the reassembled packet */
- hlen = IP_VHL_HL(ip->ip_vhl) << 2;
+ return;
+ }
+ ipstat.ips_reassembled++;
+ ip = mtod(m, struct ip *);
+ /* Get the header length of the reassembled packet */
+ hlen = IP_VHL_HL(ip->ip_vhl) << 2;
#ifdef IPDIVERT
- /* Restore original checksum before diverting packet */
- if (divert_info != 0) {
- ip->ip_len += hlen;
- HTONS(ip->ip_len);
- HTONS(ip->ip_off);
- ip->ip_sum = 0;
- ip->ip_sum = in_cksum_hdr(ip);
- NTOHS(ip->ip_off);
- NTOHS(ip->ip_len);
- ip->ip_len -= hlen;
- }
+ /* Restore original checksum before diverting packet */
+ if (divert_info != 0) {
+ ip->ip_len += hlen;
+ HTONS(ip->ip_len);
+ HTONS(ip->ip_off);
+ ip->ip_sum = 0;
+ ip->ip_sum = in_cksum_hdr(ip);
+ NTOHS(ip->ip_off);
+ NTOHS(ip->ip_len);
+ ip->ip_len -= hlen;
+ }
#endif
- } else
- if (fp)
- ip_freef(fp);
} else
ip->ip_len -= hlen;
@@ -804,7 +781,7 @@ ip_reass(m, fp, where)
#endif
{
struct ip *ip = mtod(m, struct ip *);
- register struct mbuf *p = 0, *q, *nq;
+ register struct mbuf *p, *q, *nq;
struct mbuf *t;
int hlen = IP_VHL_HL(ip->ip_vhl) << 2;
int i, next;
OpenPOWER on IntegriCloud