I'm now working on a project about multicasting and I had came across the struct group_req as follow:

Code:
struct group_req
{
        __u32                            gr_interface;  /* interface index */
        struct __kernel_sockaddr_storage gr_group;      /* group address */
};
what I found from online resources about gr_interface is that the interface index of the local interface on which the multicast group should be joined or dropped.

However, what is interface index regarded here? In Ubuntu 8.04, the interfaces shown by using ifconfig command is "eth0" and "wlan0". Do they have the same interface index (i.e. "0")? If they do, how the struct group_req differentiate them? I used if_nametoindex() function when assigning value to the member gr_interface.

Or I totally misunderstood the meaning of gr_interface or if_nametoindex() function? Can anyone gives me some guide?

Thanks.