icmpcode_v6.c 527 B

12345678910111213141516171819202122232425
  1. #include "trace.h"
  2. const char *
  3. icmpcode_v6(int code)
  4. {
  5. #ifdef IPV6
  6. static char errbuf[100];
  7. switch (code) {
  8. case ICMP6_DST_UNREACH_NOROUTE:
  9. return("no route to host");
  10. case ICMP6_DST_UNREACH_ADMIN:
  11. return("administratively prohibited");
  12. case ICMP6_DST_UNREACH_NOTNEIGHBOR:
  13. return("not a neighbor");
  14. case ICMP6_DST_UNREACH_ADDR:
  15. return("address unreachable");
  16. case ICMP6_DST_UNREACH_NOPORT:
  17. return("port unreachable");
  18. default:
  19. sprintf(errbuf, "[unknown code %d]", code);
  20. return errbuf;
  21. }
  22. #endif
  23. }