PF_PACKET sockets to capture different protocol types

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

 



Hi

First, apologies to Andi Kleen for sending this question directly to him
instead of to the mailing list.

I have tried to receive ISO protocol pkts (Prot Type 0xfefe) on a raw
socket, but I am only able to receive them if I create the socket as
follows:

	fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
	
with ETH_P_ALL as the 3rd argument.

If I do 

	fd = socket(PF_PACKET, SOCK_RAW, htons(0xfefe));

I do not receive the pkts to the application

The other relevant code is:
       
        setsockopt(fd, SOL_PACKET, PACKET_ADD_MEMBERSHIP, &mr, sizeof(mr))

with   mr.mr_type  = PACKET_MR_MULTICAST;   which allows me to pick up the
multicast MAC of the pkts being received .

If for example I use ETH_P_ARP or ETH_P_IP in the socket create (instead of
ETH_P_ALL), then I receive only the relevant protocol types, but if I use a
value not defined in if_ether.h, I don't get the pkts - so basically it is
all or nothing wrt my protocol type.

Any ideas why?

TIA
Talmon


-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org


[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