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

Linux Network

Development Platform:

Unix_Linux

  1. head 1.1;
  2. access;
  3. symbols;
  4. locks
  5. dls:1.1; strict;
  6. comment @ * @;
  7. 1.1
  8. date 97.09.21.19.26.41; author dls; state Dist;
  9. branches;
  10. next ;
  11. desc
  12. @@
  13. 1.1
  14. log
  15. @pre-3e code
  16. @
  17. text
  18. @/* icerrok.c - icerrok */
  19. #include <conf.h>
  20. #include <kernel.h>
  21. #include <network.h>
  22. /*------------------------------------------------------------------------
  23.  *  icerrok -  is it ok to send an error response?
  24.  *------------------------------------------------------------------------
  25.  */
  26. Bool icerrok(pep)
  27. struct ep *pep;
  28. {
  29. struct ip *pip = (struct ip *)pep->ep_data;
  30. struct icmp *pic = (struct icmp *)pip->ip_data;
  31. /* don't send errors about error packets... */
  32. if (pip->ip_proto == IPT_ICMP)
  33. switch(pic->ic_type) {
  34. case ICT_DESTUR:
  35. case ICT_REDIRECT:
  36. case ICT_SRCQ:
  37. case ICT_TIMEX:
  38. case ICT_PARAMP:
  39. return FALSE;
  40. default:
  41. break;
  42. }
  43. /* ...or other than the first of a fragment */
  44. if (pip->ip_fragoff & IP_FRAGOFF)
  45. return FALSE;
  46. /* ...or broadcast or multicast packets */
  47. if (isbrc(pip->ip_dst) || IP_CLASSD(pip->ip_dst))
  48. return FALSE;
  49. return TRUE;
  50. }
  51. @