How to get Ethernet data from Socket buffer.

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

 



Hi All,

  My kernel module get data socket buffer from Netfilter, When I try to
copy data from socket buffer filed skb->mac.raw or skb->mac.ethernet to
my ethernet data then my computer will be hang on. Would you please show
me how to fix this? Or please help me to how fill my ethernet header
when I get data from socket buffer. Thank you very much and appreciate
for help.

Both function bellow is not work properly.

inline static int build_ethernet(const struct sk_buff *skb, struct
ethhdr vs_hdr)
{
  struct ethhdr *eth_header;
  eth_header=(struct ethhdr *)skb->mac.raw;  
  if (eth_header == NULL)
    return -1;
  memcpy(&vs_hdr,skb->mac.raw,sizeof(struct ethhdr));

  return 0;
}

inline static int build_ethernet(const struct sk_buff *skb,  struct
ethhdr vs_hdr)
{
  struct ethhdr *eth_header;
  eth_header=skb->mac.ethernet;  
  if (eth_header == NULL)
    return -1;
  memcpy(&vs_hdr,skb->mac.ethernet,sizeof(struct ethhdr));

  return 0;
}

Nhanle


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux