icerrok.c
资源名称:icmp.rar [点击查看]
上传用户:lywr2008
上传日期:2022-05-26
资源大小:9k
文件大小:1k
源码类别:
网络
开发平台:
Unix_Linux
- /* icerrok.c - icerrok */
- #include <conf.h>
- #include <kernel.h>
- #include <network.h>
- /*------------------------------------------------------------------------
- * icerrok - is it ok to send an error response?
- *------------------------------------------------------------------------
- */
- Bool
- icerrok(struct ep *pep)
- {
- struct ip *pip = (struct ip *)pep->ep_data;
- struct icmp *pic = (struct icmp *)pip->ip_data;
- /* don't send errors about error packets... */
- if (pip->ip_proto == IPT_ICMP)
- switch(pic->ic_type) {
- case ICT_DESTUR:
- case ICT_REDIRECT:
- case ICT_SRCQ:
- case ICT_TIMEX:
- case ICT_PARAMP:
- return FALSE;
- default:
- break;
- }
- /* ...or other than the first of a fragment */
- if (pip->ip_fragoff & IP_FRAGOFF)
- return FALSE;
- /* ...or broadcast or multicast packets */
- if (isbrc(pip->ip_dst) || IP_CLASSD(pip->ip_dst))
- return FALSE;
- return TRUE;
- }