icmpcode_v4.c 986 B

12345678910111213141516171819202122232425262728
  1. #include "trace.h"
  2. const char *
  3. icmpcode_v4(int code)
  4. {
  5. static char errbuf[100];
  6. switch (code) {
  7. case 0: return("network unreachable");
  8. case 1: return("host unreachable");
  9. case 2: return("protocol unreachable");
  10. case 3: return("port unreachable");
  11. case 4: return("fragmentation required but DF bit set");
  12. case 5: return("source route failed");
  13. case 6: return("destination network unknown");
  14. case 7: return("destination host unknown");
  15. case 8: return("source host isolated (obsolete)");
  16. case 9: return("destination network administratively prohibited");
  17. case 10: return("destination host administratively prohibited");
  18. case 11: return("network unreachable for TOS");
  19. case 12: return("host unreachable for TOS");
  20. case 13: return("communication administratively prohibited by filtering");
  21. case 14: return("host recedence violation");
  22. case 15: return("precedence cutoff in effect");
  23. default: sprintf(errbuf, "[unknown code %d]", code);
  24. return errbuf;
  25. }
  26. }