version 1.130, 2001/03/02 04:26:10 |
version 1.131, 2001/03/27 02:24:38 |
Line 211 struct pfil_head inet_pfil_hook; |
|
Line 211 struct pfil_head inet_pfil_hook; |
|
|
|
struct ipqhead ipq; |
struct ipqhead ipq; |
int ipq_locked; |
int ipq_locked; |
|
int ip_nfragpackets = 0; |
|
int ip_maxfragpackets = -1; |
|
|
static __inline int ipq_lock_try __P((void)); |
static __inline int ipq_lock_try __P((void)); |
static __inline void ipq_unlock __P((void)); |
static __inline void ipq_unlock __P((void)); |
Line 781 ip_reass(ipqe, fp) |
|
Line 783 ip_reass(ipqe, fp) |
|
* If first fragment to arrive, create a reassembly queue. |
* If first fragment to arrive, create a reassembly queue. |
*/ |
*/ |
if (fp == 0) { |
if (fp == 0) { |
|
/* |
|
* Enforce upper bound on number of fragmented packets |
|
* for which we attempt reassembly; |
|
* If maxfrag is 0, never accept fragments. |
|
* If maxfrag is -1, accept all fragments without limitation. |
|
*/ |
|
if (ip_maxfragpackets < 0) |
|
; |
|
else if (ip_nfragpackets >= ip_maxfragpackets) |
|
goto dropfrag; |
|
ip_nfragpackets++; |
MALLOC(fp, struct ipq *, sizeof (struct ipq), |
MALLOC(fp, struct ipq *, sizeof (struct ipq), |
M_FTABLE, M_NOWAIT); |
M_FTABLE, M_NOWAIT); |
if (fp == NULL) |
if (fp == NULL) |
|
|
ip->ip_dst = fp->ipq_dst; |
ip->ip_dst = fp->ipq_dst; |
LIST_REMOVE(fp, ipq_q); |
LIST_REMOVE(fp, ipq_q); |
FREE(fp, M_FTABLE); |
FREE(fp, M_FTABLE); |
|
ip_nfragpackets--; |
m->m_len += (ip->ip_hl << 2); |
m->m_len += (ip->ip_hl << 2); |
m->m_data -= (ip->ip_hl << 2); |
m->m_data -= (ip->ip_hl << 2); |
/* some debugging cruft by sklower, below, will go away soon */ |
/* some debugging cruft by sklower, below, will go away soon */ |
|
|
} |
} |
LIST_REMOVE(fp, ipq_q); |
LIST_REMOVE(fp, ipq_q); |
FREE(fp, M_FTABLE); |
FREE(fp, M_FTABLE); |
|
ip_nfragpackets--; |
} |
} |
|
|
/* |
/* |
|
|
ip_freef(fp); |
ip_freef(fp); |
} |
} |
} |
} |
|
/* |
|
* If we are over the maximum number of fragments |
|
* (due to the limit being lowered), drain off |
|
* enough to get down to the new limit. |
|
*/ |
|
if (ip_maxfragpackets < 0) |
|
; |
|
else { |
|
while (ip_nfragpackets > ip_maxfragpackets && ipq.lh_first) |
|
ip_freef(ipq.lh_first); |
|
} |
IPQ_UNLOCK(); |
IPQ_UNLOCK(); |
#ifdef GATEWAY |
#ifdef GATEWAY |
ipflow_slowtimo(); |
ipflow_slowtimo(); |
Line 1791 ip_sysctl(name, namelen, oldp, oldlenp, |
|
Line 1817 ip_sysctl(name, namelen, oldp, oldlenp, |
|
return (error); |
return (error); |
#endif |
#endif |
|
|
|
case IPCTL_MAXFRAGPACKETS: |
|
return (sysctl_int(oldp, oldlenp, newp, newlen, |
|
&ip_maxfragpackets)); |
|
|
default: |
default: |
return (EOPNOTSUPP); |
return (EOPNOTSUPP); |
} |
} |