[ofa-general] resolving ipv6 addresses - help needed

Jason Gunthorpe jgunthorpe at obsidianresearch.com
Thu Mar 5 11:11:38 PST 2009


On Thu, Mar 05, 2009 at 07:04:13PM +0200, Eli Cohen wrote:
> Hi,
> 
> I am trying to resolve IPv6 addresses (that is, obtaining the MAC
> address of the interface bearing the IP addresses). I am using
> rdma_resolve_ip() defined in core/addr.c but I don't get consistent
> results.
> I get something like this:
> 
> fe80::202:c9ff:fe00:1341 dev eth1  FAILED
> 
> where I would expect to get address to be rachable through eth2.

You need to specify a scope for link local addreses. It is actually a
bug somewhere along this path that it allowed you to even get as far
as you did without specifying a valid scope ID.

Ie in normal IP land:
$ strace telnet fe80::202:c9ff:fe00:1341
[..]
connect(3, {sa_family=AF_INET6, sin6_port=htons(23), inet_pton(AF_INET6, "fe80::202:c9ff:fe00:1341", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = -1 EINVAL (Invalid argument)
[..]
telnet: Unable to connect to remote host: Invalid argument

RMDA should do the same and refuse to start a connection with a
scope_id of 0 for link local addresses. It should not choose an
address on a random device from the neighbour table.

To specify the scope as part of the address use:

$ strace telnet fe80::202:c9ff:fe00:1341%eth0
[..]
connect(3, {sa_family=AF_INET6, sin6_port=htons(23), inet_pton(AF_INET6, "fe80::202:c9ff:fe00:1341", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=if_nametoindex("eth0")}, 28 <unfinished ...>

And be certain you are using sane multi-family address parsing
routings like getnameinfo.

Jason



More information about the general mailing list