ipftimer.c

来自「关于IP协议方面的」· C语言 代码 · 共 47 行

C
47
字号
/* ipftimer.c - ipftimer */#include <conf.h>#include <kernel.h>#include <network.h>/*------------------------------------------------------------------------ * ipftimer - update time-to-live fields and delete expired fragments *------------------------------------------------------------------------ */voidipftimer(int gran){	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, 0);			}			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 + -
显示快捷键?