i want to receive the ifindex of the interface on which the data is arrived. I am using the ancillary data for this purpose.
When i compile my program, i get
src/igmp_pkt_reciever.c:49:21: error: ‘IP_RECVIF’ undeclared (first use in this function)
IP_RECVIF is not a Linux socket option; the documentation you linked to is Oracle's Solaris documentation. From Linux socket(7)
Some other BSD sockets implementations provide
IP_RECVIFsocket options to get the destination address and the interface of received datagrams. Linux has the more general
IP_PKTINFOfor the same task.
So you need to use
IP_PKTINFO instead. The above web page provides the details of how to use it.