Hello,
I have registered a socket and I am getting UDP broadcast messages on it. I would like to know, on what interface (not an interface name, and not its MAC address, but rather its IP address) did I receive such a message.
I can get the struct sockaddr_dl with interface's low level characteristics (using setsockopt level IPPROTO_IP, sublevel IP_RECVIF).
Unfortunately I am not able to retrieve the IP address directly using setsockopt level IPPROTO_IP, sublevel IP_RECVDSTADDR, since it returns 255.255.255.255 - no wonder, since the packet did not contain any information about the interface's IP address).
Could you please help me?
Thanks,
Mike
I have registered a socket and I am getting UDP broadcast messages on it. I would like to know, on what interface (not an interface name, and not its MAC address, but rather its IP address) did I receive such a message.
I can get the struct sockaddr_dl with interface's low level characteristics (using setsockopt level IPPROTO_IP, sublevel IP_RECVIF).
Unfortunately I am not able to retrieve the IP address directly using setsockopt level IPPROTO_IP, sublevel IP_RECVDSTADDR, since it returns 255.255.255.255 - no wonder, since the packet did not contain any information about the interface's IP address).
Could you please help me?
Thanks,
Mike