icerrok.c
Upload User: lywr2008
Upload Date: 2022-05-26
Package Size: 9k
Code Size: 1k
Category:

Linux Network

Development Platform:

Unix_Linux

  1. /* icerrok.c - icerrok */
  2. #include <conf.h>
  3. #include <kernel.h>
  4. #include <network.h>
  5. /*------------------------------------------------------------------------
  6.  *  icerrok -  is it ok to send an error response?
  7.  *------------------------------------------------------------------------
  8.  */
  9. Bool
  10. icerrok(struct ep *pep)
  11. {
  12. struct ip *pip = (struct ip *)pep->ep_data;
  13. struct icmp *pic = (struct icmp *)pip->ip_data;
  14. /* don't send errors about error packets... */
  15. if (pip->ip_proto == IPT_ICMP)
  16. switch(pic->ic_type) {
  17. case ICT_DESTUR:
  18. case ICT_REDIRECT:
  19. case ICT_SRCQ:
  20. case ICT_TIMEX:
  21. case ICT_PARAMP:
  22. return FALSE;
  23. default:
  24. break;
  25. }
  26. /* ...or other than the first of a fragment */
  27. if (pip->ip_fragoff & IP_FRAGOFF)
  28. return FALSE;
  29. /* ...or broadcast or multicast packets */
  30. if (isbrc(pip->ip_dst) || IP_CLASSD(pip->ip_dst))
  31. return FALSE;
  32. return TRUE;
  33. }