| version 1.71, 1998/09/30 21:52:25 |
version 1.72, 1998/10/08 01:19:25 |
|
|
| #include <sys/time.h> |
#include <sys/time.h> |
| #include <sys/kernel.h> |
#include <sys/kernel.h> |
| #include <sys/proc.h> |
#include <sys/proc.h> |
| |
#include <sys/pool.h> |
| |
|
| #include <vm/vm.h> |
#include <vm/vm.h> |
| #include <sys/sysctl.h> |
#include <sys/sysctl.h> |
| Line 165 u_int16_t ip_id; |
|
| Line 166 u_int16_t ip_id; |
|
| int ip_defttl; |
int ip_defttl; |
| struct ipqhead ipq; |
struct ipqhead ipq; |
| |
|
| |
struct pool ipqent_pool; |
| |
|
| /* |
/* |
| * We need to save the IP options in case a protocol wants to respond |
* We need to save the IP options in case a protocol wants to respond |
| * to an incoming packet over the same route if the packet got here |
* to an incoming packet over the same route if the packet got here |
|
|
| register struct protosw *pr; |
register struct protosw *pr; |
| register int i; |
register int i; |
| |
|
| |
pool_init(&ipqent_pool, sizeof(struct ipqent), 0, 0, 0, "ipqepl", |
| |
0, NULL, NULL, M_IPQ); |
| |
|
| pr = pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW); |
pr = pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW); |
| if (pr == 0) |
if (pr == 0) |
| panic("ip_init"); |
panic("ip_init"); |
|
|
| */ |
*/ |
| if (mff || ip->ip_off) { |
if (mff || ip->ip_off) { |
| ipstat.ips_fragments++; |
ipstat.ips_fragments++; |
| MALLOC(ipqe, struct ipqent *, sizeof (struct ipqent), |
ipqe = pool_get(&ipqent_pool, PR_NOWAIT); |
| M_IPQ, M_NOWAIT); |
|
| if (ipqe == NULL) { |
if (ipqe == NULL) { |
| ipstat.ips_rcvmemdrop++; |
ipstat.ips_rcvmemdrop++; |
| goto bad; |
goto bad; |
| Line 609 ip_reass(ipqe, fp) |
|
| Line 614 ip_reass(ipqe, fp) |
|
| nq = q->ipqe_q.le_next; |
nq = q->ipqe_q.le_next; |
| m_freem(q->ipqe_m); |
m_freem(q->ipqe_m); |
| LIST_REMOVE(q, ipqe_q); |
LIST_REMOVE(q, ipqe_q); |
| FREE(q, M_IPQ); |
pool_put(&ipqent_pool, q); |
| } |
} |
| |
|
| insert: |
insert: |
|
|
| m->m_next = 0; |
m->m_next = 0; |
| m_cat(m, t); |
m_cat(m, t); |
| nq = q->ipqe_q.le_next; |
nq = q->ipqe_q.le_next; |
| FREE(q, M_IPQ); |
pool_put(&ipqent_pool, q); |
| for (q = nq; q != NULL; q = nq) { |
for (q = nq; q != NULL; q = nq) { |
| t = q->ipqe_m; |
t = q->ipqe_m; |
| nq = q->ipqe_q.le_next; |
nq = q->ipqe_q.le_next; |
| FREE(q, M_IPQ); |
pool_put(&ipqent_pool, q); |
| m_cat(m, t); |
m_cat(m, t); |
| } |
} |
| |
|
|
|
| dropfrag: |
dropfrag: |
| ipstat.ips_fragdropped++; |
ipstat.ips_fragdropped++; |
| m_freem(m); |
m_freem(m); |
| FREE(ipqe, M_IPQ); |
pool_put(&ipqent_pool, ipqe); |
| return (0); |
return (0); |
| } |
} |
| |
|
|
|
| p = q->ipqe_q.le_next; |
p = q->ipqe_q.le_next; |
| m_freem(q->ipqe_m); |
m_freem(q->ipqe_m); |
| LIST_REMOVE(q, ipqe_q); |
LIST_REMOVE(q, ipqe_q); |
| FREE(q, M_IPQ); |
pool_put(&ipqent_pool, q); |
| } |
} |
| LIST_REMOVE(fp, ipq_q); |
LIST_REMOVE(fp, ipq_q); |
| FREE(fp, M_FTABLE); |
FREE(fp, M_FTABLE); |