I am trying to create a BSD socket to listen for messages from a specific IPv6 multicast address. I currently have no problem creating the socket listening on the correct address 0::0.
The problem is that I am running on a small embedded linux server with multiple NICs; here the ipv6mr_interface field of the ipv6_mreq is important. By trial and error, I have determined that 0, 1 and 3 do not work, but 2, does (it gives me all IPv6 multicast messages to my address, ff05::3, arriving on the correct interface).
My question is: How do I correlate, in linux, my interface, whos' address I know, to the correct interface number?