ipftimer.c,v
来自「TCP-IP红宝书源代码」· C,V 代码 · 共 71 行
C,V
71 行
head 1.1;
access;
symbols;
locks
dls:1.1; strict;
comment @ * @;
1.1
date 97.09.21.19.27.09; author dls; state Dist;
branches;
next ;
desc
@@
1.1
log
@pre-3e code
@
text
@/* ipftimer.c - ipftimer */
#include <conf.h>
#include <kernel.h>
#include <network.h>
/*------------------------------------------------------------------------
* ipftimer - update time-to-live fields and delete expired fragments
*------------------------------------------------------------------------
*/
void ipftimer(gran)
int gran; /* granularity of this run */
{
struct ep *pep;
struct ip *pip;
int i;
wait(ipfmutex);
for (i=0; i<IP_FQSIZE; ++i) {
struct ipfq *iq = &ipfqt[i];
if (iq->ipf_state == IPFF_FREE)
continue;
iq->ipf_ttl -= gran;
if (iq->ipf_ttl <= 0) {
if (iq->ipf_state == IPFF_BOGUS) {
/* resources already gone */
iq->ipf_state = IPFF_FREE;
continue;
}
if (pep = (struct ep *)deq(iq->ipf_q)) {
IpReasmFails++;
pip = (struct ip *)pep->ep_data;
icmp(ICT_TIMEX, ICC_FTIMEX,
pip->ip_src, pep);
}
while (pep = (struct ep *)deq(iq->ipf_q)) {
IpReasmFails++;
freebuf(pep);
}
freeq(iq->ipf_q);
iq->ipf_state = IPFF_FREE;
}
}
signal(ipfmutex);
}
@
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?