18 struct sockaddr_in6 sa;
19 unsigned int dummy =
sizeof(sa);
22 fd = accept(s,(
struct sockaddr *)&sa,&dummy);
23 if (fd == -1)
return -1;
25 if (sa.sin6_family == AF_INET) {
26 struct sockaddr_in *sa4 = (
struct sockaddr_in*)&sa;
28 byte_copy(ip + 12,4,(
char *)&sa4->sin_addr);
30 if (scope_id) *scope_id = 0;
34 if (scope_id) *scope_id = sa.sin6_scope_id;
42 struct sockaddr_in sa;
43 unsigned int dummy =
sizeof(sa);
46 fd = accept(s,(
struct sockaddr *) &sa,&dummy);
47 if (fd == -1)
return -1;
57 return listen(s,backlog);
64 r = setsockopt(s,IPPROTO_IP,1,(
char *) 0,0);
65 r = setsockopt(s,IPPROTO_IPV6,1,(
char *) 0,0);
76 r = setsockopt(s,IPPROTO_IP,GEN_IP_PKTINFO,&opt,
sizeof(opt));
78 r = setsockopt(s,IPPROTO_IP,IP_PKTINFO,&opt,
sizeof(opt));
80 r = setsockopt(s,IPPROTO_IP,IP_RECVDSTADDR,&opt,
sizeof(opt));
82 r = setsockopt(s,IPPROTO_IPV6,IP_RECVDSTADDR,&opt,
sizeof(opt));
91 return setsockopt(s,IPPROTO_IPV6,IPV6_V6ONLY,&opt,
sizeof(opt));
98 return setsockopt(s,IPPROTO_IPV6,IPV6_V6ONLY,&opt,
sizeof(opt));
int socket_listen(int s, int backlog)
int socket_accept4(int s, char ip[4], uint16 *port)
int socket_ipoptionskill(int s)
int socket_ip6anycast(int s)
int socket_dualstack(int s)
int socket_accept(int s, char ip[16], uint16 *port, uint32 *scope_id)
int socket_nodualstack(int s)
const unsigned char V4mappedprefix[12]
void uint16_unpack_big(char[16], uint16 *)
void byte_copy(void *, unsigned int, const void *)