MCPcopy Create free account
hub / github.com/F-Stack/f-stack / kdebug_port2str

Function kdebug_port2str

freebsd/netipsec/key_debug.c:694–718  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

692}
693
694static char*
695kdebug_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
720void
721kdebug_secpolicy(struct secpolicy *sp)

Callers 1

kdebug_secasindexFunction · 0.85

Calls 1

snprintfFunction · 0.85

Tested by

no test coverage detected