The ancillary data IP_PKTINFO reports for a received datagram: the interface it arrived on, the local address it was sent to and the header's destination address.
IP_PKTINFO