How to tell which interface the socket received the message from?

dwc is right, IPV6_PKTINFO will work for IPv6 on Linux.

Moreover, IP_PKTINFO will work for IPv4 — you can see details in manpage ip(7)

Leave a Comment