Raw sockets and IP_PKTINFO - does it work?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

Is IP_PKTINFO supposed to work with raw sockets? I'm trying to do this:

int true_value = 1;
int fd = socket(AF_INET, SOCK_RAW, IPPROTO_UDP);
setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &true_value, sizeof(true_value));

The call to setsockopt() succeeds and the socket is receiving packets as expected, but there are no ancillary messages coming with the packets. The control message buffer passed to recvmsg() is empty upon return. I don't think I made a mistake in the code, because if I change SOCK_RAW to SOCK_DGRAM then everything works fine. So what might be the problem?

If this is not meant to work with raw sockets, is there another way to determine the incoming interface index for a packet?

Thank you,
Kind regards,

Sergei.

--
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux