Control: reassign -1 iputils
Control: retitle -1 ping6 should respect the scope_id returned by getaddrinfo

Hi everyone,

Am Freitag, den 03.05.2013, 13:22 +0200 schrieb Lennart Poettering:
> We currently filter addresses of HOST and NOWHERE scope, but local
> addresses should generally be fine.
> 
> > The alternative would be to return addresses with %interface appended,
> > but I did not investigate how to do that.
> 
> This is done by filling in the scopeid field, which we do.
>
>[..]
>
> But anyway, AFAICS we already do the right thing here anyway, and local
> addresses should be unproblematic.

from this I wondered if ping6 is the problem, but it seem to look good
(despite a possibly related bug at
https://bugzilla.redhat.com/show_bug.cgi?id=505044).

But it seems that the scope id is not really passed all the way down to
the user. Using the attached test code, I get:
$ ./test kirk
Scope id returned for ./test: 0

So is this a bug in the libc?

Greetings,
Joachim

-- 
Joachim "nomeata" Breitner
Debian Developer
  nome...@debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C
  JID: nome...@joachim-breitner.de | http://people.debian.org/~nomeata

#include <stdio.h>
#include <string.h>
#include <linux/filter.h>
#include <stdlib.h>
#include <netinet/ip6.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>


int main(int argc, char *argv[])
{
	if (argc < 2) {
		printf("Usage: %s hostname\n", argv[0]);
		exit(1);
	}
	struct addrinfo hints, *ai;
	struct sockaddr_in6 *addr;

	memset(&hints, 0, sizeof(hints));
	hints.ai_family = AF_INET6;

	getaddrinfo(argv[1], 0, &hints, &ai);
	addr = (struct sockaddr_in6 *)(ai->ai_addr);
	fprintf(stdout, "Scope id returned for %s: %d\n", argv[1], addr->sin6_scope_id);
}
	

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to