0

Can anybody please help me difference between packet_ops_spkt and packet_ops structures operations.Where is used packet_ops_spkt and how to use packet_ops. This both structures having Linux kernel source code under source/net/packet/af_packet.c

user2944178
  • 59
  • 1
  • 11

1 Answers1

0

Google it and for your reference,

http://lxr.free-electrons.com/source/net/packet/af_packet.c#L2788

If sock->type is SOCK_PACKET then use the packet_ops_spkt stucture

The SOCK_PACKET is used to write raw socket, if you create socket with SOCK_RAW type.

http://www.masterraghu.com/subjects/np/introduction/unix_network_programming_v1.3/ch29lev1sec4.html

Jrm301
  • 16
  • Thank you very much your support – user2944178 Jun 12 '14 at 03:50
  • I am using for creating socket following API socket(AF_PACKET,SOCK_DGRAM,0x86dc) can you please help which can interact in kernel level ( packet_ops_spkt or packet_ops) – user2944178 Jun 12 '14 at 04:11
  • Not sure what you mean... the socket you use shall use packet_ops_spkt as its operation functions. If you read from the socket fd, you should get the buf without LL header. I guess 0x86dc is the protocol you self-defined and want to capture or filter by this socket. – Jrm301 Jun 12 '14 at 08:41