| 692 | } |
| 693 | |
| 694 | static char* |
| 695 | kdebug_port2str(const struct sockaddr *sa, char *buf, size_t len) |
| 696 | { |
| 697 | uint16_t port; |
| 698 | |
| 699 | IPSEC_ASSERT(sa != NULL, ("null sa")); |
| 700 | switch (sa->sa_family) { |
| 701 | #ifdef INET |
| 702 | case AF_INET: |
| 703 | port = ntohs(((const struct sockaddr_in *)sa)->sin_port); |
| 704 | break; |
| 705 | #endif |
| 706 | #ifdef INET6 |
| 707 | case AF_INET6: |
| 708 | port = ntohs(((const struct sockaddr_in6 *)sa)->sin6_port); |
| 709 | break; |
| 710 | #endif |
| 711 | default: |
| 712 | port = 0; |
| 713 | } |
| 714 | if (port == 0) |
| 715 | return ("*"); |
| 716 | snprintf(buf, len, "%u", port); |
| 717 | return (buf); |
| 718 | } |
| 719 | |
| 720 | void |
| 721 | kdebug_secpolicy(struct secpolicy *sp) |
no test coverage detected