-int
-in6_getpeeraddr_s(struct socket *so, struct sockaddr_storage *ss)
-{
- struct inpcb *inp;
- struct in6_addr addr;
- in_port_t port;
-
- VERIFY(ss != NULL);
- bzero(ss, sizeof (*ss));
-
- if ((inp = sotoinpcb(so)) == NULL
-#if NECP
- || (necp_socket_should_use_flow_divert(inp))
-#endif /* NECP */
- )
- return (inp == NULL ? EINVAL : EPROTOTYPE);
-
- port = inp->inp_fport;
- addr = inp->in6p_faddr;
-
- in6_sockaddr_s(port, &addr, SIN6(ss));
- return (0);
-}
-