[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(usagi-users 02462) Link-local address and sendto()



When I use sendto with link-local address, then sendto() stops with
segmentaiton faults.

source code is like below..

------------------------------------------------------------------
struct addrinfo hints, *res0, *res;
int s;

memset(&hints, 0, sizeof(hints));
hints.ai_socktype = SOCK_DGRAM;

getaddrinfo(argv[1], argv[3], &hints, &res0);

for (res = res0; res; res = res->ai_next) {
	getnameinfo(res->ai_addr, res->ai_addrlen, hbuf,
	sizeof(hbuf), sbuf, sizeof(sbuf),
	NI_NUMERICHOST | NI_NUMERICSERV);
	
	s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
}

sendto(s, buf, 1024, 0, (struct sockaddr *)res->ai_addr,
res->ai_addrlen);

close(s);

-------------------------------------------------------------------

after kernel 2.4, we need to set interface to sockaddr_in6.sin6_scope_id,
but this happens regardress sin6_scope_id.

Does anybody success to use sendto with link-local address?